Monday, 11 September 2023

Sample Fast Formula - Global Absence Rollover

 /***************************************************************************

FORMULA NAME: XYZ_Annual_Leave_Rollover_FF

FORMULA TYPE: Global Absence Rollover

DESCRIPTION: This is used to calculate the Annual Leave Rollover value to the 'Annual Leave - Carry Over' plan at the end of every year for Edelweiss India emps

Change History:

Name Date Version Comments

-------------------------------------------------------------------------------

Aditya Initial Version

*******************************************************************************/

DEFAULT FOR PER_ASG_BUSINESS_UNIT_NAME IS ' '

DEFAULT FOR l_plan_balance is 0

DEFAULT FOR l_rollover is 0


INPUTS ARE IV_ACCRUAL, 

IV_CARRYOVER,

IV_ACCRUALPERIODSTARTDATE (date), 

IV_ACCRUALPERIODENDDATE (date), 

IV_CALEDARSTARTDATE (date), 

IV_CALEDARENDDATE (date), 

IV_PLANENROLLMENTSTARTDATE (date), 

IV_PLANENROLLMENTENDDATE (date)



lc_plan_name = 'Annual Leave - Carry Over'

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)



L_DATA = ESS_LOG_WRITE('XYZ_Annual_Leave_Rollover_FF: Value of ln_hr_assignment_id: ' || to_char(ln_hr_assignment_id))


L_DATA = ESS_LOG_WRITE('XYZ_Annual_Leave_Rollover_FF: Value of LN_PERSON_ID: ' || to_char(LN_PERSON_ID))


L_DATA = ESS_LOG_WRITE('XYZ_Annual_Leave_Rollover_FF: Value of ld_effective_date: ' || to_char(ld_effective_date))

L_DATA = ESS_LOG_WRITE('XYZ_Annual_Leave_Rollover_FF: Value of ln_leg_group_id: ' || to_char(ln_leg_group_id))



CHANGE_CONTEXTS(HR_ASSIGNMENT_ID = ln_hr_assignment_id,PERSON_ID = LN_PERSON_ID,EFFECTIVE_DATE = ld_effective_date,LEGISLATIVE_DATA_GROUP_ID = ln_leg_group_id)


(


l_plan_balance = GET_PLAN_BALANCE(lc_plan_name)


)


MAX_CARRYOVER = 60

l_rollover = MAX_CARRYOVER-l_plan_balance

L_DATA = ESS_LOG_WRITE('XYZ_Annual_Leave_Rollover_FF: Value of l_plan_balance: ' || to_char(l_plan_balance))

L_DATA = ESS_LOG_WRITE('XYZ_Annual_Leave_Rollover_FF: Value of l_rollover: ' || to_char(l_rollover))


MAX_ROLLOVER = 10

if l_rollover > MAX_ROLLOVER

THEN

(

ROLLOVER = MAX_ROLLOVER

)

ELSE 

(

ROLLOVER = l_rollover

)


L_DATA = ESS_LOG_WRITE('XYZ_Annual_Leave_Rollover_FF: Value of ROLLOVER: ' || to_char(ROLLOVER))


RETURN ROLLOVER


x

No comments:

Post a Comment