How to get Net Entitlement of Leaves in Oracle HRMS Payroll

How to get net entitlement of leaves of an employee on a specific date in oracle hrms??

Please refer to the function code below.





CREATE OR REPLACE FUNCTION CUST_GET_NET_ENTITLEMENT (
   P_ASSG_ID            IN   NUMBER,
   P_PAYROLL_ID         IN   NUMBER,
   P_CALCULATION_DATE   IN   DATE
)
   RETURN NUMBER
IS
   L_START_DATE         DATE;
   L_END_DATE           DATE;
   L_ACC_END_DATE       DATE;
   L_VALUE              NUMBER         := 0;
   L_NET_VALUE          NUMBER (15, 2);
   P_PLAN_ID            NUMBER;
--   L_CALCULATION_DATE   DATE;
BEGIN
   SELECT PAP.ACCRUAL_PLAN_ID
     INTO P_PLAN_ID
     FROM PAY_ACCRUAL_PLANS PAP
    WHERE UPPER (PAP.ACCRUAL_PLAN_NAME) LIKE
             (SELECT UPPER (PETF.ELEMENT_NAME)
                FROM PAY_ELEMENT_ENTRIES_F PEEF, PAY_ELEMENT_TYPES_F PETF
               WHERE PEEF.ELEMENT_TYPE_ID = PETF.ELEMENT_TYPE_ID
                 AND UPPER (PETF.ELEMENT_NAME) LIKE '%PLAN%'
                 AND PETF.PROCESSING_TYPE = 'R'
                 AND PEEF.ASSIGNMENT_ID = P_ASSG_ID
                 AND P_CALCULATION_DATE BETWEEN PEEF.EFFECTIVE_START_DATE
                                            AND PEEF.EFFECTIVE_END_DATE);

/* QUERY ABOVE AUTOMATICALLY GETS THE PLAN ID OF THE ACCRUAL PLAN ID ATTACHED AS ON CALCULATION DATE*/
   PER_ACCRUAL_CALC_FUNCTIONS.GET_NET_ACCRUAL
                           (P_ASSIGNMENT_ID               => P_ASSG_ID,
                            P_PLAN_ID                     => P_PLAN_ID,
                            P_PAYROLL_ID                  => P_PAYROLL_ID,
                            P_BUSINESS_GROUP_ID           => 81,   -- Kindly change your business group id accordingly
                            P_ASSIGNMENT_ACTION_ID        => -1,
                            P_CALCULATION_DATE            => TO_DATE
                                                                (P_CALCULATION_DATE
                                                                )
-- DATE YOU WANT TO CHECK THE NET ENTITLEMENT EX. TO_DATE('01-MAR-2009', 'DD-MON-YYYY')
   ,
                            P_ACCRUAL_START_DATE          => NULL,
                            P_ACCRUAL_LATEST_BALANCE      => NULL,
                            P_CALLING_POINT               => 'FRM',
                            P_START_DATE                  => L_START_DATE,
                            P_END_DATE                    => L_END_DATE,
                            P_ACCRUAL_END_DATE            => L_ACC_END_DATE,
                            P_ACCRUAL                     => L_VALUE,
                            P_NET_ENTITLEMENT             => L_NET_VALUE
                           );
   RETURN NVL (L_NET_VALUE, 0);
EXCEPTION
   WHEN OTHERS
   THEN
      RETURN 0;
END;
/



Feedback is much appreciated.


10 comments:

  1. i use this function with accrual plans normally ;
    but some other plans returns no data found

    ReplyDelete
    Replies
    1. Salam Asma,

      Kindly pass correct name of accrual plan and also pass the correct business group id as parameter in place of hard coded value.

      Regards,
      Waqas

      Delete
  2. Hi Waqas

    I am trying to use this function in my Indemnity fast-formula, wherein I need the NET_ENTITLEMENT days to calculate the Vacation Final Settlement.

    ASSIGNMENT_ID & CALCULATION_DATE parameters can be passed easily, but can you please guide me on how to pass the PAYROLL_ID parameter in the fast-formula?

    Any help is much appreciated.

    Thanks

    Regards
    Trupti

    ReplyDelete
  3. Hi Waqas

    My client has a new requirement w.r.t. the Accrual Plan.

    They need to have a new element called 'Partial Leave' with below conditions:
    (a) It needs to contain an input value 'Number of hours', with a max value of 8.5.
    (b) Depending on the input value entered, there will be a deduction from leave accrual plan as: (Number of hours / 8.5).

    For example, if an employee has applied for a 'Partial Leave' of 2 hours, the system needs to deduct 0.23 days from the total leave balance (2/8.5 = 0.23).

    To handle this, I have done the following:
    (a) Defined an element called 'Partial Leave', with input value 'Number of Hours'.
    (b) And have written a fast-formula to handle the calculation of Number of Hours / 8.5.
    (c) I have passed the output value of this element to another element called 'Partial Leave Ded Days'.
    (d) And included this element under the 'Net Calculation Rules' of the Accrual Plan (with calculation type as Subtract).

    But when I ran the payroll and checked on the Accruals form, the element is seen, but the value is showing as zero, irrespective of the number of hours I enter for Partial Leave.

    Please let me know if the configurations I have followed is correct? If not, please provide me inputs on how to achieve this requirement.

    Thanks much.

    Regards

    ReplyDelete
    Replies
    1. Hello Trupti , I have the same issue now, did you solve it?

      Delete
  4. Hello,
    I have one issue, if you please I want discussing it with you.
    As you know in defining the accrual plane we put the annual rate,let it 30 days.
    In our company business , the employee must have 30 days vacation at the end of the year.
    So the days for every month is 2.5.
    I he worked the full year without any vacation his rights taking the full 30 days vacation.
    If he take one month for forced vacation, so his annual vacation will shrink by 2.5 days.
    So his vacation in the last month of the year will be 27.5
    How and where in the application we can do this solution.
    Please if you have one answer me or send by mail.

    hany_marawan@hotmail.com

    Thanks and best regards

    ReplyDelete
  5. my requiremnt is

    1) HRMS Super User - Fath Path - Accruals - for any leave ( annual , medical , casual) - Entitlement Calculation is between 01-JAN-2017 to 03-NOV-2017(Sysdate)

    2) Employee Self Service - Absence - Entitlement Balance - Show Accrual balances are " As of Sysdate "

    in above 2 cases, accruals are displayed " As of Sysdate", But client wants Leaves are displayed as of Year Last date ( 31- Dec-2017).

    I.E current, Annual(or)medical(or)casual leaves are as of sysdate,
    now this leaves should be as of 31-DEC-2017.

    Please reply to my mail id - sdileep.reddy@alvieel.com

    Thank You

    ReplyDelete
  6. Hello Dear,
    I have one query, let us suppose one employee has 10 days leave balance, and he applied for the 10 days leave.
    (In the company leave approval is going through the line manager to CTO.)
    Line Manager approved the leave after that approval goes to CTO. When CTO is going to approve his leave, leave balance is showing less.
    What could be the valid reason for this.
    Thanks

    ReplyDelete
  7. How to delete net entitlement i.e(leave balance record) records in hrms ??,

    ReplyDelete