diff --git a/catalyst/api-bundle/Command/TestCommand.php b/catalyst/api-bundle/Command/TestCommand.php index 03d1fe85..3d03ae0d 100644 --- a/catalyst/api-bundle/Command/TestCommand.php +++ b/catalyst/api-bundle/Command/TestCommand.php @@ -75,6 +75,17 @@ class TestCommand extends Command ]; $api->post('/capi/warranties/' . $id . '/claim', $params); + // add battery + $sku = 'WZMB31QT-CPP00-S'; + $brand_id = '4'; + $size_id = '1'; + $params = [ + 'sku' => $sku, + 'brand_id' => $brand_id, + 'size_id' => $size_id, + ]; + $api->post('/capi/batteries', $params); + /* // plate warranty diff --git a/config/acl.yaml b/config/acl.yaml index a1152234..6655e53f 100644 --- a/config/acl.yaml +++ b/config/acl.yaml @@ -248,3 +248,5 @@ access_keys: label: Menu - id: report.reject label: Rejection Report + - id: report.battery.conflict + label: Battery Conflict Report diff --git a/config/routes/warranty_api.yaml b/config/routes/capi.yaml similarity index 94% rename from config/routes/warranty_api.yaml rename to config/routes/capi.yaml index 85075440..a340041c 100644 --- a/config/routes/warranty_api.yaml +++ b/config/routes/capi.yaml @@ -30,6 +30,12 @@ capi_battery_sizes: controller: App\Controller\CAPI\BatteryController::getSizes methods: [GET] +# add battery +capi_battery_add: + path: /capi/batteries + controller: App\Controller\CAPI\BatteryController::addBattery + methods: [POST] + # vehicle api diff --git a/config/routes/report.yaml b/config/routes/report.yaml index 483d7254..c8560798 100644 --- a/config/routes/report.yaml +++ b/config/routes/report.yaml @@ -17,3 +17,13 @@ rep_reject_detail_submit: path: /report/rejection_detail controller: App\Controller\ReportController::rejectDetailSubmit methods: [POST] + +rep_battery_conflict_form: + path: /report/battery_conflict + controller: App\Controller\ReportController::batteryConflictForm + methods: [GET] + +rep_battery_conflict_submit: + path: /report/battery_conflict + controller: App\Controller\ReportController::batteryConflictSubmit + methods: [POST] diff --git a/config/routes/search.yaml b/config/routes/search.yaml index 54bebd51..b21d8562 100644 --- a/config/routes/search.yaml +++ b/config/routes/search.yaml @@ -6,3 +6,7 @@ search_history: path: /search/history controller: App\Controller\SearchController::search methods: [GET] + +search_legacyjo_details: + path: /search/legacyjo/{id}/details + controller: App\Controller\SearchController::legacyJODetails diff --git a/kml/supported_areas.kml b/kml/supported_areas.kml new file mode 100644 index 00000000..aa643fb4 --- /dev/null +++ b/kml/supported_areas.kml @@ -0,0 +1,73 @@ + + + + ResQ Supported Area + + + + + + normal + #poly-000000-1200-77-nodesc-normal + + + highlight + #poly-000000-1200-77-nodesc-highlight + + + + ResQ Supported Area + + Supported Area + #poly-000000-1200-77-nodesc + + + + 1 + + 121.0717128,14.7868868,0 + 121.0222743,14.7895424,0 + 120.9302638,14.6793076,0 + 120.9494899,14.4427135,0 + 121.0250209,14.3735484,0 + 121.0744593,14.5171749,0 + 121.1513636,14.5357864,0 + 121.1884425,14.5809791,0 + 121.2021754,14.6248337,0 + 121.1321376,14.6540653,0 + 121.129391,14.7616569,0 + 121.0717128,14.7868868,0 + + + + + + + + diff --git a/src/Command/ImportLegacyJobOrderCommand.php b/src/Command/ImportLegacyJobOrderCommand.php index 8161fbae..7546880b 100644 --- a/src/Command/ImportLegacyJobOrderCommand.php +++ b/src/Command/ImportLegacyJobOrderCommand.php @@ -10,6 +10,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Doctrine\Common\Persistence\ObjectManager; use App\Entity\Warranty; +use App\Entity\Battery; use App\Entity\BatterySize; use App\Entity\BatteryModel; use App\Entity\VehicleManufacturer; @@ -31,6 +32,7 @@ use DateTime; class ImportLegacyJobOrderCommand extends Command { protected $em; + protected $batt_hash; protected $bmodel_hash; protected $bsize_hash; protected $vmfg_hash; @@ -50,6 +52,7 @@ class ImportLegacyJobOrderCommand extends Command $this->loadBatterySizes(); $this->loadVehicleManufacturers(); $this->loadVehicles(); + $this->loadBatteries(); $this->jo_hash = []; @@ -312,7 +315,7 @@ class ImportLegacyJobOrderCommand extends Command continue; // check if battery is found - $found_battery = $this->findBattery($fields[92], $batt_model, $batt_size); + $found_battery = $this->findBattery($fields[92], $batt_model, $batt_size, $sap_code); if (!$found_battery) { // $output->writeln('battery not found - ' . $fields[92]); @@ -399,7 +402,33 @@ class ImportLegacyJobOrderCommand extends Command $line .= '\N,'; // date claim - $line .= '\N'; + $line .= '\N,'; + + // claim id + $line .= '\N,'; + + // sap battery id + if (isset($sap_code)) + $line .= $sap_code . ','; + else + $line .= '\N,'; + // first name + if (isset($fields[20]) && strlen(trim($fields[20])) > 0) + $line .= $fields[20] . ','; + else + $line .= '\N,'; + + // last name + if (isset($fields[22]) && strlen(trim($fields[22])) > 0) + $line .= $fields[22] . ','; + else + $line .= '\N,'; + + // mobile number + if (isset($fields[24]) && strlen(trim($fields[24])) > 0) + $line .= $fields[24] . ','; + else + $line .= '\N'; fwrite($warr_outfile, $line . "\n"); } @@ -769,6 +798,25 @@ class ImportLegacyJobOrderCommand extends Command } } + protected function loadBatteries() + { + $this->batt_hash = []; + + $batts = $this->em->getRepository(Battery::class)->findAll(); + foreach ($batts as $batt) + { + if (($batt->getModel() == null) or ($batt->getSize() == null) or ($batt->getSAPCode() == null)) + { + continue; + } + + $model_id = $batt->getModel()->getID(); + $size_id = $batt->getSize()->getID(); + + $this->batt_hash[$model_id][$size_id] = $batt->getSAPCode(); + } + } + protected function loadVehicleManufacturers() { $this->vmfg_hash = []; @@ -817,16 +865,16 @@ class ImportLegacyJobOrderCommand extends Command return $clean_text; } - protected function findBattery($batt_field, &$batt_model, &$batt_size) - { - // split battery into model and size - // echo "trying match - " . $fields[92] . "\n"; - $res = preg_match("/^(.+)(GOLD|EXCEL|ENDURO|\(Trade-In\))/", $batt_field, $matches); - if (!$res) - { - // echo "no match - " . $fields[92] . "\n"; + protected function findBattery($batt_field, &$batt_model, &$batt_size, &$sap_code) + { + // split battery into model and size + // echo "trying match - " . $batt_field . "\n"; + $res = preg_match("/^(.+)(GOLD|EXCEL|ENDURO|\(Trade-In\))/", $batt_field, $matches); + if (!$res) + { + //echo "no match - " . $fields[92] . "\n"; return false; - } + } if ($matches[2] == '(Trade-In)') return false; @@ -836,29 +884,35 @@ class ImportLegacyJobOrderCommand extends Command // TODO: what to do about (Trade-In) - // check if we have the size - $found_size = $this->simplifyName($matches[1]); - if (!isset($this->bsize_hash[$found_size])) - { - // try legacy battery lookup - $legacy_size = LegacyBattery::translate($found_size); - if ($legacy_size == null) - { - // echo "no size - $found_size\n"; - if (isset($no_sizes[$found_size])) - $no_sizes[$found_size]++; - else - $no_sizes[$found_size] = 1; - return false; - } + // check if we have the size + $found_size = $this->simplifyName($matches[1]); + if (!isset($this->bsize_hash[$found_size])) + { + // try legacy battery lookup + $legacy_size = LegacyBattery::translate($found_size); + if ($legacy_size == null) + { + // echo "no size - $found_size\n"; + if (isset($no_sizes[$found_size])) + $no_sizes[$found_size]++; + else + $no_sizes[$found_size] = 1; + return false; + } - $found_size = $legacy_size; - } + $found_size = $legacy_size; + } $batt_size = $this->bsize_hash[$found_size]; // $batt_size = $found_size; + //get battery using ids of batt_model and batt_size + if (!isset($this->batt_hash[$batt_model][$batt_size])) + return false; + + $sap_code = $this->batt_hash[$batt_model][$batt_size]; + return true; - } + } protected function findVehicle($vmfg_field, $vmake_field, $vmodel_field, &$vehicle) { diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index a9a23caf..4925cf9b 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -802,8 +802,9 @@ class APIController extends Controller $is_covered = $geo->isCovered($long, $lat); if (!$is_covered) { + // TODO: put geofence error message in config file somewhere $res->setError(true) - ->setErrorMessage('Location is not covered by our service.'); + ->setErrorMessage('Oops! Our service is limited to Metro Manila only. We will update you as soon as we are able to cover your area'); return $res->getReturnResponse(); } diff --git a/src/Controller/BatteryController.php b/src/Controller/BatteryController.php index 317f0f43..48e1dde4 100644 --- a/src/Controller/BatteryController.php +++ b/src/Controller/BatteryController.php @@ -119,6 +119,7 @@ class BatteryController extends BaseController $row['sell_price'] = $orow[0]->getSellingPrice(); $row['warr_private'] = $orow[0]->getWarrantyPrivate(); $row['warr_commercial'] = $orow[0]->getWarrantyCommercial(); + $row['warr_tnv'] = $orow[0]->getWarrantyTnv(); $row['res_capacity'] = $orow[0]->getReserveCapacity(); $row['length'] = $orow[0]->getLength(); $row['width'] = $orow[0]->getWidth(); @@ -181,6 +182,7 @@ class BatteryController extends BaseController ->setSAPCode($req->request->get('sap_code')) ->setWarrantyPrivate($req->request->get('warr_private')) ->setWarrantyCommercial($req->request->get('warr_commercial')) + ->setWarrantyTnv($req->request->get('warr_tnv')) ->setReserveCapacity($req->request->get('res_capacity')) ->setLength($req->request->get('length')) ->setWidth($req->request->get('width')) @@ -303,6 +305,7 @@ class BatteryController extends BaseController ->setSAPCode($req->request->get('sap_code')) ->setWarrantyPrivate($req->request->get('warr_private')) ->setWarrantyCommercial($req->request->get('warr_commercial')) + ->setWarrantyTnv($req->request->get('warr_tnv')) ->setReserveCapacity($req->request->get('res_capacity')) ->setLength($req->request->get('length')) ->setWidth($req->request->get('width')) diff --git a/src/Controller/CAPI/BatteryController.php b/src/Controller/CAPI/BatteryController.php index cff96fb9..02ce3104 100644 --- a/src/Controller/CAPI/BatteryController.php +++ b/src/Controller/CAPI/BatteryController.php @@ -89,4 +89,72 @@ class BatteryController extends APIController return new APIResponse(true, 'Battery sizes loaded.', $data); } + + public function addBattery(Request $req, EntityManagerInterface $em) + { + // required parameters + $params = [ + 'sku', + 'brand_id', + 'size_id', + ]; + + $msg = $this->checkRequiredParameters($req, $params); + error_log('msg - ' . $msg); + if ($msg) + return new APIResponse(false, $msg); + + $sku = $req->request->get('sku'); + $brand_id = $req->request->get('brand_id'); + $size_id = $req->request->get('size_id'); + + // check if sku already exists + $batt = $em->getRepository(SAPBattery::class)->find($sku); + if ($batt != null) + return new APIResponse(false, 'Battery SKU already exists.'); + + // check if brand exists + $batt_brand = $em->getRepository(SAPBatteryBrand::class)->find($brand_id); + if ($batt_brand == null) + return new APIResponse(false, 'Invalid brand.'); + + // check if size exists + $batt_size = $em->getRepository(SAPBatterySize::class)->find($size_id); + if ($batt_size == null) + return new APIResponse(false, 'Invalid size.'); + + + $new_batt = new SAPBattery(); + $new_batt->setID($sku) + ->setBrand($batt_brand) + ->setSize($batt_size); + + try + { + $em->persist($new_batt); + $em->flush(); + } + catch (UniqueConstraintViolationException $e) + { + return new APIResponse(false, 'Battery SKU already exists.'); + } + + // return the new battery data + $data = [ + 'battery' => $this->generateBatteryData($new_batt), + ]; + + return new APIResponse(true, 'Battery added.', $data); + } + + protected function generateBatteryData(SAPBattery $batt) + { + $data = [ + 'sku' => $batt->getID(), + 'brand' => $batt->getBrand()->getID(), + 'size' => $batt->getSize()->getID(), + ]; + + return $data; + } } diff --git a/src/Controller/CAPI/WarrantyController.php b/src/Controller/CAPI/WarrantyController.php index 739cd15f..1c56a837 100644 --- a/src/Controller/CAPI/WarrantyController.php +++ b/src/Controller/CAPI/WarrantyController.php @@ -110,7 +110,7 @@ class WarrantyController extends APIController $query = $qb->select('w') ->from('App\\Entity\\Warranty', 'w') - ->orderBy('w.serial', $order) + ->orderBy('w.date_create', $order) ->setFirstResult($start) ->setMaxResults($max) ->getQuery(); diff --git a/src/Controller/ReportController.php b/src/Controller/ReportController.php index 7d302694..800474d7 100644 --- a/src/Controller/ReportController.php +++ b/src/Controller/ReportController.php @@ -5,8 +5,11 @@ namespace App\Controller; use App\Ramcar\BaseController; use App\Ramcar\JORejectionReason; use App\Ramcar\ServiceType; +use App\Ramcar\JOStatus; use App\Entity\JORejection; +use App\Entity\Battery; +use App\Entity\JobOrder; use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; @@ -260,4 +263,139 @@ class ReportController extends BaseController ]); */ } + + public function batteryConflictForm() + { + $this->denyAccessUnlessGranted('report.battery.conflict', null, 'No access.'); + + $params = $this->initParameters('outlet_list'); + + return $this->render('report/battery/batt_conflict_form.html.twig', $params); + } + + public function batteryConflictSubmit(Request $req) + { + $this->denyAccessUnlessGranted('report.battery.conflict', null, 'No access.'); + + // get job order query builder + $job_qb = $this->getDoctrine() + ->getRepository(JobOrder::class) + ->createQueryBuilder('jo'); + + $em = $this->getDoctrine()->getManager(); + + // get dates + $raw_date_start = $req->request->get('date_start'); + $raw_date_end = $req->request->get('date_end'); + + $date_start = DateTime::createFromFormat('m/d/Y', $raw_date_start); + $date_end = DateTime::createFromFormat('m/d/Y', $raw_date_end); + + // build query for job order + $jo_query = $job_qb->where('jo.date_create >= :start') + ->andWhere('jo.date_create <= :end') + ->andWhere('jo.status != :status') + ->setParameter('start', $date_start->format('Y-m-d') . ' 00:00:00') + ->setParameter('end', $date_end->format('Y-m-d') . ' 23:59:59') + ->setParameter('status', JOStatus::CANCELLED) + ->getQuery(); + + + // run queries + $jos = $jo_query->getResult(); + + $batteries = $em->getRepository(Battery::class)->findAll(); + + // create compatibility matrix for battery and vehicle + $comp_matrix = []; + foreach ($batteries as $batt) + { + $vehicles = $batt->getVehicles(); + foreach ($vehicles as $vehicle) + { + $comp_matrix[$batt->getID()][$vehicle->getID()] = true; + } + } + + // go through the job orders to find the conflicts + $results = []; + foreach ($jos as $jo) + { + $invoice_items = $jo->getInvoice()->getItems(); + foreach ($invoice_items as $item) + { + // check if the item is a battery + if ($item->getBattery() != null) + { + $batt_id = $item->getBattery()->getID(); + $vehicle_id = $jo->getCustomerVehicle()->getVehicle()->getID(); + 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[] = [ + // 'mfg_name' => $comp_batt->getManufacturer()->getName(), + // 'model_name' => $comp_batt->getModel()->getName(), + // 'size_name' => $comp_batt->getSize()->getName(), + //]; + $batteries[] = $comp_batt->getManufacturer()->getName() . ' ' . + $comp_batt->getModel()->getName() . ' ' . + $comp_batt->getSize()->getName(); + } + + $results[] = [ + 'jo_id' => $jo->getID(), + 'jo_date_create' => $jo->getDateCreate()->format('m/d/Y H:i'), + '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_size_ordered' => $item->getBattery()->getSize()->getName(), + 'compatible_batt' => implode(', ', $batteries), + ]; + } + } + } + } + + $resp = new StreamedResponse(); + $resp->setCallback(function() use ($results) { + // csv output + $csv_handle = fopen('php://output', 'w+'); + fputcsv($csv_handle, [ + 'Order #', + 'Order Date and Time', + 'Manufacturer', + 'Make', + 'Year', + 'Battery Model', + 'Battery Size', + 'Compatible Batteries' + ]); + foreach ($results as $row) + { + fputcsv($csv_handle, $row); + } + + fclose($csv_handle); + }); + + $filename = 'battery_conflict_' . $date_start->format('Ymd') . '_' . $date_end->format('Ymd') . '.csv'; + + $resp->setStatusCode(200); + $resp->headers->set('Content-Type', 'text/csv; charset=utf-8'); + $resp->headers->set('Content-Disposition', 'attachment; filename="' . $filename . '"'); + + return $resp; + + //return $this->json([ + // 'result' => $results, + //]); + } } diff --git a/src/Controller/SearchController.php b/src/Controller/SearchController.php index 1e660e16..9632c0fc 100644 --- a/src/Controller/SearchController.php +++ b/src/Controller/SearchController.php @@ -3,8 +3,12 @@ namespace App\Controller; use App\Ramcar\BaseController; + use App\Service\GeneralSearch; +use App\Entity\LegacyJobOrder; +use App\Entity\LegacyJobOrderRow; + use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -46,4 +50,20 @@ class SearchController extends BaseController // response return $this->render('search/form.html.twig', $params); } + + public function legacyJODetails($id) + { + $this->denyAccessUnlessGranted('general.search', null, 'No access.'); + + // get legacy job order + $em = $this->getDoctrine()->getManager(); + $legacy_jo = $em->getRepository(LegacyJobOrder::class)->find($id); + + $params = $this->initParameters('general.search'); + $params['data'] = $legacy_jo; + $params['mode'] = "details"; + + // response + return $this->render('search/legacyjo_details.html.twig', $params); + } } diff --git a/src/Entity/Battery.php b/src/Entity/Battery.php index ed0c99ec..e05bff81 100644 --- a/src/Entity/Battery.php +++ b/src/Entity/Battery.php @@ -85,6 +85,13 @@ class Battery */ protected $warr_commercial; + // warranty tnv + /** + * @ORM\Column(type="smallint") + * @Assert\NotBlank() + */ + protected $warr_tnv; + // reserve capacity /** * @ORM\Column(type="smallint") @@ -248,6 +255,17 @@ class Battery return $this->warr_commercial; } + public function setWarrantyTnv($warr_tnv) + { + $this->warr_tnv = $warr_tnv; + return $this; + } + + public function getWarrantyTnv() + { + return $this->warr_tnv; + } + public function setReserveCapacity($res_capacity) { $this->res_capacity = $res_capacity; diff --git a/src/Entity/LegacyJobOrder.php b/src/Entity/LegacyJobOrder.php index fde4d7ff..e9cbd660 100644 --- a/src/Entity/LegacyJobOrder.php +++ b/src/Entity/LegacyJobOrder.php @@ -343,6 +343,10 @@ class LegacyJobOrder */ protected $plate_number; + /** + * @ORM\OneToMany(targetEntity="LegacyJobOrderRow", mappedBy="job_order") + */ + protected $rows; public function setID($id) @@ -642,15 +646,15 @@ class LegacyJobOrder return $this->dispatch_date; } - public function setDispatchBy($dispatch_by) + public function setDispatchedBy($dispatched_by) { - $this->dispatch_by = $dispatch_by; + $this->dispatched_by = $dispatched_by; return $this; } - public function getDispatchBy() + public function getDispatchedBy() { - return $this->dispatch_by; + return $this->dispatched_by; } public function setAddress($address) @@ -696,4 +700,9 @@ class LegacyJobOrder { return $this->plate_number; } + + public function getRows() + { + return $this->rows; + } } diff --git a/src/Entity/LegacyJobOrderRow.php b/src/Entity/LegacyJobOrderRow.php index 6927afb2..1b52ee6a 100644 --- a/src/Entity/LegacyJobOrderRow.php +++ b/src/Entity/LegacyJobOrderRow.php @@ -19,11 +19,6 @@ class LegacyJobOrderRow */ protected $id; - /** - * @ORM\Column(type="integer") - */ - protected $job_order_id; - /** * @ORM\Column(type="string", length=40) */ @@ -59,6 +54,12 @@ class LegacyJobOrderRow */ protected $enrollee; + /** + * @ORM\ManyToOne(targetEntity="LegacyJobOrder", inversedBy="rows") + * @ORM\JoinColumn(name="job_order_id", referencedColumnName="id", nullable=true) + */ + protected $job_order; + public function setID($id) { $this->id = $id; @@ -69,4 +70,93 @@ class LegacyJobOrderRow { return $this->id; } + + public function setItem($item) + { + $this->item = $item; + return $this; + } + + public function getItem() + { + return $this->item; + } + + public function setQuantity($qty) + { + $this->qty = $qty; + return $this; + } + + public function getQuantity() + { + return $this->qty; + } + + public function setPrice($price) + { + $this->price = $price; + return $this; + } + + public function getPrice() + { + return $this->price; + } + + public function setPriceLevel($price_level) + { + $this->price_level = $price_level; + return $this; + } + + public function getPriceLevel() + { + return $this->price_level; + } + + public function setStatus($status) + { + $this->status = $status; + return $this; + } + + public function getStatus() + { + return $this->status; + } + + public function setAccount($account) + { + $this->account = $account; + return $this; + } + + public function getAccount() + { + return $this->account; + } + + public function setEnrollee($enrollee) + { + $this->enrollee = $enrollee; + return $this; + } + + public function getEnrollee() + { + return $this->enrollee; + } + + public function setJobOrder(LegacyJobOrder $job_order) + { + $this->job_order = $job_order; + return $this; + } + + public function getJobOrder() + { + return $this->job_order; + } + } diff --git a/templates/base.html.twig b/templates/base.html.twig index b6464785..e61acf78 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -128,6 +128,16 @@ + +
+
+
+

Battery Conflict Report

+
+
+
+ +
+ +
+
+
+
+
+
+ + + +

+ Select a date range +

+
+
+
+
+
+
+
+ +
+ +
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+{% endblock %} + +{% block scripts %} + +{% endblock %} diff --git a/templates/search/form.html.twig b/templates/search/form.html.twig index 1b61334d..892ca1ed 100644 --- a/templates/search/form.html.twig +++ b/templates/search/form.html.twig @@ -86,6 +86,7 @@ Last Name First Name Plate Number + @@ -95,6 +96,7 @@ {{ result.getCustLastName|default('') }} {{ result.getCustFirstName|default('') }} {{ result.getPlateNumber|default('') }} + Details {% endfor %} @@ -191,6 +193,10 @@ Last Name First Name Plate Number + Warranty Class + Expiry Date + Serial + Battery @@ -200,6 +206,10 @@ {{ result.getLastName|default("") }} {{ result.getFirstName|default("") }} {{ result.getPlateNumber|default("") }} + {{ result.getWarrantyClass|default("") }} + {{ result.getDateExpire|default("")|date('d M Y') }} + {{ result.getSerial|default("") }} + {{ result.getSAPBattery.getID|default("") }} {% endfor %} diff --git a/templates/search/legacyjo_details.html.twig b/templates/search/legacyjo_details.html.twig new file mode 100644 index 00000000..15b3ea94 --- /dev/null +++ b/templates/search/legacyjo_details.html.twig @@ -0,0 +1,298 @@ +{% extends 'base.html.twig' %} + +{% block body %} + +
+
+
+

Job Order

+
+
+
+ +
+ +
+
+
+
+
+
+ + + +

+ Legacy Job Order +

+
+
+
+ +
+
+
+
+
+

+ Customer Details +

+
+
+
+ + + +
+
+ + + +
+
+
+
+ +
+ +63 + + +
+
+
+ +
+ +63 + + +
+
+
+
+
+ +
+ +63 + + +
+
+
+
+
+
+

+ Vehicle Details +

+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+
+
+ + + +
+
+ + + +
+
+
+
+
+

+ Transaction Details +

+ + + +
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+
+
+ + + +
+
+ +
+ + + + +
+ +
+
+ +
+ + + + +
+ +
+
+
+
+ + + +
+
+
+
+
+ + + +
+
+
+ + +
+
+
+
+ + + +
+
+
+ + + +
+
+
+
+
+ + + +
+
+
+
+ + + +
+
+ + + +
+
+
+
+ {% if data.getRows is empty %} + + {% else %} + + + + + + + + + + + + + + + {% for row in data.getRows %} + + + + + + + + + + + {% endfor %} + +
IDItemQuantityPricePrice LevelStatusAccountEnrollee
{{ row.getID|default("") }}{{ row.getItem|default('') }}{{ row.getQuantity|default('') }}{{ row.getPrice|default('') }}{{ row.getPriceLevel|default('') }}{{ row.getStatus|default('') }}{{ row.getAccount|default('') }}{{ row.getEnrollee|default('') }}
+ {% endif %} +
+
+
+
+
+
+

+ Location +

+
+
+
+ + + +
+
+ + + +
+
+
+
+
+
+
+
+
+{% endblock %} diff --git a/utils/battery_warranty/set_tnv_warranty.sql b/utils/battery_warranty/set_tnv_warranty.sql new file mode 100644 index 00000000..28f67d82 --- /dev/null +++ b/utils/battery_warranty/set_tnv_warranty.sql @@ -0,0 +1,2 @@ +update battery as batt inner join battery_model as bmodel on batt.model_id = bmodel.id set batt.warr_tnv=12 where bmodel.name='GOLD'; + diff --git a/utils/legacy_load/import_legacy_data.sql b/utils/legacy_load/import_legacy_data.sql new file mode 100644 index 00000000..0f12390e --- /dev/null +++ b/utils/legacy_load/import_legacy_data.sql @@ -0,0 +1,4 @@ +load data local infile '/tmp/plate_numbers.csv' into table plate_number fields terminated by ','; +load data infile '/tmp/legacy_jo_row.csv' into table legacy_job_order_row fields terminated by ',' enclosed by '"' lines terminated by '\n' (job_order_id, item, qty, price, price_level, status, account, enrollee) set id = null; +load data local infile '/tmp/warranty.csv' into table warranty fields terminated by ',' (bty_model_id, bty_size_id, serial, warranty_class, plate_number, status, date_create, date_purchase, date_expire, date_claim, claim_id, sap_bty_id, first_name, last_name, mobile_number) set id = null; +load data infile '/tmp/legacy_jo.csv' into table legacy_job_order fields terminated by '|' (id, trans_date, trans_type, origin, car_brand, car_make, car_model, car_color, cust_name, cust_first_name, cust_middle_name, cust_last_name, cust_contact, cust_mobile, cust_landline, delivery_instructions, agent_notes_1, delivery_date, delivery_time, advance_order, stage, cancel_reason, cancel_reason_specify, payment_method, prepared_by, dispatch_time, dispatch_date, dispatched_by, address, landmark, date_purchase, plate_number);