| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 | 
							- using System;
 
- using System.Collections.Generic;
 
- using System.Linq.Expressions;
 
- using InABox.Core;
 
- namespace Comal.Classes
 
- {
 
-     public class QuoteProposalExTax : CoreAggregate<QuoteProposal, QuoteProposalCostSheet, double>
 
-     {
 
-         public override Expression<Func<QuoteProposalCostSheet, double>> Aggregate => x => x.ExTax;
 
-         public override AggregateCalculation Calculation => AggregateCalculation.Sum;
 
-         public override Dictionary<Expression<Func<QuoteProposalCostSheet, object>>, Expression<Func<QuoteProposal, object>>> Links =>
 
-             new Dictionary<Expression<Func<QuoteProposalCostSheet, object>>, Expression<Func<QuoteProposal, object>>>()
 
-             {
 
-                 { QuoteProposalCostSheet => QuoteProposalCostSheet.Proposal.ID, QuoteProposal => QuoteProposal.ID }
 
-             };
 
-     }
 
-     public class QuoteProposalTax : CoreAggregate<QuoteProposal, QuoteProposalCostSheet, double>
 
-     {
 
-         public override Expression<Func<QuoteProposalCostSheet, double>> Aggregate => x => x.Tax;
 
-         public override AggregateCalculation Calculation => AggregateCalculation.Sum;
 
-         public override Dictionary<Expression<Func<QuoteProposalCostSheet, object>>, Expression<Func<QuoteProposal, object>>> Links =>
 
-             new Dictionary<Expression<Func<QuoteProposalCostSheet, object>>, Expression<Func<QuoteProposal, object>>>()
 
-             {
 
-                 { QuoteProposalCostSheet => QuoteProposalCostSheet.Proposal.ID, QuoteProposal => QuoteProposal.ID }
 
-             };
 
-     }
 
-     public class QuoteProposalIncTax : CoreAggregate<QuoteProposal, QuoteProposalCostSheet, double>
 
-     {
 
-         public override Expression<Func<QuoteProposalCostSheet, double>> Aggregate => x => x.IncTax;
 
-         public override AggregateCalculation Calculation => AggregateCalculation.Sum;
 
-         public override Dictionary<Expression<Func<QuoteProposalCostSheet, object>>, Expression<Func<QuoteProposal, object>>> Links =>
 
-             new Dictionary<Expression<Func<QuoteProposalCostSheet, object>>, Expression<Func<QuoteProposal, object>>>()
 
-             {
 
-                 { QuoteProposalCostSheet => QuoteProposalCostSheet.Proposal.ID, QuoteProposal => QuoteProposal.ID }
 
-             };
 
-     }
 
-     
 
-     [UserTracking(typeof(Quote))]
 
-     public class QuoteProposal : Entity, IRemotable, IPersistent, IQuoteProposal, IOneToMany<Quote>, ILicense<QuotesManagementLicense>
 
-     {
 
-         
 
-         [NullEditor]
 
-         [EntityRelationship(DeleteAction.Cascade)]
 
-         public QuoteLink Quote { get; set; }
 
-         
 
-         [DateEditor(Visible = Visible.Default)]
 
-         [EditorSequence(1)]
 
-         public DateTime Date { get; set; }
 
-         
 
-         [TextBoxEditor(Visible = Visible.Default)]
 
-         [EditorSequence(2)]
 
-         public string Description { get; set; }
 
-         
 
-         [EditorSequence(3)]
 
-         public double Price { get; set; }
 
-         
 
-         [EditorSequence(4)]
 
-         public TaxCodeLink TaxCode { get; set; }
 
-         
 
-         [CheckBoxEditor]
 
-         [EditorSequence(5)]
 
-         public bool Default { get; set; }
 
-         
 
-         private class ExTaxFormula : ComplexFormulaGenerator<QuoteProposal, double>
 
-         {
 
-             public override IComplexFormulaNode<QuoteProposal, double> GetFormula() => If<double>(
 
-                     x => x.Property(x => x.Price),
 
-                     Condition.Equals,
 
-                     x => Constant(0.0))
 
-                 .Then(Aggregate<QuoteProposalCostSheet>(AggregateCalculation.Sum, x => x.Property(x => x.ExTax)).WithLink(x => x.Proposal.ID, x => x.ID))
 
-                 .Else(Property(x => x.Price));
 
-         }
 
-         
 
-         [CurrencyEditor(Visible = Visible.Default, Editable = Editable.Hidden)]
 
-         [ComplexFormula(typeof(ExTaxFormula))]
 
-         public double ExTax { get; set; }
 
-         
 
-         private class TaxFormula : ComplexFormulaGenerator<QuoteProposal, double>
 
-         {
 
-             public override IComplexFormulaNode<QuoteProposal, double> GetFormula() => If<double>(
 
-                     x => x.Property(x => x.Price),
 
-                     Condition.Equals,
 
-                     x => x.Constant(0.0))
 
-                 .Then(Aggregate<QuoteProposalCostSheet>(AggregateCalculation.Sum, x => x.Property(x => x.Tax)).WithLink(x => x.Proposal.ID, x => x.ID))
 
-                 .Else(Formula(FormulaOperator.Multiply, Property(x => x.Price), Property(x => x.TaxCode.Rate), Constant(0.01)));
 
-         }
 
-         
 
-         [CurrencyEditor(Visible = Visible.Optional, Editable = Editable.Hidden)]
 
-         [ComplexFormula(typeof(TaxFormula))]
 
-         public double Tax { get; set; }
 
-         private class IncTaxFormula : ComplexFormulaGenerator<QuoteProposal, double>
 
-         {
 
-             public override IComplexFormulaNode<QuoteProposal, double> GetFormula() => If<double>(
 
-                     x => x.Property(x => x.Price),
 
-                     Condition.Equals,
 
-                     x => x.Constant(0.0))
 
-                 .Then(Aggregate<QuoteProposalCostSheet>(AggregateCalculation.Sum, x => x.Property(x => x.IncTax)).WithLink(x => x.Proposal.ID, x => x.ID))
 
-                 .Else(Formula(FormulaOperator.Add, Property(x => x.Price), Property(x => x.Tax)));
 
-         }
 
-         
 
-         [CurrencyEditor(Visible = Visible.Optional, Editable = Editable.Hidden)]
 
-         [ComplexFormula(typeof(IncTaxFormula))]
 
-         public double IncTax { get; set; }
 
-         
 
-         [RichTextEditor(Visible = Visible.Hidden)]
 
-         [EditorSequence("Preamble", 1)]
 
-         public string Preamble { get; set; }
 
-         [RichTextEditor(Visible = Visible.Hidden)]
 
-         [EditorSequence("Summary", 1)]
 
-         public string Summary { get; set; }
 
-         
 
-         [NullEditor]
 
-         public long Sequence { get; set; }
 
-         
 
-     }
 
- }
 
 
  |