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