Переглянути джерело

Fixed "Show All" filtering in Stock Forecast grid
Fixed Quote Cost Sheets and Proposals grids

frogsoftware 1 рік тому
батько
коміт
8389a5dc6f

+ 1 - 0
prs.desktop/Panels/Quotes/Cost Sheets/QuoteCostSheets.xaml

@@ -10,6 +10,7 @@
     <dynamicGrid:DynamicSplitPanel
         Anchor="Master"
         AnchorWidth="350"
+        View="Combined"
         AllowableViews="Combined">
         
         <dynamicGrid:DynamicSplitPanel.Master>

+ 9 - 12
prs.desktop/Panels/Quotes/Cost Sheets/QuoteCostSheets.xaml.cs

@@ -84,29 +84,26 @@ namespace PRSDesktop
         {
             var row = e.Rows?.FirstOrDefault();
             Items.Master = e.Rows?.FirstOrDefault()?.ToObject<QuoteCostSheet>();
-
+            Items.Refresh(false,true);
         }
         
-        private Guid[] costsheetids;
+        private Dictionary<Guid,Guid> costsheetids = null;
 
         private void CostSheets_OnBeforeSave(IDynamicEditorForm editor, BaseObject[] items)
         {
-            costsheetids = items.Cast<QuoteCostSheet>().Select(x => x.CostSheet.GetOriginalValue(c => c.ID)).ToArray();
+            costsheetids = new Dictionary<Guid, Guid>(
+                items.Cast<QuoteCostSheet>().Select(x => new KeyValuePair<Guid, Guid>(x.ID,x.CostSheet.GetOriginalValue(c => c.ID)))
+            );
         }
 
         private void CostSheets_OnAfterSave(IDynamicEditorForm editor, BaseObject[] items)
         {
-            for (var i = 0; i < items.Length; i++)
+            foreach (var qcs in items.OfType<QuoteCostSheet>())
             {
-                var qcs = items[i] as QuoteCostSheet;
-                if (qcs != null)
-                {
-                    if (qcs.CostSheet.IsValid() && costsheetids[i] == Guid.Empty)
-                        Items.SetupCostSheet(qcs.ID, qcs.CostSheet.ID);
-                }
+                costsheetids.TryGetValue(qcs.ID, out Guid oldcostsheetid);
+                if (qcs.CostSheet.ID != oldcostsheetid)
+                    Items.SetupCostSheet(qcs.ID, qcs.CostSheet.ID);
             }
-
-            costsheetids = null;
         }
     }
 }

+ 6 - 6
prs.desktop/Panels/Quotes/Cost Sheets/QuoteCostSheetsGrid.cs

@@ -19,7 +19,7 @@ namespace PRSDesktop
         
         public QuoteCostSheetGrid()
         {
-            OnCustomiseEditor += CustomiseEditor;
+            //OnCustomiseEditor += CustomiseEditor;
             HiddenColumns.Add(x => x.CostSheet.ID);
         }
         protected override void DoReconfigure(FluentList<DynamicGridOption> options)
@@ -36,11 +36,11 @@ namespace PRSDesktop
         }
 
 
-        private void CustomiseEditor(IDynamicEditorForm sender, QuoteCostSheet[]? items, DynamicGridColumn column, BaseEditor editor)
-        {
-            if (column.ColumnName.Equals("CostSheet.ID"))
-                editor.Editable = items?.FirstOrDefault()?.CostSheet.IsValid() != true ? Editable.Enabled : Editable.Disabled;
-        }
+        // private void CustomiseEditor(IDynamicEditorForm sender, QuoteCostSheet[]? items, DynamicGridColumn column, BaseEditor editor)
+        // {
+        //     if (column.ColumnName.Equals("CostSheet.ID"))
+        //         editor.Editable = items?.FirstOrDefault()?.CostSheet.IsValid() != true ? Editable.Enabled : Editable.Disabled;
+        // }
 
         protected override void Reload(Filters<QuoteCostSheet> criteria, Columns<QuoteCostSheet> columns, ref SortOrder<QuoteCostSheet>? sort,
             Action<CoreTable?, Exception?> action)

+ 6 - 0
prs.desktop/Panels/Quotes/Cost Sheets/QuoteCostSheetsPanel.cs

@@ -0,0 +1,6 @@
+namespace PRSDesktop;
+
+public class QuoteCostSheetsPanel
+{
+    
+}

+ 2 - 1
prs.desktop/Panels/Quotes/Proposals/QuoteProposals.xaml

@@ -10,7 +10,8 @@
     <dynamicGrid:DynamicSplitPanel
         Anchor="Master"
         AnchorWidth="350"
-        AllowableViews="Combined">
+        AllowableViews="Combined"
+        View="Combined">
         
         <dynamicGrid:DynamicSplitPanel.Master>
             <local:QuoteProposalGrid 

+ 4 - 0
prs.desktop/Panels/StockSummary/StockSummaryGrid.cs

@@ -149,6 +149,10 @@ public class StockSummaryGrid : DynamicDataGrid<ProductInstance>, IDataModelSour
             _supplierUnitSizeCol ??=
                 new Columns<SupplierProduct>(Grid._supplierProducts.Columns).IndexOf(x => x.Dimensions.UnitSize);
 
+            _instanceProductIDCol ??= new Columns<ProductInstance>(row.Table.Columns).IndexOf(x => x.Product.ID);
+            _instanceStyleIDCol ??= new Columns<ProductInstance>(row.Table.Columns).IndexOf(x => x.Style.ID);
+            _instanceUnitSizeCol ??= new Columns<ProductInstance>(row.Table.Columns).IndexOf(x => x.Dimensions.UnitSize);
+            
             return (Grid._supplierProducts.Rows.Any(r =>
                     Equals(r.Values[_supplierProductIDCol.Value], row.Values[_instanceProductIDCol.Value])
                     && Equals(r.Values[_supplierStyleIDCol.Value], row.Values[_instanceStyleIDCol.Value])