1. Dodać do procedury dbo.eCM_CoverDaysCountingUKBr tuż nad: -- Aktualizacja tabeli dbo.eCM_TotalStockToBeBilled o SafetyStock oraz QTYMinusSafetyStock - SS wyliczane na podstawie parametrów: DemandToday, SSMin i SSMax następujące wyliczenie: -- Aktualizacja tabeli dbo.eCM_TotalStockToBeBilled o ilość sprzedaną jako SUB - na podstawie tabeli dbo.ax_StagingTable4 update TSTBB set TSTBB.QTY=TSTBB.QTY-isnull(ST4.Billed_units,0) from eCM_TotalStockToBeBilled TSTBB inner join ax_StagingTable4 ST4 on TSTBB.FSC=ST4.SUB and ST4.DC_unit in (select OMS from eCM_OMSMarketRelations where BPName=@BPName) and Campaign=@CurrentCampaign 2. Dodać do procedur dbo.eCM_CoverDaysCountingPLBr oraz dbo.eCM_CoverDaysCountingUKBr - zrzut danych do tymaczasowej tabeli dbo.eCM_AxaptaStagingTableNewTEST imitującej AXAPTĘ -- PLBR select @StartDTS, CASE OMS WHEN 'GL' THEN N'GL' WHEN 'SP' THEN N'ES' WHEN 'PT' THEN N'PT' WHEN 'PL' THEN N'PL' WHEN 'UA' THEN N'UA' END, SUBSTRING(FSC,2,7), Stock, 'N', Action_code, Availability_date, Null, Null, Null, Null, Null, 'C' from eCM_AxaptaStagingTable3 WHERE (Stock<>0 or ACStatus>0 or ADStatus>0) AND Status<>0 -- UKBr select INTERFACE_TS, INV_UNIT, substring(FSC,2,7) as FSC, DELTA_QTY, [Status], CMACTION, AVAIL_DT, substring(To_FSC_itemnumber,2,7) as To_FSC_itemnumber, Camp, AvGroup, Planned, LN, SubsFlag from ( select @StartDTS as INTERFACE_TS, OMS as INV_UNIT, SUB as FSC, CritLevel as DELTA_QTY, 'N' as [Status], (select Action_code from eCM_AxaptaStagingTable3 where FSC=SUB and BPName=@BPName) as CMACTION, NULL as AVAIL_DT, NULL as To_FSC_itemnumber, Campaign as Camp, AvGroup, Planned, LineNumber as LN, 'S' as SubsFlag from eCM_FSCSUB where CritLevel<=0 union all select @StartDTS, OMS, SUB, CritLevel, 'N', (select Action_code from eCM_AxaptaStagingTable3 where FSC=SUB and BPName=@BPName), NULL, FSC, Campaign, AvGroup, Planned, LineNumber, 'S' from eCM_FSCSUB where CritLevel>0 union all select @StartDTS, OMS, FSC, Stock, 'N', Action_code, Availability_date, Null, Null, Null, Null, Null, 'C' from eCM_AxaptaStagingTable3 WHERE (Stock<>0 or ACStatus>0 or ADStatus>0) AND Status<>0 and OMS in (select OMS from eCM_OMSMarketRelations where BPName=@BPName)) as Q1 3. Dodać do procedury dbo.eCM_CoverDaysCountingUKBr tuż nad: -- 27-08-2025 Liczenie SUB'ów - STOP następujące wyliczenia: delete from eCM_FSCSUBStatic where OMS in (select OMS from eCM_OMSMarketRelations where BPName=@BPName) insert into eCM_FSCSUBStatic select * from eCM_FSCSUB where CritLevel>-1 update FS set FS.CritLevel=(case when FS.CritLevel-isnull(ST4.Billed_units,0)<0 then 0 else FS.CritLevel-isnull(ST4.Billed_units,0) end) from (select * from eCM_FSCSUB where CritLevel>-1) FS inner join ax_StagingTable4 ST4 on FS.FSC=ST4.SUB and ST4.DC_unit in (select OMS from eCM_OMSMarketRelations where BPName=@BPName) and Campaign=@CurrentCampaign 4. Usunąć z procedury dbo.eCM_DataCopying: delete from eCM_FSCSUBStatic where OMS in (select OMS from eCM_OMSMarketRelations where BPName=@BPName) insert into eCM_FSCSUBStatic select * from eCM_FSCSUB where CritLevel>-1