@Wh = VH001
Phát sinh StockMove: product_id
Case1: From_stock = @wh
Active: Balance = select top 1 balance from where StockMove where
productid = productID
Done: Balance = (select top 1 balance from where StockMove where
productid = productID) - QTY
Case2: To_Stock = @wh
Active: Balance = select top 1 balance from where StockMove where
productid = productID
Done: Balance = (select top 1 balance from where StockMove where
productid = productID) + QTY