Element Entries – Query to fetch element entries of an employee

This BI Publisher (BIP) query fetches the list of the element entries of an employee . You can run it for one person, for one element, or for all employees and elements.

Select papf.person_number,
       paam.assignment_number,
       petf.BASE_ELEMENT_NAME,
       peef.element_entry_id,
       to_char(peef.effective_start_date,'YYYY-MM-DD') estartdate,
       to_char(peef.effective_end_date,'YYYY-MM-DD') eenddate
FROM fusion.per_all_people_f papf,
     fusion.per_all_assignments_m paam,
     fusion.pay_element_entries_f peef,
     fusion.pay_element_types_f petf
WHERE 1 = 1
  AND paam.person_id = papf.person_id
  AND paam.assignment_type = 'E'
  AND paam.primary_assignment_flag = 'Y'
  AND peef.element_type_id = petf.element_type_id
  AND peef.person_id = paam.person_id
  AND petf.base_element_name = nvl(:P_ELEMENT_BASE_NAME, petf.base_element_name)
  AND TRUNC(SYSDATE) BETWEEN petf.effective_start_date AND petf.effective_end_date
  AND TRUNC(SYSDATE) BETWEEN paam.effective_start_date AND paam.effective_end_date
  AND TRUNC(SYSDATE) BETWEEN papf.effective_start_date AND papf.effective_end_date
  AND TRUNC(SYSDATE) BETWEEN peef.effective_start_date AND peef.effective_end_date
  AND papf.person_number = nvl(:P_PERSON_NUMBER, papf.person_number);

Parameters

ParameterDescription
P_ELEMENT_BASE_NAMEBase name of the payroll element. Leave it NULL to fetch all elements.
P_PERSON_NUMBERPerson number. Leave it NULL to fetch all employees.

Leave a Comment