SELECT DISTINCT C.OPRID ,B.PAY_ENTITY ,A.EMPLID ,P.NAME ,P.LAST_NAME_SRCH FROM PS_GP_PYE_PRC_STAT A , PS_GPGB_EE_RSLT B , PS_PERSON_NAME P , PS_GP_OPR_RULE_PRF C WHERE A.EMPLID = B.EMPLID AND A.EMPLID = P.EMPLID AND A.EMPL_RCD=B.EMPL_RCD AND A.CAL_RUN_ID = B.CAL_RUN_ID AND A.GP_PAYGROUP=B.GP_PAYGROUP AND A.PRD_TYPE <> 'H' AND A.CALC_TYPE = 'P' AND B.CAL_RUN_ID IN ( SELECT A1.CAL_RUN_ID FROM PS_GP_CAL_RUN A1 WHERE A1.RUN_FINALIZED_IND = 'Y' AND A1.USE_AS_TMPLT_IND='N' AND (C.USED_BY= 'A'OR (C.USED_BY = 'C' AND A1.COUNTRY = C.COUNTRY)) ) AND B.GP_PAYGROUP IN ( SELECT PG1.GP_PAYGROUP FROM PS_GP_PYGRP PG1 , PS_GP_PYENT PE WHERE (PG1.PAY_ENTITY=PE.PAY_ENTITY AND PE.COUNTRY=C.COUNTRY) OR (PG1.PAY_ENTITY=PE.PAY_ENTITY AND C.USED_BY='A') ) AND NOT EXISTS ( SELECT 'x' FROM PS_GPGB_PPR_P45CHK CHK WHERE CHK.EMPLID= B.EMPLID AND CHK.EMPL_RCD=B.EMPL_RCD AND CHK.CAL_RUN_ID=B.CAL_RUN_ID AND CHK.RSLT_SEG_NUM=B.RSLT_SEG_NUM AND CHK.GP_PAYGROUP=B.GP_PAYGROUP AND CHK.CAL_ID=B.CAL_ID)
|