Proration Issues (merged) [message #689296] |
Thu, 16 November 2023 02:55 |
daibatzu
Messages: 36 Registered: September 2007
|
Member |
|
|
Hello, I am having some issues with Oracle Fusion Cloud. I am new to this platform from R12.
Now I am trying to do a basic proration.
I have written my proration formula which works:
/* VARIABLES */
DEFAULT FOR PRORATE_START IS '01-JAN-1980' (DATE)
DEFAULT FOR PRORATE_END IS '31-DEC-4712' (DATE)
DEFAULT FOR PAY_EARN_PERIOD_START IS '01-JAN-1980' (DATE)
DEFAULT FOR PAY_EARN_PERIOD_END IS '31-DEC-4712' (DATE)
DEFAULT FOR PAY_VALUE IS 0
/* INPUTS */
INPUTS ARE PAY_VALUE, PRORATE_START (DATE), PRORATE_END (DATE)
/* CALCUATIONS */
TOTAL_DAYS = DAYS_BETWEEN(PAY_EARN_PERIOD_END, PAY_EARN_PERIOD_START) + 1
WORKED_DAYS = DAYS_BETWEEN(PRORATE_END, PRORATE_START) + 1
PAY_VALUE = ROUND( PAY_VALUE * (WORKED_DAYS/TOTAL_DAYS), 2)
/* RETURN */
RETURN PAY_VALUE
Now I have attached this proration formula to an element, Basic Pay Element.
THe formula for the element is like this:
DEFAULT FOR TEST_ELEMENT_AMOUNT_ASG_ENTRY_VALUE IS 0
DEFAULT FOR PAY_VALUE IS 0
DEFAULT FOR MONTHLY_GROSS IS 0
/* INPUTS */
INPUTS ARE MONTHLY_GROSS, PAY_VALUE
/* CALCUATIONS */
PAY_VALUE = TEST_ELEMENT_AMOUNT_ASG_ENTRY_VALUE * 0.25
MONTHLY_GROSS = TEST_ELEMENT_AMOUNT_ASG_ENTRY_VALUE
/* RETURN */
RETURN PAY_VALUE, MONTHLY_GROSS
Now this calculation uses the Amount input value of an element called Test Element. So to get the value I am using the DBI, TEST_ELEMENT_AMOUNT_ASG_ENTRY_VALUE.
However, for the current month, I have updated the value of Test Element in the middle of the month.
This has triggered proration so I get two results. But the problem is that during the calculation, the value of the DBI TEST_ELEMENT_AMOUNT_ASG_ENTRY_VALUE is the same. That is the value it is using to calculate PAY_VALUE and MONTHLY_GROSS always uses the latest value of TEST_ELEMENT_AMOUNT_ASG_ENTRY_VALUE instead of the value as at the proration period.
Any ideas?
|
|
|
Re: Proration Issues (merged) [message #689310 is a reply to message #689296] |
Fri, 17 November 2023 13:11 |
daibatzu
Messages: 36 Registered: September 2007
|
Member |
|
|
Hi everyone, I found the solution.
Now the database item for element input entry values takes the format:
ELEMENT_NAME_INPUT_VALUE_NAME_ENTRY_VALUE (this returns an array containing all element entry values for the assignment)
In fusion we also have:
ELEMENT_NAME_INPUT_VALUE_NAME_ASG_ENTRY_VALUE which will return the latest value of the entry value
Now, for an element which is prorated, we obviously do not want to use the latest value for our proration period.
This is how I solved it:
Set the following defaults:
/* During proration, pay_earn_period_start will be the proration start date
and pay_earn_period_end will be the proration end date */
DEFAULT FOR PAY_EARN_PERIOD_START IS '01-JAN-1980' (DATE)
DEFAULT FOR PAY_EARN_PERIOD_END IS '31-DEC-4712' (DATE)
/* get the database item as an array */
DEFAULT_DATA_VALUE FOR ELEMENT_NAME_INPUT_VALUE_NAME_ENTRY_VALUE IS 0
/* Next to get the value as at the proration period, we use change contexts and set the context effective date
to the proration period start date and then select array index of 1
*/
CHANGE_CONTEXTS(EFFECTIVE_DATE=PAY_EARN_PERIOD_START)
(
ELEMENT_INPUT_VALUE = ELEMENT_NAME_INPUT_VALUE_NAME_ENTRY_VALUE[1]
)
And that's it. If there are two proration periods in the month, say 1st Dec to 14 Dec, and 15 Dec to 31 Dec, the formula will be run twice and retrieve input value of element as at 1st December during the first run, and then 15 December during the second run.
|
|
|