GLCodeLookups.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System.Linq;
  2. using InABox.Core;
  3. namespace Comal.Classes
  4. {
  5. public class GLCodeLookups : EntityLookup<GLCode>, ILookupDefinition<GLCode, BillLine>, ILookupDefinition<GLCode, InvoiceLine>
  6. {
  7. public Filter<GLCode> DefineFilter(BillLine[] items)
  8. {
  9. if (items.Any())
  10. return new Filter<GLCode>(x => x.Hidden).IsEqualTo(false).And(x => x.Expense).IsEqualTo(true);
  11. return null;
  12. }
  13. Columns<BillLine> ILookupDefinition<GLCode, BillLine>.DefineFilterColumns()
  14. => new Columns<BillLine>();
  15. public Filter<GLCode> DefineFilter(InvoiceLine[] items)
  16. {
  17. if (items.Any())
  18. return new Filter<GLCode>(x => x.Hidden).IsEqualTo(false).And(x => x.Income).IsEqualTo(true);
  19. return null;
  20. }
  21. Columns<InvoiceLine> ILookupDefinition<GLCode, InvoiceLine>.DefineFilterColumns()
  22. => new Columns<InvoiceLine>();
  23. public override Columns<GLCode> DefineColumns()
  24. {
  25. return new Columns<GLCode>(
  26. x => x.ID,
  27. x => x.Code,
  28. x => x.Description
  29. );
  30. }
  31. public override Filter<GLCode> DefineFilter()
  32. {
  33. return new Filter<GLCode>(x => x.Hidden).IsEqualTo(false);
  34. }
  35. public override SortOrder<GLCode> DefineSortOrder()
  36. {
  37. return new SortOrder<GLCode>(x => x.Code);
  38. }
  39. }
  40. }