Most Annual Leave accrual plans define a fixed number of days an employee earns over a full calendar year. But employees rarely join or leave exactly on 1 January or 31 December — they join mid-year, transfer between plans mid-year, or leave the organization partway through it. Without special handling, the accrual engine either grants the full annual entitlement regardless of actual tenure in the period, or under/over-counts partial months in an inconsistent way.
This post shares a working Fast Formula, XYZ_ANNUAL_LEAVE_PRORATION_FF, of type Global Absence Partial Period Accrual Rate Formula, that prorates the Annual Leave accrual for employees with a partial period of participation — whether that partial period is caused by a hire, a termination, or a mid-period plan enrollment/un-enrollment — using a common HR rounding convention: the 15th-of-the-month rule.
Business Requirement
- An employee who joins or is enrolled in the plan on or before the 15th of a month should receive accrual credit for that whole month.
- An employee who joins or is enrolled after the 15th of a month should NOT receive accrual credit for that partial month — credit starts from the 1st of the following month.
- An employee who terminates or is un-enrolled on or before the 15th of a month should NOT receive accrual credit for that partial month — credit stops at the end of the previous month.
- An employee who terminates or is un-enrolled after the 15th of a month SHOULD receive accrual credit for that whole month.
- The final accrual is the full annual amount, scaled by the ratio of eligible participation months to total months in the calendar/accrual period.
Formula Type: Global Absence Partial Period Accrual Rate Formula
This formula type is attached at the Accrual Plan level and is invoked by the accrual engine specifically when an employee's participation does not span the full accrual period — for example, in their hire year or termination year, or around a mid-year plan transfer. It must return a single numeric value: the prorated accrual amount for that partial period.
| Input | Description |
|---|---|
| IV_ACCRUAL | The full-period accrual amount before proration (e.g., the standard annual entitlement). |
| IV_ACCRUALPERIODSTARTDATE / ENDDATE | Start and end date of the accrual period being processed. |
| IV_PLANENROLLMENTSTARTDATE / ENDDATE | The employee's enrollment start/end date in the source accrual plan. |
| IV_CALEDARSTARTDATE / ENDDATE | Start and end date of the plan's calendar (used to compute total months in the period). |
Logic Walkthrough
- Resolve the true start of participation (
ld_st_date) as the latest of hire date, accrual period start, and plan enrollment start. - If the day-of-month of
ld_st_dateis after the 15th, round the accrual start forward to the 1st of the next month (no credit for that partial month); otherwise round back to the 1st of the current month (full credit). - Resolve the true end of participation (
ld_end_date) as the earliest of termination date, accrual period end, and plan enrollment end. - If the day-of-month of
ld_end_dateis on or before the 15th, round the accrual end back to the end of the previous month (no credit); otherwise round forward to the end of the current month (full credit). - Compute
ln_term_duration— the total months spanned by the plan's calendar period. - Compute
ln_participation_duration— months between the rounded start and end dates. - Scale the full accrual:
ln_prorated_accrual = IV_ACCRUAL × (ln_participation_duration ÷ ln_term_duration), round it, and return it.
Example: An employee joins on 10-Mar (on or before the 15th, so March counts) and the plan calendar runs Jan–Dec (12 months). Rounded participation is Mar–Dec = 10 months. For a 24-day annual entitlement: 24 × (10 ÷ 12) = 20 days. If the same employee had instead joined on 20-Mar (after the 15th), March would not count, participation would be Apr–Dec = 9 months, and the entitlement would be 24 × (9 ÷ 12) = 18 days.
Full Formula Source
/***************************************************************************
FORMULA NAME: XYZ_ANNUAL_LEAVE_PRORATION_FF
FORMULA TYPE: Global Absence Partial Period Accrual Rate Formula
DESCRIPTION: This formula returns the accrual for mid-period enrollments and
un-enrollments for the Annual Leave absence plan.
Change History:
Name Date Version Comments
-------------------------------------------------------------------------------
Aditya DRAFT 1A Initial Version
*******************************************************************************/
DEFAULT FOR IV_ACCRUAL IS 0
DEFAULT FOR ACP_HIRE_DATE IS '1901/01/01 00:00:00' (date)
DEFAULT FOR ACP_TERMINATION_DATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR IV_ACCRUALPERIODSTARTDATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR IV_ACCRUALPERIODENDDATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR IV_PLANENROLLMENTSTARTDATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR IV_PLANENROLLMENTENDDATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR IV_CALEDARSTARTDATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR IV_CALEDARENDDATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR GLOBAL_PAY_INTERFACE_EXTRACTION_DATE IS '47121231'
INPUTS ARE IV_ACCRUAL, IV_ACCRUALPERIODSTARTDATE, IV_ACCRUALPERIODENDDATE,
IV_PLANENROLLMENTSTARTDATE, IV_PLANENROLLMENTENDDATE,
IV_CALEDARSTARTDATE, IV_CALEDARENDDATE
ln_hr_assignment_id = GET_CONTEXT(HR_ASSIGNMENT_ID,0)
ld_effective_date = GET_CONTEXT(EFFECTIVE_DATE,'4712/12/31 00:00:00'(date))
ln_leg_group_id = GET_CONTEXT(LEGISLATIVE_DATA_GROUP_ID,0)
LN_PERSON_ID = GET_CONTEXT(PERSON_ID,-1)
ld_hire_date = ACP_HIRE_DATE
ld_term_date = ACP_TERMINATION_DATE
/* to check if hire/enrollment date is on or before the 15th of the month */
ld_st_date = GREATEST(GREATEST(ld_hire_date,IV_ACCRUALPERIODSTARTDATE),IV_PLANENROLLMENTSTARTDATE)
ln_st_day = to_number(to_char(ld_st_date,'DD'))
IF ln_st_day > 15 THEN
(
/* accrual start date is from next month */
ld_accrual_period_st_date = ADD_DAYS(LAST_DAY(ld_st_date),1)
)
ELSE
(
/* accrual start date should be from 1st of current month */
ld_accrual_period_st_date = ADD_MONTHS(ADD_DAYS(LAST_DAY(ld_st_date),1),-1)
)
/* to check if termination/un-enrollment date is on or after the 15th of the month */
ld_end_date = LEAST(LEAST(ld_term_date,IV_ACCRUALPERIODENDDATE),IV_PLANENROLLMENTENDDATE)
ln_end_day = to_number(to_char(ld_end_date,'DD'))
IF ln_end_day <= 15 THEN
(
ld_accrual_period_end_date = ADD_MONTHS(LAST_DAY(ld_end_date),-1)
)
ELSE
(
ld_accrual_period_end_date = LAST_DAY(ld_end_date)
)
ln_term_duration = 1 + (TO_NUMBER(TO_CHAR(IV_CALEDARENDDATE, 'yy'))
- TO_NUMBER(TO_CHAR(IV_CALEDARSTARTDATE, 'yy'))) * 12
+ (TO_NUMBER(TO_CHAR(IV_CALEDARENDDATE, 'mm'))
- TO_NUMBER(TO_CHAR(IV_CALEDARSTARTDATE, 'mm')))
ln_participation_duration = months_between(ADD_DAYS(ld_accrual_period_end_date,1),ld_accrual_period_st_date)
ln_prorated_accrual = IV_ACCRUAL * (ln_participation_duration / ln_term_duration)
accrual = round(ln_prorated_accrual)
RETURN accrual
Compilation
- Compile the formula in the Fast Formula editor and resolve any syntax errors before attaching it to a live plan.
Attaching the Formula to the Accrual Plan
Navigate to Absences Administration → Accrual Plans, open the Annual Leave accrual plan, and go to the Rules tab. Under the Partial Accrual Period Rate section, set the formula to XYZ_ANNUAL_LEAVE_PRORATION_FF. Save and submit the change; it will then be invoked automatically for any employee whose participation in an accrual period is partial (new hires, terminations, and mid-period enrollment changes).
Testing and Validation
- Test with a hire date on or before the 15th and confirm the joining month is credited.
- Test with a hire date after the 15th and confirm the joining month is excluded.
- Test with termination on or before the 15th (excluded) and after the 15th (included).
Conclusion
Mid-period proration is one of the most common gaps between an out-of-the-box Annual Leave accrual plan and what organizations actually need at go-live. This formula applies a simple, widely recognized 15th-of-the-month convention to decide which partial months count, then scales the full entitlement by the resulting participation ratio — giving predictable, auditable results for new hires, leavers, and mid-year plan transfers alike. The same GREATEST/LEAST plus day-of-month pattern can be reused for other accrual plans (Sick Leave, Casual Leave) by simply changing the referenced plan and the accrual amount input.
No comments:
Post a Comment