📄 cwfx_costcompare.txt
字号:
--@Curr_date1,@Curr_date2 为当前时间段 @Comp_date1,@Comp_date2为比较期时间段
CREATE PROCEDURE dbo.cwfx_CostCompare @CY int,@CM1 int,@CM2 int,@CmpY int,@CmpM1 int,@CmpM2 int
AS
declare @ccode varchar(15),@Cname varchar(40),@Curr_V money,@Comp_V money
--@Curr_V money, 本期发生,@Comp_V money 比较期发生
BEGIN
if exists (select 1 from tempdb.dbo.sysobjects where name='##temp')
drop table ##temp
create table ##temp(Ccode varchar(15),Cname varchar(40),Curr_V money,Comp_V money)
declare Analysis_Cursor cursor for
Select CCode From cwfx_BaseProjSet where Account='成本' order by ccode
open Analysis_Cursor
fetch next from Analysis_Cursor into @ccode
while (@@FETCH_STATUS = 0)
begin
select @Cname=Cname from cwzz_Acccode where ccode=@CCode
set @Curr_V=0
set @Comp_V=0
select @Curr_V=sum(mdje) from cwzz_AccSum where ccode=@ccode and year=@cy and period between @cm1 and @cm2
select @Comp_V=sum(mdje) from cwzz_AccSum where ccode=@ccode and year=@CmpY and period between @CmpM1 and @CmpM2
insert into ##temp values(@Ccode,@Cname,@Curr_V,@Comp_V)
fetch next from Analysis_Cursor into @ccode
end
close Analysis_Cursor
deallocate Analysis_Cursor
--select * from ##temp
--drop table ##temp
END
GO
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -