diff --git a/src/Controller/ReportController.php b/src/Controller/ReportController.php index 545bdae6..13d63613 100644 --- a/src/Controller/ReportController.php +++ b/src/Controller/ReportController.php @@ -328,18 +328,32 @@ class ReportController extends BaseController { $batt_id = $item->getBattery()->getID(); $vehicle_id = $jo->getCustomerVehicle()->getVehicle()->getID(); - if (isset($comp_matrix[$batt_id][$vehicle_id])) - // if (!isset($comp_matrix[$batt_id][$vehicle_id]) && !$comp_matrix[$batt_id][$vehicle_id]) + if (isset($comp_matrix[$batt_id][$vehicle_id]) && $comp_matrix[$batt_id][$vehicle_id]) { + continue; + } + else + { + // get the compatible batteries for the customer vehicle + $batteries = []; + foreach($jo->getCustomerVehicle()->getVehicle()->getBatteries() as $comp_batt) + { + $batteries[] = [ + 'id' => $comp_batt->getID(), + 'mfg_name' => $comp_batt->getManufacturer()->getName(), + 'model_name' => $comp_batt->getModel()->getName(), + 'size_name' => $comp_batt->getSize()->getName(), + ]; + } $results[] = [ 'jo_id' => $jo->getID(), 'jo_date_create' => $jo->getDateCreate(), 'cus_vehicle_manufacturer' => $jo->getCustomerVehicle()->getVehicle()->getManufacturer()->getName(), 'cus_vehicle_make' => $jo->getCustomerVehicle()->getVehicle()->getMake(), 'cus_vehicle_model' => $jo->getCustomerVehicle()->getModelYear(), - 'battery_model_ordered' => $item->getBattery()->getModel()->getName(), + 'battery_model_ordered' => $item->getBattery()->getModel()->getName(), 'battery_size_ordered' => $item->getBattery()->getSize()->getName(), - 'compatible_batt' => $jo->getCustomerVehicle()->getVehicle()->getBatteries(), + 'compatible_batt' => $batteries, ]; } }