QuoteProposalCostSheet.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System;
  2. using System.Linq.Expressions;
  3. using InABox.Core;
  4. namespace Comal.Classes
  5. {
  6. public class QuoteProposalCostSheetExTax : IFormula<QuoteProposalCostSheet, double>
  7. {
  8. public Expression<Func<QuoteProposalCostSheet, double>> Value => x => x.CostSheet.ExTax;
  9. public Expression<Func<QuoteProposalCostSheet, double>>[] Modifiers => new Expression<Func<QuoteProposalCostSheet, double>>[] { x => x.Qty };
  10. public FormulaOperator Operator => FormulaOperator.Multiply;
  11. public FormulaType Type => FormulaType.Virtual;
  12. }
  13. public class QuoteProposalCostSheetTax : IFormula<QuoteProposalCostSheet, double>
  14. {
  15. public Expression<Func<QuoteProposalCostSheet, double>> Value => x => x.CostSheet.Tax;
  16. public Expression<Func<QuoteProposalCostSheet, double>>[] Modifiers => new Expression<Func<QuoteProposalCostSheet, double>>[] { x => x.Qty };
  17. public FormulaOperator Operator => FormulaOperator.Multiply;
  18. public FormulaType Type => FormulaType.Virtual;
  19. }
  20. public class QuoteProposalCostSheetIncTax : IFormula<QuoteProposalCostSheet, double>
  21. {
  22. public Expression<Func<QuoteProposalCostSheet, double>> Value => x => x.CostSheet.IncTax;
  23. public Expression<Func<QuoteProposalCostSheet, double>>[] Modifiers => new Expression<Func<QuoteProposalCostSheet, double>>[] { x => x.Qty };
  24. public FormulaOperator Operator => FormulaOperator.Multiply;
  25. public FormulaType Type => FormulaType.Virtual;
  26. }
  27. [UserTracking(typeof(Quote))]
  28. public class QuoteProposalCostSheet : Entity, IRemotable, IPersistent, IQuoteProposalCostSheet, ILicense<QuotesManagementLicense>
  29. {
  30. [NullEditor]
  31. [EntityRelationship(DeleteAction.Cascade)]
  32. public QuoteProposalLink Proposal { get; set; }
  33. [EntityRelationship(DeleteAction.Cascade)]
  34. public QuoteCostSheetLink CostSheet { get; set; }
  35. [IntegerEditor]
  36. public int Qty { get; set; }
  37. [CurrencyEditor(Editable = Editable.Hidden, Summary = Summary.Sum)]
  38. [Formula(typeof(QuoteProposalCostSheetExTax))]
  39. public double ExTax { get; set; }
  40. [CurrencyEditor(Editable = Editable.Hidden, Summary = Summary.Sum)]
  41. [Formula(typeof(QuoteProposalCostSheetTax))]
  42. public double Tax { get; set; }
  43. [CurrencyEditor(Visible = Visible.Default, Editable = Editable.Hidden, Summary = Summary.Sum)]
  44. [Formula(typeof(QuoteProposalCostSheetIncTax))]
  45. public double IncTax { get; set; }
  46. [NullEditor]
  47. public long Sequence { get; set; }
  48. protected override void Init()
  49. {
  50. base.Init();
  51. Proposal = new QuoteProposalLink();
  52. CostSheet = new QuoteCostSheetLink();
  53. }
  54. }
  55. }