SELECT DISTINCT D.USERID , A.SETID , A.VENDOR_ID , A.VENDOR_NAME_SHORT , A.NAME1 FROM PS_VENDOR A , PS_VENDOR_PAY B , PS_PAYMENT_TBL C , PS_PYCYCL_SEL_LST D WHERE B.EMAIL_ADVICE = 'Y' AND A.SETID = B.SETID AND A.VENDOR_ID = B.VENDOR_ID AND C.REMIT_SETID = A.SETID AND C.REMIT_VENDOR = A.VENDOR_ID AND C.VNDR_LOC = B.VNDR_LOC AND C.bank_setid = D.bank_setid AND C.bank_cd = D.bank_cd AND C.bank_acct_key = D.bank_acct_key AND C.pymnt_method = D.pymnt_method AND C.pay_cycle = D.pay_cycle AND C.pay_cycle_seq_num = D.pay_cycle_seq_num AND C.STL_THROUGH = '02' AND C.PYMNT_TYPE <> 'Z' AND B.EFFDT = ( SELECT MAX(E.EFFDT) FROM PS_VENDOR_PAY E WHERE E.SETID = B.SETID AND E.VENDOR_ID = B.VENDOR_ID AND E.VNDR_LOC = B.VNDR_LOC AND E.EFF_STATUS = 'A') AND C.PYMNT_METHOD IN ( SELECT F.PYMNT_METHOD FROM PS_EMAIL_PAY_MTHD F WHERE F.SETID = B.SETID AND F.VENDOR_ID= B.VENDOR_ID AND F.VNDR_LOC = B.VNDR_LOC AND F.EFFDT = B.EFFDT AND F.SEQ_NUM = B.SEQ_NUM)
|