当前位置:首页 > 用友交流 > 畅捷通T+ > 正文内容

厦门用友软件 畅捷通T+辅助明细账,辅助是一样的,但是跨年度查询就没有数据,数据不全

xmyonyou1年前 (2023-09-12)畅捷通T+1223

备份账套  执行以下语句

2_科目整理科目对照关系表数据-通用.zip


declare @debugger varchar(50)

if object_id(N'AA_BackUp',N'U') is null

select * into AA_BackUp from AA_AccountAssociation --删除科目对照表数据前备份

--if(@debugger='test')

--begin

-- insert into AA_AccountAssociation(idcurrentaccountingyear,createdtime,sequencenumber,idcurrentaccountDTO,idpreaccountDTO,preaccountingyear) 

-- select id,code,name,currentaccountingyear,createdtime,sequencenumber,idcurrentaccountDTO,idpreaccountDTO,preaccountingyear from AA_BackUp

--end


--修复12.1 AccountAssociation


declare @StartYear int 

declare @EndYear int 

select @StartYear=2011

select @EndYear=2022

delete AA_AccountAssociation where currentaccountingyear  between @StartYear and @EndYear  --删除科目对照表数据 

declare @TempAccount table(Code varchar(100),Num int) 

declare @AllCount int 

declare @NowCount int 

--查出所有科目CODE 

insert into @TempAccount(Code,Num) select code,ROW_NUMBER() over(order by code) as Num from aa_account  group by code

set @AllCount=(select count(*) from @TempAccount) 


 --循环科目CODE 

declare @differYear int;

set @differYear=@EndYear;

while @StartYear<=@EndYear

begin 

set @NowCount=1

while(@NowCount<=@AllCount) 

begin 

declare @TempCode varchar(20) 

select @TempCode=Code from @TempAccount where num=@NowCount 

declare @PreAccountID varchar(50) 

declare @CurAccountID varchar(50) 

select @CurAccountID=id from AA_Account where code=@TempCode and accountingyear=@EndYear

select @PreAccountID=id from AA_Account where code=@TempCode and accountingyear=@differYear

if(@PreAccountID!='' and @CurAccountID!='') 

insert into AA_AccountAssociation(currentaccountingyear,idcurrentaccountDTO,idpreaccountDTO,preaccountingyear)

values

(@EndYear,@CurAccountID,@PreAccountID,@differYear) 

set @NowCount=@NowCount+1 

set @PreAccountID='' 

set @CurAccountID='' 

end 

set @differYear=@differYear-1

if(@differYear<@StartYear)

BEGIN

set @EndYear=@EndYear-1

set @differYear=@EndYear

END

end


扫描二维码推送至手机访问。

版权声明:本文由用友畅捷通软件维护服务社区--厦门用友软件发布,如需转载请注明出处。

本文链接:https://xmyonyou.cn/post/104.html

分享给朋友:

“厦门用友软件 畅捷通T+辅助明细账,辅助是一样的,但是跨年度查询就没有数据,数据不全” 的相关文章