DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_ZA_PTO_ACCRUAL_PERIOD

Source


1 package body PER_ZA_PTO_ACCRUAL_PERIOD as
2 /* $Header: perzaapl.pkb 120.5 2007/11/29 04:59:02 rbabla noship $ */
3 /* ======================================================================
4 REM Change List:
5 REM ------------
6 REM
7 REM Name           Date       Version Bug     Text
8 REM -------------- ---------- ------- ------- ------------------------------------+
9 REM R. Kingham     15-MAR-00  110.0           Initial Version
10 REM J.N. Louw      24-Aug-00  115.0           Updated for ZAPatch11i.01
11 REM L.Kloppers     21-Dec-00  115.1           Put 'create...' on one line
12 REM P.Vaish        07-JUL-02  115.2           Changed to calculate currect
13 REM                                           PTO Carry Over as per Legislative Rules.
14 REM P.Vaish        15-JUL-02  115.3           Changed to calculate the
15 REM                                           PTO Carry Over for each period correctly.
16 REM V.Kannan       17-MAR-03  115.4  2848607  Removed the rounding of l_Accrual_Rate in
17 REM                                           za_pto_annleave_period_loop,which caused the
18 REM                                           number of days accrued per Period inaccurate.
19 REM R.Pahune       14-Aug-03  115.5               Added Procedure
20 REM					      ZA_PTO_CARRYOVER_RESI_VALUE
21 REM					      for the bug no 2932073
22 REM					      if the carry over is -ve made it 0
23 REM					      along with earlier ZA specific
24 REM					      requirements. (code from version
25 REM					      115.20.1158.2 by lklopper)
26 REM A. Mahanty     05-MAY-05  115.7  4293298  Modified procedure ZA_PTO_CARRYOVER_RESI_VALUE
27 REM                                           to have correct carryover and
28 REM                                           net entitlement value when there is
29 REM                                           negative net entitlement.
30 REM Kaladhaur P    09-MAR-06  115.8  5043294  Modified procedure ZA_PTO_SICKLEAVE_PERIOD_LOOP
31 REM                                           to have correct Total Accrued Sick Leave.
32 REM A. Mahanty     22-SEP-06  115.9           Modified the procedure ZA_PTO_CARRYOVER_RESI_VALUE.
33 REM                                           The other contributions(leave adjustments) need to
34 REM                                           be subtracted before the residual value is calculated.
35 REM                                           The adjustments in the current accrual cycle must not
36 REM                                           be forfeited.
37 REM R. Babla       26-NOV-07  115.12 6617789  Modified function ZA_PTO_SICKLEAVE_PERIOD_LOOP to
38 REM                                           calculate the accrual of 1 for 26 working days for
39 REM                                           employee's first six months of employment.
40    ==============================================================================*/
41 
42 /* ======================================================================
43    Name    : ZA_PTO_ANNLEAVE_PERIOD_LOOP
44    Purpose : This function is called by the ZA_PTO_ANNUAL_LEAVE_MONTHLY_ACCRUAL
45              formula, and replaces the Sub-Accrual formula which calculated
46              total PTO accrued per period.
47    Returns : Total Accrued entitlement
48    ======================================================================*/
49 function ZA_PTO_ANNLEAVE_PERIOD_LOOP         (p_Assignment_ID IN  Number
50                                              ,p_Plan_ID       IN  Number
51                                              ,p_Payroll_ID    IN  Number
52                                              ,p_calculation_date    IN  Date)
53 return number is
54 
55     l_CSDate                    date;
56     l_Period_SD                 date;
57     l_Period_ED                 date;
58     l_Last_Period_SD            date;
59     l_Last_Period_ED            date;
60     l_Beginning_Calc_Year_SD    date;
61     l_Total_Accrued_PTO         number := 0;
62     l_Pay_Periods_Year          number;
63     l_Period_Accrued_PTO        number;
64     l_Accrual_Rate              number;
65     l_Period_Others             number;
66     l_Amount_Over_Ceiling       number;
67     l_Annual_Rate               number := 0;
68     l_Upper_Limit               number := 0;
69     l_Ceiling                   number := 0;
70     l_Years_Service             number;
71     l_Absence                   number;
72     l_Carryover                 number;
73     l_Other                     number;
74     l_Continue_Processing_Flag  boolean := true;
75     l_Error                     number;
76     l_Acc_Freq                  char;
77     l_Acc_Mult                  number;
78     l_Net_PTO                   number;
79     /*  - P.Vaish - Defined for Bug No. - 2266289 - */
80     l_calculation_year          date;
81     l_last_start_period         date;
82     l_last_end_period           date;
83     l_six_month_current         date;
84     l_Left_Over                 number := 0;
85     l_last_period		date;
86     l_anniversary_date		date;
87     l_diff			number := 0;
88 begin
89 /*  Get global variables.  */
90     l_Last_Period_SD         := per_formula_functions.get_date('LAST_PERIOD_SD');
91     l_Last_Period_ED         := per_formula_functions.get_date('LAST_PERIOD_ED');
92     l_CSDate                 := per_formula_functions.get_date('CONTINUOUS_SERVICE_DATE');
93     l_Beginning_Calc_Year_SD := per_formula_functions.get_date('BEGINNING_OF_CALCULATION_YEAR');
94     l_Pay_Periods_Year       := per_formula_functions.get_number('PAYROLL_YEAR_NUMBER_OF_PERIODS');
95     l_Acc_Freq               := per_formula_functions.get_text('ACCRUING_FREQUENCY');
96     l_Acc_Mult               := per_formula_functions.get_number('ACCRUING_MULTIPLIER');
97 
98     hr_utility.set_location('ZA_PTO_ANNLEAVE_PERIOD_LOOP', 26);
99 
100      /*  - P.Vaish - Defined for Bug No. - 2266289 - */
101      l_diff := LAST_DAY(l_Last_Period_ED) - l_Last_Period_ED + 1;
102 
103      IF (((l_Acc_Freq = 'W') AND (l_diff < 7))
104      OR (((l_Acc_Freq = 'M') OR (l_Acc_Freq = 'D')) AND (l_diff <= l_Acc_Mult))) THEN
105 	 l_last_period := l_Last_Period_ED + l_diff;
106      ELSE
107 	 l_last_period := l_Last_Period_ED;
108      END IF;
109 
110      IF (months_between(l_Last_Period,l_Beginning_Calc_Year_SD) >= 12 ) THEN
111 	 hr_utility.trace('Setting l_calculation_year to l_Beginning_Calc_Year_SD + 1 ');
112 	 l_calculation_year := add_months(l_Beginning_Calc_Year_SD,12);
113      ELSE
114 	 hr_utility.trace('Setting l_calculation_year to l_Beginning_Calc_Year_SD');
115 	 l_calculation_year := l_Beginning_Calc_Year_SD;
116      END IF;
117 
118      IF to_char(l_CSDate,'DDMM') = '2902' THEN
119 	l_last_start_period := to_date('0103' || to_char(l_calculation_year,'YYYY'),'DDMMYYYY');
120      ELSE
121 	l_last_start_period := to_date(to_char(l_CSDate,'DDMM') || to_char(l_calculation_year,'YYYY'),'DDMMYYYY');
122      END IF;
123 
124      l_anniversary_date := l_last_start_period;
125 
126      IF l_last_start_period > l_calculation_year THEN
127 	 l_last_end_period   := add_months(l_last_start_period,-12);
128 	 l_last_start_period := add_months(l_last_start_period,-18);
129 	 l_six_month_current := add_months(l_last_end_period,6);
130      ELSE
131 	 l_last_end_period   := l_last_start_period;
132 	 l_last_start_period := add_months(l_last_start_period,-6);
133 	 l_six_month_current := add_months(l_last_end_period,6);
134      END IF;
135 
136      l_Years_Service := Floor(Months_Between(l_calculation_year,l_CSDate) / 12);
137 
138      IF ((l_Years_Service > 0) and (l_six_month_current >= l_Last_Period_ED)) THEN
139   	   hr_utility.trace('Before Six Month');
140 	   l_Left_Over := per_accrual_calc_functions.GET_CARRY_OVER(p_Assignment_id, p_Plan_id, (l_last_end_period + 1), l_last_start_period) +
141 		 per_accrual_calc_functions.GET_OTHER_NET_CONTRIBUTION(p_Assignment_id, p_Plan_id, (l_last_end_period + 1), l_last_start_period) -
142 		 per_accrual_calc_functions.GET_ABSENCE(p_Assignment_id, p_Plan_id, l_last_end_period, l_last_start_period);
143 
144 	   IF l_Left_Over < 0 THEN
145 		l_Left_Over := 0;
146 	   END IF;
147 
148 	   l_diff := p_calculation_date - l_anniversary_date;
149 
150 	   IF (l_Left_Over > 0) THEN
151 	        IF (l_Acc_Freq = 'M') THEN
152 			IF ((l_diff >= 0) AND (l_diff < (add_months(l_anniversary_date,l_Acc_Mult) - l_anniversary_date))) THEN
153 				l_Continue_Processing_Flag := FALSE;
154 			END IF;
155 		ELSIF (l_Acc_Freq = 'W') THEN
156 			IF ((l_diff >= 0) AND (l_diff < (7 * l_Acc_Mult))) THEN
157 				l_Continue_Processing_Flag := FALSE;
158 			END IF;
159 		END IF;
160 	   END IF;
161 
162 	   IF ((to_char(p_calculation_date,'DDMM') = to_char(l_CSDate - 1,'DDMM')) AND NOT l_Continue_Processing_Flag) THEN
163 		l_Continue_Processing_Flag := TRUE;
164 	   END IF;
165       ELSIF ((l_Years_Service > 0) and (l_six_month_current < l_Last_Period_ED)) THEN
166 	   hr_utility.trace('After Six Month');
167 	   IF (per_utility_functions.get_accrual_band(p_Plan_ID, l_Years_Service) = 0 ) THEN
168 		l_Left_Over := per_formula_functions.get_number('MAX_CARRY_OVER');
169 		l_Annual_Rate := 0;
170 		l_Upper_Limit := 0;
171 		l_Ceiling     := 0;
172 	   ELSE
173 		l_Left_Over := 0;
174 	   END IF;
175       ELSE
176 	   l_Left_Over := 0;
177       END IF;
178     /**/
179 
180   hr_utility.set_location('Before LOOP', 27);
181 
182   while l_Continue_Processing_Flag loop
183       l_Period_SD := per_formula_functions.get_date('PERIOD_SD');
184       l_Period_ED := per_formula_functions.get_date('PERIOD_ED');
185       l_Years_Service := Floor(Months_Between(l_Period_ED,l_CSDate) / 12);
186 
187 /* Accrual bands based on length of service, but could also use grades   */
188       if   l_Upper_Limit = 0
189       or  (l_Years_service >= l_Upper_Limit) then
190            if  (per_utility_functions.get_accrual_band(p_Plan_ID, l_Years_Service) = 0 ) then
191                l_Annual_Rate := per_formula_functions.get_number('ANNUAL_RATE');
192                l_Upper_Limit := per_formula_functions.get_number('UPPER_LIMIT');
193                l_Ceiling     := per_formula_functions.get_number('CEILING');
194            else
195                exit;
196            end if;
197       end if;
198       --Bug:2848607.
199       l_Accrual_Rate := l_Annual_Rate / l_Pay_Periods_Year;
200 
201       l_Period_Accrued_PTO := l_Accrual_Rate;
202 
203 /* Extract any absence, carry over etc for the year in question          */
204       l_Absence   := per_accrual_calc_functions.GET_ABSENCE(p_Assignment_id, p_Plan_id, l_Period_ED, l_Beginning_Calc_Year_SD);
205 
206     /*  - P.Vaish - Set for Bug No. - 2266289 - */
207       l_CarryOver := l_Left_Over;
208       l_Other     := per_accrual_calc_functions.GET_OTHER_NET_CONTRIBUTION(p_Assignment_id, p_Plan_id, l_Period_ED, l_Beginning_Calc_Year_SD);
209       l_Period_Others := l_CarryOver + l_Other - l_Absence;
210       l_Net_PTO := l_Total_Accrued_PTO + l_Period_Accrued_PTO + l_Period_Others;
211 
212 /* Only accrue if PTO < CEILING      */
213       if  l_Ceiling > 0 then
214           if  ((l_Net_PTO - l_Ceiling) > l_Left_Over) then
215               l_Amount_Over_Ceiling := l_Net_PTO - l_Ceiling - l_Left_Over;
216               if  l_Amount_Over_Ceiling > l_Period_Accrued_PTO then
217                   l_Period_Accrued_PTO := 0;
218               else
219                   l_Period_Accrued_PTO := l_Period_Accrued_PTO - l_Amount_Over_Ceiling;
220               end if;
221           end if;
222       end if;
223       l_Total_Accrued_PTO := l_Total_Accrued_PTO + l_Period_Accrued_PTO;
224 
225 /* End loop if final period and set globals to next payroll period  */
226       if  l_Period_SD >= l_Last_Period_SD then
227           l_Continue_Processing_Flag := false;
228       else
229           l_Period_ED := l_Period_ED + 1;
230           l_error := per_utility_functions.GET_PERIOD_DATES( l_Period_ED
231                                                             ,l_Acc_Freq
232                                                             ,l_Beginning_Calc_Year_SD
233                                                             ,l_Acc_Mult);
234           l_error := per_formula_functions.set_date('PERIOD_SD',
235                                              per_formula_functions.get_date('PERIOD_START_DATE'));
236           l_error := per_formula_functions.set_date('PERIOD_ED',
237                                              per_formula_functions.get_date('PERIOD_END_DATE'));
238           l_Continue_Processing_Flag := true;
239       end if;
240   end loop;
241 
242   l_error := per_formula_functions.set_number('TOTAL_ACCRUED_PTO', l_Total_Accrued_PTO);
243 
244   Return l_Total_Accrued_PTO;
245 
246 end ZA_PTO_ANNLEAVE_PERIOD_LOOP;
247 --
248 /* ======================================================================
249    Name    : ZA_PTO_SICKLEAVE_PERIOD_LOOP
250    Purpose : This function is called by the ZA_PTO_SICK_LEAVE_ACCRUAL
251              formula, and replaces the Sub-Accrual formula which calculated
252              total Sick PTO accrued per period.
253    Returns : Total Sick PTO Accrued entitlement
254    ======================================================================*/
255 function ZA_PTO_SICKLEAVE_PERIOD_LOOP       (p_Assignment_ID IN  Number
256                                             ,p_Plan_ID       IN  Number
257                                             ,p_Payroll_ID    IN  Number)
258 return number is
259     l_Beginning_Calc_Year_SD    date;
260     l_CSDate                    date;
261     l_Period_SD                 date;
262     l_Period_ED                 date;
263     l_Last_Period_SD            date;
264     l_Last_Period_ED            date;
265     l_Total_Accrued_PTO         number := 0;
266     l_Continue_Processing_Flag  boolean := true;
267     l_Accrual_Rate              number;
268     l_Error                     number;
269     l_Acc_Freq                  char;
270     l_Acc_Mult                  number;
271     l_daysoff                   number;
272     l_proc                      varchar2(80) := 'PER_ZA_PTO_ACCRUAL_PERIOD.ZA_PTO_SICKLEAVE_PERIOD_LOOP';
273 begin
274     l_Beginning_Calc_Year_SD := per_formula_functions.get_date('BEGINNING_OF_CALCULATION_YEAR');
275     l_Last_Period_SD := per_formula_functions.get_date('LAST_PERIOD_SD');
276     l_Last_Period_ED := per_formula_functions.get_date('LAST_PERIOD_ED');
277     l_CSDate         := per_formula_functions.get_date('CONTINUOUS_SERVICE_DATE');
278  -- l_Accrual_Rate   := per_formula_functions.get_number('ACCRUAL_RATE');
279     l_Accrual_Rate   := per_formula_functions.get_number('ZA_SICK_LEAVE_ACCRUAL_RATE');
280     l_Acc_Freq               := per_formula_functions.get_text('ACCRUING_FREQUENCY');
281     l_Acc_Mult               := per_formula_functions.get_number('ACCRUING_MULTIPLIER');
282 
283     hr_utility.set_location(l_proc,5);
284     hr_utility.trace('l_Accrual_Rate: '||to_char(l_Accrual_Rate));
285     while l_Continue_Processing_Flag loop
286         l_Period_SD := per_formula_functions.get_date('PERIOD_SD');
287         l_Period_ED := per_formula_functions.get_date('PERIOD_ED');
288 
289         -- Bug 5043294; Removed comments and unnessary if/else logic
290 	-- Calculating the working days in the period
291         l_daysoff :=PER_ZA_ABS_DURATION.ZA_DAYSOFF(l_Period_SD,l_Period_ED);
292         hr_utility.trace('l_daysoff: '||to_char(l_daysoff));
293 	l_Total_Accrued_PTO := round(l_Total_Accrued_PTO + (((l_Period_ED - l_Period_SD)+1) - l_daysoff)/l_Accrual_Rate , 2);
294       --l_Total_Accrued_PTO := round(l_Total_Accrued_PTO + l_Accrual_Rate, 2);
295 
296 	if  l_Period_SD = l_Last_Period_SD then
297             l_Continue_Processing_Flag := false;
298         else
299             l_Period_ED := l_Period_ED + 1;
300             l_error := per_utility_functions.GET_PERIOD_DATES( l_Period_ED
301                                                             ,l_Acc_Freq
302                                                             ,l_Beginning_Calc_Year_SD
303                                                             ,l_Acc_Mult);
304             l_error := per_formula_functions.set_date('PERIOD_SD',
305                                              per_formula_functions.get_date('PERIOD_START_DATE'));
306             l_error := per_formula_functions.set_date('PERIOD_ED',
307                                              per_formula_functions.get_date('PERIOD_END_DATE'));
308             l_Continue_Processing_Flag := true;
309 
310         end if;
311     end loop;
312     l_error := per_formula_functions.set_number('TOTAL_ACCRUED_PTO', l_Total_Accrued_PTO);
313     Return l_Total_Accrued_PTO;
314 
315 end ZA_PTO_SICKLEAVE_PERIOD_LOOP;
316 --
317 /* Start of 2932073 and 2878657 */
318 
319 /* ======================================================================
320    Name    : ZA_PTO_CARRYOVER_RESI_VALUE
321    Purpose : This function is called by the pto_carry_over_for_asg for the
322              South Africa Localisation ('ZA'). And it calculate the Carry
323 	     over value and residual value.
324 	     If the carry over is -ve it will be set to ZERO (0).
325    Returns : residula value and carry over value.
326    ======================================================================*/
327 
328 procedure ZA_PTO_CARRYOVER_RESI_VALUE (p_assignment_id			IN Number
329 				  ,p_plan_id				IN Number
330 				  ,l_payroll_id				IN Number
331 				  ,p_business_group_id                  IN Number
332 				  ,l_effective_date			IN Date
333 				  ,l_total_accrual			IN Number
334 				  ,l_net_entitlement			IN number
335 				  ,l_max_carryover			IN Number
336 				  ,l_residual				OUT NOCOPY Number
337 				  ,l_carryover				OUT NOCOPY Number) Is
338 
339   -- Declaring local variables
340   l_start_date            date;
341   l_end_date            date;
342   l_dummy13            date;
343   l_net_entitlement2   number;
344   l_effective_date2    date;
345   l_total_accrual2     number;
346   l_proc    varchar2(80) := 'PER_ZA_PTO_ACCRUAL_PERIOD.ZA_PTO_CARRYOVER_RESI_VALUE';
347   l_carryover_pre     number;   --Bug 4293298
348   l_Beginning_Calc_Year   date;
349   l_other2 number;
350 
351 Begin
352        /*l_effective_date2 := l_effective_date + 1;
353 
354        -- Get total accrual on above date, it will only return non-zero where the
355        -- carry over runs for a ZA HRMS "Semi-annual" leave cycle anniversary
356        per_accrual_calc_functions.Get_Net_Accrual (
357          P_Assignment_ID          => p_assignment_id
358         ,P_Plan_ID                => p_plan_id
359         ,P_Payroll_ID             => l_payroll_id
360         ,P_Business_Group_ID      => p_business_group_id
361         ,P_Assignment_Action_Id   => -1
362         ,P_Accrual_Start_Date     => null
363         ,P_Accrual_Latest_Balance => null
364         ,P_Calculation_Date       => l_effective_date2
365         ,P_Start_Date             => l_dummy11
366         ,P_End_Date               => l_dummy12
367         ,P_Accrual_End_Date       => l_dummy13
368         ,P_Accrual                => l_total_accrual2
369         ,P_Net_Entitlement        => l_net_entitlement2
370        );
371 
372        hr_utility.set_location(l_proc, 10);
373        hr_utility.trace('l_total_accrual2: '||to_char(l_total_accrual2));
374        hr_utility.trace('l_net_entitlement2: '||to_char(l_net_entitlement2)); */
375 
376        /* The above code is commented so that to avoid the calculation
377 	 l_net_entitlement > l_max_carryover while fixing the bug 2932073 */
378        hr_utility.set_location(l_proc,5);
379        hr_utility.trace('p_assignment_id: '||to_char(p_assignment_id));
380        hr_utility.trace('p_plan_id: '||to_char(p_plan_id));
381        hr_utility.trace('l_payroll_id: '||to_char(l_payroll_id));
382        hr_utility.trace('l_effective_date: '||to_char(l_effective_date));
383        hr_utility.trace('l_total_accrual: '||to_char(l_total_accrual));
384        hr_utility.trace('l_net_entitlement: '||to_char(l_net_entitlement));
385        hr_utility.trace('l_max_carryover: '||to_char(l_max_carryover));
386 
387       if l_net_entitlement <= l_max_carryover then
388        --
389          hr_utility.set_location(l_proc,10);
390         l_Beginning_Calc_Year := per_formula_functions.get_date('BEGINNING_OF_CALCULATION_YEAR');
391         --
392           IF (l_net_entitlement <= 0
393                AND to_char(l_effective_date + 1,'MM') <> to_char(l_Beginning_Calc_Year,'MM')
394               )THEN
395           -- Bug 4293298 in case net entitlement is -ve and the carryover process is not for the
396           -- end of the annual accrual period.
397 	      l_carryover := 0;
398           --get the carryover in the previous half of the accrual year
399             l_carryover_pre := per_accrual_calc_functions.get_carry_over
400                                 (
401                                  p_assignment_id => p_assignment_id,
402                                  p_plan_id => p_plan_id,
403                                  p_start_date => (l_effective_date-30),
404                                  p_calculation_date => (l_effective_date-1));
405              hr_utility.trace('l_carryover_pre: '||to_char(l_carryover_pre));
406              IF l_carryover_pre < 0 THEN
407                    l_carryover := l_carryover_pre;
408              END IF ;
409           hr_utility.set_location(l_proc,50);
410 	  ELSE
411              l_carryover := round(l_net_entitlement, 3);
412              hr_utility.set_location(l_proc,60);
413 	  END IF;
414           --End for bug no 2932073 14-Aug-2003
415 	 l_residual  := 0;
416        --
417       else
418        --
419           l_effective_date2 := l_effective_date + 1;
420 
421        -- Get total accrual on above date, it will only return non-zero where the
422        -- carry over runs for a ZA HRMS "Semi-annual" leave cycle anniversary
423          per_accrual_calc_functions.Get_Net_Accrual (
424 		 P_Assignment_ID          => p_assignment_id
425 		,P_Plan_ID                => p_plan_id
426 		,P_Payroll_ID             => l_payroll_id
427 		,P_Business_Group_ID      => p_business_group_id
428 		,P_Assignment_Action_Id   => -1
429 		,P_Accrual_Start_Date     => null
430 		,P_Accrual_Latest_Balance => null
431 		,P_Calculation_Date       => l_effective_date2
432 		,P_Start_Date             => l_start_date
433 		,P_End_Date               => l_end_date
434 		,P_Accrual_End_Date       => l_dummy13
435 		,P_Accrual                => l_total_accrual2
436 		,P_Net_Entitlement        => l_net_entitlement2
437 	       );
438 
439         -- The other contributions(leave adjustments) need to be subtracted before the residual value
440         -- is calculated. The adjustments in the current accrual cycle must not be forfeited.
441         -- Only for semi-annual run.
442         l_Beginning_Calc_Year := per_formula_functions.get_date('BEGINNING_OF_CALCULATION_YEAR');
443 
444        IF to_char(l_effective_date + 1,'MM') <> to_char(l_Beginning_Calc_Year,'MM') THEN
445           hr_utility.set_location(l_proc, 15);
446           l_other2 := per_accrual_calc_functions.Get_Other_Net_Contribution(
447                          P_Assignment_ID    => p_assignment_id
448                         ,P_Plan_ID          => p_plan_id
449                         ,p_start_date       => l_start_date
450                         ,p_calculation_date => l_end_date
451                         );
452         ELSE
453           l_other2 := 0;
454         END IF;
455 --
456        hr_utility.set_location(l_proc, 20);
457        hr_utility.trace('l_total_accrual2: '||to_char(l_total_accrual2));
458        hr_utility.trace('l_net_entitlement2: '||to_char(l_net_entitlement2));
459        hr_utility.trace('l_other2: '||to_char(l_other2));
460        hr_utility.trace('l_start_date: '||to_char(l_start_date));
461        hr_utility.trace('l_end_date: '||to_char(l_end_date));
462        hr_utility.trace('l_Beginning_Calc_Year: '||to_char(l_Beginning_Calc_Year));
463        hr_utility.trace('l_effective_date: '||to_char(l_effective_date));
464 --
465          hr_utility.set_location(l_proc, 30);
466          l_carryover := round(l_max_carryover, 3);
467          l_residual  := round((l_net_entitlement - l_max_carryover - l_total_accrual2 - l_other2), 3);
468          --Bug 4293298 if residual value is -ve ..then it is set to 0
469          IF l_residual < 0 THEN
470          l_residual := 0;
471          END IF ;
472        --
473        end if;
474        hr_utility.set_location(l_proc, 40);
475        hr_utility.trace('l_carryover: '||to_char(l_carryover));
476        hr_utility.trace('l_residual: '||to_char(l_residual));
477 
478 
479 End ZA_PTO_CARRYOVER_RESI_VALUE;
480 
481 /* End of 2932073 and 2878657 */
482 
483 --
484 end PER_ZA_PTO_ACCRUAL_PERIOD;