Przeglądaj źródła

Receipts Panel now remembers last filter setting

frogsoftware 1 rok temu
rodzic
commit
51288c98c3

+ 0 - 1
prs.desktop/MainWindow.xaml.cs

@@ -62,7 +62,6 @@ using SortDirection = InABox.Core.SortDirection;
 using PRSDesktop.Components.Spreadsheet;
 using InABox.Wpf.Reports;
 using Comal.Classes.SecurityDescriptors;
-using PRS.Mobile;
 
 namespace PRSDesktop
 {

+ 22 - 15
prs.desktop/Panels/Customers/CustomerReceipts.cs

@@ -4,15 +4,23 @@ using System.ComponentModel;
 using System.Linq;
 using System.Windows.Controls;
 using Comal.Classes;
+using InABox.Configuration;
 using InABox.Core;
 using InABox.DynamicGrid;
 using InABox.WPF;
 
 namespace PRSDesktop;
 
+
+public class ReceiptGridSettings : IUserConfigurationSettings
+{
+    public CoreFilterDefinition CurrentFilter { get; set; }
+}
+
 public class CustomerReceipts : DynamicDataGrid<Receipt>, IPanel<Receipt>
 {
     //private bool Outstanding = true;
+    private ReceiptGridSettings _settings;
 
     public CustomerReceipts()
     {
@@ -26,6 +34,13 @@ public class CustomerReceipts : DynamicDataGrid<Receipt>, IPanel<Receipt>
         options.AddRange(DynamicGridOption.RecordCount, DynamicGridOption.FilterRows, DynamicGridOption.SelectColumns, DynamicGridOption.MultiSelect);
     }
 
+    protected override void Init()
+    {
+        base.Init();
+        _settings = new UserConfiguration<ReceiptGridSettings>().Load();
+        SelectFilter(_settings.CurrentFilter, false);
+    }
+
     public bool IsReady { get; set; }
 
     public event DataModelUpdateEvent OnUpdateDataModel;
@@ -83,19 +98,11 @@ public class CustomerReceipts : DynamicDataGrid<Receipt>, IPanel<Receipt>
             receipt.Notes = string.Format("Invoice{0} {1}", numbers.Length > 1 ? "s" : "", string.Join(", ", numbers));
         }
     }
-
-    // private bool ToggleView(Button sender, CoreRow[] rows)
-    // {
-    //     Outstanding = !Outstanding;
-    //     UpdateButton(sender, PRSDesktop.Resources.view.AsBitmapImage(), Outstanding ? "Show All" : "Outstanding");
-    //     return true;
-    // }
-    //
-    // protected override void Reload(Filters<Receipt> criteria, Columns<Receipt> columns, ref SortOrder<Receipt> sort,
-    //     Action<CoreTable, Exception> action)
-    // {
-    //     if (Outstanding)
-    //         criteria.Add(new Filter<Receipt>(x => x.Reconciled).IsEqualTo(DateTime.MinValue));
-    //     base.Reload(criteria, columns, ref sort, action);
-    // }
+    
+    protected override void FilterSelected(CoreFilterDefinition filter)
+    {
+        base.FilterSelected(filter);
+        _settings.CurrentFilter = filter;
+        new UserConfiguration<ReceiptGridSettings>().Save(_settings);
+    }
 }

+ 1 - 1
prs.desktop/prsdesktop.iss

@@ -5,7 +5,7 @@
 #pragma verboselevel 9
 
 #define MyAppName "PRS Desktop"
-#define MyAppVersion "7.31"
+#define MyAppVersion "7.32a"
 #define MyAppPublisher "PRS Digital"
 #define MyAppURL "https://www.prs-software.com.au"
 #define MyAppExeName "PRSDesktop.exe"

+ 1 - 1
prs.server/PRSServer.iss

@@ -5,7 +5,7 @@
 #pragma verboselevel 9
 
 #define MyAppName "PRS Server"
-#define MyAppVersion "7.31"
+#define MyAppVersion "7.32a"
 #define MyAppPublisher "PRS Digital"
 #define MyAppURL "https://www.prs-software.com.au"
 #define MyAppExeName "PRSServer.exe"