瀏覽代碼

Added setting for setting didgits for bill lines

Kenric Nugteren 1 年之前
父節點
當前提交
6760a00ebc

+ 13 - 0
prs.desktop/Panels/Suppliers/Bills/SupplierBillLineGrid.cs

@@ -6,6 +6,7 @@ using System.Windows.Controls;
 using System.Windows.Media.Imaging;
 using Comal.Classes;
 using InABox.Clients;
+using InABox.Configuration;
 using InABox.Core;
 using InABox.DynamicGrid;
 using InABox.Wpf;
@@ -43,6 +44,18 @@ public class SupplierBillLineGrid : DynamicOneToManyGrid<Bill, BillLine>
 
         ActionColumns.Add(new DynamicImageColumn(pencil, BillLineEdit_Click));
     }
+
+    protected override void CustomiseEditor(BillLine[] items, DynamicGridColumn column, BaseEditor editor)
+    {
+        base.CustomiseEditor(items, column, editor);
+
+        if(editor is CurrencyEditor curr)
+        {
+            var settings = new GlobalConfiguration<SupplierBillPanelProperties>().Load();
+            curr.Digits = settings.CurrencyDecimalPlaces;
+        }
+    }
+
     protected override void DoReconfigure(FluentList<DynamicGridOption> options)
     {
         base.DoReconfigure(options);

+ 10 - 1
prs.desktop/Panels/Suppliers/Bills/SupplierBillPanel.xaml.cs

@@ -25,7 +25,14 @@ public class SupplierBillPanelSettings : IUserConfigurationSettings
     public double AnchorWidth { get; set; }
 }
 
-public partial class SupplierBillPanel : UserControl, IPanel<Bill>
+public class SupplierBillPanelProperties : BaseObject, IGlobalConfigurationSettings
+{
+    [IntegerEditor]
+    [EditorSequence(1)]
+    public int CurrencyDecimalPlaces { get; set; } = 2;
+}
+
+public partial class SupplierBillPanel : UserControl, IPanel<Bill>, IPropertiesPanel<SupplierBillPanelProperties>
 {
     private SupplierBillPanelSettings settings;
 
@@ -53,6 +60,8 @@ public partial class SupplierBillPanel : UserControl, IPanel<Bill>
 
     public string SectionName => "Supplier Bills";
 
+    public SupplierBillPanelProperties Properties { get; set; }
+
     public DataModel DataModel(Selection selection)
     {
         var ids = Bills.ExtractValues(x => x.ID, selection).ToArray();