SELECT D.OPRID , A.VENDOR_SETID , B.VENDOR_ID , A.BUSINESS_UNIT , A.PO_ID , A.PO_DT , B.VENDOR_NAME_SHORT , B.NAME1 , SUM(C.MERCHANDISE_AMT) , A.CURRENCY_CD FROM PS_PO_HDR_FS A , PS_VENDOR B , PS_PO_LINE_SHIP_FS C , PS_VENDOR_USER D WHERE A.VENDOR_SETID = B.SETID AND A.VENDOR_ID = B.VENDOR_ID AND ((A.PO_STATUS IN ('D','X','PX')) OR ((A.CHNG_ORD_BATCH > 0) AND (A.PO_STATUS IN ('D','X','PX'))) OR ((A.PO_STATUS = 'C') AND (A.MATCH_ACTION = 'N') AND (EXISTS ( SELECT 'X' FROM PS_OPR_DEF_TBL_AP E WHERE E.OPRID = D.OPRID AND E.AUTH_CPY_MTCH_PO = 'Y')))) AND A.ERS_ACTION = 'N' AND A.MATCH_STATUS_PO IN ('T','P','N') AND A.IN_PROCESS_FLG = 'N' AND A.MID_ROLL_STATUS = 'N' AND A.CC_USE_FLAG IN ('N',' ') AND A.BUSINESS_UNIT = C.BUSINESS_UNIT AND A.PO_ID = C.PO_ID AND C.MATCH_STATUS_LN_PO IN ('N', 'P') AND D.SETID = A.VENDOR_SETID AND D.VENDOR_ID = A.VENDOR_ID AND C.CANCEL_STATUS <> 'X' GROUP BY D.OPRID, A.VENDOR_SETID, B.VENDOR_NAME_SHORT, B.VENDOR_ID, B.NAME1, A.BUSINESS_UNIT, A.PO_ID, A.PO_DT, A.CURRENCY_CD
|