using System; using System.Collections.Generic; using System.Linq.Expressions; using InABox.Core; namespace Comal.Classes { public class QuoteCostSheetExTax : CoreAggregate { public override Expression> Aggregate => x => x.ExTax; public override AggregateCalculation Calculation => AggregateCalculation.Sum; public override Dictionary>, Expression>> Links => new Dictionary>, Expression>>() { { QuoteCostSheetItem => QuoteCostSheetItem.CostSheet.ID, QuoteCostSheet => QuoteCostSheet.ID } }; } public class QuoteCostSheetTax : CoreAggregate { public override Expression> Aggregate => x => x.Tax; public override AggregateCalculation Calculation => AggregateCalculation.Sum; public override Dictionary>, Expression>> Links => new Dictionary>, Expression>>() { { QuoteCostSheetItem => QuoteCostSheetItem.CostSheet.ID, QuoteCostSheet => QuoteCostSheet.ID } }; } public class QuoteCostSheetIncTax : CoreAggregate { public override Expression> Aggregate => x => x.IncTax; public override AggregateCalculation Calculation => AggregateCalculation.Sum; public override Dictionary>, Expression>> Links => new Dictionary>, Expression>>() { { QuoteCostSheetItem => QuoteCostSheetItem.CostSheet.ID, QuoteCostSheet => QuoteCostSheet.ID } }; } [UserTracking(typeof(Quote))] public class QuoteCostSheet : Entity, IRemotable, IPersistent, IQuoteCostSheet, ILicense { [NullEditor] [EntityRelationship(DeleteAction.Cascade)] public QuoteLink Quote { get; set; } [EntityRelationship(DeleteAction.SetNull)] public CostSheetLink CostSheet { get; set; } [CurrencyEditor(Visible = Visible.Default, Editable = Editable.Hidden, Summary = Summary.Sum)] [Aggregate(typeof(QuoteCostSheetExTax))] public double ExTax { get; set; } [CurrencyEditor(Visible = Visible.Optional, Editable = Editable.Hidden, Summary = Summary.Sum)] [Aggregate(typeof(QuoteCostSheetTax))] public double Tax { get; set; } [CurrencyEditor(Visible = Visible.Optional, Editable = Editable.Hidden, Summary = Summary.Sum)] [Aggregate(typeof(QuoteCostSheetIncTax))] public double IncTax { get; set; } [TextBoxEditor(Visible = Visible.Default)] public string Description { get; set; } [NullEditor] public long Sequence { get; set; } protected override void Init() { base.Init(); Quote = new QuoteLink(); CostSheet = new CostSheetLink(); } } }