Saturday, 27 November 2021

SQL:Employee Default Expense Account

 select papf.person_number "Employee Number",
   ppnf.display_name "Employee Name",
   gl.segment1 "Company", -- Description could be different for you
   gl.segment2 "Department", -- Description could be different for you,
   gl.segment3 "Account", -- Description could be different for you,
   gl.segment4 "Intercompany", -- Description could be different for you,
   gl.segment5 "Product", -- Description could be different for you,
   gl.segment1||'.'||gl.segment2||'.'||gl.segment3||'.'||gl.segment4||'.'||gl.segment5 "Default Expense Account" -- You can add more segments also
from per_all_people_f papf,
per_all_assignments_m paam,
per_person_names_f  ppnf,
gl_code_combinations gl              
where 1 = 1
and papf.person_id = paam.person_id
and paam.default_code_comb_id = gl.code_combination_id (+) 
and papf.person_id = ppnf.person_id
and ppnf.name_type = 'GLOBAL' 
and paam.assignment_type = 'E'
and trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
and trunc(sysdate) between ppnf.effective_start_date and ppnf.effective_end_date
and trunc(sysdate) between paam.effective_start_date and paam.effective_end_date
Order by papf.person_number

No comments:

Post a Comment