123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Linq.Expressions;
- using InABox.Core;
- namespace Comal.Classes
- {
- public class QuoteCostSheetExTax : CoreAggregate<QuoteCostSheet, QuoteCostSheetItem, double>
- {
- public override Expression<Func<QuoteCostSheetItem, double>> Aggregate => x => x.ExTax;
- public override AggregateCalculation Calculation => AggregateCalculation.Sum;
- public override Dictionary<Expression<Func<QuoteCostSheetItem, object>>, Expression<Func<QuoteCostSheet, object>>> Links =>
- new Dictionary<Expression<Func<QuoteCostSheetItem, object>>, Expression<Func<QuoteCostSheet, object>>>()
- {
- { QuoteCostSheetItem => QuoteCostSheetItem.CostSheet.ID, QuoteCostSheet => QuoteCostSheet.ID }
- };
- }
- public class QuoteCostSheetTax : CoreAggregate<QuoteCostSheet, QuoteCostSheetItem, double>
- {
- public override Expression<Func<QuoteCostSheetItem, double>> Aggregate => x => x.Tax;
- public override AggregateCalculation Calculation => AggregateCalculation.Sum;
- public override Dictionary<Expression<Func<QuoteCostSheetItem, object>>, Expression<Func<QuoteCostSheet, object>>> Links =>
- new Dictionary<Expression<Func<QuoteCostSheetItem, object>>, Expression<Func<QuoteCostSheet, object>>>()
- {
- { QuoteCostSheetItem => QuoteCostSheetItem.CostSheet.ID, QuoteCostSheet => QuoteCostSheet.ID }
- };
- }
- public class QuoteCostSheetIncTax : CoreAggregate<QuoteCostSheet, QuoteCostSheetItem, double>
- {
- public override Expression<Func<QuoteCostSheetItem, double>> Aggregate => x => x.IncTax;
- public override AggregateCalculation Calculation => AggregateCalculation.Sum;
- public override Dictionary<Expression<Func<QuoteCostSheetItem, object>>, Expression<Func<QuoteCostSheet, object>>> Links =>
- new Dictionary<Expression<Func<QuoteCostSheetItem, object>>, Expression<Func<QuoteCostSheet, object>>>()
- {
- { QuoteCostSheetItem => QuoteCostSheetItem.CostSheet.ID, QuoteCostSheet => QuoteCostSheet.ID }
- };
- }
- [UserTracking(typeof(Quote))]
- public class QuoteCostSheet : Entity, IRemotable, IPersistent, IQuoteCostSheet, ILicense<QuotesManagementLicense>,
- IStringAutoIncrement<QuoteCostSheet>
- {
-
- [NullEditor]
- public long Sequence { get; set; }
-
- #region IAutoIncrement
-
- public Expression<Func<QuoteCostSheet, String>> AutoIncrementField() => x => x.Number;
- public String AutoIncrementPrefix() => "QC";
- public virtual string AutoIncrementFormat() => "{0:D6}";
-
- public Filter<QuoteCostSheet> AutoIncrementFilter() => null;
-
- #endregion
-
- [NullEditor]
- [Obsolete("Replaced with Parent")]
- [EntityRelationship(DeleteAction.Cascade)]
- public QuoteLink Quote { get; set; }
-
- [CodeEditor]
- [EditorSequence(1)]
- public string Number { get; set; }
-
- [TextBoxEditor(Visible = Visible.Default)]
- [EditorSequence(2)]
- public string Description { get; set; }
-
- private class QuoteCostSheetFormLookup : LookupDefinitionGenerator<QuoteForm, QuoteCostSheet>
- {
- public override Filter<QuoteForm> DefineFilter(QuoteCostSheet[] items)
- {
- if (items?.Any() != true)
- return LookupFactory.DefineFilter<QuoteForm>();
- return new Filter<QuoteForm>(x => x.Parent.ID).IsEqualTo(items.First().Quote.ID);
- }
- public override Columns<QuoteCostSheet> DefineFilterColumns()
- => new Columns<QuoteCostSheet>(ColumnTypeFlags.Required);
- }
- [LookupDefinition(typeof(QuoteCostSheetFormLookup))]
- [EditorSequence(3)]
- public QuoteFormLink Form { get; set; }
-
- [EntityRelationship(DeleteAction.SetNull)]
- [EditorSequence(4)]
- public CostSheetLink CostSheet { get; set; }
- [CurrencyEditor(Visible = Visible.Default, Editable = Editable.Hidden, Summary = Summary.Sum)]
- [Aggregate(typeof(QuoteCostSheetExTax))]
- public double ExTax { get; set; }
- [CurrencyEditor(Visible = Visible.Optional, Editable = Editable.Hidden, Summary = Summary.Sum)]
- [Aggregate(typeof(QuoteCostSheetTax))]
- public double Tax { get; set; }
- [CurrencyEditor(Visible = Visible.Optional, Editable = Editable.Hidden, Summary = Summary.Sum)]
- [Aggregate(typeof(QuoteCostSheetIncTax))]
- public double IncTax { get; set; }
-
- }
- }
|