GLCodeLookups.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. public Filter<GLCode> DefineFilter(InvoiceLine[] items)
  14. {
  15. if (items.Any())
  16. return new Filter<GLCode>(x => x.Hidden).IsEqualTo(false).And(x => x.Income).IsEqualTo(true);
  17. return null;
  18. }
  19. public override Columns<GLCode> DefineColumns()
  20. {
  21. return new Columns<GLCode>(
  22. x => x.ID,
  23. x => x.Code,
  24. x => x.Description
  25. );
  26. }
  27. public override Filter<GLCode> DefineFilter()
  28. {
  29. return new Filter<GLCode>(x => x.Hidden).IsEqualTo(false);
  30. }
  31. public override SortOrder<GLCode> DefineSortOrder()
  32. {
  33. return new SortOrder<GLCode>(x => x.Code);
  34. }
  35. }
  36. }