SELECT C.EMPLID , B.BUSINESS_UNIT_GL , A.BUSINESS_UNIT , A.PROJECT_ID , A.DESCR FROM PS_PROJECT A , PS_PC_INT_TMPL_GL B , PS_PERSONAL_DATA C WHERE A.EFF_STATUS = 'A' AND A.SUMMARY_PRJ = 'N' AND A.INTEGRATION_TMPL = B.INTEGRATION_TMPL AND EXISTS ( SELECT 'X' FROM PS_SET_CNTRL_REC WHERE RECNAME = 'PC_INT_TMPL_GL' AND SETCNTRLVALUE = A.BUSINESS_UNIT AND B.SETID = SETID ) AND ((A.ENFORCE_TYPE IN ('P', 'B') AND A.ENFORCE NOT IN ('N','T') AND EXISTS ( SELECT 'X' FROM PS_PROJECT_TEAM PT WHERE A.BUSINESS_UNIT = PT.BUSINESS_UNIT AND A.PROJECT_ID = PT.PROJECT_ID AND PT.TEAM_MEMBER_CLASS = 'L' AND PT.TEAM_MEMBER_IND = 'E' AND C.EMPLID = PT.TEAM_MEMBER )) OR (A.ENFORCE_TYPE IN ('N', 'X') AND NOT EXISTS ( SELECT 'X' FROM PS_PROJECT B WHERE A.BUSINESS_UNIT = B.BUSINESS_UNIT AND A.PROJECT_ID = B.PROJECT_ID AND (B.ENFORCE_TYPE IN ('P', 'B', 'R', 'S') AND B.ENFORCE IN ('Y', 'E', 'T')) AND B.BUSINESS_UNIT = A.BUSINESS_UNIT GROUP BY B.BUSINESS_UNIT HAVING COUNT(*) > 0 )) OR (A.ENFORCE_TYPE IN ('P', 'B') AND A.ENFORCE = 'T' AND NOT EXISTS ( SELECT 'X' FROM PS_PROJECT B WHERE A.BUSINESS_UNIT = B.BUSINESS_UNIT AND A.PROJECT_ID = B.PROJECT_ID AND (B.ENFORCE_TYPE IN ('N', 'X', 'R', 'S') AND B.ENFORCE IN ('Y', 'E', 'N')) AND B.BUSINESS_UNIT = A.BUSINESS_UNIT GROUP BY B.BUSINESS_UNIT HAVING COUNT(*) > 0)) OR (A.ENFORCE_TYPE IN ('R', 'S') AND EXISTS ( SELECT 'X' FROM PS_PGM_POOL_CACH PL WHERE A.BUSINESS_UNIT = PL.BUSINESS_UNIT AND A.PROJECT_ID = PL.PROJECT_ID AND C.EMPLID = PL.EMPLID )))
|