| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- using System;
- using System.Collections.Generic;
- using System.Linq.Expressions;
- using InABox.Core;
- namespace Comal.Classes
- {
- public class PaymentTotal : CoreAggregate<Payment, BillPayment, double>
- {
- public override Expression<Func<BillPayment, double>> Aggregate => x => x.Amount;
- public Expression<Func<BillPayment, Guid>> Link => x => x.Payment.ID;
- public override AggregateCalculation Calculation => AggregateCalculation.Sum;
- public override Dictionary<Expression<Func<BillPayment, object>>, Expression<Func<Payment, object>>> Links =>
- new Dictionary<Expression<Func<BillPayment, object>>, Expression<Func<Payment, object>>>()
- {
- { BillPayment => BillPayment.Payment.ID, Payment => Payment.ID }
- };
- }
- [UserTracking(typeof(Bill))]
- public class Payment : Entity, IPersistent, IRemotable, ILicense<AccountsPayableLicense>
- {
- [DateEditor]
- public DateTime Date { get; set; }
- [EditorSequence(1)]
- public SupplierLink Supplier { get; set; }
- [Obsolete("Replaced by Supplier")]
- public SupplierLink SupplierLink
- {
- get => Supplier;
- set { }
- }
- [EntityRelationship(DeleteAction.SetNull)]
- public PaymentTypeLink PaymentType { get; set; }
- [Obsolete("Replaced by PaymentType")]
- public PaymentTypeLink PaymentTypeLink
- {
- get => PaymentType;
- set { }
- }
- [MemoEditor]
- public string Notes { get; set; }
- [CurrencyEditor(Editable = Editable.Hidden)]
- [Aggregate(typeof(PaymentTotal))]
- public double Total { get; set; }
- public override string ToString()
- {
- return string.Format("{0:dd MMM yy}: {1} (${2:F2})", Date, PaymentType.Description, Total);
- }
- }
- }
|