解决方案: |
凭证468、467、465、463在明细帐gl_accvouch与ap_detail中不符。 凭证线索号 ap_detail中sum(idamount)/gl_accvouch中sum(md) AR0000000003092 -91681.0000 -79215.1300 AR0000000003094 -38010.0000 -29796.3300 AR0000000003096 -69177.5000 -59865.5300 AR0000000003097 -84701.3000 -72298.4800 二者累计差额42394.33; 科目113103,9月份,在帐表查询中应收余额表借方为1546872.50; 在总帐中查询借方为1589266.83; 应收总帐中期初均为9434401.73,贷方均为619498.01,期末余额刚好差上借方之间的差额,且刚好等于所查不符凭证的借方差额,即42394.33=1589266.83-1546872.50。 查错语句供参考:
1、按凭证线索号分组汇总并插入临时表a,b;
select cpzid, sum(idamount) as a1,sum(icamount) as a2
into a
from ap_detail
where ccode='113103' and iperiod=9
group by cpzid
order by cpzid
select coutno_id,sum(md) as b1,sum(mc) as b2
into b
from gl_accvouch
where ccode='113103' and iperiod=9
and coutno_id in (select distinct cPZid from ap_detail where ccode='113103' and iperiod=9)
group by coutno_id
order by coutno_id
2、查询借方不等的记录上的凭证线索号
select cpzid from a join b on a.cpzid=b.coutno_id where a1<>b1
3、删除临时表
drop table a drop table b
从应收传递到总帐中的4张凭证上分录数变少,可删除重新生成凭证。 |