|
@@ -7,34 +7,6 @@ using PRSClasses;
|
|
|
|
|
|
namespace Comal.Classes
|
|
|
{
|
|
|
- public class PurchaseOrderItemFormCount : CoreAggregate<PurchaseOrderItem, PurchaseOrderItemForm, Guid>
|
|
|
- {
|
|
|
- public override Expression<Func<PurchaseOrderItemForm, Guid>> Aggregate => x => x.ID;
|
|
|
-
|
|
|
- public override AggregateCalculation Calculation => AggregateCalculation.Count;
|
|
|
-
|
|
|
- public override Dictionary<Expression<Func<PurchaseOrderItemForm, object>>, Expression<Func<PurchaseOrderItem, object>>> Links =>
|
|
|
- new Dictionary<Expression<Func<PurchaseOrderItemForm, object>>, Expression<Func<PurchaseOrderItem, object>>>()
|
|
|
- {
|
|
|
- { PurchaseOrderItemForm => PurchaseOrderItemForm.Parent.ID, PurchaseOrderItem => PurchaseOrderItem.ID }
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- public class PurchaseOrderItemOpenForms : CoreAggregate<PurchaseOrderItem, PurchaseOrderItemForm, Guid>
|
|
|
- {
|
|
|
- public override Expression<Func<PurchaseOrderItemForm, Guid>> Aggregate => x => x.ID;
|
|
|
-
|
|
|
- public override AggregateCalculation Calculation => AggregateCalculation.Count;
|
|
|
-
|
|
|
- public override Dictionary<Expression<Func<PurchaseOrderItemForm, object>>, Expression<Func<PurchaseOrderItem, object>>> Links =>
|
|
|
- new Dictionary<Expression<Func<PurchaseOrderItemForm, object>>, Expression<Func<PurchaseOrderItem, object>>>()
|
|
|
- {
|
|
|
- { PurchaseOrderItemForm => PurchaseOrderItemForm.Parent.ID, PurchaseOrderItem => PurchaseOrderItem.ID }
|
|
|
- };
|
|
|
-
|
|
|
- public override Filter<PurchaseOrderItemForm> Filter => new Filter<PurchaseOrderItemForm>(x => x.FormCompleted).IsEqualTo(DateTime.MinValue)
|
|
|
- .Or(x => x.FormData).IsEqualTo("");
|
|
|
- }
|
|
|
|
|
|
[UserTracking(typeof(Bill))]
|
|
|
[Caption("Purchase Order Items")]
|
|
@@ -186,12 +158,28 @@ namespace Comal.Classes
|
|
|
[EntityRelationship(DeleteAction.SetNull)]
|
|
|
public ManufacturingPacketLink Packet { get; set; }
|
|
|
|
|
|
+ private class FormCountAggregate : ComplexFormulaGenerator<PurchaseOrderItem, int>
|
|
|
+ {
|
|
|
+ public override IComplexFormulaNode<PurchaseOrderItem, int> GetFormula() =>
|
|
|
+ Count<PurchaseOrderItemForm, Guid>(
|
|
|
+ x => x.Property(x => x.ID))
|
|
|
+ .WithLink(x => x.Parent.ID, x => x.ID);
|
|
|
+ }
|
|
|
[NullEditor]
|
|
|
- [Aggregate(typeof(PurchaseOrderItemFormCount))]
|
|
|
+ [ComplexFormula(typeof(FormCountAggregate))]
|
|
|
public int FormCount { get; set; }
|
|
|
|
|
|
+ private class OpenFormsAggregate : ComplexFormulaGenerator<PurchaseOrderItem, int>
|
|
|
+ {
|
|
|
+ public override IComplexFormulaNode<PurchaseOrderItem, int> GetFormula() =>
|
|
|
+ Count<PurchaseOrderItemForm, Guid>(
|
|
|
+ x => x.Property(x => x.ID),
|
|
|
+ new Filter<PurchaseOrderItemForm>(x => x.FormCompleted).IsEqualTo(DateTime.MinValue)
|
|
|
+ .Or(x => x.FormData).IsEqualTo(""))
|
|
|
+ .WithLink(x => x.Parent.ID, x => x.ID);
|
|
|
+ }
|
|
|
[NullEditor]
|
|
|
- [Aggregate(typeof(PurchaseOrderItemOpenForms))]
|
|
|
+ [ComplexFormula(typeof(OpenFormsAggregate))]
|
|
|
public int OpenForms { get; set; }
|
|
|
|
|
|
[ChildEntity(typeof(PurchaseOrderItemAllocationNominatedJob))]
|