Wednesday, December 21, 2016

Payroll Employer Costs Extract

SELECT SUM(peevf.screen_entry_value)
FROM pay_element_types_f petf
,pay_element_entry_values_f peevf
,pay_element_entries_f peef
,per_all_assignments_f paaf
,pay_input_values_f pivf
WHERE paaf.assignment_id = p_assignment_id
AND p_effective_date between paaf.effective_start_date and paaf.effective_end_date
AND peef.assignment_id = paaf.assignment_id
AND peef.effective_start_date
between trunc(p_effective_date,'YY') and p_effective_date
AND peef.effective_end_date is not null
AND peevf.element_entry_id = peef.element_entry_id
AND peevf.effective_start_date = peef.effective_start_date
AND peevf.input_value_id = pivf.input_value_id
AND pivf.name = 'Pay Value'
AND peevf.screen_entry_value IS NOT NULL
AND peevf.effective_start_date BETWEEN pivf.effective_start_date AND pivf.effective_end_date
AND petf.element_type_id = pivf.element_type_id
AND petf.element_name = 'Total Month Employer Cost'
AND pivf.effective_start_date BETWEEN petf.effective_start_date AND petf.effective_end_date;

1 comment: