1 package per_utility_functions as
2 /* $Header: peutlfnc.pkh 120.1 2006/10/10 12:48:45 agolechh noship $ */
3 --
4 /* =====================================================================
5 Name : Get_Payroll_Period
6 Purpose : To determine the payroll period spanning a given date and
7 to set global variables containg the start and end dates and the
8 period number
9 Returns : 0 if successful, 1 otherwise
10 ---------------------------------------------------------------------*/
11 function Get_Payroll_Period
12 (P_Payroll_ID IN Number
13 ,P_Date_In_Period IN Date) return number;
14 --
15 /* =====================================================================
16 Name : Get_Accrual_Band
17 Purpose : To determine the accrual band that spans the specified number of
18 years and to set global variables containing the ANNUAL_RATE,
19 UPPER_LIMIT and CEILING values.
20 Returns : 0 if successful, 1 otherwise
21 ---------------------------------------------------------------------*/
22 function Get_Accrual_Band
23 (P_Plan_ID IN Number
24 ,P_Number_Of_Years IN Number) return number;
25 --
26 /* =====================================================================
27 Name : Get_Period_Dates
28 Purpose : To determine the start and end dates of a period of time that
29 spans a given date, which is of a given duration (e.g. Month) and
30 which is a mulitple of that duration from a given Start date
31 (e.g. 6 months on from 01/01/90)
32 The globals PERIOD_START_DATE and PERIOD_END_DATE are populated
33 Returns : 0 if successful, 1 otherwise
34 ---------------------------------------------------------------------*/
35 function Get_Period_Dates
36 (P_Date_In_Period IN Date
37 ,P_Period_Unit IN Varchar2
38 ,P_Base_Start_Date IN Date
39 ,P_Unit_Multiplier IN Number) RETURN Number;
40 --
41 /* =====================================================================
42 Name : Get_Assignment_Status
43 Purpose : To determine assignment status spanning a given date
44 The globals ASSIGNMENT_EFFECTIVE_SD, ASSIGNMENT_EFFECTIVE_ED and
45 ASSIGNMENT_SYSTEM_STATUS are populated
46 Returns : 0 if successful, 1 otherwise
47 ---------------------------------------------------------------------*/
48 function Get_Assignment_Status
49 (P_Assignment_ID IN Number
50 ,P_Effective_Date IN Date) return Number;
51 --
52 /* =====================================================================
53 Name : Calculate_Payroll_Periods
54 Purpose : Calculates number of periods in one year for the payroll
55 indicated by payroll_id, and the first day of the calendar
56 year on which there exists a valid payroll period.
57 Returns : 0 if successful, 1 otherwise
58 ---------------------------------------------------------------------*/
59 function Calculate_Payroll_Periods
60 (P_Payroll_ID IN Number,
61 P_Calculation_Date IN Date) return number;
62 --
63 /* =====================================================================
64 Name : Get_Start_Date
65 Purpose : Calculates the adjusted start date for accruals, by checking
66 for element entries attached to an accrual plan which have not
67 yet been processed in a payroll run.
68 Returns : Effective start date of payroll period.
69 ---------------------------------------------------------------------*/
70 function Get_Start_Date
71 (P_Assignment_ID IN Number,
72 P_Accrual_Plan_ID IN Number,
73 P_Assignment_Action_Id IN Number,
74 P_Accrual_Start_Date IN Date,
75 P_Turn_Of_Year_Date IN Date) return Date;
76 --
77 /* =====================================================================
78 Name : Get_Net_Accrual
79 Purpose : Wrapper function for per_accrual_calc_functions.get_net_accrual.
80 Only returns accrued time figure.
81 Returns : 0 if successful, 1 otherwise
82 ---------------------------------------------------------------------*/
83 function Get_Net_Accrual
84 (P_Assignment_ID IN Number
85 ,P_Payroll_ID IN Number
86 ,P_Business_Group_ID IN Number
87 ,P_Assignment_Action_ID IN Number default null
88 ,P_Calculation_Date IN Date
89 ,P_Plan_ID IN Number
90 ,P_Accrual_Start_Date IN Date default null
91 ,P_Accrual_Latest_Balance IN Number default null) return number;
92 --
93 /* =====================================================================
94 Name : Get_Element_Entry
95 Purpose : Assigns value of element entry id context to a
96 global variable.
97 Returns : 1
98 ---------------------------------------------------------------------*/
99 function Get_Element_Entry
100 (P_Element_Entry_Id IN Number,
101 P_Assignment_ID IN Number,
102 P_Assignment_Action_Id IN Number) return Number;
103 --
104 --
105 /* =====================================================================
106 Name : Get_Retro_Element
107 Purpose : Retrieves retrospective elements in order for them to be
108 tagged as processed.
109 Overloaded version of function for use where element_entry_id
110 context is unavailable.
111 Returns : Element Entry ID
112 ---------------------------------------------------------------------*/
113 function Get_Retro_Element return Number;
114 --
115 --
116 /* =====================================================================
117 Name : Calculate_Hours_Worked
118 Purpose : Calculates the total number of hours worked in a given date
119 range. Moved here to create global version as previously
120 only localised versions existed (Bug 2720878).
121 Returns : Number of hours
122 ---------------------------------------------------------------------*/
123 FUNCTION Calculate_Hours_Worked
124 (p_std_hrs in NUMBER,
125 p_range_start in DATE,
126 p_range_end in DATE,
127 p_std_freq in VARCHAR2) RETURN NUMBER;
128 --
129 function Get_Payroll_ID
130 (P_asg_ID IN Number
131 ,P_Payroll_Id IN Number
132 ,P_Date_In_Period IN Date) return number;
133 --
134 function Get_Payroll_Details
135 (P_payroll_ID IN Number
136 ,P_Date_In_Period IN Date) return number;
137 --
138 /* ========================================================================
139 Name : get_action_parameter
140 Purpose : Gets the Action Parameter from a cached pl/sql table to prevent
141 same table scans on pay_action_parameters view.
142 Returns : parameter value.
143 -----------------------------------------------------------------------*/
144 function get_action_parameter(p_prm_name in varchar2) return varchar2;
145
146 --
147 /* =====================================================================
148 Name : Reset_PTO_Accruals
149 Purpose : Determines whether the PTO accruals for an assignment
150 should be recalculated from the beginning.
151 This is based on RESET_PTO_ACCRUALS action parameter
152 Returns : 'FALSE' or 'TRUE'
153 ---------------------------------------------------------------------*/
154 function Reset_PTO_Accruals return varchar2;
155 --
156 /* =====================================================================
157 Name : Get_Earliest_AsgChange_Date
158 Purpose : Determines the earliest assignment status change recorded
159 by the Payroll Events Model.
160 Returns : Date
161 ---------------------------------------------------------------------*/
162 FUNCTION Get_Earliest_AsgChange_Date(p_business_group_id NUMBER
163 ,p_assignment_id NUMBER
164 ,p_event_group VARCHAR2
165 ,p_start_date DATE
166 ,p_end_date DATE
167 ,p_recalc_date DATE)
168 RETURN DATE;
169 --
170 /* =====================================================================
171 Name : Get_Legislation
172 =====================================================================
173 Purpose : Retrieves the legislation code associated with
174 business group.
175 Returns : Legislation code.
176 ---------------------------------------------------------------------*/
177 function get_legislation (p_business_group_id number)
178 return varchar2;
179 --
180 FUNCTION GET_PAYROLL_DTRANGE(P_Payroll_ID Number)
181 return NUMBER;
182 --
183 FUNCTION GET_PER_TERMINATION_DATE (P_Assignment_id Number)
184 return NUMBER;
185 --
186 end per_utility_functions;