U6普及版3.1 plus1科目汇总打印U6普及版3.1 plus1科目汇总打印
U6普及版3.1 plus1-科目汇总打印
自动编号: | 19004 | 产品版本: | U6普及版3.1 plus1 | 产品模块: | 总账 | 所属行业: | 通用 | 适用产品: | 809 | 关 键 字: | | 问题名称: | 科目汇总打印 | 问题现象: | 科目下级科目较多,有时需要汇总打印至上一级,有时需要汇总打印至一级科目,有时不汇总打印,在科目中改工作量极大! | 原因分析: | 现在还没有工具,你可以在数据库中分情况按照以下语句执行,操作前请备份好数据! --不汇总 update code set cgather=null --末级汇总到一级 declare @lenth as int set @lenth=(select left(codingrule,1) from gradedef where keyword='code') update code set cgather=left(ccode,@lenth) where igrade<>1 --末级汇总到上一级(中间级汇总到上一级等没有意义) declare @ccode as nvarchar(1000) declare @newccode as nvarchar(1000) declare @igrade as int declare @lenth as int DECLARE TST_CURSOR CURSOR FOR SELECT ccode,igrade FROM code where bend=1 and igrade>1 ORDER BY ccode OPEN TST_CURSOR FETCH NEXT FROM TST_CURSOR into @ccode,@igrade WHILE @@FETCH_STATUS = 0 BEGIN set @lenth=(select right(left(codingrule,@igrade),1) from gradedef where keyword='code') set @newccode=(select left(ccode,len(ccode)-@lenth) from code where ccode=@ccode) update code set cgather=@newccode where ccode=@ccode FETCH NEXT FROM TST_CURSOR into @ccode,@igrade END CLOSE TST_CURSOR DEALLOCATE TST_CURSOR
| 解决方案: | 现在还没有工具,你可以在数据库中分情况按照以下语句执行,操作前请备份好数据! --不汇总 update code set cgather=null --末级汇总到一级 declare @lenth as int set @lenth=(select left(codingrule,1) from gradedef where keyword='code') update code set cgather=left(ccode,@lenth) where igrade<>1 --末级汇总到上一级(中间级汇总到上一级等没有意义) declare @ccode as nvarchar(1000) declare @newccode as nvarchar(1000) declare @igrade as int declare @lenth as int DECLARE TST_CURSOR CURSOR FOR SELECT ccode,igrade FROM code where bend=1 and igrade>1 ORDER BY ccode OPEN TST_CURSOR FETCH NEXT FROM TST_CURSOR into @ccode,@igrade WHILE @@FETCH_STATUS = 0 BEGIN set @lenth=(select right(left(codingrule,@igrade),1) from gradedef where keyword='code') set @newccode=(select left(ccode,len(ccode)-@lenth) from code where ccode=@ccode) update code set cgather=@newccode where ccode=@ccode FETCH NEXT FROM TST_CURSOR into @ccode,@igrade END CLOSE TST_CURSOR DEALLOCATE TST_CURSOR
温馨提示:如果您的问题还没有解决,欢迎进入用友云基地。 |
|