123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- 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 }
- };
- }
- public class QuoteProposalExTaxCondition : ICondition<QuoteProposal, double, double>
- {
- public Expression<Func<QuoteProposal, double>> Left => x => x.ExTax;
- public Condition Condition => Condition.Equals;
- public Expression<Func<QuoteProposal, double>> Right => x => 0.00F;
- public Expression<Func<QuoteProposal, double>> True => x => x.CostSheetsExTax;
- public Expression<Func<QuoteProposal, double>> False => x => x.ExTax;
- public ConditionType Type => ConditionType.Virtual;
- }
- public class QuoteProposalTaxCondition : ICondition<QuoteProposal, double, double>
- {
- public Expression<Func<QuoteProposal, double>> Left => x => x.ExTax;
- public Condition Condition => Condition.Equals;
- public Expression<Func<QuoteProposal, double>> Right => x => 0.00F;
- public Expression<Func<QuoteProposal, double>> True => x => x.CostSheetsTax;
- public Expression<Func<QuoteProposal, double>> False => x => x.Tax;
- public ConditionType Type => ConditionType.Virtual;
- }
- public class QuoteProposalIncTaxCondition : ICondition<QuoteProposal, double, double>
- {
- public Expression<Func<QuoteProposal, double>> Left => x => x.ExTax;
- public Condition Condition => Condition.Equals;
- public Expression<Func<QuoteProposal, double>> Right => x => 0.00F;
- public Expression<Func<QuoteProposal, double>> True => x => x.CostSheetsIncTax;
- public Expression<Func<QuoteProposal, double>> False => x => x.IncTax;
- public ConditionType Type => ConditionType.Virtual;
- }
- [UserTracking(typeof(Quote))]
- public class QuoteProposal : Entity, IRemotable, IPersistent, IQuoteProposal, ITaxable, IOneToMany<Quote>, ILicense<QuotesManagementLicense>
- {
- [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]
- [Aggregate(typeof(QuoteProposalExTax))]
- public double CostSheetsExTax { get; set; }
- [NullEditor]
- [Aggregate(typeof(QuoteProposalTax))]
- public double CostSheetsTax { get; set; }
- [NullEditor]
- [Aggregate(typeof(QuoteProposalIncTax))]
- public double CostSheetsIncTax { get; set; }
- [EditorSequence(4)]
- public TaxCodeLink TaxCode { get; set; }
- [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; }
- [CurrencyEditor(Visible = Visible.Default, Editable = Editable.Hidden)]
- [Condition(typeof(QuoteProposalExTaxCondition))]
- public double ProposalExTax { get; set; }
- [CurrencyEditor(Visible = Visible.Optional, Editable = Editable.Hidden)]
- [Condition(typeof(QuoteProposalTaxCondition))]
- public double ProposalTax { get; set; }
- [CurrencyEditor(Visible = Visible.Optional, Editable = Editable.Hidden)]
- [Condition(typeof(QuoteProposalIncTaxCondition))]
- public double ProposalIncTax { get; set; }
- [CheckBoxEditor]
- [EditorSequence(7)]
- public bool Default { get; set; }
- [NullEditor]
- public long Sequence { get; set; }
- [DoubleEditor(Visible = Visible.Optional)]
- [EditorSequence(3)]
- public double ExTax { get; set; }
- [NullEditor]
- public double TaxRate { get; set; }
- [DoubleEditor(Visible = Visible.Optional, Editable = Editable.Disabled)]
- [EditorSequence(5)]
- public double Tax { get; set; }
- [DoubleEditor(Visible = Visible.Optional)]
- [EditorSequence(6)]
- public double IncTax { get; set; }
- static QuoteProposal()
- {
- LinkedProperties.Register<QuoteProposal, TaxCodeLink, double>(x => x.TaxCode, x => x.Rate, x => x.TaxRate);
- }
- }
- }
|