| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 | 
							- using System;
 
- using System.Collections.Generic;
 
- using System.Linq.Expressions;
 
- using InABox.Core;
 
- namespace Comal.Classes
 
- {
 
-     public class BillExTax : CoreAggregate<Bill, BillLine, double>
 
-     {
 
-         public override Expression<Func<BillLine, double>> Aggregate => x => x.ExTax;
 
-         public override AggregateCalculation Calculation => AggregateCalculation.Sum;
 
-         public override Dictionary<Expression<Func<BillLine, object>>, Expression<Func<Bill, object>>> Links =>
 
-             new Dictionary<Expression<Func<BillLine, object>>, Expression<Func<Bill, object>>>()
 
-             {
 
-                 { BillLine => BillLine.BillLink.ID, Bill => Bill.ID }
 
-             };
 
-     }
 
-     public class BillTax : CoreAggregate<Bill, BillLine, double>
 
-     {
 
-         public override Expression<Func<BillLine, double>> Aggregate => x => x.Tax;
 
-         public override AggregateCalculation Calculation => AggregateCalculation.Sum;
 
-         public override Dictionary<Expression<Func<BillLine, object>>, Expression<Func<Bill, object>>> Links =>
 
-             new Dictionary<Expression<Func<BillLine, object>>, Expression<Func<Bill, object>>>()
 
-             {
 
-                 { BillLine => BillLine.BillLink.ID, Bill => Bill.ID }
 
-             };
 
-     }
 
-     public class BillIncTax : CoreAggregate<Bill, BillLine, double>
 
-     {
 
-         public override Expression<Func<BillLine, double>> Aggregate => x => x.IncTax;
 
-         public override AggregateCalculation Calculation => AggregateCalculation.Sum;
 
-         public override Dictionary<Expression<Func<BillLine, object>>, Expression<Func<Bill, object>>> Links =>
 
-             new Dictionary<Expression<Func<BillLine, object>>, Expression<Func<Bill, object>>>()
 
-             {
 
-                 { BillLine => BillLine.BillLink.ID, Bill => Bill.ID }
 
-             };
 
-     }
 
-     public class BillAmountPaid : CoreAggregate<Bill, BillPayment, double>
 
-     {
 
-         public override Expression<Func<BillPayment, double>> Aggregate => x => x.Amount;
 
-         public override AggregateCalculation Calculation => AggregateCalculation.Sum;
 
-         public override Dictionary<Expression<Func<BillPayment, object>>, Expression<Func<Bill, object>>> Links =>
 
-             new Dictionary<Expression<Func<BillPayment, object>>, Expression<Func<Bill, object>>>()
 
-             {
 
-                 { BillPayment => BillPayment.BillLink.ID, Bill => Bill.ID }
 
-             };
 
-     }
 
-     public class BillBalance : IFormula<Bill, double>
 
-     {
 
-         public Expression<Func<Bill, double>> Value => x => x.IncTax;
 
-         public Expression<Func<Bill, double>>[] Modifiers => new Expression<Func<Bill, double>>[] { x => x.AmountPaid };
 
-         public FormulaOperator Operator => FormulaOperator.Subtract;
 
-         public FormulaType Type => FormulaType.Virtual;
 
-     }
 
-     public class BillDocumentCount : CoreAggregate<Bill, BillDocument, Guid>
 
-     {
 
-         public override Expression<Func<BillDocument, Guid>> Aggregate => x => x.ID;
 
-         public override AggregateCalculation Calculation => AggregateCalculation.Count;
 
-         public override Dictionary<Expression<Func<BillDocument, object>>, Expression<Func<Bill, object>>> Links =>
 
-             new Dictionary<Expression<Func<BillDocument, object>>, Expression<Func<Bill, object>>>()
 
-             {
 
-                 { BillDocument => BillDocument.EntityLink.ID, Bill => Bill.ID }
 
-             };
 
-     }
 
- }
 
 
  |