问题描述:凭证无法过账、账薄报表无法查询、无法结转损益、结转损益之后无法过账或结账时提示仍有余额,提示:在结果列中多次出现F1,名称或代码已存在等。
问题原因:一般是fdetailcount 数目不对或者相同的核算项目组合出现重复
解决思路或办法:
备份账套后请参考如下语句处理:
Use AIS2009###### --(指问题账套的账套号)
Exec sp_cleanitemdetailv--横表生成纵表的存储结构
Update a set a.fdetailcount=b.Fcount from t_itemdetail a join(select Fdetailid,count(Fitemid) Fcount from t_itemdetailv where fitemid<>0 group by Fdetailid) b on a.fdetailid=b.fdetailid--更新fdetailcount
Exec sp_cleanitemdetailv--重新生成纵表
Update t_account set Fdetailid =(select min(fdetailid) from t_itemdetail where fdetailid in (select Fdetailid from t_itemdetailv where fitemid=-1) and Fdetailcount=1 and F1=-1 ) where Fdetailid in (select (fdetailid) from t_itemdetail where fdetailid in (select Fdetailid from t_itemdetailv where
fitemid=-1) and Fdetailcount=1 and F1=-1 ) delete from t_itemdetail where Fdetailid in(select (fdetailid) from t_itemdetail where fdetailid in (select Fdetailid from t_itemdetailv where fitemid=-1) and Fdetailcount=1 and F1=-1 ) and Fdetailid <>(select min(fdetailid) from t_itemdetail where
fdetailid in (select Fdetailid from t_itemdetailv where fitemid=-1) and Fdetailcount=1 and F1=-1 )
Exec sp_cleanitemdetailv--重新生成纵表
Delete from t_balance where fdetailid not in (select fdetailid from t_itemdetail)
Delete from t_quantitybalance where fdetailid not in (select fdetailid from t_itemdetail)
Delete from t_profitandloss where fdetailid not in (select fdetailid from t_itemdetail)
过账后重新过账。
如果报错提示列名出现在其他列时,需要将F1 修改为报错的列名。
适用版本:KIS专业版系列