Browse Source

Did stuff for Invoice Poster things (DON't MERGE TO PRODUCTION YET)

Kenric Nugteren 1 year ago
parent
commit
3411102dae

+ 4 - 1
prs.classes/Entities/Invoice/Invoice.cs

@@ -81,7 +81,7 @@ namespace Comal.Classes
     }
 
     [UserTracking("Accounts Receivable")]
-    public class Invoice : Entity, IPersistent, IRemotable, INumericAutoIncrement<Invoice>, ILicense<AccountsReceivableLicense>, IExportable
+    public class Invoice : Entity, IPersistent, IRemotable, INumericAutoIncrement<Invoice>, ILicense<AccountsReceivableLicense>, IExportable, IPostable
     {
         [EditorSequence(1)]
         [IntegerEditor(Visible = Visible.Default, Editable = Editable.Enabled)]
@@ -136,6 +136,9 @@ namespace Comal.Classes
         [Formula(typeof(InvoiceBalance))]
         public double Balance { get; set; }
 
+        [NullEditor]
+        public DateTime Posted { get; set; }
+
         public Expression<Func<Invoice, int>> AutoIncrementField()
         {
             return x => x.Number;

+ 0 - 1
prs.classes/PRSClasses.csproj

@@ -12,7 +12,6 @@
     </PropertyGroup>
 
     <ItemGroup>
-      <ProjectReference Include="..\..\InABox\InABox.Configuration\InABox.Configuration.csproj" />
       <ProjectReference Include="..\..\InABox\InABox.Core\InABox.Core.csproj" />
     </ItemGroup>
 

+ 2 - 1
prs.desktop/PRSDesktop.csproj

@@ -26,6 +26,7 @@
 
     <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug - DB|AnyCPU'">
       <NoWarn />
+      <DefineConstants>$(DefineConstants);RPC</DefineConstants>
     </PropertyGroup>
     
     
@@ -777,7 +778,6 @@
       <ProjectReference Include="..\..\InABox\InABox.Client.Local\InABox.Client.Local.csproj" />
       <ProjectReference Include="..\..\inabox\inabox.client.rest\InABox.Client.Rest\InABox.Client.Rest.csproj" />
       <ProjectReference Include="..\..\inabox\InABox.Client.RPC\InABox.Client.RPC.csproj" />
-      <ProjectReference Include="..\..\InABox\InABox.Configuration\InABox.Configuration.csproj" />
       <ProjectReference Include="..\..\InABox\InABox.Core\InABox.Core.csproj" />
       <ProjectReference Include="..\..\InABox\InABox.Database.SQLite\InABox.Database.SQLite.csproj" />
       <ProjectReference Include="..\..\InABox\InABox.DatabaseProxy\InABox.DatabaseProxy.csproj" />
@@ -786,6 +786,7 @@
       <ProjectReference Include="..\..\InABox\InABox.Logging\InABox.Logging.csproj" />
       <ProjectReference Include="..\..\InABox\InABox.Mailer.Exchange\InABox.Mailer.Exchange.csproj" />
       <ProjectReference Include="..\..\InABox\inabox.mailer.imap\InABox.Mailer.IMAP.csproj" />
+      <ProjectReference Include="..\..\inabox\InABox.Poster.CSV\InABox.Poster.CSV.csproj" />
       <ProjectReference Include="..\..\InABox\InABox.Scripting\InABox.Scripting.csproj" />
       <ProjectReference Include="..\..\InABox\inabox.wpf\InABox.Wpf.csproj" />
       <ProjectReference Include="..\PRS.Classes\PRSClasses.csproj" />

+ 0 - 1
prs.server/PRSServer.csproj

@@ -88,7 +88,6 @@
         <ProjectReference Include="..\..\InABox\InABox.Client.Local\InABox.Client.Local.csproj" />
         <ProjectReference Include="..\..\inabox\inabox.client.rest\InABox.Client.Rest\InABox.Client.Rest.csproj" />
         <ProjectReference Include="..\..\inabox\InABox.Client.RPC\InABox.Client.RPC.csproj" />
-        <ProjectReference Include="..\..\InABox\InABox.Configuration\InABox.Configuration.csproj" />
         <ProjectReference Include="..\..\InABox\InABox.Core\InABox.Core.csproj" />
         <ProjectReference Include="..\..\InABox\InABox.Database.SQLite\InABox.Database.SQLite.csproj" />
         <ProjectReference Include="..\..\InABox\InABox.Database\InABox.Database.csproj" />

+ 1 - 0
prs.shared/PRS.Shared.csproj

@@ -12,6 +12,7 @@
     <ProjectReference Include="..\..\inabox\inabox.client.rest\InABox.Client.Rest\InABox.Client.Rest.csproj" />
     <ProjectReference Include="..\..\InABox\InABox.Core\InABox.Core.csproj" />
     <ProjectReference Include="..\..\InABox\InABox.Database\InABox.Database.csproj" />
+    <ProjectReference Include="..\..\inabox\InABox.Poster.CSV\InABox.Poster.CSV.csproj" />
     <ProjectReference Include="..\..\InABox\InABox.WPF\InABox.Wpf.csproj" />
     <ProjectReference Include="..\PRS.Classes\PRSClasses.csproj" />
   </ItemGroup>

+ 42 - 0
prs.shared/Posters/InvoiceCSVPoster.cs

@@ -0,0 +1,42 @@
+using Comal.Classes;
+using InABox.Core;
+using InABox.Poster.CSV;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace PRS.Shared
+{
+    class InvoiceExportMap
+    {
+        public int Number { get; set; }
+
+        public double Paid { get; set; }
+
+        public double Balance { get; set; }
+    }
+
+    public class InvoiceCSVPoster : ICSVPoster<Invoice>
+    {
+        public ICSVExport Process(IEnumerable<Invoice> entities)
+        {
+            var export = new CSVExport<InvoiceExportMap>();
+            export.DefineMapping(new()
+            {
+                new("Number", x => x.Number),
+                new("Paid", x => x.Paid),
+                new("Balance", x => x.Balance)
+            });
+            foreach(var entity in entities)
+            {
+                export.Add(new InvoiceExportMap
+                {
+                    Number = entity.Number,
+                    Paid = entity.AmountPaid,
+                    Balance = entity.Balance
+                });
+            }
+            return export;
+        }
+    }
+}