select ptp.period_name,
to_char(ptp.start_date, 'DD-MON-RRRR') start_date,
to_char(ptp.end_date, 'DD-MON-RRRR') end_date,
pay.payroll_name,
et.element_name,
per.employee_number,
per.last_name,
per.first_name,
to_number(prv.result_value)
from per_time_periods ptp,
pay_payrolls_f pay,
pay_payroll_actions ppa,
pay_assignment_actions pac,
pay_element_types_f et,
pay_run_results prr,
pay_run_result_values prv,
pay_input_values_f piv ,
per_assignments_f ass,
per_people_x per
where pay.payroll_name = NVL(:p_payroll_name ,pay.payroll_name)
and pay.payroll_id = ptp.payroll_id
and ptp.period_name = :p_period_name
and ptp.payroll_id = ppa.payroll_id
and ppa.action_type in ( 'R', 'Q')
and ppa.date_earned between ptp.start_date and ptp.end_date
and ppa.payroll_action_id = pac.payroll_action_id
and pac.assignment_action_id = prr.assignment_action_id
and ass.assignment_id = pac.assignment_id
and ptp.end_date between ass.effective_start_date and ass.effective_end_date
and et.element_name = :p_element_name
and ptp.start_date between et.effective_start_date and et.effective_end_date
and piv.element_type_id = et.element_type_id
and piv.name = 'Pay Value'
and prv.input_value_id = piv.input_value_id
and ptp.start_date between piv.effective_start_date and piv.effective_end_date
and prv.run_result_id = prr.run_result_id
and prr.element_type_id = et.element_type_id
and per.person_id = ass.person_id
No comments:
Post a Comment