1 PACKAGE HXT_TIME_CLOCK AS
2 /* $Header: hxttclk.pkh 120.0 2005/05/29 05:58:18 appldev noship $ */
3
4 g_user_id fnd_user.user_id%TYPE := FND_GLOBAL.User_Id;
5 g_user_name fnd_user.user_name%TYPE := 'TimeClock';
6 g_sysdate DATE := trunc(SYSDATE);
7 g_bus_group_id hr_organization_units.business_group_id%TYPE :=
8 FND_PROFILE.Value( 'PER_BUSINESS_GROUP_ID' );
9 g_batch_err_id hxt_errors.ppb_id%TYPE DEFAULT NULL;
10 g_timecard_err_id hxt_errors.tim_id%TYPE DEFAULT NULL;
11 g_hours_worked_err_id hxt_errors.hrw_id%TYPE DEFAULT NULL;
12 g_time_period_err_id hxt_errors.ptp_id%TYPE DEFAULT NULL;
13 g_error_log_error EXCEPTION;
14
15 -----------------------------< record_time >-------------------------------
16 --
17 -- Description:
18 -- This API provides a means for importing time entry data into the OTM
19 -- system. It will create a new OTM Timecard for a given employee/time
20 -- period if one does not already exist, or else add time to an employee's
21 -- existing OTM Timecard (only if the Timecard was not automatically
22 -- generated). The API is intended to log blocks of time worked by an
23 -- employee and should be called repetitively to log separate blocks of
24 -- time. For example, if this API were being interfaced with a mechanical
25 -- time clock, it would be called on each employee's PUNCH-OUT activity
26 -- with both the PUNCH-IN and PUNCH-OUT times being passed as parameters.
27 --
28 -- Prerequisites:
29 -- 1. employee_number must identify a unique (considering date effectivity)
30 -- person in the PER_PEOPLE_F table.
31 -- 2. assignment_id is currently NOT USED. Value passed may be NULL.
32 -- Assignment to be used for employee will be the first applicable
33 -- assignment to be queried from the PER_ASSIGNMENTS_F table.
34 -- 3. start_time will be used as the date worked for the block of time
35 -- being logged. No consideration will be given to the possibility
36 -- that a block of time worked may span into another day.
37 -- 4. If adding time data to an already existing OTM Timecard, the
38 -- Timecard must NOT have been generated automatically by OTM (ie,
39 -- HXT_TIMECARDS.AUTO_GEN_FLAG must NOT equal 'A').
40 -- 5. The system profile, HXT_BATCH_SIZE, defines the number of OTM
41 -- Timecards that will be created with like BATCH_ID. If no BATCH_ID
42 -- is found with fewer than HXT_BATCH_SIZE Timecards, a new BATCH_ID
43 -- will be created.
44 --
45 -- In Parameters:
46 -- NAME REQD TYPE DESCRIPTION
47 -- --------------- ---- -------- --------------------------------
48 -- employee_number YES VARCHAR2 Identifies the employee for whom
49 -- time data is being logged. Verified
50 -- via query of PER_PEOPLE_F table.
51 -- assignment_id NO NUMBER Identifies for which of the emp's
52 -- assignments the time data is being
53 -- logged. Currently NOT USED; emp's
54 -- first applicable assignment will
55 -- be queried from PER_ASSIGNMENTS_F
56 -- table. Value passed may be NULL.
57 -- start_time YES DATE Identifies the start date and time
58 -- for the time data being logged. This
59 -- value will become the date worked
60 -- for the time data being logged.
61 -- end_time YES DATE Identifies the stop date and time
62 -- for the time data being logged.
63 --
64 -- Post success:
65 -- If an OTM Timecard did not previously exist for the given employee
66 -- during the time period covering the start time provided, one is created.
67 -- Otherwise, the time data is added to the appropriate existing OTM
68 -- Timecard, provided that Timecard was not automatically generated. The
69 -- folowing OUT parameters will be set:
70 --
71 -- NAME TYPE DESCRIPTION
72 -- --------------- -------- ---------------------------------------
73 -- ret_code NUMBER Return code from OTM processing. Value
74 -- will be 0 to indicate success.
75 --
76 -- Post failure:
77 -- An OTM Timecard may or may not be created or updated depending on the
78 -- failure circumstance. Errors will be logged in the table HXT_ERRORS_F
79 -- and will be viewable on the OTM Timecard Errors form regardless of
80 -- whether the Timecard was created or previously existed. The following
81 -- OUT Parameters will be set to indicate the cause of the failure:
82 --
83 -- NAME TYPE DESCRIPTION
84 -- --------------- -------- ---------------------------------------
85 -- ret_code NUMBER Return code from OTM processing. Value
86 -- will be 1 to indicate a data related
87 -- error or 2 to indicate a system error.
88 -- err_buf VARCHAR2 Short description of the error that has
89 -- occurred.
90 --
91 -- Access Status:
92 -- Public
93 --
94 ---------------------------------------------------------------------------
95 PROCEDURE record_time( employee_number IN VARCHAR2,
96 assignment_id IN NUMBER,
97 start_time IN DATE,
98 end_time IN DATE,
99 ret_code OUT NOCOPY NUMBER,
100 err_buf OUT NOCOPY VARCHAR2);
101
102 FUNCTION log_clock_errors(i_timecard_available IN BOOLEAN,
103 i_error_text IN VARCHAR2,
104 i_error_location IN VARCHAR2,
105 i_sql_message IN VARCHAR2)RETURN NUMBER;
106
107
108 END HXT_TIME_CLOCK;