Formula
Formula
Formula
*
* Formula Name: TCC_ACCOMMODATION_ALLOWANCE
* Formula Type: Oracle Payroll
* Created: 26-Jun-2010
* Author: MHELOW
*
* Description: Calculate Accommodation for related employee
*
*/
/******************************************************************************
Site : TABUK Cement Company - TCC
Formula Name: TCC_ACCOMMODATION_ALLOWANCE
Date : 1-AUG-2015
Change Hosuing structure by using People Group
********************************************************************************/
ALIAS ASG_SALARY AS Salary
DEFAULT FOR Salary IS 0
/*****
ALIAS GROUP_KF_ACCOMMODATION_IN_TCC_BUILDING AS Accommodation
DEFAULT FOR Accommodation IS 'No'
******/
ALIAS GROUP_KF_HOUSING_TYPE AS HOUSING_TYPE
DEFAULT FOR HOUSING_TYPE is ' '
/* CALCULATIONS */
Resume_date = to_date (Resumption_Date,'YYYY/MM/DD HH24:MI:SS')
ACCOMMODATION_AMOUNT = GREATEST(ACCOMMODATION_AMOUNT,Minimum_Amount)
L_PAY_VALUE1 = round(ACCOMMODATION_AMOUNT)
/
*----------------------------------------------------------------------------------
-----*/
msg30 = 'DBLD'+to_char(DBLD)+'RDML'+to_char(RDML)+to_char(L_PAY_VALUE1)
/*months_of_leave = ROUND_UP(months_between(end_date,start_date))
L_PAY_VALUE = round(L_PAY_VALUE * months_of_leave)*/
/*msg30 = 'months_of_leave' + to_char(months_of_leave)*/
return L_PAY_VALUE,msg30
)
/* Recovery Amount*/
else if (Resume_date > payroll_end_date)
AND(Advance_Flag = 'Yes')then
(
L_PAY_VALUE = 0
return L_PAY_VALUE
)
else if (Resume_date>= payroll_start_date AND Resume_date<= payroll_end_date)
AND(Advance_Flag = 'Yes') then
(
days_between_resumption_date = days_between(payroll_end_date,Resume_date)+1
msg = 'Recovery If' +TO_CHAR(days_between_resumption_date)
ACCOMMODATION_AMOUNT = ROUND(((Salary*3)/12))
L_PAY_VALUE = ((ACCOMMODATION_AMOUNT/30)*days_between_resumption_date)
return L_PAY_VALUE,msg
)
else
/*******
if Accommodation = 'No' and (termination_date >= payroll_start_date and
termination_date <= payroll_end_date) then
******/
Number_of_days_on_current_month = days_between
(payroll_end_date,payroll_start_date)+1
return L_PAY_VALUE
)
else
/***********
if Accommodation = 'No' and (L_Emp_Hire_Date >= payroll_start_date and
L_Emp_Hire_Date <= payroll_end_date) then
********/
if (L_Emp_Hire_Date >= payroll_start_date and L_Emp_Hire_Date <= payroll_end_date)
then
(
IF HOUSING_TYPE = '2' THEN
(
ACCOMMODATION_AMOUNT = ((Salary*2)/12)
)
ELSE IF HOUSING_TYPE = '3' THEN
(
ACCOMMODATION_AMOUNT = ((Salary*3)/12)
)
ELSE IF HOUSING_TYPE = '4' THEN
(
ACCOMMODATION_AMOUNT = ((Salary*4)/12)
)
ELSE
(
ACCOMMODATION_AMOUNT = 0
)
ACCOMMODATION_AMOUNT = GREATEST(ACCOMMODATION_AMOUNT,Minimum_Amount)
Number_of_days_on_current_month = days_between
(payroll_end_date,payroll_start_date)+1
return L_PAY_VALUE
)
else
(
/** ACCOMMODATION_AMOUNT = ((Salary*3)/12) **/
IF HOUSING_TYPE = '2' THEN
(
ACCOMMODATION_AMOUNT = ((Salary*2)/12)
)
ELSE IF HOUSING_TYPE = '3' THEN
(
ACCOMMODATION_AMOUNT = ((Salary*3)/12)
)
ELSE IF HOUSING_TYPE = '4' THEN
(
ACCOMMODATION_AMOUNT = ((Salary*4)/12)
)
ELSE
(
ACCOMMODATION_AMOUNT = 0
)
ACCOMMODATION_AMOUNT = GREATEST(ACCOMMODATION_AMOUNT,Minimum_Amount)
L_PAY_VALUE = round(ACCOMMODATION_AMOUNT)
return L_PAY_VALUE,msg1
)