Differences

This shows you the differences between two versions of the page.

Link to this comparison view

control_sql_-_adjust_reserved_inventory_levels_to_match_orders [2019/01/27 11:28]
127.0.0.1 external edit
control_sql_-_adjust_reserved_inventory_levels_to_match_orders [2019/05/23 18:01] (current)
dsummers [Answer]
Line 62: Line 62:
     LEFT JOIN Warehouse W WITH(NOLOCK) ON W.ID = TP.WarehouseID     LEFT JOIN Warehouse W WITH(NOLOCK) ON W.ID = TP.WarehouseID
 WHERE  TP.ID > 0 WHERE  TP.ID > 0
-       AND ISNULL(P.TrackInventory,​ 0)  0+       AND ISNULL(P.TrackInventory,​ 0) <> ​0
        AND ISNULL(TH.StatusID,​ -1) IN (0,1,2)        AND ISNULL(TH.StatusID,​ -1) IN (0,1,2)
        AND ((TP.EstimatedValue - TP.ActualValue) >= 0)        AND ((TP.EstimatedValue - TP.ActualValue) >= 0)
Line 85: Line 85:
        ​IL.QuantityReserved        ​IL.QuantityReserved
 FROM InventoryLog IL WITH(NOLOCK) JOIN Journal J WITH(NOLOCK) ON J.ID = IL.ID FROM InventoryLog IL WITH(NOLOCK) JOIN Journal J WITH(NOLOCK) ON J.ID = IL.ID
-WHERE IL.QuantityReserved ​ 0 AND IL.ID > 0 AND IL.PartID IS NOT NULL+WHERE IL.QuantityReserved ​<> ​0 AND IL.ID > 0 AND IL.PartID IS NOT NULL
 ; ;
 DECLARE @Adjustments TABLE(TransPartID INT,  DECLARE @Adjustments TABLE(TransPartID INT,