Forráskód Böngészése

Added option to selectively allow blank bill numbers

frogsoftware 1 éve
szülő
commit
7fe97d8a72

+ 4 - 0
prs.desktop/Panels/Suppliers/Bills/SupplierBillPanel.xaml.cs

@@ -30,6 +30,10 @@ public class SupplierBillPanelProperties : BaseObject, IGlobalConfigurationSetti
     [IntegerEditor]
     [EditorSequence(1)]
     public int CurrencyDecimalPlaces { get; set; } = 2;
+    
+    [EditorSequence(2)]
+    [CheckBoxEditor]
+    public bool AllowBlankBillNumbers { get; set; }
 }
 
 public partial class SupplierBillPanel : UserControl, IPanel<Bill>, IPropertiesPanel<SupplierBillPanelProperties, CanConfigureAccountsPanels>

+ 7 - 1
prs.desktop/Panels/Suppliers/Bills/SupplierBills.cs

@@ -5,6 +5,7 @@ using System.Windows;
 using System.Windows.Media.Imaging;
 using com.sun.org.apache.xpath.@internal;
 using Comal.Classes;
+using InABox.Configuration;
 using InABox.Core;
 using InABox.DynamicGrid;
 using InABox.WPF;
@@ -21,8 +22,13 @@ namespace PRSDesktop
         private static readonly BitmapImage? data = PRSDesktop.Resources.pencil.AsBitmapImage();
         private static readonly BitmapImage? check = PRSDesktop.Resources.checklist.AsBitmapImage();
 
+        private SupplierBillPanelProperties _settings = null;
+        
         public SupplierBills()
         {
+            
+            _settings = new GlobalConfiguration<SupplierBillPanelProperties>().Load();
+
             HiddenColumns.Add(x => x.PostedStatus);
             HiddenColumns.Add(x => x.PostedStatus);
             HiddenColumns.Add(x => x.PostedNote);
@@ -133,7 +139,7 @@ namespace PRSDesktop
         {
             base.DoValidate(items, errors);
 
-            if(items.Any(x => x.Number.IsNullOrWhiteSpace()))
+            if(items.Any(x => x.Number.IsNullOrWhiteSpace()) && !_settings.AllowBlankBillNumbers)
             {
                 errors.Add($"[{nameof(Bill.Number)}] may not be blank!");
             }