Below is the Fusion OTL Sample SQL,
Shift Premium used in the SQL is the Custom Attribute. Use Custom Attributes based on your requirements.
SQL Text:
select papf.person_number Employee_Number
,ppnf.full_name Employee_Name
,(select distinct ppnf_mgr.full_name
from per_assignment_supervisors_f pasf
,per_person_names_f ppnf_mgr
where 1 = 1
and pasf.assignment_id = paam.assignment_id
and pasf.manager_type = 'LINE_MANAGER'
and pasf.primary_flag = 'Y'
and ppnf_mgr.person_id = pasf.manager_id
and ppnf_mgr.name_type = 'GLOBAL'
and sysdate between pasf.effective_start_date and pasf.effective_end_date
and sysdate between ppnf_mgr.effective_start_date and ppnf_mgr.effective_end_date) supervisor_name
,(select dept.name
from hr_organization_v dept
where 1 = 1
and sysdate between effective_start_date
and effective_end_date
and dept.organization_id = paam.organization_id
and rownum = 1) Department
,to_char(rec.start_time,'FmDay, Month dd','nls_date_language = English') Day
,to_char(rec.start_time,'hh:mi am') In_Time
,to_char(rec.stop_time,'hh:mi am') Out_Time
,round(rec.measure,2) Quantity
,(select attribute_varchar6
from hwm_ext_attrb_detail_v attrb1
where 1 = 1
and attrb1.usages_source_id = rec.tm_rec_id
and attrb1.usages_source_version = rec.tm_rec_version
and attribute_category = 'ORA_CUSTOM'
and rownum = 1) Shift_Premium
from per_all_people_f papf
,per_all_assignments_m paam
,per_person_names_f ppnf
,hwm_tm_rec rec
,hwm_tm_rec_grp trg
,hwm_tm_rec_grp trd
,hwm_tm_rec_grp_usages usg
,Hwm_Tm_Rep_Atrb_Usages atrbusg
,hwm_tm_rep_atrbs atrbs
,hwm_tm_atrb_flds_vl flds
,hwm_tm_approved_ts_v status
where 1 = 1
and sysdate between papf.effective_start_date and papf.effective_end_date
and sysdate between paam.effective_start_date and paam.effective_end_date
and sysdate between ppnf.effective_start_date and ppnf.effective_end_date
and status.approved_timestamp between trg.date_from and trg.date_to
and status.approved_timestamp between trd.date_from and trd.date_to
and status.approved_timestamp between rec.date_from and rec.date_to
and paam.person_id = papf.person_id
and ppnf.person_id = papf.person_id
and rec.resource_id = papf.person_id
and usg.tm_rec_id = rec.orig_tm_rec_id
and usg.tm_rec_version = rec.orig_tm_rec_version
and trd.tm_rec_grp_id = usg.tm_rec_grp_id
and trd.tm_rec_grp_version = usg.tm_rec_grp_version
and trg.tm_rec_grp_id = trd.parent_tm_rec_grp_id
and trg.tm_rec_grp_version = trd.parent_tm_rec_grp_version
and status.tm_bldg_blk_id = trg.tm_rec_grp_id
and status.tm_bldg_blk_version = trg.tm_rec_grp_version
and atrbusg.usages_source_id = rec.tm_rec_id
and atrbusg.usages_source_version = rec.tm_rec_version
and trbusg.tm_rep_atrb_id = atrbs.tm_rep_atrb_id
and flds.tm_atrb_fld_id = atrbs.master_attribute_id
and paam.assignment_type = 'E'
and paam.effective_latest_change = 'Y'
and paam.primary_flag = 'Y'
and paam.assignment_status_type = 'ACTIVE'
-- and paam.legislation_code = 'IN'
and ppnf.name_type = 'GLOBAL'
and rec.delete_flag is null
and rec.orig_tm_rec_id is not null
and trd.delete_flag is null
and trg.delete_flag is null
and flds.name = 'PayrollTimeType'
and rec.start_time >= :p_date_from
and rec.stop_time <= :p_date_to
Comments
Post a Comment