SELECT A.EMPLID , A.EMPL_RCD , C.ACM_FROM_DT , C.ACM_THRU_DT , B.CAL_RUN_ID , C.GP_PAYGROUP , B.CAL_ID , B.ORIG_CAL_RUN_ID , C.RSLT_SEG_NUM , C.EMPL_RCD_ACUM , C.SLICE_BGN_DT , C.SLICE_END_DT , C.USER_KEY1 , D.SERVICE_DT FROM PS_GP_PYE_PRC_STAT A , PS_GP_PYE_SEG_STAT B , PS_GP_RSLT_ACUM C , PS_GP_PIN E , PS_EMPLOYMENT D , PS_JOB Z WHERE A.PRC_ORD_TS = ( SELECT MAX(F.PRC_ORD_TS) FROM PS_GP_PYE_PRC_STAT F ,PS_GP_CAL_RUN G WHERE F.CALC_TYPE='P' AND F.EMPLID=A.EMPLID AND F.EMPL_RCD=A.EMPL_RCD AND G.CAL_RUN_ID=F.CAL_RUN_ID ) AND A.CALC_TYPE = 'P' AND B.RSLT_SEG_NUM = ( SELECT MAX(H.RSLT_SEG_NUM) FROM PS_GP_PYE_SEG_STAT H WHERE H.EMPLID=B.EMPLID AND H.CAL_RUN_ID=B.CAL_RUN_ID AND H.EMPL_RCD=B.EMPL_RCD AND H.GP_PAYGROUP=B.GP_PAYGROUP AND H.CAL_ID=B.CAL_ID AND H.ORIG_CAL_RUN_ID=B.ORIG_CAL_RUN_ID ) AND A.EMPLID=B.EMPLID AND A.EMPLID=D.EMPLID AND A.EMPL_RCD=D.EMPL_RCD AND A.CAL_RUN_ID=B.CAL_RUN_ID AND A.EMPL_RCD=B.EMPL_RCD AND A.GP_PAYGROUP=B.GP_PAYGROUP AND A.CAL_ID=B.CAL_ID AND A.ORIG_CAL_RUN_ID=B.ORIG_CAL_RUN_ID AND B.EMPLID=C.EMPLID AND B.CAL_RUN_ID=C.CAL_RUN_ID AND B.EMPL_RCD=C.EMPL_RCD AND B.GP_PAYGROUP=C.GP_PAYGROUP AND B.CAL_ID=C.CAL_ID AND B.ORIG_CAL_RUN_ID=C.ORIG_CAL_RUN_ID AND B.RSLT_SEG_NUM=C.RSLT_SEG_NUM AND (C.EMPL_RCD = C.EMPL_RCD_ACUM OR C.ACM_TYPE = 'N') AND C.CALC_RSLT_VAL > 0 AND E.PIN_CODE IN ('VAC ANIV_SALDO MEX','VAC ANIV_DEVNG MEX','VAC ANIV_AJUST MEX','VAC ANIV_AUSEN MEX') AND E.PIN_NUM=C.PIN_NUM AND Z.EMPLID=A.EMPLID AND Z.EMPL_RCD = A.EMPL_RCD AND Z.EFFDT = ( SELECT MAX(ZZ.EFFDT) FROM PS_JOB ZZ WHERE ZZ.EMPLID = Z.EMPLID AND ZZ.EMPL_RCD = Z.EMPL_RCD AND ZZ.EFFDT <= %CurrentDateIn) AND Z.EFFSEQ = ( SELECT MAX(EFFSEQ) FROM PS_JOB S WHERE S.EMPLID = Z.EMPLID AND S.EMPL_RCD = Z.EMPL_RCD AND S.COMPANY = Z.COMPANY AND S.EFFDT = Z.EFFDT) GROUP BY A.EMPLID, B.CAL_RUN_ID, A.EMPL_RCD, C.GP_PAYGROUP, B.CAL_ID, B.ORIG_CAL_RUN_ID, C.RSLT_SEG_NUM, C.EMPL_RCD_ACUM, C.ACM_FROM_DT, C.ACM_THRU_DT, C.SLICE_BGN_DT, C.SLICE_END_DT, C.USER_KEY1, D.SERVICE_DT
|