In this article, we will try to fetch the Payslip and W-2 form delivery preferences setup by Users.
select
distinct doc_type.document_type,
papf.person_number,
pref.online_enabled,
pref.paper_enabled,
pref.email_enabled
from
HR_DOCUMENT_DELIVERY_PREFS pref,
HR_DOCUMENT_TYPES_TL doc_type,
per_all_people_f papf
where
pref.document_type_id = doc_type.document_type_id
and papf.person_id = pref.person_id
and doc_type.language = 'US'
and trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
Sample data will look like: