SELECT per.employee_number,
per.full_name,
hro.name dept,
pg.name job,
pos.name Position,
loc.location_code,
(CASE
WHEN pec.classification_name IN ('Earnings', 'Direct Payment')
THEN
NVL (pet.reporting_name, pet.element_name)
END)
AS Earnings,
(CASE
WHEN pec.classification_name IN
('Voluntary Deductions',
'Involuntary Deductions',
'Social Insurance',
'Statutory Deductions')
THEN
NVL (pet.reporting_name, pet.element_name)
END)
AS Deductions,
NVL (prrv.result_value, 0) pay_value,
ptp.period_name
FROM pay_payroll_actions ppa,
pay_assignment_actions pac,
per_all_assignments_f ass,
per_all_people_f per,
pay_run_results prr,
pay_element_types_f pet,
pay_element_classifications pec,
pay_input_values_f piv,
pay_run_result_values prrv,
per_time_periods_v ptp,
hr_all_organization_units hro,
per_jobs_tl pg,
hr_all_positions_f_tl pos,
hr_locations_all loc
WHERE ppa.payroll_action_id = pac.payroll_action_id
AND pac.assignment_id = ass.assignment_id
AND ass.effective_end_date = TO_DATE ('12/31/4712', 'MM/DD/RRRR')
AND ass.person_id = per.person_id
AND per.effective_end_date = TO_DATE ('12/31/4712', 'MM/DD/RRRR')
AND pac.assignment_action_id = prr.assignment_action_id
AND prr.element_type_id = pet.element_type_id
AND prr.run_result_id = prrv.run_result_id
AND pet.element_type_id = piv.element_type_id
AND piv.input_value_id = prrv.input_value_id
AND ppa.time_period_id = ptp.time_period_id
AND pec.classification_id = pet.classification_id
AND ppa.action_status = 'C'
AND UPPER (piv.NAME) = 'PAY VALUE'
AND ass.organization_id = hro.organization_id
AND ass.job_id = pg.job_id(+)
AND pg.language(+) = USERENV ('LANG')
AND ass.position_id = pos.position_id(+)
AND pos.language(+) = USERENV ('LANG')
and ass.location_id=loc.location_id(+)
AND per.employee_number = &Emp_no
AND ptp.period_name=&Period_name --LIKE '12 2017 Calendar Month'
AND pec.classification_name IN
('Earnings',
'Direct Payment',
'Voluntary Deductions',
'Involuntary Deductions',
'Social Insurance',
'Statutory Deductions')
ORDER BY 1, 3, 4
per.full_name,
hro.name dept,
pg.name job,
pos.name Position,
loc.location_code,
(CASE
WHEN pec.classification_name IN ('Earnings', 'Direct Payment')
THEN
NVL (pet.reporting_name, pet.element_name)
END)
AS Earnings,
(CASE
WHEN pec.classification_name IN
('Voluntary Deductions',
'Involuntary Deductions',
'Social Insurance',
'Statutory Deductions')
THEN
NVL (pet.reporting_name, pet.element_name)
END)
AS Deductions,
NVL (prrv.result_value, 0) pay_value,
ptp.period_name
FROM pay_payroll_actions ppa,
pay_assignment_actions pac,
per_all_assignments_f ass,
per_all_people_f per,
pay_run_results prr,
pay_element_types_f pet,
pay_element_classifications pec,
pay_input_values_f piv,
pay_run_result_values prrv,
per_time_periods_v ptp,
hr_all_organization_units hro,
per_jobs_tl pg,
hr_all_positions_f_tl pos,
hr_locations_all loc
WHERE ppa.payroll_action_id = pac.payroll_action_id
AND pac.assignment_id = ass.assignment_id
AND ass.effective_end_date = TO_DATE ('12/31/4712', 'MM/DD/RRRR')
AND ass.person_id = per.person_id
AND per.effective_end_date = TO_DATE ('12/31/4712', 'MM/DD/RRRR')
AND pac.assignment_action_id = prr.assignment_action_id
AND prr.element_type_id = pet.element_type_id
AND prr.run_result_id = prrv.run_result_id
AND pet.element_type_id = piv.element_type_id
AND piv.input_value_id = prrv.input_value_id
AND ppa.time_period_id = ptp.time_period_id
AND pec.classification_id = pet.classification_id
AND ppa.action_status = 'C'
AND UPPER (piv.NAME) = 'PAY VALUE'
AND ass.organization_id = hro.organization_id
AND ass.job_id = pg.job_id(+)
AND pg.language(+) = USERENV ('LANG')
AND ass.position_id = pos.position_id(+)
AND pos.language(+) = USERENV ('LANG')
and ass.location_id=loc.location_id(+)
AND per.employee_number = &Emp_no
AND ptp.period_name=&Period_name --LIKE '12 2017 Calendar Month'
AND pec.classification_name IN
('Earnings',
'Direct Payment',
'Voluntary Deductions',
'Involuntary Deductions',
'Social Insurance',
'Statutory Deductions')
ORDER BY 1, 3, 4
No comments:
Post a Comment