账套版本:KIS专业版8.1结转损益后损益类科目还有余额

来源:www.nbjxsoft.cn   发布时间:2011/6/2 9:52:06   浏览次数:0


账套版本:KIS专业版8.1结转损益后损益类科目还有余额

问题是:

1、在结转损益时产生的凭证中,有部分科目本来挂核算项目,但是凭证是没有核算项目,所以过帐时提示科目缺少核算项目。
select * from t_itemdetail where fdetailid in (select fdetailid from t_itemdetailv where fitemid=-1)
and fdetailcount=1

select * from t_itemdetail where fdetailid in (select fdetailid from t_itemdetailv where fitemid=-1)
and fdetailcount=2

select fdetailid,* from t_account where fdetailid in (select fdetailid from t_itemdetail where
fdetailid in (select fdetailid from t_itemdetailv where fitemid=-1))

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
exec sp_cleanitemdetailv

--F2=-1 and f3=-1

select fdetailid from t_itemdetail where fdetailcount=2 and f2=-1 and f3=-1

update t_account
set Fdetailid =(select min(fdetailid) from t_itemdetail
   where fdetailid in (select Fdetailid from t_itemdetailv
                   where  fitemid=-1)
  and Fdetailcount=2 and F2=-1 and f3=-1)
where Fdetailid in (select (fdetailid) from t_itemdetail
  where fdetailid in (select Fdetailid from t_itemdetailv
                     where fitemid=-1)
  and Fdetailcount=2 and F2=-1 and f3=-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=2 and F2=-1 and f3=-1)
and Fdetailid <>(select min(fdetailid) from t_itemdetail
       where fdetailid in (select Fdetailid from t_itemdetailv
         where fitemid=-1)
        and Fdetailcount=2 and F2=-1 and f3=-1)

---f1=-1
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 )
--f2=-1
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 F2=-1 )
where Fdetailid in (select (fdetailid) from t_itemdetail
  where fdetailid in (select Fdetailid from t_itemdetailv
                     where fitemid=-1)
  and Fdetailcount=1 and F2=-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 F2=-1 )
and Fdetailid <>(select min(fdetailid) from t_itemdetail
       where fdetailid in (select Fdetailid from t_itemdetailv
         where fitemid=-1)
        and Fdetailcount=1 and F2=-1 )
--f3=-1
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 F3=-1 )
where Fdetailid in (select (fdetailid) from t_itemdetail
  where fdetailid in (select Fdetailid from t_itemdetailv
                     where fitemid=-1)
  and Fdetailcount=1 and F3=-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 F3=-1 )
and Fdetailid <>(select min(fdetailid) from t_itemdetail
       where fdetailid in (select Fdetailid from t_itemdetailv
         where fitemid=-1)
        and Fdetailcount=1 and F3=-1 )
--f4=-1
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 F4=-1 )
where Fdetailid in (select (fdetailid) from t_itemdetail
  where fdetailid in (select Fdetailid from t_itemdetailv
                     where fitemid=-1)
  and Fdetailcount=1 and F4=-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 F4=-1 )
and Fdetailid <>(select min(fdetailid) from t_itemdetail
       where fdetailid in (select Fdetailid from t_itemdetailv
         where fitemid=-1)
        and Fdetailcount=1 and F4=-1 )
--f8=-1
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 F8=-1 )
where Fdetailid in (select (fdetailid) from t_itemdetail
  where fdetailid in (select Fdetailid from t_itemdetailv
                     where fitemid=-1)
  and Fdetailcount=1 and F8=-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 F8=-1 )
and Fdetailid <>(select min(fdetailid) from t_itemdetail
       where fdetailid in (select Fdetailid from t_itemdetailv
         where fitemid=-1)
        and Fdetailcount=1 and F8=-1 )


exec sp_cleanitemdetailv

2、结转损益并过账后,部分损益类二级科目有余额,没有结转平衡。
--查找余额表中有没有非法的fdetailid
select * from t_balance
         where fdetailid not in (select fdetailid from t_itemdetail)
--删除非法的fdetailid
delete from t_balance
where fdetailid not in (select fdetailid from t_itemdetail)
查找数量余额表中有没有非法的fdetailid

select * from t_quantitybalance
where fdetailid not in (select fdetailid from t_itemdetail)
查找损益类图目实际发生额表中有没有非法的fdetailid

select * from t_profitandloss
where fdetailid not in (select fdetailid from t_itemdetail)
删除损益类图目实际发生额表中有没有非法的fdetailid

delete from t_profitandloss
where fdetailid not in (select fdetailid from t_itemdetail)


 上一条新闻:处理结转新帐套后往来业务数据丢失
 下一条新闻:安装金蝶专业版系列出现组件错误或者组件服务不启动解决办法
[打印本文]  [返回服务中心]  [关闭窗口]
友情链接:

宁波金蝶软件有限公司 2006 版权所有 浙ICP备16034465号-2 销售服务电话:15957871790
地址(ADD):浙江省宁波市 网址:www.nbjxsoft.cn
Copyright 2006 Auto Parts All Right Reserved