Logoda malzemeler ekranına girince gelen browser da her depo için eldeki miktarın gösterilmesi isteniyor olması durumunda, ilk önce arayüz uyarlamadan depo isimleri tanımlandıktan sonra, aşağıda yer alan triger ile ilgili ek alanlar fişler eklendikçe güncellenebilir.

bu sayede her deponun malzeme miktarı ana ekrandan izlenebilir.

USE [VT]
GO
/****** Object:  Trigger [dbo].[TRG_021_01_STLINE_UPDATE_ITEMS_UPDATE]    Script Date: 23.12.2021 15:45:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[TRG_021_01_STLINE_UPDATE_ITEMS_UPDATE] ON [dbo].[LG_021_01_STLINE]
FOR UPDATE
AS
BEGIN
 SET NOCOUNT ON;
       DECLARE @ITEM_LOGICALREF INT
       SELECT @ITEM_LOGICALREF = STOCKREF       
       FROM INSERTED

 DECLARE @MERKEZ FLOAT,@DEPO4 FLOAT,@DEPO1 FLOAT,@DEPO2 FLOAT,@DEPO3 FLOAT,@LG_XT_ID INT 

        SELECT @MERKEZ = ISNULL(SUM(ONHAND),0) FROM LV_021_01_STINVTOT T WHERE T.INVENNO = 26 AND T.STOCKREF = @ITEM_LOGICALREF 
        SELECT @DEPO4 = ISNULL(SUM(ONHAND),0) FROM LV_021_01_STINVTOT T WHERE T.INVENNO = 22 AND T.STOCKREF = @ITEM_LOGICALREF 
        SELECT @DEPO1 = ISNULL(SUM(ONHAND),0) FROM LV_021_01_STINVTOT T WHERE T.INVENNO = 0 AND T.STOCKREF = @ITEM_LOGICALREF 
        SELECT @DEPO2 = ISNULL(SUM(ONHAND),0) FROM LV_021_01_STINVTOT T WHERE T.INVENNO = 20 AND T.STOCKREF = @ITEM_LOGICALREF 
        SELECT @DEPO3 = ISNULL(SUM(ONHAND),0) FROM LV_021_01_STINVTOT T WHERE T.INVENNO = 19 AND T.STOCKREF = @ITEM_LOGICALREF 

        SET @LG_XT_ID = -1 
        SELECT @LG_XT_ID = LOGREF FROM LG_XT1001_021 XT WHERE XT.PARLOGREF = @ITEM_LOGICALREF 
            IF(@LG_XT_ID > 0) 
                BEGIN 
                UPDATE LG_XT1001_021 SET [MERKEZ] = @MERKEZ,[DEPO4] = @DEPO4,[DEPO1] = @DEPO1,[DEPO2] = @DEPO2 ,[DEPO3] = @DEPO3 
                WHERE LOGREF = @LG_XT_ID 
            END 
            ELSE 
            BEGIN 
            INSERT INTO LG_XT1001_021 ([PARLOGREF], [MERKEZ], [DEPO4], [DEPO1],[DEPO2],[DEPO3]) 
                VALUES (@ITEM_LOGICALREF,@MERKEZ,@DEPO4,@DEPO1,@DEPO2,@DEPO3) 
            END 

END