解决方案: |
在核销制单时出现借贷方不平,请先取消核销。
作好数据备份后用以下语句进行调整,由于数据存在不匹配的错误,调整后如再取消以前单据核销或查看期初发票可能会出现相关提示:
'内部错误 No Find ' 或 ‘所查看单据不存在,可能其他人已将该单据删除,请执行刷新功能。’
该提示不会影响以后相关操作及数据的正确性。*/
update ap_detail
set ap_detail.cinvcode=b.cinvcode
from ap_detail join ap_detail b on ap_detail.ccovouchtype=b.cvouchtype and ap_detail.ccovouchid=b.cvouchid and ap_detail.cdwcode=b.cdwcode and ap_detail.ibvid=b.ibvid
where ap_detail.cvouchtype='48' and ap_detail.iperiod<>0 and ap_detail.ccovouchtype='26' and b.iperiod=0
and ap_detail.ccovouchid inselect cvouchid from ap_detail where cvouchtype='26' and iperiod=0 group by cvouchid
update ap_detail
set ibvid=null
where iperiod='0' and cvouchtype='26'
update ap_detail
set cvouchid=stuffcvouchid,1,1,9,ccovouchid=stuffccovouchid,1,1,9
where iperiod='0' and cvouchtype='26'
update ap_detail
set ccovouchid=stuffccovouchid,1,1,9
where cvouchtype='48' and yeardvouchdate='2001' and iperiod<>0 and ccovouchtype='26'
update salebillvouchs
set salebillvouchs.imoneysum=salebillvouchs.imoneysum-ap_detail.icamount,salebillvouchs.iexchsum=salebillvouchs.iexchsum-ap_detail.icamount
from salebillvouchs join salebillvouch on salebillvouchs.sbvid=salebillvouch.sbvid join ap_detail on ap_detail.ibvid=salebillvouchs.autoid and rightap_detail.ccovouchid,9=rightsalebillvouch.csbvcode,9
where ap_detail.cvouchtype='48' and yearap_detail.dvouchdate='2001' and ap_detail.iperiod<>0 and ap_detail.ccovouchtype='26' and ap_detail.cdwcode<>salebillvouch.ccuscode and salebillvouch.cvouchtype='26'
update ap_detail
set ibvid=null
where cvouchtype='48' and yeardvouchdate='2001' and iperiod<>0 and ccovouchtype='26' |