Reset running number

在SL(SyteLine),每一个财务年份,得做一次Reset running Number。

你得去好几个form进行操作。

下面,是本人在SQL Server,执行SQL语句来实现:

PO, CO, RMA and Transfer order:

Reset running number_第1张图片

 

DECLARE @y INT = 2020  -- Setup this value only!!!

DECLARE @v NVARCHAR(15) = SUBSTRING(CONVERT(NVARCHAR(4),@y),3,2)

--关闭所有财务期间
UPDATE [dbo].[periods] SET [closed] = 1

--然后打开当前年份的财务期间
UPDATE [dbo].[periods] SET [closed] = 0 WHERE [fiscal_year] = @y

--为General Parameter form设置当前财务年份
UPDATE [dbo].[parms] SET [fiscal_year] = @y WHERE [parm_key] = 0

--修改PO参数,即是PO,RT单号前缀
UPDATE [dbo].[poparms] SET [po_prefix] = N'PO' + @v + N'-' ,[Uf_rtnum_prefix] = N'RT' + @v + N'-' WHERE [parm_key] = 0

--修改CO参数,即是CO,DO,Q等单号前缀
UPDATE [dbo].[coparms] SET [co_prefix] = N'CO' + @v + N'-',[do_prefix] = N'DO' + @v + N'-',[est_prefix] = N'Q' + @v + N'-' WHERE [parm_key] = 0

--修改RMA号前缀
UPDATE [dbo].[rmaparms] SET [rma_prefix] = N'RMA' + @v + N'-' WHERE [rmaparms_key] = 0

--修改Transfer order单号前缀
UPDATE [dbo].[invparms] SET [trn_prefix] = N'TR' + @v + N'-' WHERE [parm_key] = 0

--关闭所有Inv sequence
UPDATE [dbo].[inv_sequence] SET [closed] = 1

--然后打开类型为C,D,I的Inv sequence
UPDATE [dbo].[inv_sequence] SET [closed] = 0 WHERE [type] IN ('C','D','I') AND [start_date] = ''+ CONVERT(NVARCHAR(4), @y) +'-01-01 00:00:00.000' AND [end_date] = CONVERT(NVARCHAR(4), @y) +'-12-31 00:00:00.000'
Source Code

 

你可能感兴趣的:(Reset running number)