PaymentTermsLookup.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using InABox.Core;
  3. namespace Comal.Classes
  4. {
  5. public abstract class AbstractPaymentTermsLookup<T> : LookupDefinitionGenerator<PaymentTerms, T>
  6. where T : Entity
  7. {
  8. public override Columns<PaymentTerms> DefineColumns()
  9. {
  10. return base.DefineColumns()
  11. .Add(x=>x.Code)
  12. .Add(x=>x.Description);
  13. }
  14. public override string? FormatDisplay(CoreRow row)
  15. => $"{row.Get<PaymentTerms, String>(x => x.Code)}: {row.Get<PaymentTerms, String>(x => x.Description)}";
  16. }
  17. public class AccountsReceivablePaymentTermsLookup<T> : AbstractPaymentTermsLookup<T>
  18. where T : Entity
  19. {
  20. public override Filter<PaymentTerms> DefineFilter(T[] items)
  21. => new Filter<PaymentTerms>(x=>x.Active).IsEqualTo(true).And(x => x.AccountsReceivable).IsEqualTo(true);
  22. }
  23. public class AccountsPayablePaymentTermsLookup<T> : AbstractPaymentTermsLookup<T>
  24. where T : Entity
  25. {
  26. public override Filter<PaymentTerms> DefineFilter(T[] items)
  27. => new Filter<PaymentTerms>(x=>x.Active).IsEqualTo(true).And(x => x.AccountsPayable).IsEqualTo(true);
  28. }
  29. }