|  | @@ -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;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 |