Explorar o código

Caught cancelled post exception, and changed default Invoice Poster

Kenric Nugteren %!s(int64=2) %!d(string=hai) anos
pai
achega
6ad2bb0df0

+ 4 - 0
prs.desktop/Panels/Invoices/InvoicePanel.xaml.cs

@@ -103,6 +103,10 @@ namespace PRSDesktop
                         {
                             MessageBox.Show("At least one of the items you selected has already been processed. Processing cancelled.");
                         }
+                        catch (PostCancelledException)
+                        {
+                            MessageBox.Show("Processing cancelled.");
+                        }
                         catch (MissingSettingsException)
                         {
                             if (Security.CanConfigurePost<Invoice>())

+ 6 - 25
prs.shared/Posters/InvoiceCSVPoster.cs

@@ -7,42 +7,23 @@ using System.Text;
 
 namespace PRS.Shared
 {
-    class InvoiceExportMap
-    {
-        public int Number { get; set; }
-
-        public double Paid { get; set; }
-
-        public double Balance { get; set; }
-
-        public string Description { get; set; }
-
-        public Guid ID { get; set; }
-    }
-
     public class InvoiceCSVPoster : ICSVPoster<Invoice>
     {
         public ICSVExport Process(IEnumerable<Invoice> entities)
         {
-            var export = new CSVExport<InvoiceExportMap>();
+            var export = new CSVExport<Invoice>();
             export.DefineMapping(new()
             {
                 new("Number", x => x.Number),
+                new("Date", x => x.Date),
                 new("Description", x => x.Description),
-                new("Paid", x => x.Paid),
-                new("Balance", x => x.Balance),
-                new("ID", x => x.ID)
+                new("ExTax", x => x.ExTax),
+                new("Tax", x => x.Tax),
+                new("IncTax", x => x.IncTax)
             });
             foreach(var entity in entities)
             {
-                export.Add(new InvoiceExportMap
-                {
-                    Number = entity.Number,
-                    Paid = entity.AmountPaid,
-                    Balance = entity.Balance,
-                    ID = entity.ID,
-                    Description = entity.Description
-                });
+                export.Add(entity);
             }
             return export;
         }