|
@@ -71,29 +71,35 @@ public class ReservationManagementTreatmentPOItem : BaseObject
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-public class StockForecastTreatmentOrderingResult
|
|
|
+public class StockForecastTreatmentOrderingResult(
|
|
|
+ SupplierLink supplier,
|
|
|
+ PurchaseOrder? purchaseOrder,
|
|
|
+ ReservationManagementTreatmentPOItem item,
|
|
|
+ double quantity,
|
|
|
+ SupplierProduct supplierProduct)
|
|
|
{
|
|
|
- public SupplierLink Supplier { get; set; }
|
|
|
+ public SupplierLink Supplier { get; set; } = supplier;
|
|
|
|
|
|
- public ReservationManagementTreatmentPOItem Item { get; set; }
|
|
|
+ public PurchaseOrder? PurchaseOrder { get; set; } = purchaseOrder;
|
|
|
|
|
|
- public SupplierProduct SupplierProduct { get; set; }
|
|
|
+ public ReservationManagementTreatmentPOItem Item { get; set; } = item;
|
|
|
|
|
|
- public double Quantity { get; set; }
|
|
|
+ public SupplierProduct SupplierProduct { get; set; } = supplierProduct;
|
|
|
|
|
|
- public StockForecastTreatmentOrderingResult(SupplierLink supplier, ReservationManagementTreatmentPOItem item, double quantity, SupplierProduct supplierProduct)
|
|
|
- {
|
|
|
- Supplier = supplier;
|
|
|
- Item = item;
|
|
|
- Quantity = quantity;
|
|
|
- SupplierProduct = supplierProduct;
|
|
|
- }
|
|
|
+ public double Quantity { get; set; } = quantity;
|
|
|
}
|
|
|
|
|
|
public class ReservationManagementTreatmentOrderGrid: DynamicItemsListGrid<ReservationManagementTreatmentPOItem>, ISpecificGrid
|
|
|
{
|
|
|
+ private class OrderSupplier(SupplierLink supplier, PurchaseOrder? purchaseOrder)
|
|
|
+ {
|
|
|
+ public SupplierLink Supplier { get; set; } = supplier;
|
|
|
+
|
|
|
+ public PurchaseOrder? PurchaseOrder { get; set; } = purchaseOrder;
|
|
|
+ }
|
|
|
+
|
|
|
private List<SupplierProduct> SupplierProducts = [];
|
|
|
- private SupplierLink[] Suppliers = [];
|
|
|
+ private OrderSupplier[] Suppliers = [];
|
|
|
|
|
|
public double TotalQuantity => Items.Sum(x => x.GetTotalQuantity());
|
|
|
|
|
@@ -103,6 +109,7 @@ public class ReservationManagementTreatmentOrderGrid: DynamicItemsListGrid<Reser
|
|
|
private readonly Dictionary<Guid, Job> JobDetails = [];
|
|
|
|
|
|
private static BitmapImage _warning = PRSDesktop.Resources.warning.AsBitmapImage();
|
|
|
+ private static BitmapImage _search = PRSDesktop.Resources.menu.AsBitmapImage();
|
|
|
|
|
|
public IEnumerable<StockForecastTreatmentOrderingResult> Results
|
|
|
{
|
|
@@ -119,13 +126,13 @@ public class ReservationManagementTreatmentOrderGrid: DynamicItemsListGrid<Reser
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- var supplierProduct = GetSupplierProduct(item, supplier.ID);
|
|
|
+ var supplierProduct = GetSupplierProduct(item, supplier.Supplier.ID);
|
|
|
if (supplierProduct is null)
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- yield return new(supplier, item, qty, supplierProduct);
|
|
|
+ yield return new(supplier.Supplier, supplier.PurchaseOrder, item, qty, supplierProduct);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -181,7 +188,7 @@ public class ReservationManagementTreatmentOrderGrid: DynamicItemsListGrid<Reser
|
|
|
var idx = Math.Max(qIdx, Grid.CostColumns.IndexOf(ac));
|
|
|
if(idx != -1)
|
|
|
{
|
|
|
- var supplierProduct = Grid.GetSupplierProduct(item, Grid.Suppliers[idx].ID);
|
|
|
+ var supplierProduct = Grid.GetSupplierProduct(item, Grid.Suppliers[idx].Supplier.ID);
|
|
|
if(supplierProduct is null)
|
|
|
{
|
|
|
return new SolidColorBrush(Colors.Gainsboro);
|
|
@@ -198,10 +205,83 @@ public class ReservationManagementTreatmentOrderGrid: DynamicItemsListGrid<Reser
|
|
|
}
|
|
|
return base.GetCellBackground(row, column);
|
|
|
}
|
|
|
+
|
|
|
+ protected override Style GetColumnGroupHeaderCellStyle(DynamicGridColumnGroup group)
|
|
|
+ {
|
|
|
+ var style = base.GetColumnGroupHeaderCellStyle(group);
|
|
|
+ if(group.Tag is int index)
|
|
|
+ {
|
|
|
+ style.AddSetter(Control.HorizontalContentAlignmentProperty, HorizontalAlignment.Stretch);
|
|
|
+ style.AddSetter(Control.VerticalContentAlignmentProperty, VerticalAlignment.Stretch);
|
|
|
+ style.AddSetter(Control.PaddingProperty, new Thickness(0.0));
|
|
|
+ style.AddSetter(GridStackedHeaderCellControl.ContentTemplateProperty, TemplateGenerator.CreateDataTemplate(() =>
|
|
|
+ {
|
|
|
+ var dock = new DockPanel { LastChildFill = true };
|
|
|
+
|
|
|
+ var button = new Button();
|
|
|
+ button.Content = new Image
|
|
|
+ {
|
|
|
+ Source = _search
|
|
|
+ };
|
|
|
+ button.Width = 25;
|
|
|
+ button.BorderBrush = Colors.Silver.ToBrush();
|
|
|
+ button.BorderThickness = new Thickness(0.75, 0.0, 0.0, 0.0);
|
|
|
+ //button.Background = Colors.WhiteSmoke.ToBrush();
|
|
|
+ DockPanel.SetDock(button, Dock.Right);
|
|
|
+ dock.Children.Add(button);
|
|
|
+
|
|
|
+ var border = new Border();
|
|
|
+ border.Background = Colors.LightYellow.ToBrush();
|
|
|
+ border.Margin = new Thickness(0.0, 0.0, 0.0, 0.0);
|
|
|
+ border.BorderThickness = new(0.0);
|
|
|
+
|
|
|
+ var textBox = new TextBox();
|
|
|
+ textBox.IsEnabled = false;
|
|
|
+ textBox.VerticalContentAlignment = VerticalAlignment.Center;
|
|
|
+ textBox.HorizontalContentAlignment = HorizontalAlignment.Center;
|
|
|
+ textBox.Padding = new Thickness(2.0, 0.0, 0.0, 0.0);
|
|
|
+ textBox.Background = Colors.LightYellow.ToBrush();
|
|
|
+ textBox.BorderThickness = new(0.0);
|
|
|
+ textBox.Text = Grid.Suppliers[index].PurchaseOrder?.PONumber ?? "(New Order)";
|
|
|
+
|
|
|
+ border.Child = textBox;
|
|
|
+
|
|
|
+ DockPanel.SetDock(border, Dock.Left);
|
|
|
+ dock.Children.Add(border);
|
|
|
+
|
|
|
+ button.Click += (o, e) =>
|
|
|
+ {
|
|
|
+ var supplier = Grid.Suppliers[index];
|
|
|
+ var dlg = new MultiSelectDialog<PurchaseOrder>(
|
|
|
+ new Filter<PurchaseOrder>(x => x.ClosedDate).IsEqualTo(DateTime.MinValue)
|
|
|
+ .And(x => x.SupplierLink.ID).IsEqualTo(supplier.Supplier.ID),
|
|
|
+ Columns.None<PurchaseOrder>().Add(x => x.ID).Add(x => x.PONumber),
|
|
|
+ multiselect: false);
|
|
|
+ var result = dlg.ShowDialog();
|
|
|
+ if(result == true)
|
|
|
+ {
|
|
|
+ var item = dlg.Data().ToObjects<PurchaseOrder>()?.FirstOrDefault();
|
|
|
+ supplier.PurchaseOrder = item;
|
|
|
+ textBox.Text = item?.PONumber ?? "(New Order)";
|
|
|
+ }
|
|
|
+ else if(result == false)
|
|
|
+ {
|
|
|
+ supplier.PurchaseOrder = null;
|
|
|
+ textBox.Text = "(New Order)";
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ return dock;
|
|
|
+ }));
|
|
|
+ }
|
|
|
+ return style;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
+ #region Grid Stuff
|
|
|
+
|
|
|
private bool _observing = true;
|
|
|
private void SetObserving(bool observing)
|
|
|
{
|
|
@@ -221,6 +301,10 @@ public class ReservationManagementTreatmentOrderGrid: DynamicItemsListGrid<Reser
|
|
|
options.FilterRows = true;
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Data
|
|
|
+
|
|
|
private bool _loadedData = false;
|
|
|
private void LoadData()
|
|
|
{
|
|
@@ -240,7 +324,7 @@ public class ReservationManagementTreatmentOrderGrid: DynamicItemsListGrid<Reser
|
|
|
new SortOrder<SupplierProduct>(x => x.SupplierLink.Code))
|
|
|
.ToList<SupplierProduct>();
|
|
|
|
|
|
- Suppliers = SupplierProducts.Select(x => x.SupplierLink).DistinctBy(x => x.ID).ToArray();
|
|
|
+ Suppliers = SupplierProducts.Select(x => x.SupplierLink).DistinctBy(x => x.ID).Select(x => new OrderSupplier(x, null)).ToArray();
|
|
|
|
|
|
foreach(var (itemIdx, item) in Items.WithIndex())
|
|
|
{
|
|
@@ -281,7 +365,7 @@ public class ReservationManagementTreatmentOrderGrid: DynamicItemsListGrid<Reser
|
|
|
for(int i = 0; i < Suppliers.Length; ++i)
|
|
|
{
|
|
|
var supplier = Suppliers[i];
|
|
|
- if(supplierProduct is not null && supplier.ID == supplierProduct.SupplierLink.ID)
|
|
|
+ if(supplierProduct is not null && supplier.Supplier.ID == supplierProduct.SupplierLink.ID)
|
|
|
{
|
|
|
item.SetQuantity(i, item.RequiredQuantity);
|
|
|
}
|
|
@@ -297,6 +381,10 @@ public class ReservationManagementTreatmentOrderGrid: DynamicItemsListGrid<Reser
|
|
|
InvalidateGrid();
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Columns
|
|
|
+
|
|
|
protected override void SaveColumns(DynamicGridColumns columns)
|
|
|
{
|
|
|
ColumnsComponent.SaveColumns(columns);
|
|
@@ -352,76 +440,21 @@ public class ReservationManagementTreatmentOrderGrid: DynamicItemsListGrid<Reser
|
|
|
return columns;
|
|
|
}
|
|
|
|
|
|
- private void EditSupplierProductGrid(DynamicGrid<SupplierProduct> grid)
|
|
|
+ protected override void ConfigureColumnGroups()
|
|
|
{
|
|
|
- grid.OnCustomiseEditor += (sender, items, column, editor) =>
|
|
|
+ // The first set of header groups is for the supplier Codes
|
|
|
+ var codeGroup = GetColumnGrouping();
|
|
|
+ for(int idx = 0; idx < Suppliers.Length; ++idx)
|
|
|
{
|
|
|
- if(new Column<SupplierProduct>(x => x.SupplierLink.ID).IsEqualTo(column.ColumnName)
|
|
|
- || new Column<SupplierProduct>(x => x.Product.ID).IsEqualTo(column.ColumnName)
|
|
|
- || new Column<SupplierProduct>(x => x.Style.ID).IsEqualTo(column.ColumnName)
|
|
|
- || new Column<SupplierProduct>(x => x.Job.ID).IsEqualTo(column.ColumnName)
|
|
|
- //|| new Column<SupplierProduct>(x => x.Dimensions).IsEqualTo(column.ColumnName)
|
|
|
- )
|
|
|
- {
|
|
|
- editor.Editable = editor.Editable.Combine(Editable.Disabled);
|
|
|
- }
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- private void BuildMenu(DynamicMenuColumn column, CoreRow? row)
|
|
|
- {
|
|
|
- if (row is null) return;
|
|
|
+ codeGroup.AddGroup(Suppliers[idx].Supplier.Code, QuantityColumns[idx], CostColumns[idx]);
|
|
|
+ }
|
|
|
|
|
|
- column.AddItem("New Supplier", null, row =>
|
|
|
+ // The next set of header groups is for the purchase order combo-boxes.
|
|
|
+ var poGroup = AddColumnGrouping();
|
|
|
+ for(int idx = 0; idx < Suppliers.Length; ++idx)
|
|
|
{
|
|
|
- if (row is null) return;
|
|
|
-
|
|
|
- var selection = new MultiSelectDialog<Supplier>(
|
|
|
- new Filter<Supplier>(x => x.ID).NotInList(Suppliers.Select(x => x.ID).ToArray()),
|
|
|
- Columns.None<Supplier>().Add(x => x.ID).Add(x => x.Code), multiselect: false);
|
|
|
- if (selection.ShowDialog() != true)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- var supplier = selection.Data().Rows.First().ToObject<Supplier>();
|
|
|
- var item = LoadItem(row);
|
|
|
-
|
|
|
- var supplierProduct = new SupplierProduct();
|
|
|
- LookupFactory.DoLookup<SupplierProduct, Product, ProductLink>(supplierProduct, x => x.Product, item.TreatmentProduct.ID);
|
|
|
- supplierProduct.SupplierLink.CopyFrom(supplier);
|
|
|
-
|
|
|
- if (DynamicGridUtils.EditEntity(supplierProduct, customiseGrid: EditSupplierProductGrid))
|
|
|
- {
|
|
|
- SupplierProducts.Add(supplierProduct);
|
|
|
- var newSuppliers = new SupplierLink[Suppliers.Length + 1];
|
|
|
- var newIdx = Suppliers.Length;
|
|
|
-
|
|
|
- for (int i = 0; i < Suppliers.Length; i++)
|
|
|
- {
|
|
|
- newSuppliers[i] = Suppliers[i];
|
|
|
- }
|
|
|
- newSuppliers[newIdx] = supplierProduct.SupplierLink;
|
|
|
-
|
|
|
- foreach (var (itemIdx, oItem) in Items.WithIndex())
|
|
|
- {
|
|
|
- var populateSupplierProduct = GetSupplierProduct(oItem);
|
|
|
-
|
|
|
- var quantities = new double[newSuppliers.Length];
|
|
|
- for (int i = 0; i < Suppliers.Length; ++i)
|
|
|
- {
|
|
|
- quantities[i] = oItem.GetQuantity(i);
|
|
|
- }
|
|
|
- quantities[newIdx] = 0;
|
|
|
-
|
|
|
- oItem.SetQuantities(quantities);
|
|
|
- }
|
|
|
-
|
|
|
- Suppliers = newSuppliers;
|
|
|
-
|
|
|
- Refresh(true, true);
|
|
|
- }
|
|
|
- });
|
|
|
+ poGroup.AddGroup(Suppliers[idx].Supplier.Code, QuantityColumns[idx], CostColumns[idx], tag: idx);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private BitmapImage? Warning_Image(CoreRow? row)
|
|
@@ -439,14 +472,6 @@ public class ReservationManagementTreatmentOrderGrid: DynamicItemsListGrid<Reser
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- protected override void ConfigureColumnGroups()
|
|
|
- {
|
|
|
- for(int idx = 0; idx < Suppliers.Length; ++idx)
|
|
|
- {
|
|
|
- GetColumnGrouping().AddGroup(Suppliers[idx].Code, QuantityColumns[idx], CostColumns[idx]);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private class QuantityControl : ContentControl
|
|
|
{
|
|
|
private readonly ReservationManagementTreatmentPOItem Item;
|
|
@@ -464,7 +489,7 @@ public class ReservationManagementTreatmentOrderGrid: DynamicItemsListGrid<Reser
|
|
|
|
|
|
public void UpdateControl()
|
|
|
{
|
|
|
- var supplierProduct = Parent.GetSupplierProduct(Item, Parent.Suppliers[SupplierIndex].ID);
|
|
|
+ var supplierProduct = Parent.GetSupplierProduct(Item, Parent.Suppliers[SupplierIndex].Supplier.ID);
|
|
|
if(supplierProduct is null)
|
|
|
{
|
|
|
Content = null;
|
|
@@ -502,7 +527,7 @@ public class ReservationManagementTreatmentOrderGrid: DynamicItemsListGrid<Reser
|
|
|
|
|
|
private void InitialiseSupplierColumn(int idx)
|
|
|
{
|
|
|
- var supplierProducts = SupplierProducts.Where(x => x.SupplierLink.ID == Suppliers[idx].ID).ToArray();
|
|
|
+ var supplierProducts = SupplierProducts.Where(x => x.SupplierLink.ID == Suppliers[idx].Supplier.ID).ToArray();
|
|
|
|
|
|
var contextMenuFunc = (CoreRow[]? rows) =>
|
|
|
{
|
|
@@ -510,7 +535,7 @@ public class ReservationManagementTreatmentOrderGrid: DynamicItemsListGrid<Reser
|
|
|
if (row is null) return null;
|
|
|
|
|
|
var item = LoadItem(row);
|
|
|
- var supplierProduct = GetSupplierProduct(item, Suppliers[idx].ID);
|
|
|
+ var supplierProduct = GetSupplierProduct(item, Suppliers[idx].Supplier.ID);
|
|
|
if (supplierProduct is not null)
|
|
|
{
|
|
|
return null;
|
|
@@ -544,7 +569,7 @@ public class ReservationManagementTreatmentOrderGrid: DynamicItemsListGrid<Reser
|
|
|
|
|
|
var instance = LoadItem(row);
|
|
|
var qty = instance.GetQuantity(idx);
|
|
|
- var supplierProduct = GetSupplierProduct(instance, Suppliers[idx].ID);
|
|
|
+ var supplierProduct = GetSupplierProduct(instance, Suppliers[idx].Supplier.ID);
|
|
|
if(supplierProduct is not null)
|
|
|
{
|
|
|
return $"{qty * supplierProduct.CostPrice * instance.Multiplier:C2}";
|
|
@@ -572,7 +597,7 @@ public class ReservationManagementTreatmentOrderGrid: DynamicItemsListGrid<Reser
|
|
|
return rows.Sum(row =>
|
|
|
{
|
|
|
var item = LoadItem(row);
|
|
|
- var supplierProduct = GetSupplierProduct(item, Suppliers[supplierIdx].ID);
|
|
|
+ var supplierProduct = GetSupplierProduct(item, Suppliers[supplierIdx].Supplier.ID);
|
|
|
if (supplierProduct is not null)
|
|
|
{
|
|
|
var qty = item.GetQuantity(supplierIdx);
|
|
@@ -585,13 +610,93 @@ public class ReservationManagementTreatmentOrderGrid: DynamicItemsListGrid<Reser
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region New Suppliers
|
|
|
+
|
|
|
+ private void EditSupplierProductGrid(DynamicGrid<SupplierProduct> grid)
|
|
|
+ {
|
|
|
+ grid.OnCustomiseEditor += (sender, items, column, editor) =>
|
|
|
+ {
|
|
|
+ if(new Column<SupplierProduct>(x => x.SupplierLink.ID).IsEqualTo(column.ColumnName)
|
|
|
+ || new Column<SupplierProduct>(x => x.Product.ID).IsEqualTo(column.ColumnName)
|
|
|
+ || new Column<SupplierProduct>(x => x.Style.ID).IsEqualTo(column.ColumnName)
|
|
|
+ || new Column<SupplierProduct>(x => x.Job.ID).IsEqualTo(column.ColumnName)
|
|
|
+ //|| new Column<SupplierProduct>(x => x.Dimensions).IsEqualTo(column.ColumnName)
|
|
|
+ )
|
|
|
+ {
|
|
|
+ editor.Editable = editor.Editable.Combine(Editable.Disabled);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ private void BuildMenu(DynamicMenuColumn column, CoreRow? row)
|
|
|
+ {
|
|
|
+ if (row is null) return;
|
|
|
+
|
|
|
+ column.AddItem("New Supplier", null, row =>
|
|
|
+ {
|
|
|
+ if (row is null) return;
|
|
|
+
|
|
|
+ var selection = new MultiSelectDialog<Supplier>(
|
|
|
+ new Filter<Supplier>(x => x.ID).NotInList(Suppliers.ToArray(x => x.Supplier.ID)),
|
|
|
+ Columns.None<Supplier>().Add(x => x.ID).Add(x => x.Code), multiselect: false);
|
|
|
+ if (selection.ShowDialog() != true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var supplier = selection.Data().Rows.First().ToObject<Supplier>();
|
|
|
+ var item = LoadItem(row);
|
|
|
+
|
|
|
+ var supplierProduct = new SupplierProduct();
|
|
|
+ LookupFactory.DoLookup<SupplierProduct, Product, ProductLink>(supplierProduct, x => x.Product, item.TreatmentProduct.ID);
|
|
|
+ supplierProduct.SupplierLink.CopyFrom(supplier);
|
|
|
+
|
|
|
+ if (DynamicGridUtils.EditEntity(supplierProduct, customiseGrid: EditSupplierProductGrid))
|
|
|
+ {
|
|
|
+ SupplierProducts.Add(supplierProduct);
|
|
|
+ var newSuppliers = new OrderSupplier[Suppliers.Length + 1];
|
|
|
+ var newIdx = Suppliers.Length;
|
|
|
+
|
|
|
+ for (int i = 0; i < Suppliers.Length; i++)
|
|
|
+ {
|
|
|
+ newSuppliers[i] = Suppliers[i];
|
|
|
+ }
|
|
|
+ newSuppliers[newIdx] = new(supplierProduct.SupplierLink, null);
|
|
|
+
|
|
|
+ foreach (var (itemIdx, oItem) in Items.WithIndex())
|
|
|
+ {
|
|
|
+ var populateSupplierProduct = GetSupplierProduct(oItem);
|
|
|
+
|
|
|
+ var quantities = new double[newSuppliers.Length];
|
|
|
+ for (int i = 0; i < Suppliers.Length; ++i)
|
|
|
+ {
|
|
|
+ quantities[i] = oItem.GetQuantity(i);
|
|
|
+ }
|
|
|
+ quantities[newIdx] = 0;
|
|
|
+
|
|
|
+ oItem.SetQuantities(quantities);
|
|
|
+ }
|
|
|
+
|
|
|
+ Suppliers = newSuppliers;
|
|
|
+
|
|
|
+ Refresh(true, true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Supplier Product Matching
|
|
|
+
|
|
|
private void CreateSupplierProduct_Click(Tuple<ReservationManagementTreatmentPOItem, int> tuple)
|
|
|
{
|
|
|
var (item, supplierIdx) = tuple;
|
|
|
|
|
|
var supplierProduct = new SupplierProduct();
|
|
|
LookupFactory.DoLookup<SupplierProduct, Product, ProductLink>(supplierProduct, x => x.Product, item.TreatmentProduct.ID);
|
|
|
- supplierProduct.SupplierLink.CopyFrom(Suppliers[supplierIdx]);
|
|
|
+ supplierProduct.SupplierLink.CopyFrom(Suppliers[supplierIdx].Supplier);
|
|
|
|
|
|
if (DynamicGridUtils.EditEntity(supplierProduct, customiseGrid: EditSupplierProductGrid))
|
|
|
{
|
|
@@ -623,39 +728,6 @@ public class ReservationManagementTreatmentOrderGrid: DynamicItemsListGrid<Reser
|
|
|
{
|
|
|
return SupplierProducts.FirstOrDefault(x => x.SupplierLink.ID == supplierID && Matches(item, x, false));
|
|
|
}
|
|
|
- //private double GetQuantity(SupplierProduct product)
|
|
|
- //{
|
|
|
- // var instance = ProductInstances.WithIndex().Where(x => x.Value.Product.ID == product.ID)
|
|
|
- //}
|
|
|
-
|
|
|
- private class CostAggregate : ISummaryAggregate
|
|
|
- {
|
|
|
- public double Sum { get; private set; }
|
|
|
-
|
|
|
- private int SupplierIndex;
|
|
|
-
|
|
|
- private ReservationManagementTreatmentOrderGrid Grid;
|
|
|
-
|
|
|
- public CostAggregate(int supplierIndex, ReservationManagementTreatmentOrderGrid grid)
|
|
|
- {
|
|
|
- SupplierIndex = supplierIndex;
|
|
|
- Grid = grid;
|
|
|
- }
|
|
|
|
|
|
- public Action<IEnumerable, string, PropertyDescriptor> CalculateAggregateFunc()
|
|
|
- {
|
|
|
- return AggregateFunc;
|
|
|
- }
|
|
|
-
|
|
|
- private void AggregateFunc(IEnumerable items, string property, PropertyDescriptor args)
|
|
|
- {
|
|
|
- if (items is IEnumerable<DataRowView> rows)
|
|
|
- {
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- Logger.Send(LogType.Error, "", $"Attempting to calculate aggregate on invalid data type '{items.GetType()}'.");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ #endregion
|
|
|
}
|