Home » Applications » Oracle Fusion Apps & E-Business Suite » HR module (Payroll) (R12)
HR module (Payroll) [message #464410] |
Thu, 08 July 2010 00:05 |
lokeshsurana
Messages: 212 Registered: April 2010 Location: India
|
Senior Member |
|
|
I try to compile formula as Accrual Calculation
* ------------------------------------------------------------------------
NAME : PTO_SIMPLE_MULTIPLIER_6_HOURS
This formula calculates the start and end dates for out simple multiplier.
---------------------------------------------------------------------*/
DEFAULT FOR ACP_INELIGIBILITY_PERIOD_TYPE IS 'CM'
DEFAULT FOR ACP_INELIGIBILITY_PERIOD_LENGTH IS 0
DEFAULT FOR ACP_CONTINUOUS_SERVICE_DATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR ACP_ENROLLMENT_END_DATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR ACP_TERMINATION_DATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR ACP_ENROLLMENT_START_DATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR ACP_SERVICE_START_DATE IS '4712/12/31 00:00:00' (date)
INPUTS ARE
Calculation_Date (date)
/*E = SET_NUMBER('CEILING', 72)
E = SET_NUMBER('ACCRUAL_RATE', 6)*/
Accruing_Frequency = 'M' /* Month */
Accruing_Multiplier = 1
E = SET_TEXT('ACCRUING_FREQUENCY', Accruing_Frequency)
E = SET_NUMBER('ACCRUING_MULTIPLIER', Accruing_Multiplier)
Beginning_Of_Calculation_Year = to_date('0104'||to_char(Calculation_Date,'YYYY'),'DDMMYYYY')
IF Beginning_Of_Calculation_Year > Calculation_Date THEN
(
Beginning_of_Calculation_Year = ADD_MONTHS(Beginning_Of_Calculation_Year, -12)
)
E = SET_DATE('BEGINNING_OF_CALCULATION_YEAR', Beginning_Of_Calculation_Year)
E = GET_PERIOD_DATES(Beginning_of_Calculation_Year,
Accruing_Frequency,
Beginning_Of_Calculation_Year,
Accruing_Multiplier)
First_Period_SD = get_date('PERIOD_START_DATE')
First_Period_ED = get_date('PERIOD_END_DATE')
/* ------------------------------------------------------------------------
Set the Calculation_Date to the Termination Date if not null
-------------------------------------------------------------------------- */
IF NOT (ACP_TERMINATION_DATE WAS DEFAULTED) OR
NOT (ACP_ENROLLMENT_END_DATE WAS DEFAULTED) THEN
(
Early_End_Date = least(ACP_TERMINATION_DATE, ACP_ENROLLMENT_END_DATE)
IF (Early_End_Date < First_Period_ED) THEN
(
Total_Accrued_PTO = 0
E = PUT_MESSAGE('HR_52794_PTO_FML_ASG_TER')
)
IF (Early_End_Date < Calculation_Date) THEN
(
Calculation_Date = Early_End_Date
)
)
/* ------------------------------------------------------------------------
Get the last whole period prior to the Calculation Date and ensure that it is within the
Year (if the Calculation Date is the End of a Period then use that period)
------------------------------------------------------------------------ */
E = GET_PERIOD_DATES(Calculation_Date,
Accruing_Frequency,
Beginning_of_Calculation_Year,
Accruing_Multiplier)
Calculation_Period_SD = get_date('PERIOD_START_DATE')
Calculation_Period_ED = get_date('PERIOD_END_DATE')
IF (Calculation_Date <> Calculation_Period_ED) THEN
(
E = GET_PERIOD_DATES(ADD_DAYS(Calculation_Period_SD,-1),
Accruing_Frequency,
Beginning_of_Calculation_Year,
Accruing_Multiplier)
Calculation_Period_SD = get_date('PERIOD_START_DATE')
Calculation_Period_ED = get_date('PERIOD_END_DATE')
)
If (Calculation_Period_ED < First_Period_ED) THEN
(
Total_Accrued_PTO = 0
E = PUT_MESSAGE('HR_52795_PTO_FML_CALC_DATE')
)
/* ------------------------------------------------------------------------
Set the Continuous Service Global Variable, whilst also
ensuring that the continuous service date is before the Calculation Period
------------------------------------------------------------------------ */
IF (ACP_CONTINUOUS_SERVICE_DATE WAS DEFAULTED) THEN
(
E = set_date('CONTINUOUS_SERVICE_DATE', ACP_SERVICE_START_DATE)
)
ELSE IF(ACP_CONTINUOUS_SERVICE_DATE > Calculation_Period_SD) THEN
(
Total_Accrued_PTO = 0
E = PUT_MESSAGE('HR_52796_PTO_FML_CSD')
E = set_date('CONTINUOUS_SERVICE_DATE', ACP_CONTINUOUS_SERVICE_DATE)
)
ELSE
(
E = set_date('CONTINUOUS_SERVICE_DATE', ACP_CONTINUOUS_SERVICE_DATE)
)
Continuous_Service_Date = get_date('CONTINUOUS_SERVICE_DATE')
First_Eligible_To_Accrue_Date = Continuous_Service_Date
/*------------------------------------------------------------------------
Determine the date on which accrued PTo may first be registered, i.e the date on which the
Ineligibility Period expires
------------------------------------------------------------------------ */
Accrual_Ineligibility_Expired_Date = First_Eligible_To_Accrue_Date
IF (ACP_INELIGIBILITY_PERIOD_LENGTH > 0) THEN
(
IF ACP_INELIGIBILITY_PERIOD_TYPE = 'BM' THEN
(
Accrual_Ineligibility_Expired_Date = add_months(Continuous_Service_Date,
ACP_INELIGIBILITY_PERIOD_LENGTH*2)
)
ELSE IF ACP_INELIGIBILITY_PERIOD_TYPE = 'F' THEN
(
Accrual_Ineligibility_Expired_Date = add_days(Continuous_Service_Date,
ACP_INELIGIBILITY_PERIOD_LENGTH*14)
)
ELSE IF ACP_INELIGIBILITY_PERIOD_TYPE = 'CM' THEN
(
Accrual_Ineligibility_Expired_Date = add_months(Continuous_Service_Date,
ACP_INELIGIBILITY_PERIOD_LENGTH)
)
ELSE IF ACP_INELIGIBILITY_PERIOD_TYPE = 'LM' THEN
(
Accrual_Ineligibility_Expired_Date = add_days(Continuous_Service_Date,
ACP_INELIGIBILITY_PERIOD_LENGTH*28)
)
ELSE IF ACP_INELIGIBILITY_PERIOD_TYPE = 'Q' THEN
(
Accrual_Ineligibility_Expired_Date = add_months(Continuous_Service_Date,
ACP_INELIGIBILITY_PERIOD_LENGTH*3)
)
ELSE IF ACP_INELIGIBILITY_PERIOD_TYPE = 'SM' THEN
(
Accrual_Ineligibility_Expired_Date = add_months(Continuous_Service_Date,
ACP_INELIGIBILITY_PERIOD_LENGTH/2)
)
ELSE IF ACP_INELIGIBILITY_PERIOD_TYPE = 'SY' THEN
(
Accrual_Ineligibility_Expired_Date = add_months(Continuous_Service_Date,
ACP_INELIGIBILITY_PERIOD_LENGTH*6)
)
ELSE IF ACP_INELIGIBILITY_PERIOD_TYPE = 'W' THEN
(
Accrual_Ineligibility_Expired_Date = add_days(Continuous_Service_Date,
ACP_INELIGIBILITY_PERIOD_LENGTH*7)
)
ELSE IF ACP_INELIGIBILITY_PERIOD_TYPE = 'Y' THEN
(
Accrual_Ineligibility_Expired_Date = add_months(Continuous_Service_Date,
ACP_INELIGIBILITY_PERIOD_LENGTH*12)
)
IF Accrual_Ineligibility_Expired_Date > First_Eligible_To_Accrue_Date
AND Calculation_Date < Accrual_Ineligibility_Expired_Date THEN
(
First_Eligible_To_Accrue_Date = Accrual_Ineligibility_Expired_Date
)
)
/* ------------------------------------------------------------------------
Get the first full period following the First_Eligible_To_Accrue_Date
(if it falls on the beginning of the period then use that period)
------------------------------------------------------------------------- */
IF First_Eligible_To_Accrue_Date > Beginning_Of_Calculation_Year THEN
(
E = GET_PERIOD_DATES(First_Eligible_To_Accrue_Date,
Accruing_Frequency,
Beginning_Of_Calculation_Year,
Accruing_Multiplier)
First_Eligible_To_Accrue_Period_SD = get_date('PERIOD_START_DATE')
First_Eligible_To_Accrue_Period_ED = get_date('PERIOD_END_DATE')
IF First_Eligible_To_Accrue_Date <> First_Eligible_To_Accrue_Period_SD THEN
(
E = GET_PERIOD_DATES(add_days(First_Eligible_To_Accrue_Period_ED,1),
Accruing_Frequency,
Beginning_Of_Calculation_Year,
Accruing_Multiplier)
First_Eligible_To_Accrue_Period_SD = get_date('PERIOD_START_DATE')
First_Eligible_To_Accrue_Period_ED = get_date('PERIOD_END_DATE')
)
IF (First_Eligible_To_Accrue_Period_SD > Calculation_Period_ED) THEN
(
Total_Accrued_PTO = 0
E = PUT_MESSAGE('HR_52793_PTO_FML_ASG_INELIG')
)
)
ELSE
(
First_Eligible_To_Accrue_Period_SD = First_Period_SD
First_Eligible_To_Accrue_Period_ED = First_Period_ED
)
/* ------------------------------------------------------------------------
Determine the date on which PTO actually starts accruing based on Hire Date,
Continuous Service Date and plan Enrollment Start Date. Remember, we have already determined
whether to user hire date or CSD earlier in the formula.
If this date is after the 1st period and the fisrt eligible date then establish the first full period
after this date (if the Actual Start Date falls on the beginning of a period then use this period)
------------------------------------------------------------------------ */
IF Continuous_Service_date = ACP_CONTINUOUS_SERVICE_DATE THEN
(
Actual_Accrual_Start_Date = Continuous_service_Date
)
ELSE
(
Actual_Accrual_Start_Date = greatest(Continuous_Service_Date,
ACP_ENROLLMENT_START_DATE,
First_Period_SD)
)
/* -------------------------------------------------------------------------
Determine the actual start of the accrual calculation
-------------------------------------------------------------------------*/
IF (Actual_Accrual_Start_Date > First_Period_SD AND
Actual_Accrual_Start_Date > First_Eligible_To_Accrue_Period_SD) THEN
(
E = GET_PERIOD_DATES(Actual_Accrual_Start_Date,
Accruing_Frequency,
Beginning_Of_Calculation_Year,
Accruing_Multiplier)
Accrual_Start_Period_SD = get_date('PERIOD_START_DATE')
Accrual_Start_Period_ED = get_date('PERIOD_END_DATE')
IF Actual_Accrual_Start_Date > Accrual_Start_Period_SD THEN
(
E = GET_PERIOD_DATES(add_days(Accrual_Start_Period_ED,1),
Accruing_Frequency,
Beginning_of_Calculation_Year,
Accruing_Multiplier)
Accrual_Start_Period_SD = get_date('PERIOD_START_DATE')
Accrual_Start_Period_ED = get_date('PERIOD_END_DATE')
)
/* -----------------------------------------------------------------
If the Actual Acrual Period is after the Calculation Period then end the processing.
----------------------------------------------------------------- */
IF (Accrual_Start_Period_SD > Calculation_Period_ED) THEN
(
Total_Accrued_PTO = 0
E = PUT_MESSAGE('HR_52797_PTO_FML_ACT_ACCRUAL')
)
)
ELSE IF (First_Eligible_To_Accrue_Period_SD > First_Period_SD) THEN
(
Accrual_Start_Period_SD = First_Eligible_To_Accrue_Period_SD
Accrual_Start_Period_ED = First_Eligible_To_Accrue_Period_ED
)
ELSE
(
Accrual_Start_Period_SD = First_Period_SD
Accrual_Start_Period_ED = First_Period_ED
)
/* -------------------------------------------------------------------
Now set up the information that will be used in when looping through the periods
--------------------------------------------------------------------- */
IF Calculation_Period_ED >= Accrual_Start_Period_ED THEN
(
E = set_date('PERIOD_SD',Accrual_Start_Period_SD)
E = set_date('PERIOD_ED',Accrual_Start_Period_ED)
E = set_date('LAST_PERIOD_SD',Calculation_Period_SD)
E = set_date('LAST_PERIOD_ED',Calculation_Period_ED)
E = set_number('TOTAL_ACCRUED_PTO',0)
E = set_number('ANNUAL_RATE',0)
E = set_number('UPPER_LIMIT',0)
E = set_number('CEILING',0)
E = LOOP_CONTROL('SPNEW_PERIOD_ACCRUAL')
Total_Accrued_PTO = get_number('TOTAL_ACCRUED_PTO')
)
IF Accrual_Start_Period_SD <= Calculation_Period_SD THEN
(
Accrual_end_date = Calculation_Period_ED
)
Effective_Start_Date = Accrual_Start_Period_SD
Effective_End_Date = Calculation_Date
IF Effective_Start_Date >= Effective_End_Date THEN
(
Effective_Start_Date = Effective_End_Date
)
RETURN Total_Accrued_PTO, Effective_start_date, Effective_end_date, Accrual_end_date
But getting error as :
app-pay-33238
error line 259
it showing error on :
E = LOOP_CONTROL('SPNEW_PERIOD_ACCRUAL')
what need to do..?
|
|
|
Goto Forum:
Current Time: Sat Jan 11 04:23:32 CST 2025
|