解决方案: |
问题1、从发票和其他应收单审核后写入到ap_detail表中的部门与发票和其他应收单上的部门不一致。
可以用下面语句查询出来错误的纪录。
--根据其他应收单生成的ap_detail
select a.cvouchtype,a.cvouchid,a.cdeptcode,b.cprocstyle,b.ccovouchid,b.cdeptcode
from (
select cvouchtype,cvouchid,cdeptcode from ap_vouch where cflag='ar')a
join
(select cprocstyle,ccovouchid,cdeptcode from ap_detail where cflag='ar')b
on a.cvouchtype=b.cprocstyle and a.cvouchid=b.ccovouchid
where a.cdeptcode<>b.cdeptcode
--根据发票生成的ap_detail
select ibvid, a.cdepcode,b.cdeptcode,cprocstyle
from (
select autoid,cdepcode from salebillvouch join salebillvouchs
on salebillvouch.sbvid=salebillvouchs.sbvid
)a
join
(select ibvid,cdeptcode,cprocstyle from ap_detail where cflag='ar')b
on a.autoid=b.ibvid
where a.cdepcode<>b.cdeptcode
|