SELECT a.business_unit , a.voucher_id , a.invoice_id , a.invoice_dt , a.vendor_setid , a.vendor_id , a.vndr_loc , a.gross_amt , a.txn_currency_cd , a.oprid FROM PS_VOUCHER a , ps_em_buy_reg_tbl b , ps_em_agreement c , ps_set_cntrl_rec d WHERE a.vchr_src IN ('SSI','XML','DCM','EXL') AND a.business_unit = b.business_unit AND a.business_unit = d.setcntrlvalue AND d.recname = 'EM_AGREEMENT' AND d.rec_group_id = 'EM_01' AND d.setid = c.setid AND c.vendor_setid = a.vendor_setid AND c.vendor_id = a.vendor_id AND c.vndr_loc = a.vndr_loc UNION SELECT aa.business_unit , aa.voucher_id , aa.invoice_id , aa.invoice_dt , aa.vendor_setid , aa.vendor_id , aa.vndr_loc , aa.gross_amt , aa.txn_currency_cd , aa.oprid FROM ps_vchr_hdr_qv aa , ps_em_buy_reg_tbl bb , ps_em_agreement cc , ps_set_cntrl_rec dd WHERE aa.vchr_src IN ('SSI','XML','DCM','EXL') AND aa.business_unit = bb.business_unit AND aa.business_unit = dd.setcntrlvalue AND dd.recname = 'EM_AGREEMENT' AND dd.rec_group_id = 'EM_01' AND dd.setid = cc.setid AND cc.vendor_setid = aa.vendor_setid AND cc.vendor_id = aa.vendor_id AND cc.vndr_loc = aa.vndr_loc
|