| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 | 
							- using System;
 
- using System.Collections.Generic;
 
- using System.Linq.Expressions;
 
- using InABox.Core;
 
- namespace Comal.Classes
 
- {
 
-     public class PaymentTotal : CoreAggregate<Payment, BillPayment, double>
 
-     {
 
-         public override Expression<Func<BillPayment, double>> Aggregate => x => x.Amount;
 
-         public Expression<Func<BillPayment, Guid>> Link => x => x.PaymentLink.ID;
 
-         public override AggregateCalculation Calculation => AggregateCalculation.Sum;
 
-         public override Dictionary<Expression<Func<BillPayment, object>>, Expression<Func<Payment, object>>> Links =>
 
-             new Dictionary<Expression<Func<BillPayment, object>>, Expression<Func<Payment, object>>>()
 
-             {
 
-                 { BillPayment => BillPayment.PaymentLink.ID, Payment => Payment.ID }
 
-             };
 
-     }
 
-     [UserTracking(typeof(Bill))]
 
-     public class Payment : Entity, IPersistent, IRemotable, ILicense<AccountsPayableLicense>
 
-     {
 
-         [DateEditor]
 
-         public DateTime Date { get; set; }
 
-         [EditorSequence(1)]
 
-         public SupplierLink SupplierLink { get; set; }
 
-         [EntityRelationship(DeleteAction.SetNull)]
 
-         public PaymentTypeLink PaymentTypeLink { get; set; }
 
-         [MemoEditor]
 
-         public string Notes { get; set; }
 
-         [CurrencyEditor(Editable = Editable.Hidden)]
 
-         [Aggregate(typeof(PaymentTotal))]
 
-         public double Total { get; set; }
 
-         protected override void Init()
 
-         {
 
-             base.Init();
 
-             SupplierLink = new SupplierLink();
 
-             PaymentTypeLink = new PaymentTypeLink();
 
-         }
 
-         public override string ToString()
 
-         {
 
-             return string.Format("{0:dd MMM yy}: {1} (${2:F2})", Date, PaymentTypeLink.Description, Total);
 
-         }
 
-     }
 
- }
 
 
  |