解决方案: |
因为SALEBILLVOUCHS表中的科目与AP_DEATIL中科目不一致,造成预收冲应收时,原始单据中的科目与预收科目一致, 不能制单.附件为更新脚本.
--检查原始发票表和AP_DETAIL科目不一致,而AP_DETAIL中的科目与发票制单的科目一致
select c.cdwcode,c.cvouchtype,c.cvouchid,b.cincomesub,c.ccode from salebillvouch a inner join salebillvouchs b on a.sbvid=b.sbvid
inner join ap_detail c on b.autoid =c.ibvid
inner join gl_accvouch d on c.cpzid=d.coutno_id
where c.cflag='ar'
and cprocstyle like '2%'
and b.cincomesub<>c.ccode and d.md<>0
and d.ccode=c.ccode
--按AP_DETAIL中的制单科目更新原始的单据表中的科目.
update salebillvouchs
set cincomesub=c.ccode
from salebillvouch a inner join salebillvouchs b on a.sbvid=b.sbvid
inner join ap_detail c on b.autoid =c.ibvid
inner join gl_accvouch d on c.cpzid=d.coutno_id
where c.cflag='ar' and cprocstyle like '2%' and b.cincomesub<>c.ccode and d.md<>0
and d.ccode=c.ccode |