SELECT DISTINCT A.BUSINESS_UNIT , A.RECEIVER_ID , A.RECEIPT_DT , B.BUSINESS_UNIT_PO , B.PO_ID , D.PO_DT , A.VENDOR_SETID , C.VENDOR_ID , C.NAME1 , B.SHIPTO_ID , B.BILL_OF_LADING , A.CARRIER_ID , B.PRO_NUMBER , B.PACKSLIP_NO , A.ORIGIN , D.CURRENCY_CD FROM PS_RECV_HDR_FS A , PS_RCV_L_SH_PRO_VW B , PS_VENDOR C , PS_PO_HDR_FS D WHERE A.MATCH_STATUS_RECV IN ('T','P','N') AND (A.ERS_FLAG= 'N' OR A.ERS_FLAG = ' ') AND A.IN_PROCESS_FLG = 'N' AND A.BUSINESS_UNIT = B.BUSINESS_UNIT AND A.RECEIVER_ID = B.RECEIVER_ID AND A.VENDOR_SETID = C.SETID AND A.VENDOR_ID = C.VENDOR_ID AND B.RECV_LN_MATCH_OPT IN ('N','P') AND B.RECV_SHIP_STATUS IN ('R','O','M','C') AND b.QTY_SH_ACCPT_VUOM <> 0 AND B.BUSINESS_UNIT_PO = D.BUSINESS_UNIT AND B.PO_ID = D.PO_ID AND D.BUDGET_HDR_STATUS = 'V' AND D.BUDGET_HDR_STS_NP = 'V' AND D.CC_USE_FLAG IN ('N',' ') AND D.po_status IN ('D', 'X') AND EXISTS ( SELECT 'X' FROM PS_PO_LINE_DIST_FS E WHERE E.BUSINESS_UNIT = B.BUSINESS_UNIT_PO AND E.PO_ID = B.PO_ID AND E.LINE_NBR = B.LINE_NBR AND E.DST_ACCT_TYPE = 'DST' AND E.KK_CLOSE_FLAG <> 'Y') AND NOT EXISTS ( SELECT 'X' FROM PS_RECV_LN_SHIP_FS F WHERE F.BUSINESS_UNIT = A.BUSINESS_UNIT AND F.RECEIVER_ID = A.RECEIVER_ID AND F.SERIAL_CONTROL = 'Y' AND F.SERIAL_STATUS = 'I' AND F.RECV_SHIP_STATUS <> 'X' )
|