SELECT INITCAP(ppf.last_name
||','
||ppf.first_name) name,
ety.element_name,
to_number(rrv.result_value) commission
FROM per_all_people_f ppf,
apps.per_assignments_f paf,
apps.pay_assignment_actions pas,
apps.pay_payroll_actions ppa,
apps.pay_run_results rr,
apps.pay_run_result_values rrv,
apps.pay_element_types_f ety,
apps.pay_input_values_f I
WHERE ppf.person_id = paf.person_id
AND paf.assignment_id = pas.assignment_id
AND pas.assignment_action_id = rr.assignment_action_id
AND ppa.payroll_action_id = pas.payroll_action_id
AND rr.element_type_id = ety.element_type_id
AND i.element_type_id = ety.element_type_id
AND rrv.run_result_id = rr.run_result_id
AND rrv.input_value_id = i.input_value_id
AND sysdate BETWEEN ppf.effective_start_date AND ppf.effective_end_date
AND sysdate BETWEEN paf.effective_start_date AND paf.effective_end_date
AND sysdate BETWEEN ety.effective_start_date AND ety.effective_end_date
AND sysdate BETWEEN I.effective_start_date AND I.effective_end_date
AND i.name = 'Pay Value'
AND ety.element_name = 'Salary' ;
||','
||ppf.first_name) name,
ety.element_name,
to_number(rrv.result_value) commission
FROM per_all_people_f ppf,
apps.per_assignments_f paf,
apps.pay_assignment_actions pas,
apps.pay_payroll_actions ppa,
apps.pay_run_results rr,
apps.pay_run_result_values rrv,
apps.pay_element_types_f ety,
apps.pay_input_values_f I
WHERE ppf.person_id = paf.person_id
AND paf.assignment_id = pas.assignment_id
AND pas.assignment_action_id = rr.assignment_action_id
AND ppa.payroll_action_id = pas.payroll_action_id
AND rr.element_type_id = ety.element_type_id
AND i.element_type_id = ety.element_type_id
AND rrv.run_result_id = rr.run_result_id
AND rrv.input_value_id = i.input_value_id
AND sysdate BETWEEN ppf.effective_start_date AND ppf.effective_end_date
AND sysdate BETWEEN paf.effective_start_date AND paf.effective_end_date
AND sysdate BETWEEN ety.effective_start_date AND ety.effective_end_date
AND sysdate BETWEEN I.effective_start_date AND I.effective_end_date
AND i.name = 'Pay Value'
AND ety.element_name = 'Salary' ;