QuoteContract.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq.Expressions;
  4. using InABox.Core;
  5. namespace Comal.Classes
  6. {
  7. public class QuoteContractExTax : CoreAggregate<QuoteContract, QuoteContractProposal, double>
  8. {
  9. public override Expression<Func<QuoteContractProposal, double>> Aggregate => x => x.Proposal.ProposalExTax;
  10. public override AggregateCalculation Calculation => AggregateCalculation.Sum;
  11. public override Dictionary<Expression<Func<QuoteContractProposal, object>>, Expression<Func<QuoteContract, object>>> Links =>
  12. new Dictionary<Expression<Func<QuoteContractProposal, object>>, Expression<Func<QuoteContract, object>>>()
  13. {
  14. { QuoteContractProposal => QuoteContractProposal.Contract.ID, QuoteContract => QuoteContract.ID }
  15. };
  16. }
  17. public class QuoteContractTax : CoreAggregate<QuoteContract, QuoteContractProposal, double>
  18. {
  19. public override Expression<Func<QuoteContractProposal, double>> Aggregate => x => x.Proposal.ProposalTax;
  20. public override AggregateCalculation Calculation => AggregateCalculation.Sum;
  21. public override Dictionary<Expression<Func<QuoteContractProposal, object>>, Expression<Func<QuoteContract, object>>> Links =>
  22. new Dictionary<Expression<Func<QuoteContractProposal, object>>, Expression<Func<QuoteContract, object>>>()
  23. {
  24. { QuoteContractProposal => QuoteContractProposal.Contract.ID, QuoteContract => QuoteContract.ID }
  25. };
  26. }
  27. public class QuoteContractIncTax : CoreAggregate<QuoteContract, QuoteContractProposal, double>
  28. {
  29. public override Expression<Func<QuoteContractProposal, double>> Aggregate => x => x.Proposal.ProposalIncTax;
  30. public override AggregateCalculation Calculation => AggregateCalculation.Sum;
  31. public override Dictionary<Expression<Func<QuoteContractProposal, object>>, Expression<Func<QuoteContract, object>>> Links =>
  32. new Dictionary<Expression<Func<QuoteContractProposal, object>>, Expression<Func<QuoteContract, object>>>()
  33. {
  34. { QuoteContractProposal => QuoteContractProposal.Contract.ID, QuoteContract => QuoteContract.ID }
  35. };
  36. }
  37. [UserTracking(typeof(Quote))]
  38. public class QuoteContract : Entity, IRemotable, IPersistent, IQuoteContract, ILicense<QuotesManagementLicense>, IOneToMany<Quote>
  39. {
  40. [NullEditor]
  41. [EntityRelationship(DeleteAction.Cascade)]
  42. public QuoteLink Quote { get; set; }
  43. [TextBoxEditor]
  44. public string Description { get; set; }
  45. [CurrencyEditor(Editable = Editable.Hidden, Summary = Summary.Sum)]
  46. [Aggregate(typeof(QuoteContractExTax))]
  47. public double ExTax { get; set; }
  48. [CurrencyEditor(Editable = Editable.Hidden, Summary = Summary.Sum)]
  49. [Aggregate(typeof(QuoteContractTax))]
  50. public double Tax { get; set; }
  51. [CurrencyEditor(Visible = Visible.Default, Editable = Editable.Hidden, Summary = Summary.Sum)]
  52. [Aggregate(typeof(QuoteContractIncTax))]
  53. public double IncTax { get; set; }
  54. }
  55. }