Sunday 2 October 2016

Query To Get Absence Entitlements For All Employees

This query will give Absence entitlements for active all employees
I used CUST_GET_NET_ENTITLEMENT function from this blog


select 
papf.employee_number,
CUST_GET_NET_ENTITLEMENT(papf.person_id,61,'31-Dec-2016') as Annual_Leave_Entitlement from PER_PERSON_TYPE_USAGES_F pptu,per_person_types ppt,per_all_people_f papf 
where 1=1

and
ppt.person_type_id = pptu.person_type_id
and
papf.person_id = pptu.person_id
and
ppt.USER_PERSON_TYPE = 'Employee'
and
sysdate between pptu.effective_start_date 
    and pptu.effective_end_date
and
sysdate between papf.effective_start_date 
    and papf.effective_end_date

No comments:

Post a Comment