Hi all,
I have a custom function in a formula that returns the previous 3 months' Taxable Earnings. When the formula is processed in a payroll run, the function works as expected and returns the correct value.
However when the formula is processed through Retropay by Element, a different value is calculated. To complicate matters further, when I process retropay using different start/end dates the value returned by the function varies.
The sql code I am using is below:
SELECT sum(TO_NUMBER(prrv.result_value))
FROM apps.pay_run_results prr,
apps.pay_run_result_values prrv,
apps.pay_assignment_actions paa,
apps.pay_payroll_actions ppa,
apps.pay_input_values_f piv,
apps.pay_element_types_f pet,
apps.pay_element_classifications pec,
apps.per_all_assignments_f asg,
apps.per_all_people_f per,
apps.pay_payrolls_f pay
WHERE prrv.run_result_id = prr.run_result_id
AND asg.assignment_id = paa.assignment_id
AND asg.business_group_id = c_business_group_id
AND pay.payroll_name = c_payroll_name
AND per.person_id = asg.person_id
AND asg.payroll_id = pay.payroll_id
AND prr.assignment_action_id = paa.assignment_action_id
AND paa.payroll_action_id = ppa.payroll_action_id
AND piv.input_value_id = prrv.input_value_id
AND piv.NAME = 'Pay Value'
AND ppa.action_type IN ('Q','R','V')
AND ppa.action_status = 'C'
AND paa.action_status = 'C'
AND nvl(paa.source_action_id,0) <> 0
AND pet.element_type_id = piv.element_type_id
AND pec.classification_id = pet.classification_id
AND TRUNC (ppa.date_earned) >= last_day(add_months(c_end_date,-3))+1
AND TRUNC (ppa.date_earned) <= c_end_date
and asg.assignment_id = c_assignment_id
and piv.input_value_id IN (
select distinct pbf.input_value_id
from pay_balance_feeds_f pbf
, pay_balance_types pbt
where pbf.balance_type_id = pbt.balance_type_id
and pbt.balance_name IN ('Taxable Pay','NIable Pay')
and c_end_date between pbf.effective_start_date and pbf.effective_end_date
)
AND ppa.date_earned BETWEEN asg.effective_start_date
AND asg.effective_end_date
AND ppa.date_earned BETWEEN per.effective_start_date
AND per.effective_end_date
AND ppa.date_earned BETWEEN pay.effective_start_date
AND pay.effective_end_date
AND ppa.date_earned BETWEEN pet.effective_start_date
AND pet.effective_end_date
AND ppa.date_earned BETWEEN piv.effective_start_date
AND piv.effective_end_date;
Has anyone come across this before, or can you see anything in the SQL code that may cause problems with Retropay?
Thanks in advance,
Jon