You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1795 lines
80 KiB

1 year ago
--<EFBFBD>ս<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if exists (select name from sysobjects where name='p_sys_day_over_plugin' and xtype='p')
drop procedure p_sys_day_over_plugin
go
create procedure p_sys_day_over_plugin
(
@orgcode varchar(10),
@accdate varchar(10),
@acctimes int,
@usercode varchar(10),
9 months ago
@overdaytype varchar(20),
1 year ago
@message varchar(200) out
)
as
declare @psmsg varchar(200)
begin
9 months ago
if @overdaytype = 'ODT_BLUESALE'
9 months ago
exec p_sys_day_over_plugin_bluesale @orgcode, @accdate
9 months ago
else
exec p_sys_day_over_plugin_acc @orgcode, @accdate
set @message = ''
return (1)
end
go
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD>
if exists (select name from sysobjects where name='p_sys_day_over_plugin_acc' and xtype='p')
drop procedure p_sys_day_over_plugin_acc
go
create procedure p_sys_day_over_plugin_acc
(
@orgcode varchar(10),
@accdate varchar(10)
)
as
begin
1 year ago
declare @irtnresult int
declare @srtnmsg varchar(200)
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ
1 year ago
exec @irtnresult = p_int_gen_flow_item @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD><EFBFBD><EFBFBD>۳ɱ<EFBFBD>
1 year ago
exec @irtnresult = p_int_gen_flow_chg @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--֧<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
1 year ago
exec @irtnresult = p_int_gen_flow_pay @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD>ֽ<EFBFBD><EFBFBD>ɴ<EFBFBD>
/*
1 year ago
exec @irtnresult = p_int_gen_flow_pay_cash @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
*/
--<EFBFBD><EFBFBD><EFBFBD>Ͳɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
exec @irtnresult = p_int_gen_accept @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD><EFBFBD><EFBFBD>Ͳɹ<EFBFBD><EFBFBD>˻<EFBFBD>
exec @irtnresult = p_int_gen_return @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD><EFBFBD>ʷ<EFBFBD><EFBFBD><EFBFBD>۵<EFBFBD><EFBFBD><EFBFBD>
exec @irtnresult = p_int_gen_buy_price_his @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>۵<EFBFBD><EFBFBD><EFBFBD>
exec @irtnresult = p_int_gen_buy_price_now @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
exec @irtnresult = p_int_gen_draw @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD><EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
exec @irtnresult = p_int_gen_scrap @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
exec @irtnresult = p_int_gen_damage @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD>̵<EFBFBD>
exec @irtnresult = p_int_gen_differ @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
exec @irtnresult = p_int_gen_dist @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
exec @irtnresult = p_int_gen_dist_return @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
exec @irtnresult = p_int_gen_dist_sale @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD><EFBFBD><EFBFBD>ͳɱ<EFBFBD>
exec @irtnresult = p_int_gen_dist_chg @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
exec @irtnresult = p_int_gen_out_trans @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
exec @irtnresult = p_int_gen_wh_sale @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD>
exec @irtnresult = p_int_gen_wh_chg @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
1 year ago
return (1)
end
9 months ago
go
9 months ago
--<EFBFBD><EFBFBD>¼<EFBFBD>ս<EFBFBD>
9 months ago
if exists (select name from sysobjects where name='p_sys_day_over_plugin_bluesale' and xtype='p')
drop procedure p_sys_day_over_plugin_bluesale
1 year ago
go
9 months ago
create procedure p_sys_day_over_plugin_bluesale
9 months ago
(
@orgcode varchar(10),
@accdate varchar(10)
)
as
begin
declare @irtnresult int
declare @srtnmsg varchar(200)
6 months ago
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ
exec @irtnresult = p_int_del_flow_item @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ
9 months ago
exec @irtnresult = p_int_gen_flow_item @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
6 months ago
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۳ɱ<EFBFBD>
exec @irtnresult = p_int_del_flow_chg @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۳ɱ<EFBFBD>
exec @irtnresult = p_int_gen_flow_chg @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
9 months ago
begin
6 months ago
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
exec @irtnresult = p_int_del_flow_pay @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
exec @irtnresult = p_int_gen_flow_pay @orgcode, @accdate, @srtnmsg out
if @irtnresult <> 1
begin
insert into t_over_error (orgcode, overdate, overtime, errreason)
values (@orgcode, @accdate, convert(varchar(10), getdate(), 24), @srtnmsg)
end
return (1)
end
go
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if exists (select name from sysobjects where name='p_int_del_flow_item' and xtype='p')
drop procedure p_int_del_flow_item
go
create procedure p_int_del_flow_item
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
declare @ywdat varchar(10)
declare @lastcomguid bigint
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
set @ywdat = replace(@psaccdate,'-','')
select @lastcomguid = isnull(max(COMGUID),0) from t_int_sap_drysalesinfo
4 months ago
where WERKS=@psorgcode and ZYWDAT=@ywdat and DATASTATUS = '2' and IFTYPE = 'F01' and ZJYFS in ('Z01','Z03')
6 months ago
if (@lastcomguid<>0)
begin
set @sql = 'insert into t_int_sap_drysalesinfo' +
' (CREATEDATE,IFTYPE,BUKRS,WERKS,ZSIGN,PRCTR,ZYWDAT,ZTYPE,ZCXLX,ZJYFS,' +
' VVTYP,MATNR,MENGE,MEINS,PRICE,SKTAK,SKTBT,TMWSTS,GTTAX,WAERS,ZTOLAMT,' +
' ZTSDAT,ZGZDAT,ZFNAME,ZUNFLG,ZYZLX,MWSKZ)' +
'select ''' + @createdate + ''' as CREATEDATE,IFTYPE,BUKRS,WERKS,ZSIGN,PRCTR,ZYWDAT,ZTYPE,ZCXLX,ZJYFS,' +
' VVTYP,MATNR,-MENGE,MEINS,-PRICE,-SKTAK,-SKTBT,-TMWSTS,-GTTAX,WAERS,-ZTOLAMT,' +
' ''' + @tsdat + ''' as ZTSDAT,ZGZDAT,ZFNAME,case when PRICE > 0 then ''Y'' else '''' end as ZUNFLG,ZYZLX,MWSKZ' +
' from t_int_sap_drysalesinfo' +
' where COMGUID=' + cast(@lastcomguid as varchar(50)) +
' and WERKS=''' + @psorgcode + ''' and ZYWDAT=''' + @ywdat + '''' +
' and IFTYPE = ''F01'' and ZJYFS in (''Z01'',''Z03'')'
exec(@sql)
if @@error <>0
9 months ago
begin
6 months ago
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>'
return(-1)
9 months ago
end
end
6 months ago
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_drysalesinfo
set DOCNO = 'XSD' + ZYWDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'F01' and ZJYFS in ('Z01','Z03') and DOCNO is null
set @psmsg = ''
return (1)
end
go
--<EFBFBD><EFBFBD><EFBFBD>Ϳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if exists (select name from sysobjects where name='p_int_del_flow_chg' and xtype='p')
drop procedure p_int_del_flow_chg
go
create procedure p_int_del_flow_chg
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
declare @ywdat varchar(10)
declare @lastcomguid bigint
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
set @ywdat = replace(@psaccdate,'-','')
select @lastcomguid = isnull(max(COMGUID),0) from t_int_sap_inventorychginfo
4 months ago
where WERKS=@psorgcode and ZYWDAT=@ywdat and DATASTATUS = '2' and IFTYPE = 'F11' and ZJYFS in ('Z01','Z03')
6 months ago
if (@lastcomguid<>0)
9 months ago
begin
6 months ago
set @sql = 'insert into t_int_sap_inventorychginfo' +
' (CREATEDATE,IFTYPE,BUKRS,ZSIGN,WERKS,PRCTR,ZYWDAT,ZTYPE,MATNR,ZJYFS,' +
' SLTWR,WEARS,MENGE,DWERT,MEINS,ZTSDAT,ZGZDAT,ZCSBS,ZYZLX,UNFLG)' +
'select ''' + @createdate + ''' as CREATEDATE,IFTYPE,BUKRS,ZSIGN,WERKS,PRCTR,ZYWDAT,ZTYPE,MATNR,ZJYFS,' +
4 months ago
' -SLTWR,WEARS,-MENGE,-DWERT,MEINS,''' + @tsdat + ''' as ZTSDAT,ZGZDAT,ZCSBS,ZYZLX,case when MENGE > 0 then ''Y'' else '''' end as UNFLG' +
6 months ago
' from t_int_sap_inventorychginfo' +
' where COMGUID=' + cast(@lastcomguid as varchar(50)) +
' and WERKS=''' + @psorgcode + ''' and ZYWDAT=''' + @ywdat + '''' +
' and IFTYPE = ''F11'' and ZJYFS in (''Z01'',''Z03'')'
exec(@sql)
if @@error <>0
9 months ago
begin
6 months ago
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۳ɱ<EFBFBD>ʧ<EFBFBD><EFBFBD>'
return(-1)
9 months ago
end
end
6 months ago
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_inventorychginfo
set DOCNO = 'XSC' + ZYWDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'F11' and ZJYFS in ('Z01','Z03') and DOCNO is null
set @psmsg = ''
return (1)
end
go
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if exists (select name from sysobjects where name='p_int_del_flow_pay' and xtype='p')
drop procedure p_int_del_flow_pay
go
create procedure p_int_del_flow_pay
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
declare @ywdat varchar(10)
declare @lastcomguid bigint
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
set @ywdat = replace(@psaccdate,'-','')
9 months ago
6 months ago
select @lastcomguid = isnull(max(COMGUID),0) from t_int_sap_paymentreportinfo
4 months ago
where KUNNR=@psorgcode and ZYYDAT=@ywdat and DATASTATUS = '2' and IFTYPE = 'Z01'
6 months ago
if (@lastcomguid<>0)
begin
set @sql = 'insert into t_int_sap_paymentreportinfo' +
' (CREATEDATE,IFTYPE,ZSIGN,ZTSDAT,BUKRS,PRCTR,KUNNR,' +
' SKART,ZYYDAT,WRBTR,WEARS,ZCXBS)' +
'select ''' + @createdate + ''' as CREATEDATE,IFTYPE,ZSIGN,''' + @tsdat + ''' as ZTSDAT,BUKRS,PRCTR,KUNNR,' +
' SKART,ZYYDAT,-WRBTR,WEARS,case when WRBTR > 0 then ''Y'' else '''' end as ZCXBS' +
' from t_int_sap_paymentreportinfo' +
' where COMGUID=' + cast(@lastcomguid as varchar(50)) +
' and KUNNR=''' + @psorgcode + ''' and ZYYDAT=''' + @ywdat + '''' +
' and IFTYPE = ''Z01'''
exec(@sql)
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽʧ<EFBFBD><EFBFBD>'
return(-1)
end
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_paymentreportinfo
set DOCNO = 'ZFD' + ZTSDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'Z01' and DOCNO is null
set @psmsg = ''
return (1)
9 months ago
end
9 months ago
go
1 year ago
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if exists (select name from sysobjects where name='p_int_gen_flow_item' and xtype='p')
drop procedure p_int_gen_flow_item
go
create procedure p_int_gen_flow_item
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @tablename varchar(40)
declare @where varchar(2000)
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
1 year ago
set @tablename = 't_plusale_'+substring(@psaccdate,1,4)+substring(@psaccdate,6,2)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
1 year ago
if not exists(select * from sysobjects where name=@tablename)
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڱ<EFBFBD>'+@tablename
return(-1)
end
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and sale.OrgCode = ''' + @psorgcode + ''''
end
set @sql = 'insert into t_int_sap_drysalesinfo' +
' (CREATEDATE,IFTYPE,BUKRS,WERKS,ZSIGN,PRCTR,ZYWDAT,ZTYPE,ZCXLX,ZJYFS,' +
' VVTYP,MATNR,MENGE,MEINS,PRICE,SKTAK,SKTBT,TMWSTS,GTTAX,WAERS,ZTOLAMT,' +
' ZTSDAT,ZGZDAT,ZFNAME,ZUNFLG,ZYZLX,MWSKZ)' +
'select ''' + @createdate + ''' as CREATEDATE,''F01'' as IFTYPE,FinaCode as BUKRS,OrgCode as WERKS,''1'' as ZSIGN,''P''+FinaCode+''1''+OrgCode as PRCTR,replace(AccDate,''-'','''') as ZYWDAT,''F01'' as ZTYPE,''Z30'' as ZCXLX,''Z01'' as ZJYFS,' +
' '''' as VVTYP,ClsCode as MATNR,Counts as MENGE,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,Amount as PRICE,Total as SKTAK,0 as SKTBT,TaxAmount as TMWSTS,0 as GTTAX,''CNY'' as WAERS,0 as ZTOLAMT,' +
' ''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,'''' as ZFNAME,case when Amount < 0 then ''Y'' else '''' end as ZUNFLG,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX,' +
1 year ago
' case STaxRate when 0 then ''X0'' when 17 then ''X1'' when 13 then ''X2'' when 2 then ''X3'' when 6 then ''X4'' when 11 then ''X5'' when 16 then ''X7'' when 10 then ''X8'' when 9 then ''X9'' end as MWSKZ' +
' from (' +
' select AccDate,FinaCode,OrgCode,ClsCode,STaxRate,OrgType,sum(Total) as Total,sum(Amount) as Amount,sum(Amount-NetAmount) as TaxAmount,sum(Counts) as Counts' +
1 year ago
' from (' +
' select sale.AccDate,shop.FinaCode,sale.OrgCode,class.UpperCode1 as ClsCode,sale.STaxRate,' +
' isnull((select JyMode from t_supplier where SupCode = sale.SupCode),''0'') as JyMode,' +
' sale.Counts,sale.Total,sale.Amount,sale.NetAmount,shop.OrgType' +
1 year ago
' from ' + @tablename + ' sale, t_shop shop, t_plu plu, t_gclass class' +
' where sale.OrgCode = shop.OrgCode' +
' and sale.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and sale.AccDate = ''' + @psaccdate + '''' + @where +
' ) b' +
' where JyMode = ''0''' +
' group by AccDate,FinaCode,OrgCode,ClsCode,STaxRate,OrgType' +
' ) a' +
' where Amount <> 0 or Counts <> 0'
exec(@sql)
9 months ago
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD>ܾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸʧ<EFBFBD><EFBFBD>'
return(-1)
end
1 year ago
set @sql = 'insert into t_int_sap_drysalesinfo' +
' (CREATEDATE,IFTYPE,BUKRS,WERKS,ZSIGN,PRCTR,ZYWDAT,ZTYPE,ZCXLX,ZJYFS,' +
' VVTYP,MATNR,MENGE,MEINS,PRICE,SKTAK,SKTBT,TMWSTS,GTTAX,WAERS,ZTOLAMT,' +
' ZTSDAT,ZGZDAT,ZFNAME,ZUNFLG,ZYZLX,MWSKZ)' +
'select ''' + @createdate + ''' as CREATEDATE,''F01'' as IFTYPE,FinaCode as BUKRS,OrgCode as WERKS,''1'' as ZSIGN,''P''+FinaCode+''1''+OrgCode as PRCTR,replace(AccDate,''-'','''') as ZYWDAT,''F01'' as ZTYPE,''Z30'' as ZCXLX,''Z03'' as ZJYFS,' +
' '''' as VVTYP,ClsCode as MATNR,Counts as MENGE,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,Amount as PRICE,Total as SKTAK,DkTotal as SKTBT,round(DkTotal-DkTotal/(1+STaxRate/100.00),2) as TMWSTS,0 as GTTAX,''CNY'' as WAERS,0 as ZTOLAMT,' +
6 months ago
' ''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,'''' as ZFNAME,case when Amount < 0 then ''Y'' else '''' end as ZUNFLG,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX,' +
1 year ago
' case STaxRate when 0 then ''X0'' when 17 then ''X1'' when 13 then ''X2'' when 2 then ''X3'' when 6 then ''X4'' when 11 then ''X5'' when 16 then ''X7'' when 10 then ''X8'' when 9 then ''X9'' end as MWSKZ' +
' from (' +
' select AccDate,FinaCode,OrgCode,ClsCode,STaxRate,OrgType,sum(Total) as Total,sum(Amount) as Amount,sum(Total-Cost) as DkTotal,sum(Counts) as Counts' +
' from (' +
' select sale.AccDate,shop.FinaCode,sale.OrgCode,class.UpperCode1 as ClsCode,sale.STaxRate,' +
' isnull((select JyMode from t_supplier where SupCode = sale.SupCode),''0'') as JyMode,' +
' sale.Counts,sale.Cost,sale.Total,sale.Amount,shop.OrgType' +
' from ' + @tablename + ' sale, t_shop shop, t_plu plu, t_gclass class' +
' where sale.OrgCode = shop.OrgCode' +
' and sale.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and sale.AccDate = ''' + @psaccdate + '''' + @where +
' ) b' +
' where JyMode = ''2''' +
' group by AccDate,FinaCode,OrgCode,ClsCode,STaxRate,OrgType' +
' ) a' +
' where Amount <> 0 or Counts <> 0'
exec(@sql)
if @@error <>0
begin
9 months ago
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸʧ<EFBFBD><EFBFBD>'
1 year ago
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_drysalesinfo
set DOCNO = 'XSD' + ZYWDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'F01' and ZJYFS in ('Z01','Z03') and DOCNO is null
set @psmsg = ''
return (1)
end
go
--<EFBFBD><EFBFBD><EFBFBD>Ϳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD>
if exists (select name from sysobjects where name='p_int_gen_flow_chg' and xtype='p')
drop procedure p_int_gen_flow_chg
go
create procedure p_int_gen_flow_chg
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @tablename varchar(40)
declare @where varchar(2000)
declare @sql varchar(2000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
1 year ago
set @tablename = 't_plusale_'+substring(@psaccdate,1,4)+substring(@psaccdate,6,2)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
1 year ago
if not exists(select * from sysobjects where name=@tablename)
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڱ<EFBFBD>'+@tablename
return(-1)
end
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and sale.OrgCode = ''' + @psorgcode + ''''
end
set @sql = 'insert into t_int_sap_inventorychginfo' +
' (CREATEDATE,IFTYPE,BUKRS,ZSIGN,WERKS,PRCTR,ZYWDAT,ZTYPE,MATNR,ZJYFS,' +
' SLTWR,WEARS,MENGE,DWERT,MEINS,ZTSDAT,ZGZDAT,ZCSBS,ZYZLX,UNFLG)' +
'select ''' + @createdate + ''' as CREATEDATE,''F11'' as IFTYPE,FinaCode as BUKRS,''1'' as ZSIGN,OrgCode as WERKS,''P''+FinaCode+''1''+OrgCode as PRCTR,replace(AccDate,''-'','''') as ZYWDAT,''F11'' as ZTYPE,ClsCode as MATNR,case JyMode when ''0'' then ''Z01'' else ''Z03'' end as ZJYFS,' +
' NetCost as SLTWR,''CNY'' as WEARS,Counts as MENGE,0 as DWERT,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,''X'' as ZCSBS,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX,case when Counts < 0 then ''Y'' else '''' end as UNFLG' +
1 year ago
' from (' +
' select AccDate,FinaCode,OrgCode,ClsCode,JyMode,OrgType,sum(NetCost+NetAdjustProfit) as NetCost,sum(Counts) as Counts' +
' from (' +
' select sale.AccDate,shop.FinaCode,sale.OrgCode,class.UpperCode1 as ClsCode,' +
' isnull((select JyMode from t_supplier where SupCode = sale.SupCode),''0'') as JyMode,' +
' sale.NetCost,sale.NetAdjustProfit,sale.Counts,shop.OrgType' +
' from ' + @tablename + ' sale, t_shop shop, t_plu plu, t_gclass class' +
' where sale.OrgCode = shop.OrgCode' +
' and sale.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and sale.AccDate = ''' + @psaccdate + '''' + @where +
' ) b' +
' where JyMode = ''0''' +
' group by AccDate,FinaCode,OrgCode,ClsCode,OrgType,JyMode' +
' ) a' +
' where NetCost <> 0 or Counts <> 0'
exec(@sql)
if @@error <>0
begin
1 year ago
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۳ɱ<EFBFBD>ʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_inventorychginfo
set DOCNO = 'XSC' + ZYWDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'F11' and ZJYFS in ('Z01','Z03') and DOCNO is null
set @psmsg = ''
return (1)
end
go
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD>
if exists (select name from sysobjects where name='p_int_gen_flow_pay' and xtype='p')
drop procedure p_int_gen_flow_pay
go
create procedure p_int_gen_flow_pay
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @tablename varchar(40)
declare @where varchar(2000)
declare @sql varchar(2000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
1 year ago
set @tablename = 't_int_flow_pay_deily_'+substring(@psaccdate,1,4)+substring(@psaccdate,6,2)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
1 year ago
if not exists(select * from sysobjects where name=@tablename)
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڱ<EFBFBD>'+@tablename
return(-1)
end
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and shop.OrgCode = ''' + @psorgcode + ''''
end
set @sql = 'insert into t_int_sap_paymentreportinfo' +
' (CREATEDATE,IFTYPE,ZSIGN,ZTSDAT,BUKRS,PRCTR,KUNNR,' +
' SKART,ZYYDAT,WRBTR,WEARS,ZCXBS)' +
'select ''' + @createdate + ''' as CREATEDATE,''Z01'' as IFTYPE,''1'' as ZSIGN,''' + @tsdat + ''' as ZTSDAT,FinaCode as BUKRS,''P''+FinaCode+''1''+OrgCode as PRCTR,OrgCode as KUNNR,' +
6 months ago
' PayCode as SKART,replace(AccDate,''-'','''') as ZYYDAT,Amount as WRBTR,''CNY'' as WEARS,case when Amount < 0 then ''Y'' else '''' end as ZCXBS' +
1 year ago
' from (' +
' select pay.BUSINESS_DATE as AccDate,shop.FinaCode,pay.WERKS as OrgCode,pay.MOP_ID as PayCode,sum(pay.AMOUNT) as Amount' +
' from ' + @tablename + ' pay, t_shop shop' +
' where pay.WERKS = shop.OrgCode' +
' and pay.ITEM_ID like ''20%''' + -- ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
' and pay.BUSINESS_DATE > ''2023-09-15''' +
' and pay.BUSINESS_DATE = ''' + @psaccdate + '''' + @where +
' group by pay.BUSINESS_DATE,shop.FinaCode,pay.WERKS,pay.MOP_ID' +
' ) a' +
' where Amount <> 0'
exec(@sql)
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_paymentreportinfo
set DOCNO = 'ZFD' + ZTSDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'Z01' and DOCNO is null
set @psmsg = ''
return (1)
end
go
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>
if exists (select name from sysobjects where name='p_int_gen_flow_pay_cash' and xtype='p')
drop procedure p_int_gen_flow_pay_cash
go
create procedure p_int_gen_flow_pay_cash
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @tablename varchar(40)
declare @where varchar(2000)
declare @sql varchar(2000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
1 year ago
set @tablename = 't_int_flow_pay_deily_'+substring(@psaccdate,1,4)+substring(@psaccdate,6,2)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
1 year ago
if not exists(select * from sysobjects where name=@tablename)
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڱ<EFBFBD>'+@tablename
return(-1)
end
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and shop.OrgCode = ''' + @psorgcode + ''''
end
set @sql = 'insert into t_int_sap_cashpaymentinfo' +
' (CREATEDATE,IFTYPE,ZSIGN,ZTSDAT,BUKRS,PRCTR,KUNNR,SKART,' +
' ZYRDAT,JCRQ,WRBTR,JCYYK,SYBTR,CDYSK,JKDOC,ZGZDAT,WAERS,ZCXBS)' +
'select ''' + @createdate + ''' as CREATEDATE,''Z02'' as IFTYPE,''1'' as ZSIGN,''' + @tsdat + ''' as ZTSDAT,FinaCode as BUKRS,''P''+FinaCode+''1''+OrgCode as PRCTR,OrgCode as KUNNR,''1000001'' as SKART,' +
1 year ago
' replace(AccDate,''-'','''') as ZYRDAT,replace(AccDate,''-'','''') as JCRQ,Amount as WRBTR,Amount as JCYYK,0 as SYBTR,0 as CDYSK,'''' as JKDOC,replace(AccDate,''-'','''') as ZGZDAT,''CNY'' as WAERS,case when Amount < 0 then ''Y'' else '''' end as ZCXBS' +
' from (' +
' select pay.BUSINESS_DATE as AccDate,shop.FinaCode,pay.WERKS as OrgCode,sum(pay.AMOUNT) as Amount' +
' from ' + @tablename + ' pay, t_shop shop' +
' where pay.WERKS = shop.OrgCode' +
' and pay.MOP_ID = ''40''' + -- 40-<2D>ֽ𣬸<D6BD>֧<EFBFBD><D6A7><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BOSϵͳֱ<CDB3><D6B1><EFBFBD>·<EFBFBD>
' and pay.ITEM_ID like ''20%''' + -- ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
' and pay.BUSINESS_DATE > ''2023-09-15''' +
' and pay.BUSINESS_DATE = ''' + @psaccdate + '''' + @where +
' group by pay.BUSINESS_DATE,shop.FinaCode,pay.WERKS' +
' ) a' +
' where Amount <> 0'
exec(@sql)
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>֧<EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_cashpaymentinfo
set DOCNO = 'ZFX' + ZTSDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'Z02' and DOCNO is null
set @psmsg = ''
return (1)
end
go
if exists (select name from sysobjects where name='p_int_gen_accept' and xtype='p')
drop procedure p_int_gen_accept
go
create procedure p_int_gen_accept
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @where varchar(2000)
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and head.OrgCode = ''' + @psorgcode + ''''
end
--<EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_drypurchaseinfo ' +
' (CREATEDATE,IFTYPE,BUKRS,WERKS,ZSIGN,PRCTR,MATNR,LIFNR,ZJYFS,' +
' ZYWDAT,ZTYPE,WAERS,SLTWR,DWERT,MENGE,MEINS,ZTSDAT,ZGZDAT,ZYZLX)' +
'select ''' + @createdate + ''' as CREATEDATE,''F02'' as IFTYPE,FinaCode as BUKRS,case OrgType when ''2'' then ''2Y00'' else OrgCode end as WERKS, ''1'' as ZSIGN,''P''+FinaCode+''1''+case OrgType when ''2'' then ''2Y00'' else OrgCode end as PRCTR,ClsCode as MATNR,SupCode as LIFNR,case JyMode when ''0'' then ''Z01'' else ''Z03'' end as ZJYFS,' +
' replace(AccDate,''-'','''') as ZYWDAT,''F02'' as ZTYPE,''CNY'' as WAERS,NetCost as SLTWR,0 as DWERT,Counts as MENGE,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX' +
' from (' +
' select head.AccDate,shop.FinaCode,shop.OrgType,head.OrgCode,class.UpperCode1 as ClsCode,head.SupCode,sup.JyMode,' +
' sum(body.NetCost) as NetCost,sum(body.Counts) as Counts' +
' from t_accept_head head, t_accept_body body, t_shop shop, t_plu plu, t_gclass class, t_supplier sup, t_financial_body fina' +
' where head.BillNo = body.BillNo' +
' and head.OrgCode = shop.OrgCode' +
' and head.SupCode = sup.SupCode' +
' and body.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and shop.FinaCode = fina.FinaCode' +
' and head.BillType in (''1'',''2'')' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' and fina.FinaType = ''0''' +
' group by head.AccDate,shop.FinaCode,head.OrgCode,class.UpperCode1,head.SupCode,sup.JyMode,shop.OrgType' +
' ) a'
exec(@sql)
9 months ago
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD>ӹ<EFBFBD>˾<EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_drypurchaseinfo ' +
' (CREATEDATE,IFTYPE,BUKRS,WERKS,ZSIGN,PRCTR,MATNR,LIFNR,ZJYFS,' +
' ZYWDAT,ZTYPE,WAERS,SLTWR,DWERT,MENGE,MEINS,ZTSDAT,ZGZDAT,ZYZLX)' +
'select ''' + @createdate + ''' as CREATEDATE,''F02'' as IFTYPE,FinaCode as BUKRS,ShopCode as WERKS, ''1'' as ZSIGN,''P''+FinaCode+''1''+ShopCode as PRCTR,ClsCode as MATNR,SupCode as LIFNR,''Z02'' as ZJYFS,' +
' replace(AccDate,''-'','''') as ZYWDAT,''F02'' as ZTYPE,''CNY'' as WAERS,NetCost as SLTWR,0 as DWERT,Counts as MENGE,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX' +
' from (' +
' select head.BillNo,head.AccDate,shop.FinaCode,head.ShopCode,class.UpperCode1 as ClsCode,' +
' sum(body.NetCost) as NetCost,sum(body.ZpCount) as Counts,shop.OrgType,fina.SupCode' +
' from t_dist_head head, t_dist_body body, t_shop shop, t_plu plu, t_gclass class, t_financial_body fina' +
' where head.BillNo = body.BillNo' +
' and head.ShopCode = shop.OrgCode' +
' and body.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and shop.FinaCode = fina.FinaCode' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' and body.ZpCount > 0' +
' and fina.FinaType = ''1''' +
' group by head.BillNo,head.AccDate,shop.FinaCode,head.ShopCode,class.UpperCode1,shop.OrgType,fina.SupCode' +
' ) a';
exec(@sql)
if @@error <>0
begin
9 months ago
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD>˾<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_drypurchaseinfo
set DOCNO = 'JHD' + ZYWDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'F02' and DOCNO is null
set @psmsg = ''
return (1)
end
go
if exists (select name from sysobjects where name='p_int_gen_return' and xtype='p')
drop procedure p_int_gen_return
go
create procedure p_int_gen_return
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @where varchar(2000)
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and head.OrgCode = ''' + @psorgcode + ''''
end
--<EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_drypurchaseinfo' +
' (CREATEDATE,IFTYPE,BUKRS,WERKS,ZSIGN,PRCTR,MATNR,LIFNR,ZJYFS,' +
' ZYWDAT,ZTYPE,WAERS,SLTWR,DWERT,MENGE,MEINS,ZTSDAT,ZGZDAT,ZYZLX)' +
'select ''' + @createdate + ''' as CREATEDATE,''F03'' as IFTYPE,FinaCode as BUKRS,case OrgType when ''2'' then ''2Y00'' else OrgCode end as WERKS, ''1'' as ZSIGN,''P''+FinaCode+''1''+case OrgType when ''2'' then ''2Y00'' else OrgCode end as PRCTR,ClsCode as MATNR,SupCode as LIFNR,case JyMode when ''0'' then ''Z01'' else ''Z03'' end as ZJYFS,' +
' replace(AccDate,''-'','''') as ZYWDAT,''F03'' as ZTYPE,''CNY'' as WAERS,NetCost as SLTWR,0 as DWERT,Counts as MENGE,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX' +
' from (' +
' select head.AccDate,shop.FinaCode,shop.OrgType,head.OrgCode,class.UpperCode1 as ClsCode,head.SupCode,sup.JyMode,' +
' sum(body.NetCost) as NetCost,sum(body.Counts) as Counts' +
' from t_return_head head, t_return_body body, t_shop shop, t_plu plu, t_gclass class, t_supplier sup, t_financial_body fina' +
' where head.BillNo = body.BillNo ' +
' and head.OrgCode = shop.OrgCode ' +
' and head.SupCode = sup.SupCode' +
' and body.PluCode = plu.PluCode ' +
' and plu.ClsCode = class.ClsCode ' +
' and shop.FinaCode = fina.FinaCode ' +
' and head.BillType in (''0'',''2'') ' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' and fina.FinaType = ''0''' +
' group by head.AccDate,shop.FinaCode,head.OrgCode,class.UpperCode1,head.SupCode,sup.JyMode,shop.OrgType' +
' ) a'
exec(@sql)
9 months ago
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD>ϸʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD>ӹ<EFBFBD>˾<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_drypurchaseinfo ' +
' (CREATEDATE,IFTYPE,BUKRS,WERKS,ZSIGN,PRCTR,MATNR,LIFNR,ZJYFS,' +
' ZYWDAT,ZTYPE,WAERS,SLTWR,DWERT,MENGE,MEINS,ZTSDAT,ZGZDAT,ZYZLX)' +
'select ''' + @createdate + ''' as CREATEDATE,''F03'' as IFTYPE,FinaCode as BUKRS,ShopCode as WERKS, ''1'' as ZSIGN,''P''+FinaCode+''1''+ShopCode as PRCTR,ClsCode as MATNR,SupCode as LIFNR,''Z02'' as ZJYFS,' +
' replace(AccDate,''-'','''') as ZYWDAT,''F03'' as ZTYPE,''CNY'' as WAERS,NetCost as SLTWR,0 as DWERT,Counts as MENGE,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX' +
' from (' +
' select head.BillNo,head.AccDate,shop.FinaCode,head.ShopCode,class.UpperCode1 as ClsCode,' +
' sum(-body.NetCost) as NetCost,sum(-body.ZpCount) as Counts,shop.OrgType,fina.SupCode' +
' from t_dist_head head, t_dist_body body, t_shop shop, t_plu plu, t_gclass class, t_financial_body fina' +
' where head.BillNo = body.BillNo' +
' and head.ShopCode = shop.OrgCode' +
' and body.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and shop.FinaCode = fina.FinaCode' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' and body.ZpCount < 0' +
' and fina.FinaType = ''1''' +
' group by head.BillNo,head.AccDate,shop.FinaCode,head.ShopCode,class.UpperCode1,shop.OrgType,fina.SupCode' +
' ) a';
exec(@sql)
if @@error <>0
begin
9 months ago
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD>˾<EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD>ϸʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_drypurchaseinfo
set DOCNO = 'THD' + ZYWDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'F03' and DOCNO is null
set @psmsg = ''
return (1)
end
go
if exists (select name from sysobjects where name='p_int_gen_buy_price_his' and xtype='p')
drop procedure p_int_gen_buy_price_his
go
create procedure p_int_gen_buy_price_his
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @where varchar(2000)
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and head.OrgCode = ''' + @psorgcode + ''''
end
--<EFBFBD><EFBFBD>ʷ<EFBFBD><EFBFBD><EFBFBD>۵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_drypurchaseinfo' +
' (CREATEDATE,IFTYPE,BUKRS,WERKS,ZSIGN,PRCTR,MATNR,LIFNR,ZJYFS,' +
' ZYWDAT,ZTYPE,WAERS,SLTWR,DWERT,MENGE,MEINS,ZTSDAT,ZGZDAT,ZUNFLG,ZYZLX)' +
'select ''' + @createdate + ''' as CreateDate,''F14'' as IFTYPE,FinaCode as BUKRS,case OrgType when ''2'' then ''2Y00'' else OrgCode end as WERKS, ''1'' as ZSIGN,''P''+FinaCode+''1''+case OrgType when ''2'' then ''2Y00'' else OrgCode end as PRCTR,ClsCode as MATNR,SupCode as LIFNR,case JyMode when ''0'' then ''Z01'' else ''Z03'' end as ZJYFS,' +
' replace(AccDate,''-'','''') as ZYWDAT,''F14'' as ZTYPE,''CNY'' as WAERS,NetCost as SLTWR,0 as DWERT,Counts as MENGE,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,case when NetCost < 0 then ''Y'' else '''' end as ZUNFLG,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX' +
' from (' +
' select head.AccDate,shop.FinaCode,shop.OrgType,head.OrgCode,class.UpperCode1 as ClsCode, head.SupCode,sup.JyMode,' +
' sum(body.NetCjCost) as NetCost,sum(body.TzCount) as Counts' +
' from t_adjbuyprice_head head, t_adjbuyprice_body body, t_shop shop, t_plu plu, t_gclass class, t_supplier sup' +
' where head.BillNo = body.BillNo' +
' and head.OrgCode = shop.OrgCode' +
' and head.SupCode = sup.SupCode' +
' and body.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and head.TzType = ''0''' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' group by head.AccDate,shop.FinaCode,head.OrgCode,class.UpperCode1,head.SupCode,sup.JyMode,shop.OrgType' +
' ) a'
exec(@sql)
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ<EFBFBD><EFBFBD><EFBFBD>۵<EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_drypurchaseinfo
set DOCNO = 'TJS' + ZYWDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'F14' and DOCNO is null
set @psmsg = ''
return (1)
end
go
if exists (select name from sysobjects where name='p_int_gen_buy_price_now' and xtype='p')
drop procedure p_int_gen_buy_price_now
go
create procedure p_int_gen_buy_price_now
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @where varchar(2000)
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and head.OrgCode = ''' + @psorgcode + ''''
end
--<EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>۵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_drypurchaseinfo' +
' (CREATEDATE,IFTYPE,BUKRS,WERKS,ZSIGN,PRCTR,MATNR,LIFNR,ZJYFS,' +
' ZYWDAT,ZTYPE,WAERS,SLTWR,DWERT,MENGE,MEINS,ZTSDAT,ZGZDAT,ZUNFLG,ZYZLX)' +
'select ''' + @createdate + ''' as CreateDate,''F15'' as IFTYPE,FinaCode as BUKRS,case OrgType when ''2'' then ''2Y00'' else OrgCode end as WERKS, ''1'' as ZSIGN,''P''+FinaCode+''1''+case OrgType when ''2'' then ''2Y00'' else OrgCode end as PRCTR,ClsCode as MATNR,SupCode as LIFNR,case JyMode when ''0'' then ''Z01'' else ''Z03'' end as ZJYFS,' +
' replace(AccDate,''-'','''') as ZYWDAT,''F15'' as ZTYPE,''CNY'' as WAERS,NetCost as SLTWR,0 as DWERT,Counts as MENGE,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,case when NetCost < 0 then ''Y'' else '''' end as ZUNFLG,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX' +
' from (' +
' select head.AccDate,shop.FinaCode,shop.OrgType,head.OrgCode,class.UpperCode1 as ClsCode, head.SupCode,sup.JyMode,' +
' sum(body.NetCjCost) as NetCost,sum(body.TzCount) as Counts' +
' from t_adjbuyprice_head head, t_adjbuyprice_body body, t_shop shop, t_plu plu, t_gclass class, t_supplier sup' +
' where head.BillNo = body.BillNo' +
' and head.OrgCode = shop.OrgCode' +
' and head.SupCode = sup.SupCode' +
' and body.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and head.TzType = ''1''' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' group by head.AccDate,shop.FinaCode,head.OrgCode,class.UpperCode1,head.SupCode,sup.JyMode,shop.OrgType' +
' ) a'
exec(@sql)
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>۵<EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_drypurchaseinfo
set DOCNO = 'TJC' + ZYWDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'F15' and DOCNO is null
set @psmsg = ''
return (1)
end
go
if exists (select name from sysobjects where name='p_int_gen_draw' and xtype='p')
drop procedure p_int_gen_draw
go
create procedure p_int_gen_draw
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @where varchar(2000)
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and head.OrgCode = ''' + @psorgcode + ''''
end
--<EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_stockconsumer' +
' (CREATEDATE,IFTYPE,BUKRS,WERKS,ZHQBS,KOSTL,PRCTR,ZLYLB,' +
' ZTYPE,BLDAT,MATNR,SLTWR,ZXSZJ,MENGE,WAERS,MEINS,' +
' MWSKZ,TSDAT,BUDAT,UNFLG,SGTXT,ZPLXH)' +
'select ''' + @createdate + ''' as CreateDate,''F13'' as IFTYPE,FinaCode as BUKRS,case OrgType when ''2'' then ''2Y00'' else OrgCode end as WERKS, ''1'' as ZHQBS,CostCenter as KOSTL,''P''+FinaCode+''1''+case OrgType when ''2'' then ''2Y00'' else OrgCode end as PRCTR,LyType as ZLYLB,' +
' ''F13'' as ZTYPE,replace(AccDate,''-'','''') as BLDAT,ClsCode as MATNR,NetCost as SLTWR,Total as ZXSZJ,Counts as MENGE,''CNY'' as WAERS,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,' +
' case left(LyType,2) when ''A1'' then case JTaxRate when 0 then ''J0'' when 17 then ''J1'' when 13 then ''J2'' when 11 then ''J3'' when 6 then ''J4'' when 4 then ''J5'' when 3 then ''J6'' when 5 then ''J7'' when 16 then ''J8'' when ''10'' then ''J9'' when 9 then ''JA'' when 1 then ''JB'' end' +
' when ''A2'' then case STaxRate when 0 then ''X0'' when 17 then ''X1'' when 13 then ''X2'' when 2 then ''X3'' when 6 then ''X4'' when 11 then ''X5'' when 16 then ''X7'' when 10 then ''X8'' when 9 then ''X9'' end' +
5 months ago
' else ''X0'' end as MWSKZ,''' + @tsdat + ''' as TSDAT,replace(AccDate,''-'','''') as BUDAT,'''' as UNFLG,replace(PurPose,''&'','''') as SGTXT,'''' as ZPLXH' +
' from (' +
' select head.AccDate,shop.FinaCode,shop.OrgType,head.OrgCode,head.LyType,head.CostCenter,head.PurPose,class.UpperCode1 as ClsCode,body.JTaxRate,plu.STaxRate,' +
' sum(body.NetCost) as NetCost,sum(body.Total) as Total,sum(body.Counts) as Counts' +
' from t_draw_head head, t_draw_body body, t_shop shop, t_plu plu, t_gclass class' +
' where head.billno = body.billno ' +
' and head.OrgCode = shop.OrgCode ' +
' and body.PluCode = plu.PluCode ' +
' and plu.ClsCode = class.ClsCode ' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' group by head.AccDate,shop.FinaCode,head.OrgCode,head.LyType,head.CostCenter,head.PurPose,class.UpperCode1,shop.OrgType,body.JTaxRate,plu.STaxRate' +
' ) a'
exec(@sql)
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_stockconsumer
set DOCNO = 'LYD' + BLDAT + convert(varchar(10),SERIALNO), DOCNO1 = 'LYD'+BLDAT+convert(varchar(10),SERIALNO)
where IFTYPE = 'F13' and DOCNO is null
set @psmsg = ''
return (1)
end
go
if exists (select name from sysobjects where name='p_int_gen_scrap' and xtype='p')
drop procedure p_int_gen_scrap
go
create procedure p_int_gen_scrap
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @where varchar(2000)
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and head.OrgCode = ''' + @psorgcode + ''''
end
--<EFBFBD><EFBFBD><EFBFBD>𵥻<EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_inventorychginfo' +
' (CREATEDATE,IFTYPE,BUKRS,ZSIGN,WERKS,PRCTR,ZYWDAT,ZTYPE,MATNR,ZJYFS,SLTWR,' +
' WEARS,MENGE,DWERT,MEINS,MWSKZ,TMWSTS,ZTSDAT,ZGZDAT,ZCSBS,ZYZLX,UNFLG)' +
'select ''' + @createdate + ''' as CreateDate,''F08'' as IFTYPE,FinaCode as BUKRS, ''1'' as ZSIGN,case OrgType when ''2'' then ''2Y00'' else OrgCode end as WERKS,''P''+FinaCode+''1''+case OrgType when ''2'' then ''2Y00'' else OrgCode end as PRCTR,replace(AccDate,''-'','''') as ZYWDAT,''F08'' as ZTYPE,ClsCode as MATNR,''Z01'' as ZJYFS,NetCost as SLTWR,' +
11 months ago
' ''CNY'' as WEARS,Counts as MENGE,0 as DWERT,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,'''' as MWSKZ,0 as TMWSTS,''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,''X'' as ZCSBS,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX,'''' as UNFLG' +
' from (' +
' select head.AccDate,shop.FinaCode,shop.OrgType,head.OrgCode,class.UpperCode1 as ClsCode,' +
' sum(body.NetCost) as NetCost,sum(body.Counts) as Counts,sum(body.Cost-body.NetCost) as TaxTotal' +
' from t_scrap_head head, t_scrap_body body, t_shop shop, t_plu plu, t_gclass class' +
' where head.BillNo = body.BillNo' +
' and head.OrgCode = shop.OrgCode' +
' and body.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' and body.BsType = ''01''' +
' group by head.AccDate,shop.FinaCode,head.OrgCode,class.UpperCode1,shop.OrgType' +
' ) a'
exec(@sql)
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_inventorychginfo
set DOCNO = 'BSZ' + ZYWDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'F08' and ZJYFS = 'Z01' and DOCNO is null
set @psmsg = ''
return (1)
end
go
if exists (select name from sysobjects where name='p_int_gen_damage' and xtype='p')
drop procedure p_int_gen_damage
go
create procedure p_int_gen_damage
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @where varchar(2000)
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and head.OrgCode = ''' + @psorgcode + ''''
end
--<EFBFBD><EFBFBD><EFBFBD>𵥻<EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_inventorychginfo' +
' (CREATEDATE,IFTYPE,BUKRS,ZSIGN,WERKS,PRCTR,ZYWDAT,ZTYPE,MATNR,ZJYFS,SLTWR,' +
' WEARS,MENGE,DWERT,MEINS,MWSKZ,TMWSTS,ZTSDAT,ZGZDAT,ZCSBS,ZYZLX,UNFLG)' +
'select ''' + @createdate + ''' as CreateDate,''F09'' as IFTYPE,FinaCode as BUKRS, ''1'' as ZSIGN,case OrgType when ''2'' then ''2Y00'' else OrgCode end as WERKS,''P''+FinaCode+''1''+case OrgType when ''2'' then ''2Y00'' else OrgCode end as PRCTR,replace(AccDate,''-'','''') as ZYWDAT,''F09'' as ZTYPE,ClsCode as MATNR,''Z01'' as ZJYFS,NetCost as SLTWR,' +
7 months ago
' ''CNY'' as WEARS,Counts as MENGE,0 as DWERT,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,''JC'' as MWSKZ,case when TaxTotal < 0 then 0 else TaxTotal end as TMWSTS,''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,''X'' as ZCSBS,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX,'''' as UNFLG' +
' from (' +
' select head.AccDate,shop.FinaCode,shop.OrgType,head.OrgCode,class.UpperCode1 as ClsCode,' +
' sum(body.NetCost) as NetCost,sum(body.Counts) as Counts,sum(body.Cost-body.NetCost) as TaxTotal' +
' from t_scrap_head head, t_scrap_body body, t_shop shop, t_plu plu, t_gclass class' +
' where head.BillNo = body.BillNo' +
' and head.OrgCode = shop.OrgCode' +
' and body.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' and body.BsType = ''02''' +
' group by head.AccDate,shop.FinaCode,head.OrgCode,class.UpperCode1,shop.OrgType' +
' ) a'
exec(@sql)
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_inventorychginfo
set DOCNO = 'BSF' + ZYWDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'F09' and ZJYFS = 'Z01' and DOCNO is null
set @psmsg = ''
return (1)
end
go
if exists (select name from sysobjects where name='p_int_gen_differ' and xtype='p')
drop procedure p_int_gen_differ
go
create procedure p_int_gen_differ
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @where varchar(2000)
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and head.OrgCode = ''' + @psorgcode + ''''
end
--ӯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_inventorychginfo' +
' (CREATEDATE,IFTYPE,BUKRS,ZSIGN,WERKS,PRCTR,ZYWDAT,ZTYPE,MATNR,' +
' ZJYFS,SLTWR,WEARS,MENGE,DWERT,MEINS,ZTSDAT,ZGZDAT,ZCSBS,ZYZLX,UNFLG)' +
'select ''' + @createdate + ''' as CreateDate,''F10'' as IFTYPE,FinaCode as BUKRS, ''1'' as ZSIGN,case OrgType when ''2'' then ''2Y00'' else OrgCode end as WERKS,''P''+FinaCode+''1''+case OrgType when ''2'' then ''2Y00'' else OrgCode end as PRCTR,replace(AccDate,''-'','''') as ZYWDAT,''F10'' as ZTYPE,ClsCode as MATNR,' +
' ''Z01'' as ZJYFS,NetCost as SLTWR,''CNY'' as WEARS,Counts as MENGE,0 as DWERT,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,''X'' as ZCSBS,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX,case when Counts < 0 then ''Y'' else '''' end as UNFLG' +
' from (' +
' select head.AccDate,shop.FinaCode,shop.OrgType,head.OrgCode,class.UpperCode1 as ClsCode,' +
' sum(body.YkNetCost) as NetCost,sum(body.YkCount) as Counts' +
' from t_differ_head head, t_differ_body body, t_shop shop, t_plu plu, t_gclass class' +
' where head.BillNo = body.BillNo' +
' and head.OrgCode = shop.OrgCode' +
' and body.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and head.BillType in (''0'',''1'',''3'')' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' group by head.AccDate,shop.FinaCode,head.OrgCode,class.UpperCode1,shop.OrgType' +
' ) a' +
' where NetCost <> 0 or Counts <> 0'
exec(@sql)
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_inventorychginfo
set DOCNO = 'PKD' + ZYWDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'F10' and ZJYFS = 'Z01' and DOCNO is null
set @psmsg = ''
return (1)
end
go
if exists (select name from sysobjects where name='p_int_gen_dist' and xtype='p')
drop procedure p_int_gen_dist
go
create procedure p_int_gen_dist
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @where varchar(2000)
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and head.OrgCode = ''' + @psorgcode + ''''
end
--<EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_drydeliveryinfo' +
' (CREATEDATE,IFTYPE,BUKRS,ZSIGN,SDWRK,SPRCTR,WERKS,PRCTR,ZYWDAT,ZTYPE,' +
' MATNR,ZJYFS,DMBTR,WAERS,MENGE,DWERT,MEINS,ZTSDAT,ZGZDAT,ZYZLX)' +
'select ''' + @createdate + ''' as CreateDate,''F04'' as IFTYPE,FinaCode as BUKRS,''1'' as ZSIGN,ShopCode as SDWRK,''P''+FinaCode+''1''+ShopCode as SPRCTR,''2Y00'' as WERKS,''P''+FinaCode+''1''+''2Y00'' as PRCTR,replace(AccDate,''-'','''') as ZYWDAT,''F04'' as ZTYPE,' +
' ClsCode as MATNR,''Z01'' as ZJYFS,NetCost as DMBTR,''CNY'' as WAERS,Counts as MENGE,0 as DWERT,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX' +
' from (' +
' select head.AccDate,shop.FinaCode,head.ShopCode,class.UpperCode1 as ClsCode,' +
' sum(body.NetCost) as NetCost,sum(body.ZpCount) as Counts,shop.OrgType' +
' from t_dist_head head, t_dist_body body, t_shop shop, t_plu plu, t_gclass class, t_financial_body fina' +
' where head.BillNo = body.BillNo' +
' and head.ShopCode = shop.OrgCode' +
' and body.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and shop.FinaCode = fina.FinaCode' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' and body.ZpCount > 0' +
' and fina.FinaType = ''0''' +
' group by head.AccDate,shop.FinaCode,head.ShopCode,class.UpperCode1,shop.OrgType' +
' ) a'
exec(@sql)
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_drydeliveryinfo
set DOCNO = 'PSD' + ZYWDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'F04' and DOCNO is null
set @psmsg = ''
return (1)
end
go
if exists (select name from sysobjects where name='p_int_gen_dist_return' and xtype='p')
drop procedure p_int_gen_dist_return
go
create procedure p_int_gen_dist_return
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @where varchar(2000)
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and head.OrgCode = ''' + @psorgcode + ''''
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_drydeliveryinfo' +
' (CREATEDATE,IFTYPE,BUKRS,ZSIGN,SDWRK,SPRCTR,WERKS,PRCTR,ZYWDAT,ZTYPE,' +
' MATNR,ZJYFS,DMBTR,WAERS,MENGE,DWERT,MEINS,ZTSDAT,ZGZDAT,ZYZLX)' +
'select ''' + @createdate + ''' as CreateDate,''F05'' as IFTYPE,FinaCode as BUKRS,''1'' as ZSIGN,ShopCode as SDWRK,''P''+FinaCode+''1''+ShopCode as SPRCTR,''2Y00'' as WERKS,''P''+FinaCode+''1''+''2Y00'' as PRCTR,replace(AccDate,''-'','''') as ZYWDAT,''F05'' as ZTYPE,' +
' ClsCode as MATNR,''Z01'' as ZJYFS,NetCost as DMBTR,''CNY'' as WAERS,Counts as MENGE,0 as DWERT,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX' +
' from (' +
' select head.AccDate,shop.FinaCode,head.ShopCode,class.UpperCode1 as ClsCode,' +
' sum(-body.NetCost) as NetCost,sum(-body.ZpCount) as Counts,shop.OrgType' +
' from t_dist_head head, t_dist_body body, t_shop shop, t_plu plu, t_gclass class, t_financial_body fina' +
' where head.BillNo = body.BillNo' +
' and head.ShopCode = shop.OrgCode' +
' and body.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and shop.FinaCode = fina.FinaCode' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' and body.ZpCount < 0' +
' and fina.FinaType = ''0''' +
' group by head.AccDate,shop.FinaCode,head.ShopCode,class.UpperCode1,shop.OrgType' +
' ) a'
exec(@sql)
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD>ϸʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_drydeliveryinfo
set DOCNO = 'PST' + ZYWDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'F05' and DOCNO is null
set @psmsg = ''
return (1)
end
go
if exists (select name from sysobjects where name='p_int_gen_dist_sale' and xtype='p')
drop procedure p_int_gen_dist_sale
go
create procedure p_int_gen_dist_sale
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @where varchar(2000)
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and head.OrgCode = ''' + @psorgcode + ''''
end
--<EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_drysalesinfo' +
' (CREATEDATE,IFTYPE,BUKRS,WERKS,ZSIGN,PRCTR,ZYWDAT,ZTYPE,ZCXLX,ZJYFS,VVTYP,MATNR,' +
' MENGE,MEINS,PRICE,SKTAK,SKTBT,TMWSTS,GTTAX,WAERS,ZTOLAMT,ZTSDAT,ZGZDAT,ZYZLX,' +
' ZFNAME,ZUNFLG,VBELN,KUNNR,KUNWE,MWSKZ)' +
'select ''' + @createdate + ''' as CreateDate,''F01'' as IFTYPE,FinaCode as BUKRS,''2Y00'' as WERKS,''1'' as ZSIGN,''P''+FinaCode+''1''+''2Y00'' as PRCTR,replace(AccDate,''-'','''') as ZYWDAT,''F01'' as ZTYPE,''Z30'' as ZCXLX,''Z20'' as ZJYFS,'''' as VVTYP,ClsCode as MATNR,' +
' Counts as MENGE,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,ZpAmount as PRICE,ZpAmount as SKTAK,0 as SKTBT,TaxAmount as TMWSTS,0 as GTTAX,''CNY'' as WAERS,0 as ZTOLAMT,''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX,' +
' '''' as ZFNAME,case when Counts < 0 then ''Y'' else '''' end as ZUNFLG,BillNo as VBELN,ShopCode as KUNNR,ShopCode as KUNWE,case JTaxRate when 0 then ''X0'' when 17 then ''X1'' when 13 then ''X2'' when 2 then ''X3'' when 6 then ''X4'' when 11 then ''X5'' when 16 then ''X7'' when 10 then ''X8'' when 9 then ''X9'' end as MWSKZ' +
' from (' +
' select head.BillNo,head.AccDate,shop.FinaCode,head.ShopCode,class.UpperCode1 as ClsCode,body.JTaxRate,' +
' sum(body.ZpAmount) as ZpAmount,sum(body.ZpAmount-body.ZpNetAmount) as TaxAmount,sum(body.ZpCount) as Counts,shop.OrgType' +
' from t_dist_head head, t_dist_body body, t_shop shop, t_plu plu, t_gclass class' +
' where head.BillNo = body.BillNo' +
' and head.OrgCode = shop.OrgCode' +
' and body.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and head.AccDate is not null and head.AccDate <> ''''' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' and body.ZpCount <> 0' +
' and exists (select OrgCode from t_shop a, t_financial_body b where a.FinaCode = b.FinaCode and a.OrgCode = head.ShopCode and b.FinaType = ''1'')' +
' group by head.BillNo,head.AccDate,shop.FinaCode,head.ShopCode,class.UpperCode1,shop.OrgType,body.JTaxRate' +
' ) a'
exec(@sql)
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_drysalesinfo
set DOCNO = 'PSX' + ZYWDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'F01' and ZJYFS = 'Z20' and DOCNO is null
set @psmsg = ''
return (1)
end
go
if exists (select name from sysobjects where name='p_int_gen_dist_chg' and xtype='p')
drop procedure p_int_gen_dist_chg
go
create procedure p_int_gen_dist_chg
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @where varchar(2000)
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and head.OrgCode = ''' + @psorgcode + ''''
end
--<EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_inventorychginfo' +
' (CREATEDATE,IFTYPE,BUKRS,ZSIGN,WERKS,PRCTR,ZYWDAT,ZTYPE,MATNR,ZJYFS,SLTWR,' +
' WEARS,MENGE,DWERT,MEINS,ZTSDAT,ZGZDAT,ZCSBS,ZYZLX,VBELN,KUNNR,KUNWE,UNFLG)' +
'select ''' + @createdate + ''' as CreateDate,''F11'' as IFTYPE,FinaCode as BUKRS,''1'' as ZSIGN,''2Y00'' as WERKS,''P''+FinaCode+''1''+''2Y00'' as PRCTR,replace(AccDate,''-'','''') as ZYWDAT,''F11'' as ZTYPE,ClsCode as MATNR,''Z20'' as ZJYFS,NetCost as SLTWR,' +
' ''CNY'' as WEARS,Counts as MENGE,0 as DWERT,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,''X'' as ZCSBS,' +
' case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX,BillNo as VBELN,ShopCode as KUNNR,ShopCode as KUNWE,case when Counts < 0 then ''Y'' else '''' end as UNFLG' +
' from (' +
' select head.BillNo,head.AccDate,shop.FinaCode,head.ShopCode,class.UpperCode1 as ClsCode,' +
' sum(body.NetCost) as NetCost,sum(body.ZpCount) as Counts,shop.OrgType' +
' from t_dist_head head, t_dist_body body, t_shop shop, t_plu plu, t_gclass class' +
' where head.BillNo = body.BillNo' +
' and head.OrgCode = shop.OrgCode' +
' and body.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' and body.ZpCount <> 0' +
' and exists (select OrgCode from t_shop a, t_financial_body b where a.FinaCode = b.FinaCode and a.OrgCode = head.ShopCode and b.FinaType = ''1'')' +
' group by head.BillNo,head.AccDate,shop.FinaCode,head.ShopCode,class.UpperCode1,shop.OrgType' +
' ) a'
exec(@sql)
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳɱ<EFBFBD>ʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_inventorychginfo
set DOCNO = 'PSC' + ZYWDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'F11' and ZJYFS = 'Z20' and DOCNO is null
set @psmsg = ''
return (1)
end
go
if exists (select name from sysobjects where name='p_int_gen_out_trans' and xtype='p')
drop procedure p_int_gen_out_trans
go
create procedure p_int_gen_out_trans
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @where varchar(2000)
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and head.OrgCode = ''' + @psorgcode + ''''
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_drytransferinfo' +
' (CREATEDATE,IFTYPE,BUKRS,ZSIGN,SDWRK,SPRCTR,WERKS,PRCTR,ZYWDAT,' +
' ZTYPE,MATNR,ZJYFS,SLTWR,WEARS,MENGE,DWERT,MEINS,ZTSDAT,ZYZLX,UNFLG)' +
'select ''' + @createdate + ''' as CreateDate,''F06'' as IFTYPE,FinaCode as BUKRS, ''1'' as ZSIGN,OutOrgCode as SDWRK,''P''+FinaCode+''1''+OutOrgCode as SPRCTR,InOrgCode as WERKS,''P''+FinaCode+''1''+InOrgCode as PRCTR,replace(AccDate,''-'','''') as ZYWDAT,' +
' ''F06'' as ZTYPE,ClsCode as MATNR,''Z01'' as ZJYFS,NetCost as SLTWR,''CNY'' as WEARS,Counts as MENGE,0 as DWERT,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,''' + @tsdat + ''' as ZTSDAT,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX,'''' as UNFLG' +
' from (' +
' select head.AccDate,shop.FinaCode,head.OutOrgCode,head.InOrgCode,class.UpperCode1 as ClsCode,' +
' sum(body.NetCost) as NetCost,sum(body.Counts) as Counts,shop.OrgType' +
' from t_outtrans_head head, t_outtrans_body body, t_shop shop, t_plu plu, t_gclass class' +
' where head.BillNo = body.BillNo' +
' and head.OutOrgCode = shop.OrgCode' +
' and body.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and head.BillType = ''1''' +
' and head.IsOut = ''1''' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' group by head.AccDate,shop.FinaCode,head.OutOrgCode,head.InOrgCode,class.UpperCode1,shop.OrgType' +
' ) a'
exec(@sql)
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_drytransferinfo
set DOCNO = 'DBD' + ZYWDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'F06' and DOCNO is null
set @psmsg = ''
return (1)
end
go
if exists (select name from sysobjects where name='p_int_gen_wh_sale' and xtype='p')
drop procedure p_int_gen_wh_sale
go
create procedure p_int_gen_wh_sale
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @where varchar(2000)
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and head.OrgCode = ''' + @psorgcode + ''''
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_drysalesinfo' +
' (CREATEDATE,IFTYPE,BUKRS,WERKS,ZSIGN,PRCTR,ZYWDAT,ZTYPE,ZCXLX,ZJYFS,VVTYP,MATNR,' +
' MENGE,MEINS,PRICE,SKTAK,SKTBT,TMWSTS,GTTAX,WAERS,ZTOLAMT,ZTSDAT,ZGZDAT,ZYZLX,' +
' ZFNAME,ZUNFLG,VBELN,KUNNR,KUNWE,MWSKZ)' +
'select ''' + @createdate + ''' as CreateDate,''F01'' as IFTYPE,FinaCode as BUKRS,''2Y00'' as WERKS,''1'' as ZSIGN,''P''+FinaCode+''1''+''2Y00'' as PRCTR,replace(AccDate,''-'','''') as ZYWDAT,''F01'' as ZTYPE,''Z30'' as ZCXLX,''Z21'' as ZJYFS,'''' as VVTYP,ClsCode as MATNR,' +
' Counts as MENGE,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,PfTotal as PRICE,PfTotal as SKTAK,0 as SKTBT,TaxAmount as TMWSTS,0 as GTTAX,''CNY'' as WAERS,0 as ZTOLAMT,''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX,' +
' '''' as ZFNAME,'''' as ZUNFLG,BillNo as VBELN,CustCode as KUNNR,CustCode as KUNWE,case STaxRate when 0 then ''X0'' when 17 then ''X1'' when 13 then ''X2'' when 2 then ''X3'' when 6 then ''X4'' when 11 then ''X5'' when 16 then ''X7'' when 10 then ''X8'' when 9 then ''X9'' end as MWSKZ' +
' from (' +
' select head.BillNo,head.AccDate,shop.FinaCode,head.OrgCode,head.CustCode,class.UpperCode1 as ClsCode,plu.STaxRate,' +
' sum(body.PfTotal) as PfTotal,sum(body.PfTotal - body.NetPfTotal) as TaxAmount,sum(body.Counts) as Counts,shop.OrgType' +
11 months ago
' from t_whsale_head head, t_whsale_body body, t_shop shop, t_plu plu, t_gclass class' +
' where head.BillNo = body.BillNo' +
' and head.OrgCode = shop.OrgCode' +
' and body.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' group by head.BillNo,head.AccDate,shop.FinaCode,head.OrgCode,head.CustCode,class.UpperCode1,shop.OrgType,plu.STaxRate' +
' ) a'
exec(@sql)
9 months ago
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_drysalesinfo' +
' (CREATEDATE,IFTYPE,BUKRS,WERKS,ZSIGN,PRCTR,ZYWDAT,ZTYPE,ZCXLX,ZJYFS,VVTYP,MATNR,' +
' MENGE,MEINS,PRICE,SKTAK,SKTBT,TMWSTS,GTTAX,WAERS,ZTOLAMT,ZTSDAT,ZGZDAT,ZYZLX,' +
' ZFNAME,ZUNFLG,VBELN,KUNNR,KUNWE,MWSKZ)' +
'select ''' + @createdate + ''' as CreateDate,''F01'' as IFTYPE,FinaCode as BUKRS,''2Y00'' as WERKS,''1'' as ZSIGN,''P''+FinaCode+''1''+''2Y00'' as PRCTR,replace(AccDate,''-'','''') as ZYWDAT,''F01'' as ZTYPE,''Z30'' as ZCXLX,''Z21'' as ZJYFS,'''' as VVTYP,ClsCode as MATNR,' +
' Counts as MENGE,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,PfTotal as PRICE,PfTotal as SKTAK,0 as SKTBT,TaxAmount as TMWSTS,0 as GTTAX,''CNY'' as WAERS,0 as ZTOLAMT,''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX,' +
' '''' as ZFNAME,''Y'' as ZUNFLG,BillNo as VBELN,CustCode as KUNNR,CustCode as KUNWE,case STaxRate when 0 then ''X0'' when 17 then ''X1'' when 13 then ''X2'' when 2 then ''X3'' when 6 then ''X4'' when 11 then ''X5'' when 16 then ''X7'' when 10 then ''X8'' when 9 then ''X9'' end as MWSKZ' +
' from (' +
' select head.BillNo,head.AccDate,shop.FinaCode,head.OrgCode,head.CustCode,class.UpperCode1 as ClsCode,plu.STaxRate,' +
' sum(-body.PfTotal) as PfTotal,sum(body.NetPfTotal - body.PfTotal) as TaxAmount,sum(body.ZrTotal-body.PfTotal) as SsTotal,sum(-body.Counts) as Counts,shop.OrgType' +
11 months ago
' from t_whreturn_head head, t_whreturn_body body, t_shop shop, t_plu plu, t_gclass class' +
' where head.BillNo = body.BillNo' +
' and head.OrgCode = shop.OrgCode' +
' and body.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and head.AccDate is not null and head.AccDate <> ''''' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' group by head.BillNo,head.AccDate,shop.FinaCode,head.OrgCode,head.CustCode,class.UpperCode1,shop.OrgType,plu.STaxRate' +
' ) a'
exec(@sql)
if @@error <>0
begin
9 months ago
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>ʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_drysalesinfo
set DOCNO = 'PFX' + ZYWDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'F01' and ZJYFS = 'Z21' and DOCNO is null
set @psmsg = ''
return (1)
end
go
if exists (select name from sysobjects where name='p_int_gen_wh_chg' and xtype='p')
drop procedure p_int_gen_wh_chg
go
create procedure p_int_gen_wh_chg
(
@psorgcode varchar(10),
@psaccdate varchar(10),
@psmsg varchar(2000) out
)
as
begin
declare @where varchar(2000)
declare @sql varchar(5000)
declare @createdate varchar(20)
declare @tsdat varchar(10)
set @where = ''
set @createdate = convert(varchar(20),getdate(),120)
set @tsdat = convert(varchar(8),getdate(),112)
if @psorgcode <> '' and @psorgcode is not null and @psorgcode <> '*'
begin
set @where = ' and head.OrgCode = ''' + @psorgcode + ''''
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_inventorychginfo' +
' (CREATEDATE,IFTYPE,BUKRS,ZSIGN,WERKS,PRCTR,ZYWDAT,ZTYPE,MATNR,ZJYFS,SLTWR,' +
' WEARS,MENGE,DWERT,MEINS,ZTSDAT,ZGZDAT,ZCSBS,ZYZLX,UNFLG,VBELN,KUNNR,KUNWE)' +
'select ''' + @createdate + ''' as CreateDate,''F11'' as IFTYPE,FinaCode as BUKRS,''1'' as ZSIGN,''2Y00'' as WERKS,''P''+FinaCode+''1''+''2Y00'' as PRCTR,replace(AccDate,''-'','''') as ZYWDAT,''F11'' as ZTYPE,ClsCode as MATNR,''Z21'' as ZJYFS,NetCost as SLTWR,' +
' ''CNY'' as WEARS,Counts as MENGE,0 as DWERT,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,''X'' as ZCSBS,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX,'''' as UNFLG,BillNo as VBELN,CustCode as KUNNR,CustCode as KUNWE' +
' from (' +
' select head.BillNo,head.AccDate,shop.FinaCode,head.OrgCode,head.CustCode,class.UpperCode1 as ClsCode,' +
' sum(body.NetCost) as NetCost,sum(body.Counts) as Counts,shop.OrgType' +
' from t_whsale_head head, t_whsale_body2 body, t_shop shop, t_plu plu, t_gclass class' +
' where head.BillNo = body.BillNo' +
' and head.OrgCode = shop.OrgCode' +
' and body.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' group by head.BillNo,head.AccDate,shop.FinaCode,head.OrgCode,head.CustCode,class.UpperCode1,shop.OrgType' +
' ) a'
exec(@sql)
9 months ago
if @@error <>0
begin
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۳ɱ<EFBFBD>ʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
set @sql = 'insert into t_int_sap_inventorychginfo' +
' (CREATEDATE,IFTYPE,BUKRS,ZSIGN,WERKS,PRCTR,ZYWDAT,ZTYPE,MATNR,ZJYFS,SLTWR,' +
' WEARS,MENGE,DWERT,MEINS,ZTSDAT,ZGZDAT,ZCSBS,ZYZLX,UNFLG,VBELN,KUNNR,KUNWE)' +
'select ''' + @createdate + ''' as CreateDate,''F11'' as IFTYPE,FinaCode as BUKRS,''1'' as ZSIGN,''2Y00'' as WERKS,''P''+FinaCode+''1''+''2Y00'' as PRCTR,replace(AccDate,''-'','''') as ZYWDAT,''F11'' as ZTYPE,ClsCode as MATNR,''Z21'' as ZJYFS,NetCost as SLTWR,' +
' ''CNY'' as WEARS,Counts as MENGE,0 as DWERT,case ClsCode when ''2018'' then ''L'' else ''EA'' end as MEINS,''' + @tsdat + ''' as ZTSDAT,replace(AccDate,''-'','''') as ZGZDAT,''X'' as ZCSBS,case OrgType when ''1'' then ''DO'' else ''COCO'' end as ZYZLX,'''' as UNFLG,BillNo as VBELN,CustCode as KUNNR,CustCode as KUNWE' +
' from (' +
' select head.BillNo,head.AccDate,shop.FinaCode,head.OrgCode,head.CustCode,class.UpperCode1 as ClsCode,' +
' sum(-body.NetCost) as NetCost,sum(-body.Counts) as Counts,shop.OrgType' +
' from t_whreturn_head head, t_whreturn_body2 body, t_shop shop, t_plu plu, t_gclass class' +
' where head.BillNo = body.BillNo' +
' and head.OrgCode = shop.OrgCode' +
' and body.PluCode = plu.PluCode' +
' and plu.ClsCode = class.ClsCode' +
' and head.AccDate = ''' + @psaccdate + '''' + @where +
' group by head.BillNo,head.AccDate,shop.FinaCode,head.OrgCode,head.CustCode,class.UpperCode1,shop.OrgType' +
' ) a'
exec(@sql)
if @@error <>0
begin
9 months ago
set @psmsg = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD>ɱ<EFBFBD>ʧ<EFBFBD><EFBFBD>'
return(-1)
end
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD>ţ<EFBFBD>3λҵ<EFBFBD><EFBFBD>ǰ׺+6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+6<EFBFBD><EFBFBD>ˮ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
update t_int_sap_inventorychginfo
set DOCNO = 'PFC' + ZYWDAT + convert(varchar(10),SERIALNO)
where IFTYPE = 'F11' and ZJYFS = 'Z21' and DOCNO is null
set @psmsg = ''
return (1)
end
1 year ago
go