Employee Master DM
Employee Master DM
PERSON_NUMBER
,pp.attribute1 as SAGE_EMP_CODE
,rpad(pni.national_identifier_number,20) as ID_NUMBER
,ppass.passport_number as PASSPORT_NUMBER
,per_extract_utility.get_decoded_lookup('PER_ETHNICITY', pe.ethnicity) as
ETHNICITY
,nvl(pplf.per_information1, pplf.attribute4) as FOREIGN_NATIONAL
----- ,pplf.attribute4 as FOREIGN_NATIONAL_MZ
,rpad(pplf.attribute1,20) as INCOME_TAX
,per_extract_utility.get_decoded_lookup('PER_HIGHEST_EDUCATION_LEVEL',pplf.hi
ghest_education_level) as HIGHEST_EDUCATION_LEVEL
,per_extract_utility.get_decoded_lookup('DISABILITY_CATEGORY', pdf.category)
as DISABLITY
,pdf.accommodation_request as DISABLITY_ACCOMMODATION_REQUEST
,pdf.effective_start_date as DISABLITY_START_DATE
,per_extract_utility.get_decoded_lookup('TITLE', ppnf.title) as TITLE
,ppnf.first_name
,ppnf.middle_names
,ppnf.last_name
,ppnf.previous_last_name as MAIDEN_NAME
,ppnf.known_as
,ppnf.nam_information1 as INITIALS
----- ,ppnf.nam_information15 as MZ_INITIALS
,hr_general.decode_lookup('SEX', pplf.sex) as GENDER
,per_extract_utility.get_decoded_lookup('MAR_STATUS', pplf.marital_status) as
MARITAL_STATUS
,hr_general.decode_lookup('NATIONALITY', pc.legislation_code) as CITZENSHIP
,pp.date_of_birth as DATE_OF_BIRTH
,(select pea.email_address
from per_email_addresses pea
where 1=1
and :p_date between nvl(pea.date_from, :p_date) and
nvl(pea.date_to, :p_date)
and pea.email_type = 'W1'
---and papf.primary_email_id = pea.email_address_id
and pea.person_id = papf.person_id
and rownum=1) as WORK_EMAIL
,(select pea.email_address
from per_email_addresses pea
where 1=1
and :p_date between nvl(pea.date_from, :p_date) and
nvl(pea.date_to, :p_date)
and pea.email_type = 'H1'
---and papf.primary_email_id = pea.email_address_id
and pea.person_id = papf.person_id
and rownum=1) as PRIVATE_EMAIL
,(select listagg(rpad(pphone.phone_number,20), ',') within group (order by
pphone.person_id)
from per_phones pphone
where 1=1
and (pphone.date_to is null or :p_date between pphone.date_from and
pphone.date_to)
and pphone.phone_type in ('WM','W1')
and pphone.person_id = papf.person_id
and rownum=1) as WORK_PHONE_NUMBER
,(select listagg(rpad(pphone.phone_number,20), ',') within group (order by
pphone.person_id)
from per_phones pphone
where 1=1
and (pphone.date_to is null or :p_date between pphone.date_from and
pphone.date_to)
and pphone.phone_type in ('HM','H1')
and pphone.person_id = papf.person_id
and rownum=1) as PRIVATE_PHONE_NUMBER
,ppav.address_line_3 as HOME_ADDRESS_UNIT_NUMBER
,ppav.address_line_2 as HOME_ADDRESS_COMPLEX_NAME
,ppav.address_line_1 as HOME_ADDRESS_STREET_NUMBER
,ppav.address_line_4 as HOME_ADDRESS_NAME_STREET
,ppav.addl_address_attribute1 as HOME_ADDRESS_SUBURB_DISTRICT
,ppav.town_or_city as HOME_ADDRESS_CITY_TOWN
,to_char(ppav.postal_code, '0999') as HOME_ADDRESS_POSTAL_CODE
,ppav.region_3 as HOME_ADDRESS_PROVINCE
,(select geography_name
from hz_geographies hg
where 1=1
and (hg.end_date is null or hg.end_date > sysdate)
and hg.geography_type = 'COUNTRY'
and hg.geography_code = ppav.country
and rownum=1) as HOME_ADDRESS_COUNTRY
,ple.name as LEGAL_EMPLOYER
,pplf.attribute2 as MZ_NUIT
,pptt.user_person_type as WORKER_TYPE
,ppos.date_start as HIRE_DATE
,psdf.seniority_date as ENTERPRISE_SENIORITY_DATE
,ppos.actual_termination_date as TERMINATION_DATE
,(select pav.action_name
from per_actions_vl pav
,per_action_occurrences pao
where 1=1
and pav.action_id = pao.action_id
and ppos.actual_termination_date is not null
and pav.action_name not in ('Global Transfer')
and pao.action_occurrence_id = ppos.action_occurrence_id) as
TERMINATION_ACTION
,(select partl.action_reason
from per_action_reasons_b parb
,per_action_reasons_tl partl
,per_action_occurrences pao
where 1=1
and pao.action_reason_id = parb.action_reason_id
and partl.action_reason_id = parb.action_reason_id
and partl.language = userenv('LANG')
and ppos.actual_termination_date is not null
and partl.action_reason not in ('Promotion','Transfer')
and pao.action_occurrence_id = ppos.action_occurrence_id) as
TERMINATION_REASON
,patl.action_name as ASSIGNMENT_ACTION
,part.action_reason as ASSIGNMENT_ACTION_REASON
,paam.effective_start_date as ASSIGNMENT_START_DATE
,paam.effective_end_date as ASSIGNMENT_END_DATE
,per_extract_utility.get_decoded_lookup('CONTRACT_TYPE', pcf.type) as
CONTRACT_TYPE
,pcf.contract_end_date as CONTRACT_END_DATE
,paam.ASSIGNMENT_NUMBER
,pastt.user_status as ASSIGNMENT_STATUS
,bhaou.name as BUSINESS_UNIT
---- ,pjf.job_code as JOB_CODE
,pjft.name JOB_TITLE
,hr_general.decode_lookup('MANAGER_LEVEL', pjf.manager_level) as
MANAGEMENT_LEVEL
,hr_general.decode_lookup('JOB_FUNCTION_CODE', pjf.job_function_code) as
JOB_FUNCTION
,hr_general.decode_lookup('HWB_OCC_LEVEL', pjf.attribute1) as
OCCUPATIONAL_LEVEL
,hr_general.decode_lookup('HWB_OCC_CAT', pjf.attribute2) as
OCCUPATIONAL_CATEGORY
,per_extract_utility.get_decoded_lookup('HWB_OFO_CODE', pjf.attribute3) as
OFO_CODE
,per_extract_utility.get_decoded_lookup('HWB_OFO_SPEC_CODE', pjf.attribute4)
as OFO_SPECIALIZATION_CODE
,dhaou.attribute3 as EMP_DEPARTMENT_NAME_CODE
,dhaou.name as EMP_DEPARTMENT_NAME
---- ,dhaou.attribute4 as EMP_DEPARTMENT_TITLE_CODE
,dhouft.title as EMP_DEPARTMENT_TITLE
---- ,hla.internal_location_code as EMP_LOCATION_CODE
,hla.location_name as EMP_LOCATION_NAME
,per_extract_utility.get_decoded_lookup('HWB_SUP_DEPARTMENT',
paam.ass_attribute2) as EMP_SUB_DEPARTMENT
,per_extract_utility.get_decoded_lookup('HWB_GEOGR_LOC', dhaou.attribute1) as
EMP_GEOGRAPICAL_REGION
,per_extract_utility.get_decoded_lookup('HWB_ORG_BUSINESS_UNIT',
paam.ass_attribute4) as EMP_HWB_BUSINESS_UNIT
,per_extract_utility.get_decoded_lookup('HWB_ORG_HR_FUNCT',paam.ass_attribute
1) as EMP_HR_FUNCTION
---- ,(select fcl.lookup_code
---- from fnd_common_lookups fcl
---- where 1=1
---- and fcl.lookup_type = 'HWB_BRANCH_AS_BU'
---- and fcl.meaning = bhaou.name
---- and rownum=1) as EMP_BRANCH_CODE
,decode(paam.work_at_home,'N','No','Y','Yes', paam.work_at_home) as
WORK_AT_HOME
,per_extract_utility.get_decoded_lookup('EMPLOYEE_CATG',
paam.employee_category) as WORKER_CATEGORY
,per_extract_utility.get_decoded_lookup('EMP_CAT', paam.employment_category)
as PORTFOLIO_APPROVER
,per_extract_utility.get_decoded_lookup('HWB_HRPORTFOLIO_ACCESS',paam.ass_att
ribute6) as PORTFOLIO_ACCESS
,per_extract_utility.get_decoded_lookup('HWB_EARNING_ACCESS',
paam.ass_attribute5) as EARNING_ACCESS
---- ,per_extract_utility.get_decoded_lookup('HOURLY_SALARIED_CODE',
paam.hourly_salaried_code) as EMP_PAYTYPE
,paam.normal_hours as NORMAL_WORKING_HOURS
,hr_general.decode_lookup('FREQUENCY', paam.frequency) as
WORKING_HOURS_FREQUENCY
,per_extract_utility.get_decoded_lookup('ORA_HRX_ZA_NATURE_OF_PERSON',
paam.asg_information1) as NATURE_PERSON
,lmpapf.person_number as LINE_MANAGER_PERSON_NUMBER
,lmppnf.display_name as LINE_MANAGER_NAME
,smpapf.person_number as SALARY_MANAGER_PERSON_NUMBER
,smppnf.display_name as SALARY_MANAGER_NAME
,hmpapf.person_number as HOURS_MANAGER_PERSON_NUMBER
,hmppnf.display_name as HOURS_MANAGER_NAME
,paam.probation_period ||' '||
decode(paam.probation_unit,'D','Days','M','Months','W','Weeks','H','Hours','Y','Yea
rs') as PROBATION_PERIOD
,paam.date_probation_end AS DATE_PROBATION_END
,paam.notice_period ||' '||
decode(paam.notice_period_uom,'D','Days','M','Months','W','Weeks','H','Hours','Y','
Years') as NOTICE_PERIOD
,paam.retirement_age as RETIREMENT_AGE
,paam.retirement_date as RETIREMENT_DATE
,null as SALARY_BASIS_NAME
,null as SALARY
,null as SALARY_START_DATE
,null as SALARY_END_DATE
,null as WORKER_PAYROLL_NAME
,null as PAYROLL_START_DATE
,null as PAYROLL_END_DATE
,to_char(:p_date,'YYYY') - to_char(psdf.seniority_date,'YYYY') as
YEARS_SERVICE
,case when to_char(psdf.seniority_date,'DD') < 15 then
trunc(months_between(:p_date, psdf.seniority_date))
else round(months_between(:p_date, psdf.seniority_date))
end as MONTHS_SERVICE
,(select distinct div.name
from fnd_tree_vl ftvl
,fnd_tree_version_tl ftvt
,per_org_tree_node_rf potnc
,hr_all_organization_units dept
,hr_all_organization_units div
where 1=1
and trunc(sysdate) between dept.effective_start_date and
dept.effective_end_date
and trunc(sysdate) between div.effective_start_date and
div.effective_end_date
and ftvl.tree_code = ftvt.tree_code
and ftvt.language = 'US'
and ftvl.tree_structure_code = 'PER_ORG_TREE_STRUCTURE'
and ftvl.tree_name = 'HOLLYWOODBETS GROUP'
and ftvt.tree_version_name = 'Hollywoodbets Group Feb 2024'
and ftvl.tree_code = potnc.tree_code
and potnc.tree_structure_code = 'PER_ORG_TREE_STRUCTURE'
and ftvl.tree_code = potnc.tree_code
and potnc.distance = 2
and potnc.pk1_value = dept.organization_id
and potnc.ancestor_pk1_value = div.organization_id
and dept.organization_id = paam.organization_id) as DIVISION
from per_person_secured_list_v papf
,per_person_names_f ppnf
,per_all_assignments_m paam
,per_periods_of_service ppos
,per_persons pp
,per_seniority_dates_f psdf
,per_national_identifiers pni
,per_ethnicities pe
,per_legal_employers ple
,per_people_legislative_f pplf
,per_person_types_tl pptt
,per_assignment_status_types_tl pastt
,per_contracts_f pcf
,hr_all_organization_units bhaou
,hr_org_unit_classifications_f bhoucf
,hr_all_organization_units dhaou
,hr_organization_units_f_tl dhouft
,hr_org_unit_classifications_f dhoucf
,hr_locations_all hla
,per_jobs_f pjf
,per_jobs_f_tl pjft
,per_person_addresses_v ppav
,per_passports ppass
,per_disabilities_f pdf
,per_citizenships pc
,per_actions_b pab
,per_actions_tl patl
,per_action_reasons_tl part
,per_action_reasons_b parb
,per_assignment_supervisors_f lmpasf
,per_all_people_f lmpapf
,per_all_assignments_m lmpaam
,per_person_names_f lmppnf
,per_assignment_supervisors_f smpasf
,per_all_people_f smpapf
,per_all_assignments_m smpaam
,per_person_names_f smppnf
,per_assignment_supervisors_f hmpasf
,per_all_people_f hmpapf
,per_all_assignments_m hmpaam
,per_person_names_f hmppnf
where 1=1
and :p_date between papf.effective_start_date and papf.effective_end_date
and :p_date between ppnf.effective_start_date and ppnf.effective_end_date
and :p_date between paam.effective_start_date and paam.effective_end_date
and :p_date between psdf.effective_start_date(+) and psdf.effective_end_date(+)
and :p_date between ple.effective_start_date(+) and ple.effective_end_date(+)
and :p_date between pplf.effective_start_date(+) and pplf.effective_end_date(+)
and :p_date between bhaou.effective_start_date(+) and bhaou.effective_end_date(+)
and :p_date between bhoucf.effective_start_date(+) and bhoucf.effective_end_date(+)