SELECT A.SF_PMT_REF_NBR , A.COMMON_ID , A.STRM , A.INSTITUTION_SET , B.BUSINESS_UNIT , A.CURRENCY_CD , A.CR_CARD_DIGITS , -1 * (SUM(E.PAYOUT_AMT)) ,'N' FROM PS_SF_PAYMENT A , PS_BUS_UNIT_TBL_SF B , PS_ISET_BU_DTL C , PS_INSTITUTION_SET D , PS_SF_PAYMENT_DTL E WHERE A.INSTITUTION_SET <> ' ' AND C.INSTITUTION_SET = A.INSTITUTION_SET AND C.BUSINESS_UNIT = B.BUSINESS_UNIT AND B.SF_ENABLE_WEB_PAY = 'Y' AND D.INSTITUTION_SET = C.INSTITUTION_SET AND D.SF_ALLOW_EXCESS = 'Y' AND A.SF_PMT_REF_NBR = E.SF_PMT_REF_NBR AND A.SEQNUM = E.SEQNUM AND B.BUSINESS_UNIT = E.BUSINESS_UNIT AND A.SA_ID_TYPE = 'P' AND (A.SF_PAYMENT_STATUS = 'S' OR A.SF_PAYMENT_STATUS = 'A' OR A.SF_PAYMENT_STATUS = 'B') AND A.SF_POST_STATUS <> 'S' AND A.CR_CARD_TRANS_SRC = 'P' AND C.PRIORITY <> ( SELECT MIN(X.PRIORITY) FROM PS_ISET_BU_DTL X , PS_BUS_UNIT_TBL_SF Y WHERE X.INSTITUTION_SET = C.INSTITUTION_SET AND X.BUSINESS_UNIT = Y.BUSINESS_UNIT AND Y.SF_ENABLE_WEB_PAY = 'Y') GROUP BY A.SF_PMT_REF_NBR , A.COMMON_ID , A.CURRENCY_CD, A.CR_CARD_DIGITS , A.STRM, A.INSTITUTION_SET , B.BUSINESS_UNIT
|