select a.makevdate,a.summary,a.totalcredit,a.cent_typeid,c.accidname from fts_voucher a,fts_voucher_b b, bd_accid c where a.pk_voucher=b.pk_voucher and b.pk_account=c.pk_accid and a.cyear=2014 and a.datasource=2 --(6上收,2委託,5下撥,3到帳通知,0手工填制) and c.accidcode='011201'
不包括內部轉帳spa
從委託付款書 --少於上面的部分是委託付款是內部轉帳的,即bustype = 0 --1第一步內部付款,2第二步客商直接付款,0內部轉帳 .net
select a.accidname, n.auditdate, ne.purpose, n.company_r, n.totalamount, n.netpaystatus from fts_newpayment n, bd_accid a, fts_newpayment_b ne where n.pk_newpayment = ne.pk_newpayment and n.pk_account_p = a.pk_accid and n.bustype = 1 --bustype=1 第一步 and n.netpaystatus = 0 --0 成功,3人爲做廢空未提交,1支付失敗做廢 and substr(n.auditdate, 1, 4) = '2015' --年份 and a.accidcode = '010201' --分公司 order by n.auditdate