-
select
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.Sick_Cat_A(
-
so_far2.reporting_class
-
) as Sick_Cat_A,
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.Sick_Cat_B(
-
so_far2.BVPI_Employment_Category
-
) as Sick_Cat_B,
-
so_far2.*
-
from (
-
select
-
so_far.*,
-
--Now run calce
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.FTE(
-
so_far.salary_payment_basis,
-
so_far.full_time_hours,
-
so_far.anualised_hours,
-
so_far.assignment_id,
-
xxgceul_context_pkg.show_context_date ('Effective Date')
-
) as FTE,
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.BVPI_Employment_Category(
-
so_far.assignment_category,
-
xxgceul_context_pkg.show_context_date ('Effective Date'),
-
so_far.Assignment_Start_Date --Hire_Date IN Date
-
) as BVPI_Employment_Category,
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.Age(
-
so_far.date_of_birth,
-
xxgceul_context_pkg.show_context_date ('Effective Date')
-
) as Age,
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.Age_range_10(
-
so_far.date_of_birth,
-
xxgceul_context_pkg.show_context_date ('Effective Date')
-
) as Age_range_10,
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.Age_range_5(
-
so_far.date_of_birth,
-
xxgceul_context_pkg.show_context_date ('Effective Date')
-
) as Age_range_5,
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.BME_Minority(
-
so_far.Ethnic_Origin
-
) as BME_Minority,
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.Months_Service(
-
so_far.original_date_of_hire,
-
xxgceul_context_pkg.show_context_date ('Effective Date')
-
) as Months_Service,
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.Length_Of_Service_range(
-
so_far.original_date_of_hire,
-
xxgceul_context_pkg.show_context_date ('Effective Date')
-
) as Length_Of_Service_range,
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.Service_Greenwich(
-
so_far.latest_start_date, --ppos_date_start
-
xxgceul_context_pkg.show_context_date ('Effective Date')
-
) as Service_Greenwich,
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.Service_L_Gov(
-
so_far.adjusted_svc_date,
-
xxgceul_context_pkg.show_context_date ('Effective Date')
-
) as Service_L_Gov,
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.Reporting_Class(
-
so_far.payroll_id,
-
so_far.assignment_status,
-
so_far.salary_payment_basis,
-
so_far.job_name,
-
so_far.pos_name,
-
so_far.assignment_category,
-
so_far.team
-
) as Reporting_Class,
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.Pen_ContPerc(
-
so_far.pension,
-
so_far.pen_lbg_percent,
-
so_far.pen_lbg_ab_percent,
-
so_far.pen_lpf_percent,
-
so_far.pen_teach_percent,
-
so_far.pen_councillors_percent,
-
so_far.business_group_id
-
) pen_all_percent,
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.Pen_ContSD(
-
so_far.pension,
-
so_far.pen_lbg_start,
-
so_far.pen_lbg_ab_start,
-
so_far.pen_lpf_start,
-
so_far.pen_teach_start,
-
so_far.pen_councillors_start,
-
so_far.business_group_id
-
) pen_all_start,
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.Pen_ContED(
-
so_far.pension,
-
so_far.pen_lbg_end,
-
so_far.pen_lbg_ab_end,
-
so_far.pen_lpf_end,
-
so_far.pen_teach_end,
-
so_far.pen_councillors_end,
-
so_far.business_group_id
-
) pen_all_end,
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.Eth_Category(
-
eth_lookup
-
) Ethnic_Category
-
--
-
-- XXGCEUL.XXGCEUL_CACULATIONS_PKG.Pen_ContPerc(
-
-- so_far.assignment_id,
-
-- so_far.pension,
-
-- xxgceul_context_pkg.show_context_date ('Effective Date')
-
-- ) as Pen_Cont_Per,
-
-- XXGCEUL.XXGCEUL_CACULATIONS_PKG.Pen_ContSD(
-
-- so_far.assignment_id,
-
-- so_far.pension,
-
-- xxgceul_context_pkg.show_context_date ('Effective Date')
-
-- ) as Pen_Cont_Start,
-
-- XXGCEUL.XXGCEUL_CACULATIONS_PKG.Pen_ContED(
-
-- so_far.assignment_id,
-
-- so_far.pension,
-
-- xxgceul_context_pkg.show_context_date ('Effective Date')
-
-- ) as Pen_Cont_End
-
from (
-
select
-
papf.person_id,
-
papf.applicant_number,
-
papf.employee_number,
-
papf.full_name,
-
papf.first_name,
-
papf.last_name,
-
initcap(papf.title) as title,
-
papf.date_of_birth,
-
papf.national_identifier as NI_Number,
-
papf.sex as gender,
-
papf.original_date_of_hire,
-
papf.previous_last_name,
-
papf.per_information1 as eth_lookup,
-
eth_orig.Meaning as Ethnic_Origin,
-
paaf.assignment_id,
-
paaf.effective_start_date as ass_esd,
-
paaf.effective_end_date as ass_eed,
-
paaf.assignment_number,
-
paaf.normal_hours,
-
paaf.ass_attribute3 as Leg_Contract_Num,
-
apps.fnd_date.canonical_to_date(paaf.ass_attribute4) as Motor_Ins_Expiry,
-
apps.fnd_date.canonical_to_date(paaf.ass_attribute5) as Fixed_Term_Cont_End,
-
decode(paaf.business_group_id,4194,paaf.ass_attribute10,'') as Leg_GC_Assign_Num,
-
paaf.grade_id,
-
paaf.supervisor_assignment_id,
-
ass_cat_lu.meaning as assignment_category,
-
paaf.primary_flag,
-
paaf.payroll_id,
-
paaf.business_group_id,
-
xoh.TEAM_ID,
-
xoh.TEAM_COST_ID,
-
xoh.TEAM_LOC_ID,
-
xoh.TEAM_FROM,
-
xoh.TEAM_TO,
-
nvl(xoh.TEAM,'???') as team,
-
xoh.TEAM_COST1,
-
xoh.TEAM_COST2,
-
xoh.TEAM_COST3,
-
xoh.TEAM_LOC_CODE,
-
xoh.TEAM_LOC_DESC,
-
xoh.TEAM_ADD1,
-
xoh.TEAM_ADD2,
-
xoh.TEAM_ADD3,
-
xoh.TEAM_TOWN,
-
xoh.TEAM_COUNTRY,
-
xoh.TEAM_POSTCODE,
-
xoh.TEAM_REP_LEA,
-
xoh.TEAM_ESTAB_NUM,
-
xoh.TEAM_ESTAB_NAME,
-
xoh.TEAM_ESTAB_TYPE,
-
xoh.TEAM_SCH_NUM,
-
xoh.TEAM_LEA_NUM,
-
xoh.SECTION_ID,
-
xoh.SECTION_COST_ID,
-
xoh.SECTION_LOC_ID,
-
xoh.SECTION_FROM,
-
xoh.SECTION_TO,
-
nvl(xoh.SECTION,'???') as section,
-
xoh.SECTION_COST1,
-
xoh.SECTION_COST2,
-
xoh.SECTION_COST3,
-
xoh.SECTION_LOC_CODE,
-
xoh.SECTION_LOC_DESC,
-
xoh.SECTION_ADD1,
-
xoh.SECTION_ADD2,
-
xoh.SECTION_ADD3,
-
xoh.SECTION_TOWN,
-
xoh.SECTION_COUNTRY,
-
xoh.SECTION_POSTCODE,
-
xoh.SECTION_REP_LEA,
-
xoh.SECTION_ESTAB_NUM,
-
xoh.SECTION_ESTAB_NAME,
-
xoh.SECTION_ESTAB_TYPE,
-
xoh.SECTION_SCH_NUM,
-
xoh.SECTION_LEA_NUM,
-
xoh.SERV_ID,
-
xoh.SERV_COST_ID,
-
xoh.SERV_LOC_ID,
-
xoh.SERV_FROM,
-
xoh.SERV_TO,
-
nvl(xoh.SERV,'???') as Service_Area,
-
xoh.SERV_COST1,
-
xoh.SERV_COST2,
-
xoh.SERV_COST3,
-
xoh.SERV_LOC_CODE,
-
xoh.SERV_LOC_DESC,
-
xoh.SERV_ADD1,
-
xoh.SERV_ADD2,
-
xoh.SERV_ADD3,
-
xoh.SERV_TOWN,
-
xoh.SERV_COUNTRY,
-
xoh.SERV_POSTCODE,
-
xoh.SERV_REP_LEA,
-
xoh.SERV_ESTAB_NUM,
-
xoh.SERV_ESTAB_NAME,
-
xoh.SERV_ESTAB_TYPE,
-
xoh.SERV_SCH_NUM,
-
xoh.SERV_LEA_NUM,
-
xoh.DIV_ID,
-
xoh.DIV_COST_ID,
-
xoh.DIV_LOC_ID,
-
xoh.DIV_FROM,
-
xoh.DIV_TO,
-
nvl(xoh.DIV,'???') as Division,
-
xoh.DIV_COST1,
-
xoh.DIV_COST2,
-
xoh.DIV_COST3,
-
xoh.DIV_LOC_CODE,
-
xoh.DIV_LOC_DESC,
-
xoh.DIV_ADD1,
-
xoh.DIV_ADD2,
-
xoh.DIV_ADD3,
-
xoh.DIV_TOWN,
-
xoh.DIV_COUNTRY,
-
xoh.DIV_POSTCODE,
-
xoh.DIV_REP_LEA,
-
xoh.DIV_ESTAB_NUM,
-
xoh.DIV_ESTAB_NAME,
-
xoh.DIV_ESTAB_TYPE,
-
xoh.DIV_SCH_NUM,
-
xoh.DIV_LEA_NUM,
-
xoh.DIR_ID,
-
xoh.DIR_COST_ID,
-
xoh.DIR_LOC_ID,
-
xoh.DIR_FROM,
-
xoh.DIR_TO,
-
nvl(xoh.DIR,'???') as Directorate,
-
xoh.DIR_COST1,
-
xoh.DIR_COST2,
-
xoh.DIR_COST3,
-
xoh.DIR_LOC_CODE,
-
xoh.DIR_LOC_DESC,
-
xoh.DIR_ADD1,
-
xoh.DIR_ADD2,
-
xoh.DIR_ADD3,
-
xoh.DIR_TOWN,
-
xoh.DIR_COUNTRY,
-
xoh.DIR_POSTCODE,
-
xoh.DIR_REP_LEA,
-
xoh.DIR_ESTAB_NUM,
-
xoh.DIR_ESTAB_NAME,
-
xoh.DIR_ESTAB_TYPE,
-
xoh.DIR_SCH_NUM,
-
xoh.DIR_LEA_NUM,
-
past.user_status as assignment_status,
-
pj.name as job_name,
-
--**People Group**
-
--Greenwich BG and GSP
-
decode(paaf.business_group_id,101,ppg.segment1,4194,ppg.segment1,'') as salary_payment_basis,
-
decode(paaf.business_group_id,101,pen_sch_des.description,4194,pen_sch_des_gsp.description ,'') as pension,
-
decode(paaf.business_group_id,101,ppg.segment3,4194,ppg.segment3,'') as car_user_type,
-
decode(paaf.business_group_id,101,ppg.segment4,4194,ppg.segment4,'') as osp_scheme,
-
decode(paaf.business_group_id,101,ppg.segment5,4194,ppg.segment5,'') as retained_pay,
-
decode(paaf.business_group_id,101,ppg.segment6,4194,ppg.segment6,'') as anualised_hours,
-
decode(paaf.business_group_id,101,ppg.segment7,4194,ppg.segment7,'') as term_time_weeks,
-
decode(paaf.business_group_id,101,ppg.segment8,4194,ppg.segment8,'') as number_of_sessions,
-
decode(paaf.business_group_id,101,ppg.segment9,4194,ppg.segment9,'') as teacher_tpa_code,
-
decode(paaf.business_group_id,101,ppg.segment10,4194,ppg.segment10,'') as Leave_Band,
-
--Pensions BG
-
case paaf.business_group_id when 102 then ppg.segment1 else '' end as Ill_Health_Indicator,
-
--**People Group End**
-
--**Additional Person Details**
-
papf.ATTRIBUTE1 as ExILEAContractNum,
-
apps.fnd_date.canonical_to_date(papf.ATTRIBUTE2) as RetirementExtensionExp,
-
--**END Additional Person Details**
-
paa.contract_type,
-
paa.work_pattern,
-
paa.start_day,
-
paa.effective_start_date as paa_esd,
-
paa.effective_end_date as paa_eed,
-
paa.LGPS_PROCESS_FLAG,
-
paa.LGPS_EXCLUSION_TYPE,
-
paa.LGPS_PENSIONABLE_PAY,
-
paa.LGPS_TRANS_ARRANG_FLAG,
-
paa.LGPS_Membership_number,
-
ppos.adjusted_svc_date,
-
ppos.date_start as latest_start_date,
-
ppos.accepted_termination_date,
-
ppos.actual_termination_date,
-
ppos.final_process_date,
-
ppos.last_standard_process_date,
-
ppos.leaving_reason,
-
APPS.hr_reports.get_lookup_meaning('LEAV_REAS', ppos.leaving_reason) as leaving_reason_full,
-
ppos.notified_termination_date,
-
ppos.projected_termination_date,
-
hapf.position_id,
-
hapf.name as pos_name,
-
hapf.pos_post_num,
-
hapf.pos_org,
-
hapf.pos_SSDS_Line_Num,
-
hapf.pos_req_crb,
-
hapf.pos_crb_lev,
-
hapf.pos_tied_accom,
-
hapf.pos_wf_plan_pri,
-
hapf.pos_ISA,
-
ppf.payroll_name as payroll,
-
loc.location_code as loc_location_code,
-
loc.description as loc_description,
-
loc.address_line_1 as loc_address_line_1,
-
loc.address_line_2 as loc_address_line_2,
-
loc.address_line_3 as loc_address_line_3,
-
loc.town_or_city as loc_town,
-
loc.country as loc_country,
-
loc.postal_code as loc_postal_code,
-
loc.Rep_Through_LEA as loc_Rep_Through_LEA,
-
loc.Establishment_Num as loc_Establishment_Num,
-
loc.Establishment_Name as loc_Establishment_Name,
-
loc.Establishment_Type as loc_Establishment_Type,
-
loc.School_Number as loc_School_Number,
-
loc.LEA_Number as loc_LEA_Number,
-
pdf.Disabled,
-
pq_dfes.membership_number as dfes_number,
-
pq_dfes.professional_body_name as dfes_pro_body,
-
ppei.etw_Entitlement_to_work_in_UK,
-
ppei.etw_ID_Verfied,
-
ppei.etw_Type_of_ID,
-
ppei.etw_DateWP_SponsorReq,
-
ppei.etw_DateWP_SponsorRec,
-
ppei.etw_WP_SponsorNum,
-
ppei.etw_WP_SponsorExp,
-
ppei.etw_Leave_To_Remain_Exp,
-
ppei.etw_Student_Visa,
-
ppei.etw_Student_Visa_Exp_Date,
-
ppei.etw_Terms_And_Conditions,
-
ppei_ls.long_serv_invite,
-
ppei_ls.long_serv_recieved,
-
fthlu.full_time_hours,
-
sup_v.full_name as sup_name,
-
sup_v.assignment_number as sup_ass_num,
-
nvl((
-
select min(effective_Start_date)
-
from hr.per_all_assignments_f paaf1
-
where paaf1.assignment_id=paaf.assignment_id
-
and paaf1.assignment_type='E'
-
),TO_DATE('01-JAN-1951','DD-MON-YYYY')) as Assignment_Start_Date,
-
pg.Grade_Name,
-
pg.Grade,
-
pg.Grade_Description,
-
pg.Grade_TPA,
-
pg.Grade_Band,
-
pg_sp.SPINAL_POINT,
-
pg_sp.auto_increment_flag,
-
pg_sp.Ceiling_Spinal_Point,
-
pg_sp.parent_spine as pg_sp_parent_spine,
-
nvl(rates.pg_sp_annual_value,0) as pg_sp_annual_value,
-
nvl(pg_sp_lw_annual_value,0) as pg_sp_lw_annual_value,
-
spot.approved as spot_approved,
-
spot.proposed_salary_n as spot_amount,
-
spot.change_date as spot_from,
-
spot.date_to as spot_to,
-
(nvl(spot.proposed_salary_n,0) + nvl(rates.pg_sp_annual_value,0)) as sal_basic,
-
(nvl(spot.proposed_salary_n,0) + nvl(rates.pg_sp_annual_value,0) + nvl(pg_sp_lw_annual_value,0)) as sal_total,
-
(
-
select hl.meaning
-
from apps.hr_lookups hl
-
where hl.lookup_type = 'HOME_OFFICE'
-
and papf.expense_check_send_to_address = lookup_code
-
) as Office_Details_Mail_To,
-
pa.address_line1 as per_add_line1,
-
pa.address_line2 as per_add_line2,
-
pa.address_line3 as per_add_line3,
-
pa.country as per_add_country,
-
pa.postal_code as per_postcode,
-
pa.address_type as per_address_type,
-
nvl(ppei_crb.crb_Rec_Ent,'No') as crb_Rec_Ent,
-
ppei_crb.crb_Number,
-
ppei_crb.crb_Form_Ref,
-
ppei_crb.crb_Type,
-
ppei_crb.crb_Requested,
-
ppei_crb.crb_App_Recieved,
-
ppei_crb.crb_Outcome,
-
ppei_crb.crb_Disc_Num,
-
ppei_crb.crb_Renewal,
-
ppei_crb.crb_Port_Cert,
-
ppei_crb.crb_Port_Date,
-
ppei_crb.crb_Suitability_Conf,
-
ppei_crb.crb_Unsuitable_Offence,
-
ppei_crb.crb_CO_Notif_of_Offences,
-
ppei_crb.crb_CO_Notif_of_Offences_date,
-
ppei_crb.crb_CO_Notif_of_Clear,
-
ppei_crb.crb_CO_Notif_of_Date,
-
ppei_crb.crb_Appeal_Lodged,
-
ppei_crb.crb_Appeal_Hear_Date,
-
ppei_crb.crb_Outcome_Decision,
-
ppei_crb.crb_Medical_Sent_Out,
-
ppei_crb.crb_Medical_Cleared,
-
ppei_crb.crb_Letter_Sent_Out,
-
ppei_crb.crb_Notes,
-
ppei_crb.crb_List99ISAClear,
-
ppei_crb.crb_List99ISAClearDate,
-
ppei_crb.crb_CPAccess,
-
ppei_crb.crb_CPAccessDate,
-
ppei_crb.crb_CPAdminNotified,
-
pen_ele.lbg_p as pen_lbg_percent,
-
pen_ele.lbg_s as pen_lbg_start,
-
pen_ele.lbg_e as pen_lbg_end,
-
pen_ele.lbga_p as pen_lbg_ab_percent,
-
pen_ele.lbga_s as pen_lbg_ab_start,
-
pen_ele.lbga_e as pen_lbg_ab_end,
-
pen_ele.lpf_p as pen_lpf_percent,
-
pen_ele.lpf_s as pen_lpf_start,
-
pen_ele.lpf_e as pen_lpf_end,
-
pen_ele.t_p as pen_teach_percent,
-
pen_ele.t_s as pen_teach_start,
-
pen_ele.t_e as pen_teach_end,
-
pen_ele.c_p as pen_councillors_percent,
-
pen_ele.c_s as pen_councillors_start,
-
pen_ele.c_e as pen_councillors_end,
-
bank.sort_code as bank_sort_code,
-
bank.bank_name as bank_name,
-
bank.bank_branch as bank_branch,
-
bank.Account_number as bank_Account_number,
-
bank.Account_Name as bank_Account_Name,
-
bank.Account_Type as bank_Account_Type,
-
bank.BID_Soc_Acc_No as bank_BID_Soc_Acc_No,
-
bank.bank_Branc_Loc as bank_Branc_Loc,
-
bank.org_payment_method_name as bank_org_payment_method_name,
-
bank.percentage as bank_percentage,
-
bank.PO_Number as bank_PO_Number,
-
bank.Overseas_Payment_Ind as bank_Overseas_Payment_Ind,
-
bank.bank_context,
-
ev_pd.Tax_Code,
-
ev_pd.effective_start_date as Tax_Code_ESD,
-
ev_pd.effective_end_date as Tax_Code_EED,
-
ev_pd.Tax_Basis,
-
ev_pd.effective_start_date as Tax_Basis_ESD,
-
ev_pd.effective_end_date as Tax_Basis_EED,
-
ev_pd.Tax_PayPrev,
-
ev_pd.Tax_Prev,
-
ev_pd.Tax_Refundable,
-
ev_pd.Tax_Authority,
-
ev_nic.NI_Cat as NI_Cat,
-
ev_nic.effective_start_date as NI_Cat_ESD,
-
ev_nic.effective_end_date as NI_Cat_EED,
-
ev_nic.NI_Cert,
-
ev_nic.NI_Pension,
-
ev_nic.NI_Process
-
from (
-
select paaf1.*
-
from hr.per_all_assignments_f paaf1
-
where (
-
xxgceul_context_pkg.show_context_date ('Effective Date')
-
BETWEEN paaf1.effective_start_date
-
AND paaf1.effective_end_date
-
)
-
) paaf
-
left join (
-
select papf1.*
-
from hr.per_all_people_f papf1
-
where xxgceul_context_pkg.show_context_date ('Effective Date')
-
BETWEEN papf1.effective_start_date
-
AND papf1.effective_end_date
-
) papf on paaf.person_id=papf.person_id
-
left join (
-
select
-
flv.lookup_code,
-
flv.Meaning,
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.GetSecurityGroupFromKey(fsg.security_group_key) as security_group_key
-
from apps.fnd_lookup_values flv
-
left join apps.fnd_security_groups fsg on flv.security_group_id=fsg.security_group_id
-
where flv.lookup_type='ETH_TYPE'
-
and enabled_flag='Y'
-
) eth_orig on eth_orig.lookup_code=papf.per_information1 and eth_orig.security_group_key=paaf.business_group_id
-
left join (
-
select
-
flv.lookup_code,
-
case substr(flv.meaning,0,1)
-
when 'Z' then
-
substr(flv.meaning,2)
-
else
-
flv.meaning
-
end as meaning,
-
XXGCEUL.XXGCEUL_CACULATIONS_PKG.GetSecurityGroupFromKey(fsg.security_group_key) as security_group_key
-
from apps.fnd_lookup_values flv
-
left join apps.fnd_security_groups fsg on flv.security_group_id=fsg.security_group_id
-
where flv.lookup_type='EMP_CAT'
-
) ass_cat_lu on ass_cat_lu.lookup_code=paaf.employment_category and ass_cat_lu.security_group_key=paaf.business_group_id
-
left join (
-
select *
-
from APPS.XXGCEUL_ORG_HIERARCHY_mv
-
) xoh on xoh.team_id=paaf.organization_id
-
left join (
-
select *
-
from hr.per_assignment_status_types
-
) past on past.assignment_status_type_id=paaf.assignment_status_type_id
-
left join (
-
select pj1.*
-
from hr.per_jobs pj1
-
) pj on pj.job_id=paaf.job_id
-
left join (
-
select ppg1.*
-
from hr.pay_people_groups ppg1
-
) ppg on ppg.people_group_id=paaf.people_group_id
-
left join (
-
select
-
paa1.assignment_id,
-
paa1.business_group_id,
-
paa1.contract_type,
-
paa1.work_pattern,
-
paa1.start_day,
-
paa1.effective_start_date,
-
paa1.effective_end_date,
-
paa1.LGPS_PROCESS_FLAG,
-
paa1.LGPS_EXCLUSION_TYPE,
-
paa1.LGPS_PENSIONABLE_PAY,
-
paa1.LGPS_TRANS_ARRANG_FLAG,
-
paa1.LGPS_Membership_number
-
from hr.PQP_assignment_attributes_f paa1
-
where xxgceul_context_pkg.show_context_date ('Effective Date')
-
BETWEEN paa1.effective_start_date
-
AND paa1.effective_end_date
-
) paa on paa.ASSIGNMENT_ID=paaf.assignment_id
-
left join (
-
select ppos1.*
-
from hr.PER_Periods_of_service ppos1
-
) ppos on ppos.period_of_service_id=paaf.period_of_service_id
-
left join ( --No Improvement
-
select
-
hapf1.position_id,
-
ppd1.segment1 as pos_post_num,
-
ppd1.segment2 as name,
-
ppd1.segment3 as pos_org,
-
hapf1.attribute1 as pos_SSDS_Line_Num,
-
hapf1.attribute2 as pos_req_crb,
-
hapf1.attribute3 as pos_crb_lev,
-
hapf1.attribute4 as pos_tied_accom,
-
hapf1.attribute5 as pos_wf_plan_pri,
-
hapf1.attribute6 as pos_ISA
-
from hr.hr_all_positions_f hapf1
-
left join (
-
select *
-
from hr.per_position_definitions ppd2
-
) ppd1 on ppd1.position_definition_id=hapf1.position_definition_id
-
where xxgceul_context_pkg.show_context_date ('Effective Date')
-
BETWEEN hapf1.effective_start_date
-
AND hapf1.effective_end_date
-
) hapf on hapf.position_id=paaf.position_id
-
left join ( -- No Improvement
-
select ppf1.*
-
from apps.pay_all_payrolls_f ppf1
-
where xxgceul_context_pkg.show_context_date ('Effective Date')
-
BETWEEN ppf1.effective_start_date
-
AND ppf1.effective_end_date
-
) ppf on ppf.payroll_id=paaf.payroll_id
-
left join ( -- No Improvement
-
select
-
hla.location_id,
-
hla.location_code,
-
hla.description,
-
hla.address_line_1,
-
hla.address_line_2,
-
hla.address_line_3,
-
hla.town_or_city,
-
ft.country,
-
hla.postal_code,
-
hlei.lei_information1 as Rep_Through_LEA,
-
hlei.lei_information2 as Establishment_Num,
-
hlei.lei_information3 as Establishment_Name,
-
hlei.lei_information4 as Establishment_Type,
-
hlei.lei_information5 as School_Number,
-
hlei.lei_information6 as LEA_Number
-
from (
-
select *
-
from hr.hr_locations_all hla1
-
) hla
-
left join (
-
select ft1.TERRITORY_CODE, ft1.TERRITORY_SHORT_NAME as country
-
from apps.fnd_territories_tl ft1
-
) ft on ft.territory_code=hla.country
-
left join (
-
select *
-
from hr.hr_location_extra_info hlei1
-
) hlei on hlei.location_id=hla.location_id
-
) loc on loc.location_id=paaf.location_id
-
left join ( --No Improvement
-
select
-
person_id,
-
category as Disabled,
-
pdf1.effective_start_date,
-
pdf1.effective_end_date
-
from per_disabilities_f pdf1
-
where xxgceul_context_pkg.show_context_date ('Effective Date')
-
BETWEEN pdf1.effective_start_date
-
AND pdf1.effective_end_date
-
) pdf on pdf.person_id=paaf.person_id
-
left join ( --No Improvement
-
select
-
pq1.person_id,
-
pq1.membership_number,
-
pq1.professional_body_name
-
--,pq1.*
-
from hr.per_qualifications pq1
-
where pq1.qualification_type_id=8 --Qualified Teacher Status (QTS)
-
--and person_id=29627
-
) pq_dfes on pq_dfes.person_id=paaf.person_id
-
left join ( --No Improvement
-
select
-
ppei1.person_id,
-
ppei1.pei_information1 as etw_Entitlement_to_work_in_UK,
-
ppei1.pei_information2 as etw_ID_Verfied,
-
ppei1.pei_information3 as etw_Type_of_ID,
-
apps.fnd_date.CANONICAL_TO_DATE(ppei1.pei_information4) as etw_DateWP_SponsorReq,
-
apps.fnd_date.CANONICAL_TO_DATE(ppei1.pei_information5) as etw_DateWP_SponsorRec,
-
ppei1.pei_information6 as etw_WP_SponsorNum,
-
apps.fnd_date.CANONICAL_TO_DATE(ppei1.pei_information7) as etw_WP_SponsorExp,
-
apps.fnd_date.CANONICAL_TO_DATE(ppei1.pei_information8) as etw_Leave_To_Remain_Exp,
-
ppei1.pei_information9 as etw_Student_Visa,
-
apps.fnd_date.CANONICAL_TO_DATE(ppei1.pei_information10) as etw_Student_Visa_Exp_Date,
-
ppei1.pei_information11 as etw_Terms_And_Conditions
-
from hr.per_people_extra_info ppei1
-
where ppei1.information_type = 'GC_ENTITLEMENT_TO_WORK'
-
and ppei1.person_extra_info_id = (
-
select max(ppei2.person_extra_info_id)
-
from hr.per_people_extra_info ppei2
-
where ppei2.information_type = 'GC_ENTITLEMENT_TO_WORK'
-
and ppei1.person_id=ppei2.person_id
-
)
-
) ppei on ppei.person_id = paaf.person_id
-
left join (
-
select /*+ FIRST_ROWS */
-
ppei1.person_id,
-
ppei1.pei_information1 as long_serv_invite,
-
ppei1.pei_information2 as long_serv_recieved
-
from hr.per_people_extra_info ppei1
-
where ppei1.information_type = 'GC_LONG_SERVICE_AWARD'
-
and ppei1.person_extra_info_id = (
-
select max(ppei2.person_extra_info_id)
-
from hr.per_people_extra_info ppei2
-
where ppei2.information_type = 'GC_LONG_SERVICE_AWARD'
-
and ppei1.person_id=ppei2.person_id
-
)
-
) ppei_ls on ppei_ls.person_id = paaf.person_id
-
left join ( --Optermised no improvement
-
select
-
'Yes' as crb_Rec_Ent,
-
ppei1.person_id,
-
ppei1.pei_information1 as crb_Number,
-
ppei1.pei_information18 as crb_Form_Ref,
-
ppei1.pei_information2 as crb_Type,
-
apps.fnd_date.CANONICAL_TO_DATE(ppei1.pei_information3) as crb_Requested,
-
apps.fnd_date.CANONICAL_TO_DATE(ppei1.pei_information4) as crb_App_Recieved,
-
ppei1.pei_information5 as crb_Outcome,
-
ppei1.pei_information6 as crb_Disc_Num,
-
apps.fnd_date.CANONICAL_TO_DATE(ppei1.pei_information7) as crb_Renewal,
-
ppei1.pei_information8 as crb_Port_Cert,
-
apps.fnd_date.CANONICAL_TO_DATE(ppei1.pei_information9) as crb_Port_Date,
-
ppei1.pei_information10 as crb_Suitability_Conf,
-
ppei1.pei_information11 as crb_Unsuitable_Offence,
-
ppei1.pei_information12 as crb_CO_Notif_of_Offences,
-
apps.fnd_date.CANONICAL_TO_DATE(ppei1.pei_information13) as crb_CO_Notif_of_Offences_date,
-
ppei1.pei_information20 as crb_CO_Notif_of_Clear,
-
apps.fnd_date.CANONICAL_TO_DATE(ppei1.pei_information21) as crb_CO_Notif_of_Date,
-
ppei1.pei_information14 as crb_Appeal_Lodged,
-
apps.fnd_date.CANONICAL_TO_DATE(ppei1.pei_information15) as crb_Appeal_Hear_Date,
-
ppei1.pei_information16 as crb_Outcome_Decision,
-
apps.fnd_date.CANONICAL_TO_DATE(ppei1.pei_information22) as crb_Medical_Sent_Out,
-
apps.fnd_date.CANONICAL_TO_DATE(ppei1.pei_information23) as crb_Medical_Cleared,
-
apps.fnd_date.CANONICAL_TO_DATE(ppei1.pei_information24) as crb_Letter_Sent_Out,
-
ppei1.pei_information25 as crb_Notes,
-
--ppei1.pei_information17 as crb_xx17,
-
--ppei1.pei_information19 as crb_xx19,
-
ppei1.pei_information26 as crb_List99ISAClear,
-
ppei1.pei_information27 as crb_List99ISAClearDate,
-
ppei1.pei_information28 as crb_CPAccess,
-
ppei1.pei_information29 as crb_CPAccessDate,
-
ppei1.pei_information30 as crb_CPAdminNotified
-
from hr.per_people_extra_info ppei1
-
where ppei1.information_type = 'GC_PRE_EMPLOYMENT_CRB_CHECK'
-
and ppei1.person_extra_info_id = (
-
select max(ppei2.person_extra_info_id)
-
from hr.per_people_extra_info ppei2
-
where ppei2.information_type = 'GC_PRE_EMPLOYMENT_CRB_CHECK'
-
and ppei1.person_id=ppei2.person_id
-
)
-
) ppei_crb on ppei_crb.person_id = paaf.person_id
-
left join ( --Index set recomended
-
SELECT
-
purf.ROW_LOW_RANGE_OR_NAME as contract_type,
-
pucif.value as full_time_hours,
-
purf.business_group_id
-
FROM hr.PAY_USER_ROWS_F purf
-
left join (
-
SELECT
-
pucif1.user_row_id,
-
pucif1.VALUE
-
FROM hr.PAY_USER_COLUMN_INSTANCES_F pucif1
-
inner join (
-
select *
-
from hr.pay_user_columns
-
where user_column_name='Contract Hours'
-
and user_table_id=77
-
) puc on puc.business_group_id=pucif1.business_group_id
-
and puc.user_column_id=pucif1.user_column_id
-
WHERE ( pucif1.LEGISLATION_CODE IS NULL OR pucif1.LEGISLATION_CODE = 'GB' )
-
and xxgceul_context_pkg.show_context_date ('Effective Date')
-
BETWEEN pucif1.effective_start_date
-
AND pucif1.effective_end_date
-
) pucif on pucif.USER_ROW_ID=purf.user_row_id
-
WHERE ( LEGISLATION_CODE IS NULL OR LEGISLATION_CODE = 'GB' )
-
and purf.user_table_id=77
-
and xxgceul_context_pkg.show_context_date ('Effective Date')
-
BETWEEN purf.effective_start_date
-
AND purf.effective_end_date
-
) fthlu on fthlu.contract_type = paa.contract_type
-
and fthlu.business_group_id=paa.business_group_id
-
left join ( --Optermised but no improvement
-
select paaf_i2.assignment_id, papf_i3.full_name, assignment_number
-
from hr.per_all_assignments_f paaf_i2
-
left join (
-
select person_id, full_name
-
from hr.per_all_people_f papf_i2
-
where effective_start_date = (
-
select max(papf_i1.effective_start_date)
-
from hr.per_all_people_f papf_i1
-
where papf_i1.person_id=papf_i2.person_id
-
)
-
) papf_i3 on paaf_i2.person_id=papf_i3.person_id
-
where assignment_number is not null
-
and paaf_i2.effective_start_date = (
-
select max(paaf_i1.effective_start_date)
-
from hr.per_all_assignments_f paaf_i1
-
where assignment_number is not null
-
and paaf_i1.assignment_id=paaf_i2.assignment_id
-
)
-
) sup_v on sup_v.assignment_id=paaf.supervisor_assignment_id
-
left join ( --Optermised but no improvement
-
select
-
pg1.grade_id,
-
pg1.name as Grade_Name,
-
pgd1.segment1 as Grade,
-
pgd1.segment2 as Grade_Description,
-
pgd1.segment3 as Grade_TPA,
-
pg1.attribute1 as Grade_Band
-
from per_grades pg1
-
left join (
-
select *
-
from hr.per_grade_definitions
-
) pgd1 on pgd1.grade_definition_id=pg1.grade_definition_id
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between nvl(pg1.date_from,TO_DATE('01-JAN-1951','DD-MON-YYYY')) and nvl(pg1.Date_to,TO_DATE('31-DEC-4712','DD-MON-YYYY'))
-
) pg on pg.grade_id=paaf.grade_id
-
left join ( --Optermised but further optimization possible
-
select /*+ USE_MERGE(PPS,PGSF,PSP1,PSPS1,PSPP1) */ pspp1.ASSIGNMENT_ID,
-
psp1.SPINAL_POINT,
-
pgsf.spinal_point as Ceiling_Spinal_Point,
-
psps1.grade_spine_id,
-
pspp1.auto_increment_flag,
-
pps.name as parent_spine
-
from PER_SPINAL_POINT_PLACEMENTS_f pspp1
-
inner join per_spinal_point_steps_f psps1
-
on pspp1.STEP_ID = psps1.STEP_ID
-
inner join per_spinal_points psp1
-
on psps1.spinal_point_id = psp1.spinal_point_id
-
left join (select pgsf1.grade_spine_id,
-
psp2.SPINAL_POINT,
-
psp2.PARENT_SPINE_ID
-
from per_grade_spines_f pgsf1,
-
per_spinal_point_steps_f psps2,
-
per_spinal_points psp2
-
WHERE xxgceul_context_pkg.show_context_date ('Effective Date') between pgsf1.effective_start_date and pgsf1.effective_end_date
-
AND psps2.spinal_point_id = psp2.spinal_point_id
-
AND pgsf1.ceiling_step_id = psps2.STEP_ID) pgsf
-
on pgsf.grade_spine_id = psps1.grade_spine_id
-
left join (select *
-
from per_parent_spines) pps
-
on pps.parent_spine_id = pgsf.parent_spine_id
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between pspp1.EFFECTIVE_START_DATE and pspp1.EFFECTIVE_END_DATE
-
and psp1.SPINAL_POINT is not null
-
) pg_sp on pg_sp.assignment_id=paaf.assignment_id
-
left join ( --Optomised no changes
-
select
-
psp.BUSINESS_GROUP_ID,
-
psp.NAME as Scale,
-
psps.spinal_point,
-
pgrf.val as pg_sp_annual_value,
-
pgrflw.val as pg_sp_lw_annual_value
-
from PER_PARENT_SPINES psp
-
inner join (
-
select
-
psps1.BUSINESS_GROUP_ID,
-
psps1.SPINAL_POINT_ID,
-
psps1.PARENT_SPINE_ID,
-
psps1.SEQUENCE,
-
psps1.SPINAL_POINT
-
from PER_SPINAL_POINTS psps1
-
) psps on psp.business_group_id=psps.business_group_id and psp.parent_spine_id=psps.parent_spine_id
-
left join (
-
select
-
pgrf1.BUSINESS_GROUP_ID,
-
pgrf1.GRADE_OR_SPINAL_POINT_ID,
-
pgrf1.CURRENCY_CODE,
-
sum(pgrf1.VALUE) as val
-
from apps.PAY_GRADE_RULES_F pgrf1
-
inner join (
-
select rate_id, name
-
from hr.pay_rates
-
where name not like 'LW%'
-
) pr on pr.rate_id=pgrf1.rate_id
-
where pgrf1.RATE_TYPE='SP'
-
and xxgceul.xxgceul_context_pkg.show_context_date ('Effective Date') BETWEEN nvl(pgrf1.Effective_start_date,TO_DATE('01-JAN-1951','DD-MON-YYYY')) AND nvl(pgrf1.Effective_end_date,TO_DATE('01-JAN-4712','DD-MON-YYYY'))
-
group by pgrf1.BUSINESS_GROUP_ID,pgrf1.GRADE_OR_SPINAL_POINT_ID,pgrf1.CURRENCY_CODE
-
) pgrf on pgrf.business_group_id=psp.business_group_id and pgrf.grade_or_spinal_point_id=psps.spinal_point_id
-
left join (
-
select
-
pgrf1.BUSINESS_GROUP_ID,
-
pgrf1.GRADE_OR_SPINAL_POINT_ID,
-
pgrf1.CURRENCY_CODE,
-
sum(pgrf1.VALUE) as val
-
from apps.PAY_GRADE_RULES_F pgrf1
-
inner join (
-
select rate_id, name
-
from hr.pay_rates
-
where name like 'LW%'
-
) pr on pr.rate_id=pgrf1.rate_id
-
where pgrf1.RATE_TYPE='SP'
-
and xxgceul.xxgceul_context_pkg.show_context_date ('Effective Date') BETWEEN nvl(pgrf1.Effective_start_date,TO_DATE('01-JAN-1951','DD-MON-YYYY')) AND nvl(pgrf1.Effective_end_date,TO_DATE('01-JAN-4712','DD-MON-YYYY'))
-
group by pgrf1.BUSINESS_GROUP_ID,pgrf1.GRADE_OR_SPINAL_POINT_ID,pgrf1.CURRENCY_CODE
-
) pgrflw on pgrflw.business_group_id=psp.business_group_id and pgrflw.grade_or_spinal_point_id=psps.spinal_point_id
-
) rates on rates.BUSINESS_GROUP_ID=paaf.business_Group_id and rates.scale=pg_sp.parent_spine and rates.spinal_point=pg_sp.spinal_point
-
left join (
-
select
-
ppp.assignment_id,
-
ppp.approved,
-
ppp.proposed_salary_n,
-
ppp.change_date,
-
ppp.date_to
-
from hr.per_pay_proposals ppp
-
where xxgceul.xxgceul_context_pkg.show_context_date ('Effective Date') BETWEEN ppp.change_date and ppp.date_to
-
and ppp.approved = 'Y'
-
) spot on spot.assignment_id=paaf.assignment_id
-
left join ( --Optomised no changes
-
select
-
pa1.person_id,
-
pa1.address_line1,
-
pa1.address_line2,
-
pa1.address_line3,
-
ft.country,
-
pa1.postal_code,
-
hrlat.meaning as address_type
-
from hr.per_addresses pa1
-
left join (
-
select ft1.TERRITORY_CODE, ft1.TERRITORY_SHORT_NAME as country
-
from apps.fnd_territories_tl ft1
-
) ft on ft.territory_code=pa1.country
-
left join (
-
select lookup_code, meaning
-
from hr_lookups
-
where lookup_type='ADDRESS_TYPE'
-
) hrlat on hrlat.lookup_code=pa1.address_type
-
where xxgceul_context_pkg.show_context_date ('ADD Effective Date') between nvl(pa1.date_from,TO_DATE('01-JAN-1951','DD-MON-YYYY')) and nvl(pa1.Date_to,TO_DATE('31-DEC-4712','DD-MON-YYYY'))
-
and Primary_flag='Y'
-
) pa on pa.person_id=paaf.person_id
-
left join ( --Optomised no changes
-
select
-
peef.assignment_id,
-
lbg_p.screen_entry_value as lbg_p,
-
apps.fnd_date.CANONICAL_TO_DATE(lbg_s.screen_entry_value) as lbg_s,
-
apps.fnd_date.CANONICAL_TO_DATE(lbg_e.screen_entry_value) as lbg_e,
-
lbga_p.screen_entry_value as lbga_p,
-
apps.fnd_date.CANONICAL_TO_DATE(lbga_s.screen_entry_value) as lbga_s,
-
apps.fnd_date.CANONICAL_TO_DATE(lbga_e.screen_entry_value) as lbga_e,
-
lpf_p.screen_entry_value as lpf_p,
-
apps.fnd_date.CANONICAL_TO_DATE(lpf_s.screen_entry_value) as lpf_s,
-
apps.fnd_date.CANONICAL_TO_DATE(lpf_e.screen_entry_value) as lpf_e,
-
t_p.screen_entry_value as t_p,
-
apps.fnd_date.CANONICAL_TO_DATE(t_s.screen_entry_value) as t_s,
-
apps.fnd_date.CANONICAL_TO_DATE(t_e.screen_entry_value) as t_e,
-
c_p.screen_entry_value as c_p,
-
apps.fnd_date.CANONICAL_TO_DATE(c_s.screen_entry_value) as c_s,
-
apps.fnd_date.CANONICAL_TO_DATE(c_e.screen_entry_value) as c_e
-
from hr.pay_element_entries_f peef
-
left join (
-
select peevf1.element_entry_id, peevf1.screen_entry_value
-
from hr.pay_element_entry_values_f peevf1
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between peevf1.effective_start_date and peevf1.effective_end_date
-
and peevf1.input_value_id=decode(apps.hr_general.get_business_group_id,4194,14436,11592)
-
) lbg_p on lbg_p.element_entry_id=peef.element_entry_id
-
left join (
-
select peevf1.element_entry_id, peevf1.screen_entry_value from hr.pay_element_entry_values_f peevf1 where xxgceul_context_pkg.show_context_date ('Effective Date') between peevf1.effective_start_date and peevf1.effective_end_date and peevf1.input_value_id=11593
-
) lbg_s on lbg_s.element_entry_id=peef.element_entry_id
-
left join (
-
select peevf1.element_entry_id, peevf1.screen_entry_value from hr.pay_element_entry_values_f peevf1 where xxgceul_context_pkg.show_context_date ('Effective Date') between peevf1.effective_start_date and peevf1.effective_end_date and peevf1.input_value_id=11594
-
) lbg_e on lbg_e.element_entry_id=peef.element_entry_id
-
--
-
left join (
-
select peevf1.element_entry_id, peevf1.screen_entry_value from hr.pay_element_entry_values_f peevf1 where xxgceul_context_pkg.show_context_date ('Effective Date') between peevf1.effective_start_date and peevf1.effective_end_date and peevf1.input_value_id=11595
-
) lbga_p on lbga_p.element_entry_id=peef.element_entry_id
-
left join (
-
select peevf1.element_entry_id, peevf1.screen_entry_value from hr.pay_element_entry_values_f peevf1 where xxgceul_context_pkg.show_context_date ('Effective Date') between peevf1.effective_start_date and peevf1.effective_end_date and peevf1.input_value_id=11596
-
) lbga_s on lbga_s.element_entry_id=peef.element_entry_id
-
left join (
-
select peevf1.element_entry_id, peevf1.screen_entry_value from hr.pay_element_entry_values_f peevf1 where xxgceul_context_pkg.show_context_date ('Effective Date') between peevf1.effective_start_date and peevf1.effective_end_date and peevf1.input_value_id=11597
-
) lbga_e on lbga_e.element_entry_id=peef.element_entry_id
-
--
-
left join (
-
select peevf1.element_entry_id, peevf1.screen_entry_value from hr.pay_element_entry_values_f peevf1 where xxgceul_context_pkg.show_context_date ('Effective Date') between peevf1.effective_start_date and peevf1.effective_end_date and peevf1.input_value_id=11598
-
) lpf_p on lpf_p.element_entry_id=peef.element_entry_id
-
left join (
-
select peevf1.element_entry_id, peevf1.screen_entry_value from hr.pay_element_entry_values_f peevf1 where xxgceul_context_pkg.show_context_date ('Effective Date') between peevf1.effective_start_date and peevf1.effective_end_date and peevf1.input_value_id=11599
-
) lpf_s on lpf_s.element_entry_id=peef.element_entry_id
-
left join (
-
select peevf1.element_entry_id, peevf1.screen_entry_value from hr.pay_element_entry_values_f peevf1 where xxgceul_context_pkg.show_context_date ('Effective Date') between peevf1.effective_start_date and peevf1.effective_end_date and peevf1.input_value_id=11600
-
) lpf_e on lpf_e.element_entry_id=peef.element_entry_id
-
--
-
left join (
-
select peevf1.element_entry_id, peevf1.screen_entry_value from hr.pay_element_entry_values_f peevf1 where xxgceul_context_pkg.show_context_date ('Effective Date') between peevf1.effective_start_date and peevf1.effective_end_date and peevf1.input_value_id=11601
-
) t_p on t_p.element_entry_id=peef.element_entry_id
-
left join (
-
select peevf1.element_entry_id, peevf1.screen_entry_value from hr.pay_element_entry_values_f peevf1 where xxgceul_context_pkg.show_context_date ('Effective Date') between peevf1.effective_start_date and peevf1.effective_end_date and peevf1.input_value_id=11602
-
) t_s on t_s.element_entry_id=peef.element_entry_id
-
left join (
-
select peevf1.element_entry_id, peevf1.screen_entry_value from hr.pay_element_entry_values_f peevf1 where xxgceul_context_pkg.show_context_date ('Effective Date') between peevf1.effective_start_date and peevf1.effective_end_date and peevf1.input_value_id=11603
-
) t_e on t_e.element_entry_id=peef.element_entry_id
-
--
-
left join (
-
select peevf1.element_entry_id, peevf1.screen_entry_value from hr.pay_element_entry_values_f peevf1 where xxgceul_context_pkg.show_context_date ('Effective Date') between peevf1.effective_start_date and peevf1.effective_end_date and peevf1.input_value_id=11604
-
) c_p on c_p.element_entry_id=peef.element_entry_id
-
left join (
-
select peevf1.element_entry_id, peevf1.screen_entry_value from hr.pay_element_entry_values_f peevf1 where xxgceul_context_pkg.show_context_date ('Effective Date') between peevf1.effective_start_date and peevf1.effective_end_date and peevf1.input_value_id=11605
-
) c_s on c_s.element_entry_id=peef.element_entry_id
-
left join (
-
select peevf1.element_entry_id, peevf1.screen_entry_value from hr.pay_element_entry_values_f peevf1 where xxgceul_context_pkg.show_context_date ('Effective Date') between peevf1.effective_start_date and peevf1.effective_end_date and peevf1.input_value_id=11606
-
) c_e on c_e.element_entry_id=peef.element_entry_id
-
--
-
where peef.element_type_id=decode(apps.hr_general.get_business_group_id,4194,5515,5113)
-
and xxgceul_context_pkg.show_context_date ('Effective Date') between peef.effective_start_date and peef.effective_end_date
-
) pen_ele on pen_ele.assignment_id=paaf.assignment_id
-
left join (
-
select
-
pppmf.assignment_id,
-
pea.sort_code,
-
pea.bank_name,
-
pea.bank_branch,
-
pea.Account_number,
-
pea.Account_Name,
-
pea.Account_Type,
-
pea.BID_Soc_Acc_No,
-
pea.Bank_Branc_Loc,
-
popmf.org_payment_method_name,
-
pppmf.percentage,
-
pppmf.PO_Number,
-
pppmf.Overseas_Payment_Ind,
-
pppmf.bank_Context
-
from (
-
select
-
pppmf1.assignment_id,
-
pppmf1.percentage,
-
pppmf1.org_payment_method_id,
-
pppmf1.external_account_id,
-
pppmf1.effective_start_date,
-
pppmf1.effective_end_date,
-
case when nvl(pppmf1.attribute_category,'_')='GC_PO_NUMBER' then
-
pppmf1.attribute1
-
else
-
null
-
end as PO_Number,
-
case when nvl(pppmf1.attribute_category,'_')='GC_OVERSEAS_PAYMENT_IND' then
-
pppmf1.attribute2
-
else
-
null
-
end as Overseas_Payment_Ind,
-
decode(nvl(pppmf1.attribute_category,'_'),
-
'GC_OVERSEAS_PAYMENT_IND','Overseas Payment Indicator',
-
'GC_PO_NUMBER','Post Office Number'
-
) as bank_Context
-
from hr.pay_personal_payment_methods_f pppmf1
-
where ((personal_payment_method_id < 33958)
-
OR (personal_payment_method_id > 33958)) --Ignore this one as it was an early error
-
--CEUL Health also ignroes this record
-
) pppmf
-
left join (
-
select
-
pea1.external_account_id,
-
pea1.segment3 as sort_code,
-
pea1.segment1 as bank_name,
-
pea1.segment2 as bank_branch,
-
pea1.segment4 as Account_number,
-
pea1.segment5 as Account_Name,
-
pea1.segment6 as Account_Type,
-
pea1.segment7 as BID_Soc_Acc_No,
-
pea1.segment8 as Bank_Branc_Loc
-
from hr.pay_external_accounts pea1
-
) pea on pea.external_account_id=pppmf.external_account_id
-
left join (
-
select popmf1.org_payment_method_id, popmf1.org_payment_method_name
-
from hr.PAY_ORG_PAYMENT_METHODS_f popmf1
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between popmf1.effective_start_date and popmf1.effective_end_date
-
) popmf on popmf.org_payment_method_id=pppmf.org_payment_method_id
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between pppmf.effective_start_date and pppmf.effective_end_date
-
) bank on paaf.assignment_id=bank.assignment_id
-
left join (
-
select
-
peef.assignment_id,
-
peef.effective_start_date,
-
peef.effective_end_date,
-
peevf_code.screen_entry_value as Tax_Code,
-
peevf_basis.screen_entry_value as Tax_Basis,
-
peevf_PayPrev.screen_entry_value as Tax_PayPrev,
-
peevf_Prev.screen_entry_value as Tax_Prev,
-
peevf_Refundable.screen_entry_value as Tax_Refundable,
-
peevf_Authority.screen_entry_value as Tax_Authority
-
from pay_element_entries_f peef
-
inner join (
-
--This join will restrict element to PAY Basis only and look up all the input value codes
-
select /*+ NO_USE_NL(PIVF_PROCESS) */
-
petf.element_type_id,
-
pivf.input_value_id as input_value_id_tax_code,
-
pivf_basis.input_value_id as input_value_id_tax_basis,
-
pivf_PayPrev.input_value_id as input_value_id_Tax_PayPrev,
-
pivf_Prev.input_value_id as input_value_id_Tax_Prev,
-
pivf_Refundable.input_value_id as input_value_id_Tax_Refundable,
-
pivf_Authority.input_value_id as input_value_id_Tax_Authority
-
from (
-
select *
-
from pay_element_types_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
and element_name like 'PAYE Details'
-
) petf
-
left join (
-
select *
-
from pay_input_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
and name like 'Tax Code'
-
) pivf on pivf.element_type_id=petf.element_type_id
-
left join (
-
select *
-
from pay_input_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
and name like 'Tax Basis'
-
) pivf_basis on pivf_basis.element_type_id=petf.element_type_id
-
left join (
-
select *
-
from pay_input_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
and name like 'Pay Previous'
-
) pivf_PayPrev on pivf_PayPrev.element_type_id=petf.element_type_id
-
left join (
-
select *
-
from pay_input_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
and name like 'Tax Previous'
-
) pivf_Prev on pivf_Prev.element_type_id=petf.element_type_id
-
left join (
-
select *
-
from pay_input_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
and name like 'Refundable'
-
) pivf_Refundable on pivf_Refundable.element_type_id=petf.element_type_id
-
left join (
-
select *
-
from pay_input_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
and name like 'Authority'
-
) pivf_Authority on pivf_Authority.element_type_id=petf.element_type_id
-
) element_info on element_info.element_type_id=peef.element_type_id
-
left join (
-
select input_value_id, element_entry_id, screen_entry_value
-
from pay_element_entry_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
) peevf_code on peevf_code.element_entry_id=peef.element_entry_id and element_info.input_value_id_tax_code=peevf_code.input_value_id
-
left join (
-
select input_value_id, element_entry_id, screen_entry_value
-
from pay_element_entry_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
) peevf_basis on peevf_basis.element_entry_id=peef.element_entry_id and element_info.input_value_id_tax_basis=peevf_basis.input_value_id
-
left join (
-
select input_value_id, element_entry_id, screen_entry_value
-
from pay_element_entry_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
) peevf_PayPrev on peevf_PayPrev.element_entry_id=peef.element_entry_id and element_info.input_value_id_Tax_PayPrev=peevf_PayPrev.input_value_id
-
left join (
-
select input_value_id, element_entry_id, screen_entry_value
-
from pay_element_entry_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
) peevf_Prev on peevf_Prev.element_entry_id=peef.element_entry_id and element_info.input_value_id_Tax_Prev=peevf_Prev.input_value_id
-
left join (
-
select input_value_id, element_entry_id, screen_entry_value
-
from pay_element_entry_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
) peevf_Refundable on peevf_Refundable.element_entry_id=peef.element_entry_id and element_info.input_value_id_Tax_Refundable=peevf_Refundable.input_value_id
-
left join (
-
select input_value_id, element_entry_id, screen_entry_value
-
from pay_element_entry_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
) peevf_Authority on peevf_Authority.element_entry_id=peef.element_entry_id and element_info.input_value_id_Tax_Authority=peevf_Authority.input_value_id
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
--************LINE TO REMOVE DATA ERRORS
-
--****THESE ARE TERMINATED EMPLOYEES WITH MUTIPLE PAYE Details records
-
--****This causes duplicates so PAYE Details (Tax Code and Tab Basis) not looked up
-
and assignment_id not in (44440,15770,17709,46897,47089,34241,23694,31847,44522)
-
--******END OF DATA ERROR REMOVAL LINES
-
) ev_pd on ev_pd.assignment_id=paaf.assignment_id
-
left join (
-
select
-
peef.assignment_id,
-
peef.effective_start_date,
-
peef.effective_end_date,
-
peevf_cat.screen_entry_value as NI_Cat,
-
peevf_cert.screen_entry_value as NI_Cert,
-
peevf_pen.screen_entry_value as NI_Pension,
-
peevf_process.screen_entry_value as NI_Process
-
from pay_element_entries_f peef
-
inner join (
-
--This join will restrict element to NI only and look up all the ni input value codes
-
select /*+ NO_USE_NL(PIVF_PROCESS) */
-
petf.element_type_id,
-
pivf.input_value_id as input_value_id_cat,
-
pivf_cert.input_value_id as input_value_id_cert,
-
pivf_pen.input_value_id as input_value_id_pen,
-
pivf_process.input_value_id as input_value_id_process
-
from (
-
select *
-
from pay_element_types_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
and element_name like 'NI'
-
) petf
-
left join (
-
select *
-
from pay_input_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
and name like 'Category'
-
) pivf on pivf.element_type_id=petf.element_type_id
-
left join (
-
select *
-
from pay_input_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
and name like 'Certificate'
-
) pivf_cert on pivf_cert.element_type_id=petf.element_type_id
-
left join (
-
select *
-
from pay_input_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
and name like 'Pension'
-
) pivf_pen on pivf_pen.element_type_id=petf.element_type_id
-
left join (
-
select *
-
from pay_input_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
and name like 'Process Type'
-
) pivf_process on pivf_process.element_type_id=petf.element_type_id
-
) element_info on element_info.element_type_id=peef.element_type_id
-
left join (
-
select input_value_id, element_entry_id, screen_entry_value
-
from pay_element_entry_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
) peevf_cat on peevf_cat.element_entry_id=peef.element_entry_id and element_info.input_value_id_cat=peevf_cat.input_value_id
-
left join (
-
select input_value_id, element_entry_id, screen_entry_value
-
from pay_element_entry_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
) peevf_cert on peevf_cert.element_entry_id=peef.element_entry_id and element_info.input_value_id_cert=peevf_cert.input_value_id
-
left join (
-
select input_value_id, element_entry_id, screen_entry_value
-
from pay_element_entry_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
) peevf_pen on peevf_pen.element_entry_id=peef.element_entry_id and element_info.input_value_id_pen=peevf_pen.input_value_id
-
left join (
-
select input_value_id, element_entry_id, screen_entry_value
-
from pay_element_entry_values_f
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
) peevf_process on peevf_process.element_entry_id=peef.element_entry_id and element_info.input_value_id_process=peevf_process.input_value_id
-
where xxgceul_context_pkg.show_context_date ('Effective Date') between effective_start_date and effective_end_date
-
--************LINE TO REMOVE DATA ERRORS
-
--****This is employee number 66661 who has 2 NI elements live on 30-nov-2007
-
--****This causes duplicates so NI not looked up for this employee
-
and assignment_id not in (31847)
-
--******END OF DATA ERROR REMOVAL LINES
-
) ev_nic on ev_nic.assignment_id=paaf.assignment_id
-
left join (
-
SELECT
-
ffv.flex_value,
-
ffv.flex_value_meaning,
-
ffv.description,
-
101 as business_group_id
-
FROM apps.FND_FLEX_VALUES_VL ffv
-
left join apps.fnd_flex_value_sets ffvs ON ffvs.flex_value_set_id=ffv.flex_value_set_id
-
WHERE ffvs.flex_value_set_name='GC_PENSION_SCHEME'
-
AND ffv.enabled_flag='Y'
-
) pen_sch_des on pen_sch_des.flex_value = ppg.segment2
-
and pen_sch_des.business_group_id = paaf.business_group_id
-
left join (
-
SELECT
-
ffv.flex_value,
-
ffv.flex_value_meaning,
-
ffv.description,
-
4194 as business_group_id
-
FROM apps.FND_FLEX_VALUES_VL ffv
-
left join apps.fnd_flex_value_sets ffvs ON ffvs.flex_value_set_id=ffv.flex_value_set_id
-
WHERE ffvs.flex_value_set_name='GSP_PENSION_SCHEME'
-
AND ffv.enabled_flag='Y'
-
) pen_sch_des_gsp on pen_sch_des_gsp.flex_value = ppg.segment2
-
and pen_sch_des_gsp.business_group_id = paaf.business_group_id
-
) so_far
-
--WHERE so_far.business_group_id = nvl(so_far.business_group_id,apps.hr_general.get_business_group_id)
-
WHERE so_far.business_group_id = apps.hr_general.get_business_group_id
-
) so_far2
Search
mas Greenwich EUL
RJM Article Type
Quick Reference