问题现象: |
总帐,科目设置为辅助核算后,在当年使用中都完全正常,但在结转到新一年帐后,部分辅助核算的期初余额与总帐期初不平,把辅助余额都删除完后,总帐中仍有余额,除非把辅助核算去掉后,才能删除总账余额,重新录入辅助余额才能正确,如少可照此办法,但多的话,该怎么办?请问该问题是什么原因造成? |
解决方案: |
情况1:此现象在U8下有时会出现,是已使用科目再增加下级科目时会出现。用如下语句可判断科目表非末级科目的末级标志错误
select * from FROM [code] where exists(SELECT * FROM [code] v where code.ccode=left(ccode,len(code.ccode)) and code.ccode<>ccode ) and bend<>0
修改语句
update code set bend=0 FROM [code] where exists(SELECT * FROM [code] v where code.ccode=left(ccode,len(code.ccode)) and code.ccode<>ccode ) and bend<>0
科目表末级科目的末级标志错误
select * FROM [code] where not exists(SELECT * FROM [code] v where code.ccode=left(ccode,len(code.ccode)) and code.ccode<>ccode ) and bend<>1
修改语句
update code set bend=1 FROM [code] where not exists(SELECT * FROM [code] v where code.ccode=left(ccode,len(code.ccode)) and code.ccode<>ccode ) and bend<>1
情况2:总帐表或辅助总帐表有数据丢失
总账表中按科目划分有且只能由12条记录,每月一条记录
SELECT [ccode]FROM [GL_accsum]group by [ccode]having count([i_id])<12
辅助总账表中按科目和辅助项划分有且只能由12条记录,每月一条记录
SELECT [ccode], [cdept_id], [cperson_id], [ccus_id], [csup_id], [citem_class], [citem_id] FROM [GL_accass] group by [ccode], [cdept_id], [cperson_id], [ccus_id], [csup_id], [citem_class], [citem_id] having count([i_id])<12
如果发现此现象请手工添加丢失的记录
情况3:总帐表或辅助总帐表记录重复(accesss升级到SQL后有时出现)
删除总账表中的冗余数据
delete [GL_accsum] from [GL_accsum] as v where not exists(SELECT * FROM [GL_accsum] as a where [iperiod] between 1 and 12 group by [ccode],[iperiod] having min([i_id])= [v].[i_id])
删除辅助总账表中的冗余数据
delete [GL_accass] from [GL_accass] v where not exists(SELECT * FROM [GL_accass] where [iperiod] between 1 and 12 group by [ccode], [cdept_id], [cperson_id], [ccus_id], [csup_id], [citem_class], [citem_id],[iperiod] having min([i_id])=v.[i_id])
情况4:凭证本身错误(数据库损坏造成数据错误或外部数据导入时未做平衡和辅助核算的检查)
可通过取消审核重新审核的方法找到错误凭证,进行进一步的修改
以上方法有时要结合在一起灵活使用,不要孤立的认为一方治百病。同时处理后都要恢复记帐,重新记帐,方可判断是否正确。
|