12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using System;
- using System.Linq;
- using System.Linq.Expressions;
- using InABox.Core;
- namespace Comal.Classes
- {
- public class QuoteProposalCostSheetExTax : IFormula<QuoteProposalCostSheet, double>
- {
- public Expression<Func<QuoteProposalCostSheet, double>> Value => x => x.CostSheet.ExTax;
- public Expression<Func<QuoteProposalCostSheet, double>>[] Modifiers => new Expression<Func<QuoteProposalCostSheet, double>>[] { x => x.Qty };
- public FormulaOperator Operator => FormulaOperator.Multiply;
- public FormulaType Type => FormulaType.Virtual;
- }
- public class QuoteProposalCostSheetTax : IFormula<QuoteProposalCostSheet, double>
- {
- public Expression<Func<QuoteProposalCostSheet, double>> Value => x => x.CostSheet.Tax;
- public Expression<Func<QuoteProposalCostSheet, double>>[] Modifiers => new Expression<Func<QuoteProposalCostSheet, double>>[] { x => x.Qty };
- public FormulaOperator Operator => FormulaOperator.Multiply;
- public FormulaType Type => FormulaType.Virtual;
- }
- public class QuoteProposalCostSheetIncTax : IFormula<QuoteProposalCostSheet, double>
- {
- public Expression<Func<QuoteProposalCostSheet, double>> Value => x => x.CostSheet.IncTax;
- public Expression<Func<QuoteProposalCostSheet, double>>[] Modifiers => new Expression<Func<QuoteProposalCostSheet, double>>[] { x => x.Qty };
- public FormulaOperator Operator => FormulaOperator.Multiply;
- public FormulaType Type => FormulaType.Virtual;
- }
- [UserTracking(typeof(Quote))]
- public class QuoteProposalCostSheet : Entity, IRemotable, IPersistent, IQuoteProposalCostSheet, ILicense<QuotesManagementLicense>
- {
- [NullEditor]
- [EntityRelationship(DeleteAction.Cascade)]
- public QuoteProposalLink Proposal { get; set; }
- private class QuoteCostSheetLookup : LookupDefinitionGenerator<QuoteCostSheet, QuoteProposalCostSheet>
- {
- public override Filter<QuoteCostSheet> DefineFilter(QuoteProposalCostSheet[] items)
- {
- if (items == null || items.Length != 1)
- return LookupFactory.DefineFilter<QuoteCostSheet>();
- return new Filter<QuoteCostSheet>(x => x.Quote.ID).IsEqualTo(items.First().Proposal.Quote.ID);
- }
- public override Columns<QuoteProposalCostSheet> DefineFilterColumns()
- => Columns.None<QuoteProposalCostSheet>().Add(x => x.Proposal.Quote.ID);
- }
- [LookupDefinition(typeof(QuoteCostSheetLookup))]
- [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; }
- }
- }
|