解决方案: |
情况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:凭证本身错误(数据库损坏造成数据错误或外部数据导入时未做平衡和辅助核算的检查)
可通过取消审核重新审核的方法找到错误凭证,进行进一步的修改
以上方法有时要结合在一起灵活使用,不要孤立的认为一方治百病。同时处理后都要恢复记帐,重新记帐,方可判断是否正确。
|