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');
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');
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');
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:
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);
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:
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 - */
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
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 */
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
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;
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;
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;
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;
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;
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;
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:
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;
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');
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');
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');
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');
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:
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);
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));
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
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
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);
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;
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:
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;
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;
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: --
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
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(