|
@@ -2,6 +2,7 @@
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Linq.Expressions;
|
|
|
+using System.Security;
|
|
|
using InABox.Clients;
|
|
|
using InABox.Core;
|
|
|
|
|
@@ -55,21 +56,6 @@ namespace Comal.Classes
|
|
|
public FormulaType Type => FormulaType.Virtual;
|
|
|
}
|
|
|
|
|
|
- public class JobScopeUninvoicedMaterialExTax : CoreAggregate<JobScope, StockMovement, double>
|
|
|
- {
|
|
|
- public override Expression<Func<StockMovement, double>> Aggregate => x => x.Value;
|
|
|
-
|
|
|
- public override Dictionary<Expression<Func<StockMovement, object?>>, Expression<Func<JobScope, object?>>> Links => new Dictionary<Expression<Func<StockMovement, object?>>, Expression<Func<JobScope, object?>>>()
|
|
|
- {
|
|
|
- { mvt => mvt.JobScope.ID, scope => scope.ID }
|
|
|
- };
|
|
|
-
|
|
|
- public override Filter<StockMovement>? Filter => new Filter<StockMovement>(x => x.Invoice.ID).IsEqualTo(Guid.Empty)
|
|
|
- .And(x => x.Type).IsEqualTo(StockMovementType.Issue);
|
|
|
-
|
|
|
- public override AggregateCalculation Calculation => AggregateCalculation.Sum;
|
|
|
- }
|
|
|
-
|
|
|
public interface IJobScopedItem
|
|
|
{
|
|
|
JobLink JobLink { get; set; }
|
|
@@ -151,8 +137,17 @@ namespace Comal.Classes
|
|
|
[Formula(typeof(JobScopeUninvoicedExTax))]
|
|
|
public double UninvoiceIncTax { get; set; }
|
|
|
|
|
|
+ private class UninvoicedMaterial : ComplexFormulaGenerator<JobScope, double>
|
|
|
+ {
|
|
|
+ public override IComplexFormulaNode<JobScope, double> GetFormula() =>
|
|
|
+ Aggregate<StockMovement>(AggregateCalculation.Sum, x => x.Formula(FormulaOperator.Subtract, x.Constant(0.0), x.Property(x => x.Value)))
|
|
|
+ .WithFilter(
|
|
|
+ new Filter<StockMovement>(x => x.Invoice.ID).IsEqualTo(Guid.Empty)
|
|
|
+ .And(x => x.Type).IsEqualTo(StockMovementType.Issue))
|
|
|
+ .WithLink(x => x.JobScope.ID, x => x.ID);
|
|
|
+ }
|
|
|
[CurrencyEditor(Visible = Visible.Optional, Editable = Editable.Hidden, Summary = Summary.Sum)]
|
|
|
- [Aggregate(typeof(JobScopeUninvoicedMaterialExTax))]
|
|
|
+ [ComplexFormula(typeof(UninvoicedMaterial))]
|
|
|
public double UninvoicedMaterialsExTax { get; set; }
|
|
|
|
|
|
public Expression<Func<JobScope, string>> AutoIncrementField() => x => x.Number;
|