Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- USE [BELBaseline]
- GO
- /****** Object: StoredProcedure [dbo].[sp_DMS_BaselineMonthly] Script Date: 10/22/2019 2:23:17 PM ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: Dinh Hoang Lam
- -- Create date: 2015/04/02
- -- Description:
- -- =============================================
- -- EXEC sp_DMS_BaselineMonthly 4,8, 2016, 1
- ALTER PROCEDURE [dbo].[sp_DMS_BaselineMonthly]
- @CompanyID INT
- , @Month INT
- , @Year INT
- , @DistributorID VARCHAR(MAX)
- AS
- BEGIN
- SET NOCOUNT ON
- DECLARE @_CompanyID INT = @CompanyID
- DECLARE @_Month INT = @Month
- DECLARE @_Year INT = @Year
- DECLARE @_DistributorID VARCHAR(MAX) = NULLIF(LTRIM(RTRIM(@DistributorID)), '')
- DECLARE @_MonthID CHAR(6) = RIGHT('0' + CONVERT(VARCHAR(2), @_Month), 2) + CONVERT(VARCHAR(4), @_Year)
- DECLARE @_FirstDayOfMonth DATETIME = CONVERT(DATETIME, CONVERT(VARCHAR(4), @_Year) + '/' + CONVERT(VARCHAR(2), @_Month) + '/1')
- DECLARE @_LastDayOfMonth DATETIME = DATEADD(dd, -1, DATEADD(mm, 1, @_FirstDayOfMonth))
- DECLARE @_LastDayBaselineOfMonth DATETIME
- DECLARE @_MonthlyBaseline INT
- SELECT @_MonthlyBaseline = MonthlyBaseline FROM BELDMS..DMSBaselineConfig WHERE CompanyID = @_CompanyID
- SET @_LastDayBaselineOfMonth = DATEADD(dd, @_MonthlyBaseline, @_LastDayOfMonth)
- IF DATEPART(dw, @_LastDayBaselineOfMonth) = 1
- SET @_LastDayBaselineOfMonth = DATEADD(dd, 1, @_LastDayBaselineOfMonth)
- SET @_LastDayBaselineOfMonth = GETDATE()
- ---- Baseline Transaction Data
- DECLARE @_CheckDate datetime = getdate()
- declare @StartTime datetime , @EndTime datetime;
- declare @StartRowCount float , @EndRowCount float , @RowCountNumber float;
- DECLARE @Message NVARCHAR(MAX) , @Parameter nvarchar(max);
- SET @Message='';
- DECLARE @Error NVARCHAR(MAX);
- ---- Nếu tháng trước chưa được chốt baseline tháng thì set ngày baseline từ tháng trước.
- IF NOT EXISTS (SELECT TOP 1 * FROM dbo.DMSBLMonthlyHistory WHERE CompanyID = @_CompanyID AND MonthID = @_MonthID)
- BEGIN
- INSERT INTO dbo.DMSBLMonthlyHistory(BaselineDate, CompanyID, MonthID ) VALUES(GETDATE(), @_CompanyID, @_MonthID)
- UPDATE BELDMS..DMSBaselineClosedDate SET ClosedDate = @_LastDayOfMonth WHERE CompanyID = @_CompanyID
- END
- ELSE
- UPDATE dbo.DMSBLMonthlyHistory SET BaselineDate = GETDATE() WHERE CompanyID = @_CompanyID AND MonthID = @_MonthID
- --Start Baseline Month
- begin try
- set @Parameter = '@_CompanyID = 3,@_MonthID=' + convert(nvarchar(20),@_MonthID) + ',@_FirstDayOfMonth=' + convert(nvarchar(20),@_FirstDayOfMonth) + ',@_LastDayOfMonth=' + convert(nvarchar(20),@_LastDayOfMonth) + ',@_DistributorID='+Isnull(@_DistributorID,'')
- set @StartTime = getdate();
- set @StartRowCount = (select count(1) from DMSBLMCPHistory)
- EXEC dbo.sp_DMS_Baseline_MCPMonthly @_CompanyID, @_MonthID, @_FirstDayOfMonth, @_LastDayOfMonth, @_DistributorID
- set @EndTime = GETDATE();
- set @EndRowCount = (select count(1) from DMSBLMCPHistory)
- set @RowCountNumber = @EndRowCount - @StartRowCount
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_MCPMonthly' , @Parameter, 1,'' ,@StartTime , @EndTime,@RowCountNumber
- end try
- begin catch
- IF(ERROR_MESSAGE() IS NOT NULL)
- BEGIN
- SET @Error=ERROR_MESSAGE();
- SET @Message= @Message+' - store sp_DMS_Baseline_MCPMonthly failed: ' +@Error + '<br/>';
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_MCPMonthly' , @Parameter, 0,@Message, @StartTime , @EndTime,@RowCountNumber;
- END
- end catch
- begin try
- set @Parameter = '@_CompanyID = 3,@_MonthID=' + convert(nvarchar(20),@_MonthID) + ',@_FirstDayOfMonth=' + convert(nvarchar(20),@_FirstDayOfMonth) + ',@_LastDayBaselineOfMonth=' + convert(nvarchar(20),@_LastDayBaselineOfMonth) + ',@_DistributorID='+Isnull(@_DistributorID,'')
- set @StartTime = getdate();
- set @StartRowCount = (select count(1) from DMSBLRawSalesHistory)
- EXEC dbo.sp_DMS_Baseline_RawSalesMonthly @_CompanyID, @_MonthID, @_FirstDayOfMonth, @_LastDayBaselineOfMonth, @_DistributorID
- set @EndTime = GETDATE();
- set @EndRowCount = (select count(1) from DMSBLRawSalesHistory)
- set @RowCountNumber = @EndRowCount - @StartRowCount
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_RawSalesMonthly' , @Parameter, 1,'' ,@StartTime , @EndTime,@RowCountNumber
- end try
- begin catch
- IF(ERROR_MESSAGE() IS NOT NULL)
- BEGIN
- SET @Error=ERROR_MESSAGE();
- SET @Message= @Message+' - store sp_DMS_Baseline_RawSalesMonthly failed: ' +@Error + '<br/>';
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_RawSalesMonthly' , @Parameter, 0,@Message, @StartTime , @EndTime,@RowCountNumber;
- END
- end catch
- begin try
- set @Parameter = '@_CompanyID = 3,@_MonthID=' + convert(nvarchar(20),@_MonthID) + ',@_FirstDayOfMonth=' + convert(nvarchar(20),@_FirstDayOfMonth) + ',@_LastDayBaselineOfMonth=' + convert(nvarchar(20),@_LastDayBaselineOfMonth) + ',@_DistributorID='+Isnull(@_DistributorID,'')
- set @StartTime = getdate();
- set @StartRowCount = (select count(1) from DMSBLIncompleteRawSalesHistory)
- EXEC dbo.sp_DMS_Baseline_IncompleteRawSalesMonthly @_CompanyID, @_MonthID, @_FirstDayOfMonth, @_LastDayBaselineOfMonth, @_DistributorID
- set @EndTime = GETDATE();
- set @EndRowCount = (select count(1) from DMSBLIncompleteRawSalesHistory)
- set @RowCountNumber = @EndRowCount - @StartRowCount
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_IncompleteRawSalesMonthly' , @Parameter, 1,'' ,@StartTime , @EndTime,@RowCountNumber
- end try
- begin catch
- IF(ERROR_MESSAGE() IS NOT NULL)
- BEGIN
- SET @Error=ERROR_MESSAGE();
- SET @Message= @Message+' - store sp_DMS_Baseline_IncompleteRawSalesMonthly failed: ' +@Error + '<br/>';
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_IncompleteRawSalesMonthly' , @Parameter, 0,@Message, @StartTime , @EndTime,@RowCountNumber;
- END
- end catch
- begin try
- set @Parameter = '@_CompanyID = 3,@_MonthID=' + convert(nvarchar(20),@_MonthID) + ',@_FirstDayOfMonth=' + convert(nvarchar(20),@_FirstDayOfMonth) + ',@_LastDayOfMonth=' + convert(nvarchar(20),@_LastDayOfMonth) + ',@_DistributorID='+Isnull(@_DistributorID,'')
- set @StartTime = getdate();
- set @StartRowCount = (select count(1) from DMSBLPromotionDetailHistory)
- EXEC dbo.sp_DMS_Baseline_PromotionDetailMonthly @_CompanyID, @_MonthID, @_FirstDayOfMonth, @_LastDayOfMonth, @_DistributorID
- set @EndTime = GETDATE();
- set @EndRowCount = (select count(1) from DMSBLPromotionDetailHistory)
- set @RowCountNumber = @EndRowCount - @StartRowCount
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_PromotionDetailMonthly' , @Parameter, 1,'' ,@StartTime , @EndTime,@RowCountNumber
- end try
- begin catch
- IF(ERROR_MESSAGE() IS NOT NULL)
- BEGIN
- SET @Error=ERROR_MESSAGE();
- SET @Message= @Message+' - store sp_DMS_Baseline_PromotionDetailMonthly failed: ' +@Error + '<br/>';
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_PromotionDetailMonthly' , @Parameter, 0,@Message, @StartTime , @EndTime,@RowCountNumber;
- END
- end catch
- begin try
- set @Parameter = '@_CompanyID = 3,@_MonthID=' + convert(nvarchar(20),@_MonthID) + ',@_FirstDayOfMonth=' + convert(nvarchar(20),@_FirstDayOfMonth) + ',@_LastDayOfMonth=' + convert(nvarchar(20),@_LastDayOfMonth) + ',@_DistributorID='+Isnull(@_DistributorID,'')
- set @StartTime = getdate();
- set @StartRowCount = (select count(1) from DMSBLPromotionDetailFullHistory)
- EXEC dbo.sp_DMS_Baseline_PromotionDetailFullMonthly @_CompanyID, @_MonthID, @_FirstDayOfMonth, @_LastDayOfMonth, @_DistributorID
- set @EndTime = GETDATE();
- set @EndRowCount = (select count(1) from DMSBLPromotionDetailFullHistory)
- set @RowCountNumber = @EndRowCount - @StartRowCount
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_PromotionDetailFullMonthly' , @Parameter, 1,'' ,@StartTime , @EndTime,@RowCountNumber
- end try
- begin catch
- IF(ERROR_MESSAGE() IS NOT NULL)
- BEGIN
- SET @Error=ERROR_MESSAGE();
- SET @Message= @Message+' - store sp_DMS_Baseline_PromotionDetailFullMonthly failed: ' +@Error + '<br/>';
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_PromotionDetailFullMonthly' , @Parameter, 0,@Message, @StartTime , @EndTime,@RowCountNumber;
- END
- end catch
- begin try
- set @Parameter = '@_CompanyID = 3,@_MonthID=' + convert(nvarchar(20),@_MonthID) + ',@_FirstDayOfMonth=' + convert(nvarchar(20),@_FirstDayOfMonth) + ',@_LastDayOfMonth=' + convert(nvarchar(20),@_LastDayOfMonth) + ',@_DistributorID='+Isnull(@_DistributorID,'')
- set @StartTime = getdate();
- set @StartRowCount = (select count(1) from DMSBLSalesHistory) + (select count(1) from DMSBLSalesHistory)
- EXEC dbo.sp_DMS_Baseline_SalesMonthly @_CompanyID, @_MonthID, @_FirstDayOfMonth, @_LastDayOfMonth, @_DistributorID
- set @EndTime = GETDATE();
- set @EndRowCount = (select count(1) from DMSBLSalesHistory)+ (select count(1) from DMSBLSalesHistory)
- set @RowCountNumber = @EndRowCount - @StartRowCount
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_SalesMonthly' , @Parameter, 1,'' ,@StartTime , @EndTime,@RowCountNumber
- end try
- begin catch
- IF(ERROR_MESSAGE() IS NOT NULL)
- BEGIN
- SET @Error=ERROR_MESSAGE();
- SET @Message= @Message+' - store sp_DMS_Baseline_SalesMonthly failed: ' +@Error + '<br/>';
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_SalesMonthly' , @Parameter, 0,@Message, @StartTime , @EndTime,@RowCountNumber;
- END
- end catch
- begin try
- set @Parameter = '@_CompanyID = 3,@_Year=' + convert(nvarchar(20),@_Year) + ',@_Year=' + convert(nvarchar(20),@_Year) + ',@_Month=' + convert(nvarchar(20),@_Month) + ',@_Month=' + convert(nvarchar(20),@_Month) + ',@_DistributorID='+Isnull(@_DistributorID,'')
- set @StartTime = getdate();
- set @StartRowCount = (select count(1) from DMSBLDistributorSKUSales)
- EXEC dbo.sp_DMS_Baseline_DistributorSKUSales @_CompanyID, @_Year, @_Year, @_Month, @_Month, @_DistributorID
- set @EndTime = GETDATE();
- set @StartRowCount = (select count(1) from DMSBLDistributorSKUSales)
- set @RowCountNumber = @EndRowCount - @StartRowCount
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_DistributorSKUSales' , @Parameter, 1,'' ,@StartTime , @EndTime,@RowCountNumber
- end try
- begin catch
- IF(ERROR_MESSAGE() IS NOT NULL)
- BEGIN
- SET @Error=ERROR_MESSAGE();
- SET @Message= @Message+' - store sp_DMS_Baseline_DistributorSKUSales failed: ' +@Error + '<br/>';
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_DistributorSKUSales' , @Parameter, 0,@Message, @StartTime , @EndTime,@RowCountNumber;
- END
- end catch
- begin try
- set @Parameter = '@_CompanyID = 3,@_LastDayOfMonth=' + convert(nvarchar(20),@_LastDayOfMonth)
- set @StartTime = getdate();
- set @StartRowCount = (select count(1) from DMSBLObjectKPITemp) + (select count(1) from DMSBLSalesObjectRawDataTemp) + (select count(1) from DMSBLKPI)
- EXEC dbo.sp_DMS_Baseline_KPI @_CompanyID, @_LastDayOfMonth
- set @EndTime = GETDATE();
- set @StartRowCount = (select count(1) from DMSBLObjectKPITemp) + (select count(1) from DMSBLSalesObjectRawDataTemp) + (select count(1) from DMSBLKPI)
- set @RowCountNumber = @EndRowCount - @StartRowCount
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_KPI' , @Parameter, 1,'' ,@StartTime , @EndTime,@RowCountNumber
- end try
- begin catch
- IF(ERROR_MESSAGE() IS NOT NULL)
- BEGIN
- SET @Error=ERROR_MESSAGE();
- SET @Message= @Message+' - store sp_DMS_Baseline_KPI failed: ' +@Error + '<br/>';
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_KPI' , @Parameter, 0,@Message, @StartTime , @EndTime,@RowCountNumber;
- END
- end catch
- begin try
- set @Parameter = '@_CompanyID = 3,@_MonthID=' + convert(nvarchar(20),@_MonthID) + ',@_FirstDayOfMonth=' + convert(nvarchar(20),@_FirstDayOfMonth) + ',@_LastDayOfMonth=' + convert(nvarchar(20),@_LastDayOfMonth) + ',@_DistributorID='+Isnull(@_DistributorID,'')
- set @StartTime = getdate();
- set @StartRowCount = (select count(1) from DMSBLRouteSalesHistory)
- EXEC dbo.sp_DMS_Baseline_RouteSalesMonthly @_CompanyID, @_MonthID, @_FirstDayOfMonth, @_LastDayOfMonth, @_DistributorID
- set @EndTime = GETDATE();
- set @StartRowCount = (select count(1) from DMSBLRouteSalesHistory)
- set @RowCountNumber = @EndRowCount - @StartRowCount
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_RouteSalesMonthly' , @Parameter, 1,'' ,@StartTime , @EndTime,@RowCountNumber
- end try
- begin catch
- IF(ERROR_MESSAGE() IS NOT NULL)
- BEGIN
- SET @Error=ERROR_MESSAGE();
- SET @Message= @Message+' - store sp_DMS_Baseline_RouteSalesMonthly failed: ' +@Error + '<br/>';
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_RouteSalesMonthly' , @Parameter, 0,@Message, @StartTime , @EndTime,@RowCountNumber;
- END
- end catch
- begin try
- set @Parameter = '@_CompanyID = 3,@_FirstDayOfMonth=' + convert(nvarchar(20),@_FirstDayOfMonth) + ',@_LastDayOfMonth=' + convert(nvarchar(20),@_LastDayOfMonth) + ',@_DistributorID='+Isnull(@_DistributorID,'')
- set @StartTime = getdate();
- set @StartRowCount = (select count(1) from DMSBLDistributorSales)
- EXEC dbo.sp_DMS_Baseline_DistributorSales @_CompanyID, @_FirstDayOfMonth, @_LastDayOfMonth, @_DistributorID
- set @EndTime = GETDATE();
- set @StartRowCount = (select count(1) from DMSBLDistributorSales)
- set @RowCountNumber = @EndRowCount - @StartRowCount
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_DistributorSales' , @Parameter, 1,'' ,@StartTime , @EndTime,@RowCountNumber
- end try
- begin catch
- IF(ERROR_MESSAGE() IS NOT NULL)
- BEGIN
- SET @Error=ERROR_MESSAGE();
- SET @Message= @Message+' - store sp_DMS_Baseline_DistributorSales failed: ' +@Error + '<br/>';
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_DistributorSales' , @Parameter, 0,@Message, @StartTime , @EndTime,@RowCountNumber;
- END
- end catch
- begin try
- set @Parameter = '@_CompanyID = 3,@_Month=' + convert(nvarchar(20),@_Month) + ',@_Year=' + convert(nvarchar(20),@_Year)
- set @StartTime = getdate();
- set @StartRowCount = (select count(1) from DMSBLDistributorSystem)
- EXEC dbo.sp_DMS_Baseline_DistributorSystem @_CompanyID, @_Month, @_Year
- set @EndTime = GETDATE();
- set @StartRowCount = (select count(1) from DMSBLDistributorSystem)
- set @RowCountNumber = @EndRowCount - @StartRowCount
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_DistributorSystem' , @Parameter, 1,'' ,@StartTime , @EndTime,@RowCountNumber
- end try
- begin catch
- IF(ERROR_MESSAGE() IS NOT NULL)
- BEGIN
- SET @Error=ERROR_MESSAGE();
- SET @Message= @Message+' - store sp_DMS_Baseline_DistributorSystem failed: ' +@Error + '<br/>';
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_DistributorSystem' , @Parameter, 0,@Message, @StartTime , @EndTime,@RowCountNumber;
- END
- end catch
- begin try
- set @Parameter = '@_CompanyID = 3,@_Month=' + convert(nvarchar(20),@_Month) + ',@_Year=' + convert(nvarchar(20),@_Year)
- set @StartTime = getdate();
- set @StartRowCount = (select count(1) from DMSBLDistributorSystemByCustomer)
- EXEC dbo.sp_DMS_Baseline_DistributorSystemByCustomer @_CompanyID, @_Month, @_Year
- set @EndTime = GETDATE();
- set @StartRowCount = (select count(1) from DMSBLDistributorSystemByCustomer)
- set @RowCountNumber = @EndRowCount - @StartRowCount
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_DistributorSystemByCustomer' , @Parameter, 1,'' ,@StartTime , @EndTime,@RowCountNumber
- end try
- begin catch
- IF(ERROR_MESSAGE() IS NOT NULL)
- BEGIN
- SET @Error=ERROR_MESSAGE();
- SET @Message= @Message+' - store sp_DMS_Baseline_DistributorSystemByCustomer failed: ' +@Error + '<br/>';
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_DistributorSystemByCustomer' , @Parameter, 0,@Message, @StartTime , @EndTime,@RowCountNumber;
- END
- end catch
- begin try
- set @Parameter = '@_CompanyID = 3,@_MonthID=' + convert(nvarchar(20),@_MonthID) + ',@_FirstDayOfMonth=' + convert(nvarchar(20),@_FirstDayOfMonth) + ',@_LastDayOfMonth=' + convert(nvarchar(20),@_LastDayOfMonth) + ',@_DistributorID='+Isnull(@_DistributorID,'')
- set @StartTime = getdate();
- set @StartRowCount = (select count(1) from BELDMS..DMSInventoryStockHistory)
- EXEC BELDMS..sp_DMS_InsertInventoryStockMonthly @_CompanyID, @_FirstDayOfMonth, @_LastDayOfMonth, @_DistributorID
- set @EndTime = GETDATE();
- set @StartRowCount = (select count(1) from BELDMS..DMSInventoryStockHistory)
- set @RowCountNumber = @EndRowCount - @StartRowCount
- EXEC dbo.spInsertHistory 'sp_DMS_InsertInventoryStockMonthly' , @Parameter, 1,'' ,@StartTime , @EndTime,@RowCountNumber
- end try
- begin catch
- IF(ERROR_MESSAGE() IS NOT NULL)
- BEGIN
- SET @Error=ERROR_MESSAGE();
- SET @Message= @Message+' - store sp_DMS_InsertInventoryStockMonthly failed: ' +@Error + '<br/>';
- EXEC dbo.spInsertHistory 'sp_DMS_InsertInventoryStockMonthly' , @Parameter, 0,@Message, @StartTime , @EndTime,@RowCountNumber;
- END
- end catch
- begin try
- set @Parameter = '@_CompanyID = 3,@_MonthID=' + convert(nvarchar(20),@_MonthID) + ',@_FirstDayOfMonth=' + convert(nvarchar(20),@_FirstDayOfMonth) + ',@_LastDayOfMonth=' + convert(nvarchar(20),@_LastDayOfMonth) + ',@_DistributorID='+Isnull(@_DistributorID,'')
- set @StartTime = getdate();
- set @StartRowCount = (select count(1) from BELDMS..DMSInventoryStockHistory)
- EXEC sp_DMS_Baseline_ProgramTracking @_CompanyID, @_FirstDayOfMonth, @_LastDayOfMonth, @_DistributorID
- set @EndTime = GETDATE();
- set @StartRowCount = (select count(1) from BELDMS..DMSInventoryStockHistory)
- set @RowCountNumber = @EndRowCount - @StartRowCount
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_ProgramTracking' , @Parameter, 1,'' ,@StartTime , @EndTime,@RowCountNumber
- end try
- begin catch
- IF(ERROR_MESSAGE() IS NOT NULL)
- BEGIN
- SET @Error=ERROR_MESSAGE();
- SET @Message= @Message+' - store sp_DMS_InsertInventoryStockMonthly failed: ' +@Error + '<br/>';
- EXEC dbo.spInsertHistory 'sp_DMS_Baseline_ProgramTracking' , @Parameter, 0,@Message, @StartTime , @EndTime,@RowCountNumber;
- END
- end catch
- --EXEC dbo.sp_DMS_Baseline_MCPMonthly @_CompanyID, @_MonthID, @_FirstDayOfMonth, @_LastDayOfMonth, @_DistributorID
- --EXEC dbo.sp_DMS_Baseline_RawSalesMonthly @_CompanyID, @_MonthID, @_FirstDayOfMonth, @_LastDayBaselineOfMonth, @_DistributorID
- --EXEC dbo.sp_DMS_Baseline_IncompleteRawSalesMonthly @_CompanyID, @_MonthID, @_FirstDayOfMonth, @_LastDayBaselineOfMonth, @_DistributorID
- --EXEC dbo.sp_DMS_Baseline_PromotionDetailMonthly @_CompanyID, @_MonthID, @_FirstDayOfMonth, @_LastDayOfMonth, @_DistributorID
- --EXEC dbo.sp_DMS_Baseline_PromotionDetailFullMonthly @_CompanyID, @_MonthID, @_FirstDayOfMonth, @_LastDayOfMonth, @_DistributorID
- --EXEC dbo.sp_DMS_Baseline_SalesMonthly @_CompanyID, @_MonthID, @_FirstDayOfMonth, @_LastDayOfMonth, @_DistributorID
- --EXEC dbo.sp_DMS_Baseline_DistributorSKUSales @_CompanyID, @_Year, @_Year, @_Month, @_Month, @_DistributorID
- --EXEC dbo.sp_DMS_Baseline_KPI @_CompanyID, @_LastDayOfMonth
- --EXEC dbo.sp_DMS_Baseline_RouteSalesMonthly @_CompanyID, @_MonthID, @_FirstDayOfMonth, @_LastDayOfMonth, @_DistributorID
- --EXEC dbo.sp_DMS_Baseline_DistributorSales @_CompanyID, @_FirstDayOfMonth, @_LastDayOfMonth, @_DistributorID
- --EXEC dbo.sp_DMS_Baseline_DistributorSystem @_CompanyID, @_Month, @_Year
- --EXEC dbo.sp_DMS_Baseline_DistributorSystemByCustomer @_CompanyID, @_Month, @_Year
- --EXEC BELDMS..sp_DMS_InsertInventoryStockMonthly @_CompanyID, @_FirstDayOfMonth, @_LastDayOfMonth, @_DistributorID
- exec BELDMS..pp_DMS_L2_SendInforAfterBaseline @CompanyID,@_CheckDate,@_FirstDayOfMonth,@_LastDayOfMonth
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement