Browse Source

Disabled Print button on ReservationManagement purchase viewer if the item has changed. Fixed a few bugs.

Kenric Nugteren 11 months ago
parent
commit
29f6fe5525

+ 12 - 7
prs.desktop/Panels/Reservation Management/ReservationManagementItemGrid.cs

@@ -362,7 +362,7 @@ public class ReservationManagementItemGrid : DynamicDataGrid<JobRequisitionItem>
                 jri.Style.CopyFrom(new ProductStyle());
             }
 
-            var qtyRequired = DimensionUtils.ConvertDimensions(jri.Dimensions, Math.Max(jri.Qty - jri.InStock, 0.0), (f,c) => Client.Query(f,c));
+            var qtyRequired = DimensionUtils.ConvertDimensions(jri.Dimensions, Math.Max(jri.Qty - jri.InStock - jri.OnOrder, 0.0), (f,c) => Client.Query(f,c));
 
             var item = items.FirstOrDefault(x =>
                 x.Product.ID == jri.Product.ID
@@ -827,20 +827,25 @@ public class ReservationManagementItemGrid : DynamicDataGrid<JobRequisitionItem>
 
         var window = new DynamicEditorForm()
         {
-            Title = "View Purchase Order Details"
+            Title = "View Purchase Order Details",
         };
-        window.Form.HighlightButtons = true;
         window.Form.DisableOKIfUnchanged = true;
         window.Form.SetLayoutType<VerticalDynamicEditorGridLayout>();
 
         new SupplierPurchaseOrders().InitialiseEditorForm(window, new PurchaseOrder[] { _entity }, null, true);
-        
-        window.Form.AddButton(new Button()
+
+        var reportButton = new Button()
         {
-            Content = new System.Windows.Controls.Image() { Source = PRSDesktop.Resources.printer.AsBitmapImage(32,32) },
+            Content = new System.Windows.Controls.Image() { Source = PRSDesktop.Resources.printer.AsBitmapImage(32, 32) },
             Command = new ActionCommand(() => ShowReports(id)),
             Width = 40
-        });
+        };
+        
+        window.Form.AddButton(reportButton);
+        window.Form.OnChanged += (o, e) =>
+        {
+            reportButton.IsEnabled = false;
+        };
         if (window.ShowDialog() == true)
         {
             Refresh(false, true);

+ 1 - 1
prs.desktop/Panels/Stock Forecast/OrderScreen/StockForecastOrderingGrid.cs

@@ -492,7 +492,6 @@ public class StockForecastOrderingGrid : DynamicItemsListGrid<StockOrderingItem>
             if(supplierIdx != -1)
             {
                 var qty = item.GetQuantity(supplierIdx);
-                qty.OrderTotal = GetRequiredQuantity(item, selectedSupplierProduct);
                 if(OrderType == StockForecastOrderingType.Breakup)
                 {
                     qty.Breakups.Clear();
@@ -501,6 +500,7 @@ public class StockForecastOrderingGrid : DynamicItemsListGrid<StockOrderingItem>
                         qty.Breakups[id] = q;
                     }
                 }
+                qty.OrderTotal = GetRequiredQuantity(item, selectedSupplierProduct);
             }
         }
     }

+ 4 - 1
prs.desktop/Panels/Suppliers/Bills/SupplierBillEditLayout.xaml.cs

@@ -28,7 +28,10 @@ public partial class SupplierBillEditLayout : DynamicEditorGridLayout, INotifyPr
         get { return Editors.TabStripVisible; }
         set { Editors.TabStripVisible = value; }
     }
-    
+
+    public override double TotalWidth => 0.0;
+    public override double TotalHeight => 0.0;
+
     public SupplierBillEditLayout()
     {
         InitializeComponent();