Query to get W4(Internal Revenue Service (IRS) tax form) in fusion HCM
SELECT distinct papf.person_number PERSON_NUMBER,
(select full_name from per_person_names_f ppnf
where ppnf.person_id = papf.person_id
and name_type = 'GLOBAL'
and trunc(sysdate) between ppnf.effective_start_date and ppnf.effective_end_date) person_name,
ple.name LEGAL_EMPLOYE,
'W4 Change' ACTION_NAME,
(select hl.meaning from hr_lookups hl
where hl.lookup_type = 'HRX_US_FEDERAL_FILING_STATUS'
AND hl.lookup_code = ri_old.value1) as OLD_DATA,
(select hl.meaning from hr_lookups hl
where hl.lookup_type = 'HRX_US_FEDERAL_FILING_STATUS'
AND hl.lookup_code = ri.value1) as NEW_DATA
,TO_CHAR(ri.effective_start_date, 'MM/DD/YYYY') EFFECTIVE_DATE
,TO_CHAR(ri.creation_date, 'MM/DD/YYYY') CHANGED_DATE
,ri.LAST_UPDATED_BY CHANGED_BY
FROM fusion.Pay_Value_Definitions_Vl Vd
,fusion.Pay_Value_Definitions_Vl Vdc
,fusion.PAY_RANGE_ITEMS_F RI
,fusion.PAY_RANGE_ITEMS_F RI_OLD
,fusion.pay_dir_Cards_f dc
,Fusion.Pay_Dir_Card_Components_F Dcc
,fusion.pay_dir_card_definitions_vl dcd
,fusion.PER_ALL_PEOPLE_F papf
,fusion.PER_ALL_ASSIGNMENTS_M PAAM
,fusion.PAY_PAY_RELATIONSHIPS_DN pprd
,fusion.per_legal_employers ple
WHERE 1 = 1
AND PAPF.PERSON_ID = PPRD.PERSON_ID
AND PAPF.PERSON_ID = PAAM.PERSON_ID
AND PAAM.ASSIGNMENT_TYPE = 'E'
AND PAAM.PRIMARY_FLAG = 'Y'
and paam.assignment_status_type = 'ACTIVE'
AND paam.legal_entity_id=ple.organization_id
AND paam.legislation_code='US'
AND Vd.Legislation_Code = 'US'
AND Dcd.Dir_Card_Definition_Id = Dc.Dir_Card_Definition_Id
AND Dcd.Legislation_Code = 'US'
AND Vd.Value_Defn_Id = Vdc.Parent_Value_Defn_Id
AND Vdc.Value_Defn_Id = Ri.Value_Defn_Id
AND Vdc.Value_Defn_Id = RI_OLD.Value_Defn_Id
AND ri.source_id = dcc.dir_card_comp_id
AND RI_OLD.source_id = dcc.dir_card_comp_id
AND dcc.dir_card_id = dc.dir_card_id
AND ri.effective_start_date= ri_old.effective_end_date+1
AND ri.source_id= ri_old.source_id
AND ri.effective_start_date between :P_FROM_DATE and :P_TO_DATE
and nvl(ri.value1, 'x') <>
nvl(ri_old.value1, 'x')
AND trunc(sysdate) between paam.effective_start_date and paam.effective_end_date
AND trunc(SYSDATE) BETWEEN Dcc.Effective_Start_Date AND
Dcc.Effective_End_Date
AND trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
AND dc.PAYROLL_RELATIONSHIP_ID = PPRD.PAYROLL_RELATIONSHIP_ID
AND vdc.BASE_NAME = 'ORA_HRX_US_FF_FIT_FEDERAL_FILING_STATUS'
Comments
Post a Comment