|
@@ -20,19 +20,6 @@ namespace Comal.Classes
|
|
|
// public override Filter<Assignment>? Filter => new Filter<Assignment>(x => x.Chargeable).IsEqualTo(true);
|
|
|
// }
|
|
|
|
|
|
- public class InvoiceExTax : CoreAggregate<Invoice, InvoiceLine, double>
|
|
|
- {
|
|
|
- public override Expression<Func<InvoiceLine, double>> Aggregate => x => x.ExTax;
|
|
|
-
|
|
|
- public override AggregateCalculation Calculation => AggregateCalculation.Sum;
|
|
|
-
|
|
|
- public override Dictionary<Expression<Func<InvoiceLine, object>>, Expression<Func<Invoice, object>>> Links =>
|
|
|
- new Dictionary<Expression<Func<InvoiceLine, object>>, Expression<Func<Invoice, object>>>()
|
|
|
- {
|
|
|
- { InvoiceLine => InvoiceLine.InvoiceLink.ID, Invoice => Invoice.ID }
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
public class InvoiceTax : CoreAggregate<Invoice, InvoiceLine, double>
|
|
|
{
|
|
|
public override Expression<Func<InvoiceLine, double>> Aggregate => x => x.Tax;
|
|
@@ -106,31 +93,42 @@ namespace Comal.Classes
|
|
|
|
|
|
[EditorSequence(5)]
|
|
|
public CustomerLink CustomerLink { get; set; }
|
|
|
-
|
|
|
+
|
|
|
+ private class ClaimedFormula : ComplexFormulaGenerator<Invoice, double>
|
|
|
+ {
|
|
|
+ public override IComplexFormulaNode<Invoice, double> GetFormula() =>
|
|
|
+ Aggregate<InvoiceLine>(AggregateCalculation.Sum, x => x.Property(x => x.ExTax))
|
|
|
+ .WithLink(x => x.InvoiceLink.ID, x => x.ID);
|
|
|
+ }
|
|
|
[EditorSequence(6)]
|
|
|
[CurrencyEditor(Editable = Editable.Hidden, Summary = Summary.Sum)]
|
|
|
- [Aggregate(typeof(InvoiceExTax))]
|
|
|
- public double ExTax { get; set; }
|
|
|
+ [ComplexFormula(typeof(ClaimedFormula))]
|
|
|
+ public double Claimed { get; set; }
|
|
|
|
|
|
[EditorSequence(7)]
|
|
|
[CurrencyEditor(Summary = Summary.Sum)]
|
|
|
public double Retained { get; set; }
|
|
|
-
|
|
|
+
|
|
|
+ private class ExTaxFormula : ComplexFormulaGenerator<Invoice, double>
|
|
|
+ {
|
|
|
+ public override IComplexFormulaNode<Invoice, double> GetFormula() =>
|
|
|
+ Formula(FormulaOperator.Subtract, Property(x => x.Claimed), Property(x => x.Retained));
|
|
|
+ }
|
|
|
[EditorSequence(8)]
|
|
|
[CurrencyEditor(Editable = Editable.Hidden, Summary = Summary.Sum)]
|
|
|
+ [ComplexFormula(typeof(ExTaxFormula))]
|
|
|
+ public double ExTax { get; set; }
|
|
|
+
|
|
|
+ [EditorSequence(9)]
|
|
|
+ [CurrencyEditor(Editable = Editable.Hidden, Summary = Summary.Sum)]
|
|
|
[Aggregate(typeof(InvoiceTax))]
|
|
|
public double Tax { get; set; }
|
|
|
|
|
|
- [EditorSequence(9)]
|
|
|
+ [EditorSequence(10)]
|
|
|
[CurrencyEditor(Visible = Visible.Default, Editable = Editable.Hidden, Summary = Summary.Sum)]
|
|
|
[Aggregate(typeof(InvoiceIncTax))]
|
|
|
public double IncTax { get; set; }
|
|
|
|
|
|
- [EditorSequence(10)]
|
|
|
- [CurrencyEditor(Editable = Editable.Hidden)]
|
|
|
- [Aggregate(typeof(InvoiceExTax))]
|
|
|
- public double Total { get; set; }
|
|
|
-
|
|
|
[EditorSequence(11)]
|
|
|
[CurrencyEditor(Editable = Editable.Hidden)]
|
|
|
[Aggregate(typeof(InvoiceAmountPaid))]
|