using System; using System.Linq.Expressions; using InABox.Core; namespace Comal.Classes { public class QuoteProposalCostSheetExTax : IFormula { public Expression> Value => x => x.CostSheet.ExTax; public Expression>[] Modifiers => new Expression>[] { x => x.Qty }; public FormulaOperator Operator => FormulaOperator.Multiply; public FormulaType Type => FormulaType.Virtual; } public class QuoteProposalCostSheetTax : IFormula { public Expression> Value => x => x.CostSheet.Tax; public Expression>[] Modifiers => new Expression>[] { x => x.Qty }; public FormulaOperator Operator => FormulaOperator.Multiply; public FormulaType Type => FormulaType.Virtual; } public class QuoteProposalCostSheetIncTax : IFormula { public Expression> Value => x => x.CostSheet.IncTax; public Expression>[] Modifiers => new Expression>[] { x => x.Qty }; public FormulaOperator Operator => FormulaOperator.Multiply; public FormulaType Type => FormulaType.Virtual; } [UserTracking(typeof(Quote))] public class QuoteProposalCostSheet : Entity, IRemotable, IPersistent, IQuoteProposalCostSheet, ILicense { [NullEditor] [EntityRelationship(DeleteAction.Cascade)] public QuoteProposalLink Proposal { get; set; } [EntityRelationship(DeleteAction.Cascade)] public QuoteCostSheetLink CostSheet { get; set; } [IntegerEditor] public int Qty { get; set; } [CurrencyEditor(Editable = Editable.Hidden, Summary = Summary.Sum)] [Formula(typeof(QuoteProposalCostSheetExTax))] public double ExTax { get; set; } [CurrencyEditor(Editable = Editable.Hidden, Summary = Summary.Sum)] [Formula(typeof(QuoteProposalCostSheetTax))] public double Tax { get; set; } [CurrencyEditor(Visible = Visible.Default, Editable = Editable.Hidden, Summary = Summary.Sum)] [Formula(typeof(QuoteProposalCostSheetIncTax))] public double IncTax { get; set; } [NullEditor] public long Sequence { get; set; } protected override void Init() { base.Init(); Proposal = new QuoteProposalLink(); CostSheet = new QuoteCostSheetLink(); } } }