销售出库--暂估应收--财务应收单,以及暂估单和暂估冲回单关联关系 sql语句原创
23人赞赏了该文章
230次浏览
编辑于2024年04月24日 18:11:31
可参考以下关联关系语句
---销售出库单和下游暂估单关联关系 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 ---冲回单 left join T_AR_RECEIVABLEENTRY b on a.fid=b.fid left 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
推荐阅读