public static IEnumerable DriverRecordsDelegate(PXGraph graph, SharedClasses.RouteSelected_view routeSelected, PXFilter <DriverSelectionFilter> filter) { if (routeSelected.Current == null) { yield break; } List <object> args = new List <object>(); PXSelectBase <EPEmployee> commandFilter = new PXSelectJoinGroupBy <EPEmployee, InnerJoin <FSRouteEmployee, On < FSRouteEmployee.employeeID, Equal <EPEmployee.bAccountID> >, LeftJoin <FSRouteDocument, On < FSRouteDocument.driverID, Equal <FSRouteEmployee.employeeID>, And < FSRouteDocument.date, Equal <Required <FSRouteDocument.date> > > > > >, Where < FSRouteEmployee.routeID, Equal <Required <FSRouteEmployee.routeID> >, And < FSxEPEmployee.sDEnabled, Equal <True>, And < FSxEPEmployee.isDriver, Equal <True> > > >, Aggregate < GroupBy < EPEmployee.bAccountID> >, OrderBy < Asc <FSRouteEmployee.priorityPreference> > >(graph); args.Add(routeSelected.Current.Date); args.Add(routeSelected.Current.RouteID); if (filter.Current.ShowUnassignedDrivers == true) { commandFilter.WhereAnd <Where <FSRouteDocument.routeID, IsNull> >(); } var bqlResultSet = commandFilter.Select(args.ToArray()); foreach (PXResult <EPEmployee, FSRouteEmployee, FSRouteDocument> bqlResult in bqlResultSet) { EPEmployee epEmployeeRow = (EPEmployee)bqlResult; FSRouteEmployee fsRouteEmployeeRow = (FSRouteEmployee)bqlResult; FSRouteDocument fsRouteDocumentRow = (FSRouteDocument)bqlResult; FSxEPEmployee fsxEPEmployeeRow = PXCache <EPEmployee> .GetExtension <FSxEPEmployee>(epEmployeeRow); if (fsRouteDocumentRow != null && fsRouteDocumentRow.RouteID != null) { fsxEPEmployeeRow.Mem_UnassignedDriver = true; } yield return(bqlResult); } }
public static IEnumerable VehicleRecordsDelegate(PXGraph graph, SharedClasses.RouteSelected_view routeSelected, PXFilter <VehicleSelectionFilter> filter) { if (routeSelected.Current == null) { yield break; } List <object> args = new List <object>(); PXSelectBase <FSVehicle> commandFilter = new PXSelectJoinGroupBy <FSVehicle, LeftJoin <FSRouteDocument, On < FSRouteDocument.vehicleID, Equal <FSVehicle.SMequipmentID>, And <FSRouteDocument.date, Equal <Required <FSRouteDocument.date> > > > >, Where < FSVehicle.isVehicle, Equal <True> >, Aggregate < GroupBy < FSVehicle.SMequipmentID> >, OrderBy < Asc <FSServiceVehicleType.priorityPreference> > >(graph); args.Add(routeSelected.Current.Date); if (filter.Current.ShowUnassignedVehicles == true) { commandFilter.WhereAnd <Where <FSRouteDocument.routeID, IsNull> >(); } var list = commandFilter.Select(args.ToArray()); foreach (PXResult <FSVehicle, FSRouteDocument> bqlResult in list) { FSVehicle fsEquipmentRow = (FSVehicle)bqlResult; FSRouteDocument fsRouteDocumentRow = (FSRouteDocument)bqlResult; if (fsRouteDocumentRow != null && fsRouteDocumentRow.RouteID != null) { fsEquipmentRow.Mem_UnassignedVehicle = true; } yield return(bqlResult); } }