0% found this document useful (0 votes)
168 views2 pages

Get Accrual

This function calculates the net accrual for a person for a given plan and effective date. It takes in the person ID, plan name, and effective date as parameters. It uses these to lookup the plan ID, payroll ID, and person's assignment ID. It then calls another function to calculate the accrual details like start date, end date, accrual amount, and net entitlement. The net entitlement value is returned, with any errors defaulting to a return of 0.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
168 views2 pages

Get Accrual

This function calculates the net accrual for a person for a given plan and effective date. It takes in the person ID, plan name, and effective date as parameters. It uses these to lookup the plan ID, payroll ID, and person's assignment ID. It then calls another function to calculate the accrual details like start date, end date, accrual amount, and net entitlement. The net entitlement value is returned, with any errors defaulting to a return of 0.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

FUNCTION XXX_Get_Net_Accrual(P_Person_Id NUMBER, P_Plan_Nnme VARCHAR2

,P_EFFECTIVE_D date)
RETURN NUMBER DETERMINISTIC IS
L_Plan_Id NUMBER;
L_Payroll_Id NUMBER;
L_Ass_Id NUMBER;
L_Bus_Id NUMBER := 101;
X_Start_Date DATE;
X_End_Date DATE;
X_Accrual_End_Date DATE;
X_Accrual NUMBER;
X_Net_Entitlement NUMBER;

BEGIN
SELECT Pap.Accrual_Plan_Id
INTO L_Plan_Id
FROM Pay_Accrual_Plans Pap
WHERE Pap.Accrual_Plan_Name = P_Plan_Nnme;
SELECT Payroll_Id
INTO L_Payroll_Id
FROM Pay_All_Payrolls_f
WHERE Payroll_Name = 'XXMonthly Payroll';
SELECT Paa.Assignment_Id
INTO L_Ass_Id
FROM Per_All_Assignments_f Paa
WHERE Person_Id = P_Person_Id
AND P_EFFECTIVE_D BETWEEN Paa.Effective_Start_Date AND
Nvl(Paa.Effective_End_Date, P_EFFECTIVE_D);

Per_Accrual_Calc_Functions.Get_Net_Accrual(P_Assignment_Id =>
L_Ass_Id,
P_Plan_Id =>
L_Plan_Id,
P_Payroll_Id =>
L_Payroll_Id,
P_Business_Group_Id =>
L_Bus_Id,
P_Assignment_Action_Id => -1,
P_Calculation_Date =>
P_EFFECTIVE_D,
P_Accrual_Start_Date => NULL,
P_Accrual_Latest_Balance => NULL,
P_Calling_Point => NULL,
P_Start_Date =>
X_Start_Date,
P_End_Date =>
X_End_Date,
P_Accrual_End_Date =>
X_Accrual_End_Date,
P_Accrual =>
X_Accrual,
P_Net_Entitlement =>
X_Net_Entitlement);
RETURN Round(Nvl(X_Net_Entitlement, 0), 3);
EXCEPTION
WHEN OTHERS THEN
RETURN 0;
END;

You might also like