解决方案: |
因为SALEBILLVOUCHS表的IMONEYSUM与AP_DETAIL表的累计收款数据不符,用语句调整后可以使凭证平衡。
语句如下:
SELECT sum(icamount_f) as icamount_f,sum(icamount) as icamount,ibvid
INTO c
FROM Ap_Detail
WHERE (cFlag = ‘ar‘) AND (cCoVouchType IN (‘26‘, ‘27‘,‘28‘,‘29‘)) and icamount<>0 and icamount_f<>0 AND
(iFlag <> ‘5‘ or cprocstyle<>‘xj‘)
group by ibvid
update salebillvouchs
set iexchsum=0 , imoneysum=0
UPDATE salebillvouchs
SET salebillvouchs.iexchsum = c.icamount_f,
salebillvouchs.imoneysum = c.icamount
from salebillvouchs join c on c.ibvid = salebillvouchs.autoid
|