I have a SP that Picks Sales O)rder lines and updates the stock with Qty Picked.
If the user picks more than the available stock it then goes negative. Is there an eay way to just set StockQty to zero?
If @PickType = 'PickMan'
Update OrderDetail Set QtyPicked = @PickQty, Pickedby = @pUser, DatePicked = GETDATE ( )
Where OrderNo = @OrderNo and Barcode = @Bcode
set @iMsg = 'Picked ordered qty for ' + @Bcode
-- update the stock qty
Update Stock Set StockQty = StockQty - isnull((@PickQty),0),
QtyReserved = QtyReserved - isnull((@PickQty),0)
Where Barcode = @Bcode