Browse Source

Removed Hard Coded Filters from Invoice and Receipt Grids

frogsoftware 2 years ago
parent
commit
ee2c0e6856

+ 16 - 16
prs.desktop/Panels/Customers/CustomerReceipts.cs

@@ -11,12 +11,12 @@ namespace PRSDesktop;
 
 public class CustomerReceipts : DynamicDataGrid<Receipt>, IPanel<Receipt>
 {
-    private bool Outstanding = true;
+    //private bool Outstanding = true;
 
     public CustomerReceipts()
     {
         Options.AddRange(DynamicGridOption.RecordCount, DynamicGridOption.FilterRows, DynamicGridOption.SelectColumns, DynamicGridOption.MultiSelect);
-        AddButton("Show All", PRSDesktop.Resources.view.AsBitmapImage(), ToggleView);
+        //AddButton("Show All", PRSDesktop.Resources.view.AsBitmapImage(), ToggleView);
         OnBeforeSave += BeforeSave;
     }
 
@@ -78,18 +78,18 @@ public class CustomerReceipts : DynamicDataGrid<Receipt>, IPanel<Receipt>
         }
     }
 
-    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);
-    }
+    // 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);
+    // }
 }

+ 3 - 3
prs.desktop/Panels/Invoices/InvoiceListGrid.cs

@@ -71,15 +71,15 @@ namespace PRSDesktop
 
         public Guid JobID { get; set; }
         
-        public bool IncludePaidInvoices { get; set; }
+        //public bool IncludePaidInvoices { get; set; }
 
         protected override void Reload(Filters<Invoice> criteria, Columns<Invoice> columns, ref SortOrder<Invoice>? sort,
             Action<CoreTable?, Exception?> action)
         {
             if (JobID != Guid.Empty)
                 criteria.Add(new Filter<Invoice>(x => x.JobLink.ID).IsEqualTo(JobID));
-            if (!IncludePaidInvoices)
-                criteria.Add(new Filter<Invoice>(x => x.Balance).IsNotEqualTo(FilterConstant.Zero));
+            // if (!IncludePaidInvoices)
+            //     criteria.Add(new Filter<Invoice>(x => x.Balance).IsNotEqualTo(FilterConstant.Zero));
             base.Reload(criteria, columns, ref sort, action);
         }
 

+ 13 - 13
prs.desktop/Panels/Invoices/InvoicePanel.xaml

@@ -17,24 +17,24 @@
         DetailHeight="300">
         <dynamicGrid:DynamicSplitPanel.Header>
             <Border BorderThickness="0.75" BorderBrush="Gray" Background="WhiteSmoke" Padding="5,0">
-                <DockPanel>
+                <!-- <DockPanel> -->
                     <Label 
                         Content="Include Paid?" 
                         DockPanel.Dock="Right"
                         HorizontalContentAlignment="Center" 
                         VerticalContentAlignment="Center"/>
-                    <CheckBox
-                        x:Name="_includePaid"
-                        DockPanel.Dock="Right"
-                        VerticalContentAlignment="Center"
-                        Checked="_includePaid_OnChecked"
-                        Unchecked="_includePaid_OnChecked"/>
-                    <Label 
-                        Content="Invoice List" 
-                        DockPanel.Dock="Left"
-                        HorizontalContentAlignment="Center" 
-                        VerticalContentAlignment="Center"/>
-                </DockPanel>
+                    <!-- <CheckBox -->
+                    <!--     x:Name="_includePaid" -->
+                    <!--     DockPanel.Dock="Right" -->
+                    <!--     VerticalContentAlignment="Center" -->
+                    <!--     Checked="_includePaid_OnChecked" -->
+                    <!--     Unchecked="_includePaid_OnChecked"/> -->
+                    <!-- <Label  -->
+                    <!--     Content="Invoice List"  -->
+                    <!--     DockPanel.Dock="Left" -->
+                    <!--     HorizontalContentAlignment="Center"  -->
+                    <!--     VerticalContentAlignment="Center"/> -->
+                <!-- </DockPanel> -->
             </Border>
         </dynamicGrid:DynamicSplitPanel.Header>
         <dynamicGrid:DynamicSplitPanel.Master>

+ 16 - 16
prs.desktop/Panels/Invoices/InvoicePanel.xaml.cs

@@ -16,10 +16,10 @@ using InABox.DynamicGrid;
 namespace PRSDesktop
 {
 
-    public class InvoicePanelSettings : IUserConfigurationSettings
-    {
-        public bool IncludePaidInvoices { get; set; }
-    }
+    // public class InvoicePanelSettings : IUserConfigurationSettings
+    // {
+    //     public bool IncludePaidInvoices { get; set; }
+    // }
     
     /// <summary>
     ///     Interaction logic for InvoiceGrid.xaml
@@ -27,14 +27,14 @@ namespace PRSDesktop
     public partial class InvoicePanel : UserControl, IPanel<Invoice>, IJobControl
     {
 
-        private InvoicePanelSettings _settings;
+        //private InvoicePanelSettings _settings;
         
         public InvoicePanel()
         {
-            _settings = new UserConfiguration<InvoicePanelSettings>().Load();
+            //_settings = new UserConfiguration<InvoicePanelSettings>().Load();
             InitializeComponent();
-            Invoices.IncludePaidInvoices = _settings.IncludePaidInvoices;
-            _includePaid.IsChecked = _settings.IncludePaidInvoices;
+            //Invoices.IncludePaidInvoices = _settings.IncludePaidInvoices;
+            //_includePaid.IsChecked = _settings.IncludePaidInvoices;
             Invoices.OnSelectItem += Invoices_OnSelectItem;
             
         }
@@ -125,13 +125,13 @@ namespace PRSDesktop
             Lines.Refresh(false, true);
         }
         
-        private void _includePaid_OnChecked(object sender, RoutedEventArgs e)
-        {
-            _settings.IncludePaidInvoices = _includePaid.IsChecked == true;
-            new UserConfiguration<InvoicePanelSettings>().Save(_settings);
-            Invoices.IncludePaidInvoices = _includePaid.IsChecked == true;
-            if (IsReady)
-                Refresh();
-        }
+        // private void _includePaid_OnChecked(object sender, RoutedEventArgs e)
+        // {
+        //     _settings.IncludePaidInvoices = _includePaid.IsChecked == true;
+        //     new UserConfiguration<InvoicePanelSettings>().Save(_settings);
+        //     Invoices.IncludePaidInvoices = _includePaid.IsChecked == true;
+        //     if (IsReady)
+        //         Refresh();
+        // }
     }
 }