Kenric Nugteren 1 år sedan
förälder
incheckning
0e7e63548f

+ 2 - 2
prs.desktop/Panels/Requisitions/RequisitionItemEditor/RequisitionItemEditor.xaml.cs

@@ -185,7 +185,7 @@ public partial class RequisitionItemEditor : INotifyPropertyChanged
 
     private void SelectHolding(CoreRow[]? rows)
     {
-        StockHolding = rows?.FirstOrDefault()?.ToObject<StockHolding>(); //rows is not null && rows.Length > 0 ? e.Rows[0].ToObject<StockHolding>() : null));
+        StockHolding = rows?.FirstOrDefault()?.ToObject<StockHolding>();
         RefreshJobRequisitionItems();
 
         JRIRow.Height = _allowActual && StockHolding is not null ? new GridLength(1, GridUnitType.Star) : new GridLength(0);
@@ -391,7 +391,7 @@ public partial class RequisitionItemEditor : INotifyPropertyChanged
     {
         if (sender is not FrameworkElement element || element.Tag is not RequisitionItemStockHoldingItem item) return;
 
-        item.Taken = Math.Min(Math.Max(RequiredQuantity+item.Taken-TotalTaken,0),item.Quantity);
+        item.Taken = Math.Min(Math.Max(RequiredQuantity - (TotalTaken - item.Taken), 0), item.Quantity);
     }
 
     #endregion