销售出库/采购入库--暂估单--财务单,以及暂估单和暂估冲回单,财务单和暂估冲回关联关系 sql语句原创
27人赞赏了该文章
442次浏览
编辑于2024年10月11日 11:29:38
可参考以下关联关系语句
应收
---销售出库单和下游暂估单关联关系 select * from T_AR_RECEIVABLE a inner join T_AR_RECEIVABLEENTRY b on a.fid=b.fid inner join T_AR_RECEIVABLEENTRY_LK c on c.fentryid=b.FENTRYID and FSTABLENAME='T_SAL_OUTSTOCKENTRY' inner join T_SAL_OUTSTOCKentry d on d.FENTRYID=c.FSID and d.fid=c.FSBILLID inner join T_SAL_OUTSTOCK e on e.fid=d.fid ---暂估应收和财务应收关联关系 select e.fdate,a.fbillno 财务应收,e.fbillno 暂估应收,* from T_AR_RECEIVABLE a ---财务单 inner join T_AR_RECEIVABLEENTRY b on a.fid=b.fid inner join T_AR_RECEIVABLEENTRY_lk c on c.FENTRYID=b.FENTRYID and c.FSTABLENAME='T_AR_RECEIVABLEENTRY' inner join T_AR_RECEIVABLEENTRY d on d.FENTRYID=c.FSID and d.FID=c.FSBILLID inner join T_AR_RECEIVABLE e on e.fid=d.fid ---暂估单 where a.FSETACCOUNTTYPE=3 and e.FSETACCOUNTTYPE=2 ---暂估应收和暂估红冲关联关系 select a.fbillno 红冲,d.fbillno 暂估, a.fbillno 冲回,* from T_AR_RECEIVABLE a ---冲回单 inner join T_AR_RECEIVABLEENTRY b on a.fid=b.fid inner join T_AR_RECEIVABLEENTRY c on c.FENTRYID=b.FSRCROWID inner join T_AR_RECEIVABLE d on d.fid=c.fid ---暂估单 where a.FBYVERIFY=2 and d.FBYVERIFY=0 ---财务应收和暂估红冲关联关系 select d.fbillno 财务单,a.fbillno 冲回单,* from T_AR_RECEIVABLE a ---冲回单 inner join T_AR_BILLINGMATCHLOGENTRY b on b.fid=a.FBILLMATCHLOGID and b.fsourcefromid='AR_RECEIVABLE' inner join T_AR_RECEIVABLEENTRY c on c.FENTRYID=b.FSRCROWID and c.fid=b.FSRCBILLID inner join T_AR_RECEIVABLE d on d.fid=c.fid ---财务单 where d.FSETACCOUNTTYPE=3 and a.FBYVERIFY=2
应付
---采购入库单和下游暂估单关联关系 select * from T_AP_PAYABLE a inner join T_AP_PAYABLEENTRY b on a.fid=b.fid inner join T_AP_PAYABLE_LK c on c.fentryid=b.FENTRYID and FSTABLENAME='T_STK_INSTOCKENTRY' inner join T_STK_INSTOCKENTRY d on d.FENTRYID=c.FSID and d.fid=c.FSBILLID inner join T_STK_INSTOCK e on e.fid=d.fid ---暂估应付和财务应付关联关系 select e.fdate,a.fbillno 财务应收,e.fbillno 暂估应付,* from T_AP_PAYABLE a ---财务单 inner join T_AP_PAYABLEENTRY b on a.fid=b.fid inner join T_AP_PAYABLE_lk c on c.FENTRYID=b.FENTRYID and c.FSTABLENAME='T_AP_PAYABLEENTRY' inner join T_AP_PAYABLEENTRY d on d.FENTRYID=c.FSID and d.FID=c.FSBILLID inner join T_AP_PAYABLE e on e.fid=d.fid ---暂估单 where a.FSETACCOUNTTYPE=3 and e.FSETACCOUNTTYPE=2 ---暂估应付和暂估红冲关联关系 select a.fbillno 红冲,d.fbillno 暂估, a.fbillno 冲回,* from T_AP_PAYABLE a ---冲回单 inner join T_AP_PAYABLEENTRY b on a.fid=b.fid inner join T_AP_PAYABLEENTRY c on c.FENTRYID=b.FSRCROWID inner join T_AP_PAYABLE d on d.fid=c.fid ---暂估单 where a.FBYVERIFY=2 and d.FBYVERIFY=0 ---财务应付和暂估红冲关联关系 select d.fbillno 财务单,a.fbillno 冲回单,* from T_AP_PAYABLE a ---冲回单 inner join T_AP_BILLINGMATCHLOGENTRY b on b.fid=a.FBILLMATCHLOGID and b.fsourcefromid='AP_PAYABLE' inner join T_AP_PAYABLEENTRY c on c.FENTRYID=b.FSRCROWID and c.fid=b.FSRCBILLID inner join T_AP_PAYABLE d on d.fid=c.fid ---财务单 where d.FSETACCOUNTTYPE=3 and a.FBYVERIFY=2
赞 27
27人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!