SELECT PersonNamePEO.FULL_NAME "Full Name",
PersonDetailsPEO.person_number "Person Number",
PPNF_MGR.full_name "Supervisor Full Name",
TO_CHAR(PeriodOfServicePEO.ACTUAL_TERMINATION_DATE,'MM-DD-YYYY') "Actual Termination Date",
JobTranslationPEO.name "Job Name",
TO_CHAR(PersonPEO.start_date,'MM-DD-YYYY') "Date of Hire",
HrLocation.location_code "Location Name",
OrganizationUnitTranslationPEO.name "Organization Name",
(
SELECT TO_CHAR(MAX(perpos.date_start),'MM-DD-YYYY')
FROM per_periods_of_service perpos,
per_all_assignments_m perpaam
WHERE perpos.person_id =PersonDetailsPEO.person_id
AND perpaam.period_of_service_id=perpos.period_of_service_id
AND perpaam.person_id =perpos.person_id
AND perpaam.ACTION_CODE IN('REHIRE','HIRE')
AND perpaam.effective_end_date <=PeriodOfServicePEO.ACTUAL_TERMINATION_DATE
) "Latest Date of Hire",
TO_CHAR(PeriodOfServicePEO.original_date_of_hire,'MM-DD-YYYY') "ORIGINAL_DATE_OF_HIRE",
PeriodOfServicePEO.last_updated_by "Terminated By",
TO_CHAR(PeriodOfServicePEO.last_update_date,'MM-DD-YYYY') "Termination Last Update Date",
AssignmentPEO.assignment_number "Assignment Number",
TO_CHAR(AssignmentPEO.effective_start_date,'MM-DD-YYYY') "Effective Start Date",
TO_CHAR(AssignmentPEO.effective_end_date,'MM-DD-YYYY') "Effective End Date",
PEA.EMAIL_ADDRESS,
NVL(PART.ACTION_REASON,'No Reason') "Leaving Reason",
NationalIdentifierPEO.NATIONAL_IDENTIFIER_NUMBER "Social Security Number"
FROM PER_PERSONS PersonPEO,
PER_ALL_PEOPLE_F PersonDetailsPEO,
PER_PERSON_NAMES_F_V PersonNamePEO,
PER_ALL_ASSIGNMENTS_M AssignmentPEO,
PER_PERSON_TYPES_TL PersonTypesTranslationPEO,
PER_PERIODS_OF_SERVICE PeriodOfServicePEO,
PER_NATIONAL_IDENTIFIERS NationalIdentifierPEO,
HR_ORGANIZATION_UNITS_F_TL OrganizationUnitTranslationPEO,
PER_JOBS_F_TL JobTranslationPEO,
hr_locations_all HrLocation,
PER_ACTION_REASONS_B PARB,
PER_ACTION_REASONS_TL PART,
per_assignment_supervisors_f PASF,
per_person_names_f PPNF_MGR,
PER_EMAIL_ADDRESSES PEA,
PER_ACTIONS_B ActionsPEO,
HR_ORGANIZATION_UNITS_F_TL GRETranslationPEO,
HR_ORGANIZATION_UNITS_F_TL BUTranslationPEO,
hr_all_positions_f_tl PosiTL,
PER_PERSON_SECURED_LIST_V PPSLV
WHERE PersonPEO.PERSON_ID = PersonDetailsPEO.PERSON_ID
AND PersonPEO.PERSON_ID = PersonNamePEO.PERSON_ID
AND PersonPEO.PERSON_ID = AssignmentPEO.PERSON_ID
AND AssignmentPEO.PERSON_TYPE_ID = PersonTypesTranslationPEO.PERSON_TYPE_ID(+)
AND (USERENV('LANG')) = PersonTypesTranslationPEO.LANGUAGE
AND AssignmentPEO.PERIOD_OF_SERVICE_ID = PeriodOfServicePEO.PERIOD_OF_SERVICE_ID(+)
AND AssignmentPEO.PERSON_ID = PeriodOfServicePEO.PERSON_ID(+)
AND PersonDetailsPEO.PERSON_ID = NationalIdentifierPEO.PERSON_ID(+)
AND PersonDetailsPEO.PRIMARY_NID_ID = NationalIdentifierPEO.NATIONAL_IDENTIFIER_ID(+)
AND ( (AssignmentPEO.EFFECTIVE_LATEST_CHANGE = 'Y' ) )
AND ( (AssignmentPEO.ASSIGNMENT_TYPE IN ('E','C' ,'N','P') ))
AND AssignmentPEO.organization_id = OrganizationUnitTranslationPEO.ORGANIZATION_ID(+)
AND (USERENV('LANG')) = OrganizationUnitTranslationPEO.LANGUAGE(+)
AND AssignmentPEO.JOB_ID = JobTranslationPEO.JOB_ID(+)
AND (USERENV('LANG')) = JobTranslationPEO.LANGUAGE(+)
AND HrLocation.location_id(+) =AssignmentPEO.location_id
AND ( sysdate BETWEEN PersonDetailsPEO.EFFECTIVE_START_DATE AND PersonDetailsPEO.EFFECTIVE_END_DATE)
AND ( sysdate BETWEEN PersonNamePEO.EFFECTIVE_START_DATE AND PersonNamePEO.EFFECTIVE_END_DATE)
AND ( sysdate BETWEEN AssignmentPEO.EFFECTIVE_START_DATE AND AssignmentPEO.EFFECTIVE_END_DATE)
AND ( sysdate BETWEEN OrganizationUnitTranslationPEO.EFFECTIVE_START_DATE(+) AND OrganizationUnitTranslationPEO.EFFECTIVE_END_DATE(+))
AND ( sysdate BETWEEN JobTranslationPEO.EFFECTIVE_START_DATE(+) AND JobTranslationPEO.EFFECTIVE_END_DATE(+))
AND PARB.ACTION_REASON_ID = PART.ACTION_REASON_ID(+)
AND AssignmentPEO.REASON_CODE = PARB.ACTION_REASON_CODE(+)
AND PART.language(+) ='US'
AND PeriodOfServicePEO.person_id = PASF.person_id(+)
AND PeriodOfServicePEO.ACTUAL_TERMINATION_DATE BETWEEN PASF.effective_start_date(+) AND PASF.effective_end_date(+)
AND PASF.manager_type(+) = 'LINE_MANAGER'
AND PASF.manager_id = PPNF_MGR.person_id(+)
AND TRUNC(SYSDATE) BETWEEN TRUNC(PPNF_MGR.effective_start_date(+)) AND TRUNC(PPNF_MGR.effective_end_date(+))
AND PPNF_MGR.name_type(+) = 'GLOBAL'
AND PersonDetailsPEO.primary_email_id = PEA.email_address_id(+)
AND AssignmentPEO.ACTION_CODE = ActionsPEO.ACTION_CODE(+)
AND AssignmentPEO.BUSINESS_GROUP_ID =ActionsPEO.BUSINESS_GROUP_ID(+)
AND ActionsPEO.ACTION_TYPE_CODE = 'EMPL_TERMINATE'
AND AssignmentPEO.legal_entity_id =GRETranslationPEO.ORGANIZATION_ID(+)
AND ( sysdate BETWEEN GRETranslationPEO.EFFECTIVE_START_DATE(+) AND GRETranslationPEO.EFFECTIVE_END_DATE(+))
AND GRETranslationPEO.language(+) ='US'
AND AssignmentPEO.Business_unit_id=BUTranslationPEO.ORGANIZATION_ID(+)
AND ( sysdate BETWEEN BUTranslationPEO.EFFECTIVE_START_DATE(+) AND BUTranslationPEO.EFFECTIVE_END_DATE(+))
AND BUTranslationPEO.language(+)='US'
AND AssignmentPEO.position_id =PosiTL.position_id(+)
AND (USERENV('LANG')) = PosiTL.LANGUAGE(+)
AND AssignmentPEO.PERSON_ID = PPSLV.PERSON_ID
AND PeriodOfServicePEO.ACTUAL_TERMINATION_DATE BETWEEN PPSLV.EFFECTIVE_START_DATE AND PPSLV.EFFECTIVE_END_DATE
AND PeriodOfServicePEO.ACTUAL_TERMINATION_DATE >= (:p_from_date)
AND PeriodOfServicePEO.ACTUAL_TERMINATION_DATE <= (:p_to_date)
PersonDetailsPEO.person_number "Person Number",
PPNF_MGR.full_name "Supervisor Full Name",
TO_CHAR(PeriodOfServicePEO.ACTUAL_TERMINATION_DATE,'MM-DD-YYYY') "Actual Termination Date",
JobTranslationPEO.name "Job Name",
TO_CHAR(PersonPEO.start_date,'MM-DD-YYYY') "Date of Hire",
HrLocation.location_code "Location Name",
OrganizationUnitTranslationPEO.name "Organization Name",
(
SELECT TO_CHAR(MAX(perpos.date_start),'MM-DD-YYYY')
FROM per_periods_of_service perpos,
per_all_assignments_m perpaam
WHERE perpos.person_id =PersonDetailsPEO.person_id
AND perpaam.period_of_service_id=perpos.period_of_service_id
AND perpaam.person_id =perpos.person_id
AND perpaam.ACTION_CODE IN('REHIRE','HIRE')
AND perpaam.effective_end_date <=PeriodOfServicePEO.ACTUAL_TERMINATION_DATE
) "Latest Date of Hire",
TO_CHAR(PeriodOfServicePEO.original_date_of_hire,'MM-DD-YYYY') "ORIGINAL_DATE_OF_HIRE",
PeriodOfServicePEO.last_updated_by "Terminated By",
TO_CHAR(PeriodOfServicePEO.last_update_date,'MM-DD-YYYY') "Termination Last Update Date",
AssignmentPEO.assignment_number "Assignment Number",
TO_CHAR(AssignmentPEO.effective_start_date,'MM-DD-YYYY') "Effective Start Date",
TO_CHAR(AssignmentPEO.effective_end_date,'MM-DD-YYYY') "Effective End Date",
PEA.EMAIL_ADDRESS,
NVL(PART.ACTION_REASON,'No Reason') "Leaving Reason",
NationalIdentifierPEO.NATIONAL_IDENTIFIER_NUMBER "Social Security Number"
FROM PER_PERSONS PersonPEO,
PER_ALL_PEOPLE_F PersonDetailsPEO,
PER_PERSON_NAMES_F_V PersonNamePEO,
PER_ALL_ASSIGNMENTS_M AssignmentPEO,
PER_PERSON_TYPES_TL PersonTypesTranslationPEO,
PER_PERIODS_OF_SERVICE PeriodOfServicePEO,
PER_NATIONAL_IDENTIFIERS NationalIdentifierPEO,
HR_ORGANIZATION_UNITS_F_TL OrganizationUnitTranslationPEO,
PER_JOBS_F_TL JobTranslationPEO,
hr_locations_all HrLocation,
PER_ACTION_REASONS_B PARB,
PER_ACTION_REASONS_TL PART,
per_assignment_supervisors_f PASF,
per_person_names_f PPNF_MGR,
PER_EMAIL_ADDRESSES PEA,
PER_ACTIONS_B ActionsPEO,
HR_ORGANIZATION_UNITS_F_TL GRETranslationPEO,
HR_ORGANIZATION_UNITS_F_TL BUTranslationPEO,
hr_all_positions_f_tl PosiTL,
PER_PERSON_SECURED_LIST_V PPSLV
WHERE PersonPEO.PERSON_ID = PersonDetailsPEO.PERSON_ID
AND PersonPEO.PERSON_ID = PersonNamePEO.PERSON_ID
AND PersonPEO.PERSON_ID = AssignmentPEO.PERSON_ID
AND AssignmentPEO.PERSON_TYPE_ID = PersonTypesTranslationPEO.PERSON_TYPE_ID(+)
AND (USERENV('LANG')) = PersonTypesTranslationPEO.LANGUAGE
AND AssignmentPEO.PERIOD_OF_SERVICE_ID = PeriodOfServicePEO.PERIOD_OF_SERVICE_ID(+)
AND AssignmentPEO.PERSON_ID = PeriodOfServicePEO.PERSON_ID(+)
AND PersonDetailsPEO.PERSON_ID = NationalIdentifierPEO.PERSON_ID(+)
AND PersonDetailsPEO.PRIMARY_NID_ID = NationalIdentifierPEO.NATIONAL_IDENTIFIER_ID(+)
AND ( (AssignmentPEO.EFFECTIVE_LATEST_CHANGE = 'Y' ) )
AND ( (AssignmentPEO.ASSIGNMENT_TYPE IN ('E','C' ,'N','P') ))
AND AssignmentPEO.organization_id = OrganizationUnitTranslationPEO.ORGANIZATION_ID(+)
AND (USERENV('LANG')) = OrganizationUnitTranslationPEO.LANGUAGE(+)
AND AssignmentPEO.JOB_ID = JobTranslationPEO.JOB_ID(+)
AND (USERENV('LANG')) = JobTranslationPEO.LANGUAGE(+)
AND HrLocation.location_id(+) =AssignmentPEO.location_id
AND ( sysdate BETWEEN PersonDetailsPEO.EFFECTIVE_START_DATE AND PersonDetailsPEO.EFFECTIVE_END_DATE)
AND ( sysdate BETWEEN PersonNamePEO.EFFECTIVE_START_DATE AND PersonNamePEO.EFFECTIVE_END_DATE)
AND ( sysdate BETWEEN AssignmentPEO.EFFECTIVE_START_DATE AND AssignmentPEO.EFFECTIVE_END_DATE)
AND ( sysdate BETWEEN OrganizationUnitTranslationPEO.EFFECTIVE_START_DATE(+) AND OrganizationUnitTranslationPEO.EFFECTIVE_END_DATE(+))
AND ( sysdate BETWEEN JobTranslationPEO.EFFECTIVE_START_DATE(+) AND JobTranslationPEO.EFFECTIVE_END_DATE(+))
AND PARB.ACTION_REASON_ID = PART.ACTION_REASON_ID(+)
AND AssignmentPEO.REASON_CODE = PARB.ACTION_REASON_CODE(+)
AND PART.language(+) ='US'
AND PeriodOfServicePEO.person_id = PASF.person_id(+)
AND PeriodOfServicePEO.ACTUAL_TERMINATION_DATE BETWEEN PASF.effective_start_date(+) AND PASF.effective_end_date(+)
AND PASF.manager_type(+) = 'LINE_MANAGER'
AND PASF.manager_id = PPNF_MGR.person_id(+)
AND TRUNC(SYSDATE) BETWEEN TRUNC(PPNF_MGR.effective_start_date(+)) AND TRUNC(PPNF_MGR.effective_end_date(+))
AND PPNF_MGR.name_type(+) = 'GLOBAL'
AND PersonDetailsPEO.primary_email_id = PEA.email_address_id(+)
AND AssignmentPEO.ACTION_CODE = ActionsPEO.ACTION_CODE(+)
AND AssignmentPEO.BUSINESS_GROUP_ID =ActionsPEO.BUSINESS_GROUP_ID(+)
AND ActionsPEO.ACTION_TYPE_CODE = 'EMPL_TERMINATE'
AND AssignmentPEO.legal_entity_id =GRETranslationPEO.ORGANIZATION_ID(+)
AND ( sysdate BETWEEN GRETranslationPEO.EFFECTIVE_START_DATE(+) AND GRETranslationPEO.EFFECTIVE_END_DATE(+))
AND GRETranslationPEO.language(+) ='US'
AND AssignmentPEO.Business_unit_id=BUTranslationPEO.ORGANIZATION_ID(+)
AND ( sysdate BETWEEN BUTranslationPEO.EFFECTIVE_START_DATE(+) AND BUTranslationPEO.EFFECTIVE_END_DATE(+))
AND BUTranslationPEO.language(+)='US'
AND AssignmentPEO.position_id =PosiTL.position_id(+)
AND (USERENV('LANG')) = PosiTL.LANGUAGE(+)
AND AssignmentPEO.PERSON_ID = PPSLV.PERSON_ID
AND PeriodOfServicePEO.ACTUAL_TERMINATION_DATE BETWEEN PPSLV.EFFECTIVE_START_DATE AND PPSLV.EFFECTIVE_END_DATE
AND PeriodOfServicePEO.ACTUAL_TERMINATION_DATE >= (:p_from_date)
AND PeriodOfServicePEO.ACTUAL_TERMINATION_DATE <= (:p_to_date)
No comments:
Post a Comment