using System; using InABox.Core; namespace Comal.Classes { public abstract class AbstractPaymentTermsLookup : LookupDefinitionGenerator where T : Entity { public override Columns DefineColumns() { return base.DefineColumns() .Add(x=>x.Code) .Add(x=>x.Description); } public override string? FormatDisplay(CoreRow row) => $"{row.Get(x => x.Code)}: {row.Get(x => x.Description)}"; } public class AccountsReceivablePaymentTermsLookup : AbstractPaymentTermsLookup where T : Entity { public override Filter DefineFilter(T[] items) => new Filter(x=>x.Active).IsEqualTo(true).And(x => x.AccountsReceivable).IsEqualTo(true); } public class AccountsPayablePaymentTermsLookup : AbstractPaymentTermsLookup where T : Entity { public override Filter DefineFilter(T[] items) => new Filter(x=>x.Active).IsEqualTo(true).And(x => x.AccountsPayable).IsEqualTo(true); } }