SELECT
papf.person_number,
aapft.name,
(
SELECT
a.end_bal
FROM
anc_per_accrual_entries a,
anc_per_plan_enrollment b
WHERE
a.per_plan_enrt_id = b.per_plan_enrt_id
AND a.accrual_period = b.last_accrual_run
AND b.work_term_asg_id = paaf.work_terms_assignment_id
AND b.plan_id = appe.plan_id
AND b.person_id = paaf.person_id
AND trunc(sysdate) BETWEEN b.enrt_st_dt AND b.enrt_end_dt
) accrual_balance
FROM
per_all_assignments_m paaf,
per_all_people_f papf,
anc_per_plan_enrollment appe,
anc_absence_plans_f_tl aapft
WHERE
paaf.person_id = papf.person_id
AND appe.person_id = papf.person_id
AND aapft.absence_plan_id = appe.plan_id
AND aapft.language = 'US'
AND aapft.name = 'Holiday - Days'
AND trunc(sysdate) BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND trunc(sysdate) BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND trunc(sysdate) BETWEEN aapft.effective_start_date AND aapft.effective_end_date
AND papf.person_number = '11111'
AND paaf.primary_flag = 'Y'
AND paaf.assignment_type = 'E'
papf.person_number,
aapft.name,
(
SELECT
a.end_bal
FROM
anc_per_accrual_entries a,
anc_per_plan_enrollment b
WHERE
a.per_plan_enrt_id = b.per_plan_enrt_id
AND a.accrual_period = b.last_accrual_run
AND b.work_term_asg_id = paaf.work_terms_assignment_id
AND b.plan_id = appe.plan_id
AND b.person_id = paaf.person_id
AND trunc(sysdate) BETWEEN b.enrt_st_dt AND b.enrt_end_dt
) accrual_balance
FROM
per_all_assignments_m paaf,
per_all_people_f papf,
anc_per_plan_enrollment appe,
anc_absence_plans_f_tl aapft
WHERE
paaf.person_id = papf.person_id
AND appe.person_id = papf.person_id
AND aapft.absence_plan_id = appe.plan_id
AND aapft.language = 'US'
AND aapft.name = 'Holiday - Days'
AND trunc(sysdate) BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND trunc(sysdate) BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND trunc(sysdate) BETWEEN aapft.effective_start_date AND aapft.effective_end_date
AND papf.person_number = '11111'
AND paaf.primary_flag = 'Y'
AND paaf.assignment_type = 'E'
No comments:
Post a Comment