Create service types for CMB. #270
This commit is contained in:
parent
eb6e311862
commit
c6b31569a6
3 changed files with 49 additions and 49 deletions
16
src/Ramcar/CMBServiceType.php
Normal file
16
src/Ramcar/CMBServiceType.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace App\Ramcar;
|
||||
|
||||
class CMBServiceType extends NameValue
|
||||
{
|
||||
const BATTERY_REPLACEMENT_NEW = 'battery_new';
|
||||
const BATTERY_REPLACEMENT_WARRANTY = 'battery_warranty';
|
||||
const JUMPSTART = 'jumpstart';
|
||||
|
||||
const COLLECTION = [
|
||||
'battery_new' => 'Battery Sales',
|
||||
'battery_warranty' => 'Under Warranty',
|
||||
'jumpstart' => 'Jumpstart',
|
||||
];
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ use App\Ramcar\InvoiceCriteria;
|
|||
use App\Ramcar\InvoiceStatus;
|
||||
use App\Ramcar\CMBTradeInType;
|
||||
use App\Ramcar\DiscountApply;
|
||||
use App\Ramcar\ServiceType;
|
||||
use App\Ramcar\CMBServiceType;
|
||||
use App\Ramcar\FuelType;
|
||||
|
||||
use App\Entity\Invoice;
|
||||
|
|
@ -68,13 +68,13 @@ class CMBInvoiceGenerator implements InvoiceGeneratorInterface
|
|||
$has_coolant = $criteria->hasCoolant();
|
||||
switch ($stype)
|
||||
{
|
||||
case ServiceType::JUMPSTART_TROUBLESHOOT:
|
||||
case CMBServiceType::JUMPSTART:
|
||||
$this->processJumpstart($total, $invoice);
|
||||
break;
|
||||
case ServiceType::JUMPSTART_WARRANTY:
|
||||
$this->processJumpstartWarranty($total, $invoice);
|
||||
//case ServiceType::JUMPSTART_WARRANTY:
|
||||
// $this->processJumpstartWarranty($total, $invoice);
|
||||
|
||||
case ServiceType::BATTERY_REPLACEMENT_NEW:
|
||||
case CMBServiceType::BATTERY_REPLACEMENT_NEW:
|
||||
$this->processEntries($total, $criteria, $invoice);
|
||||
/*
|
||||
$this->processBatteries($total, $criteria, $invoice);
|
||||
|
|
@ -83,27 +83,27 @@ class CMBInvoiceGenerator implements InvoiceGeneratorInterface
|
|||
$this->processDiscount($total, $criteria, $invoice);
|
||||
break;
|
||||
|
||||
case ServiceType::BATTERY_REPLACEMENT_WARRANTY:
|
||||
case CMBServiceType::BATTERY_REPLACEMENT_WARRANTY:
|
||||
$this->processWarranty($total, $criteria, $invoice);
|
||||
break;
|
||||
case ServiceType::POST_RECHARGED:
|
||||
$this->processRecharge($total, $invoice);
|
||||
break;
|
||||
case ServiceType::POST_REPLACEMENT:
|
||||
$this->processReplacement($total, $invoice);
|
||||
break;
|
||||
case ServiceType::TIRE_REPAIR:
|
||||
$this->processTireRepair($total, $invoice, $cv);
|
||||
//case ServiceType::POST_RECHARGED:
|
||||
// $this->processRecharge($total, $invoice);
|
||||
// break;
|
||||
//case ServiceType::POST_REPLACEMENT:
|
||||
// $this->processReplacement($total, $invoice);
|
||||
// break;
|
||||
//case ServiceType::TIRE_REPAIR:
|
||||
// $this->processTireRepair($total, $invoice, $cv);
|
||||
// $this->processOtherServices($total, $invoice, $stype);
|
||||
break;
|
||||
case ServiceType::OVERHEAT_ASSISTANCE:
|
||||
$this->processOverheat($total, $invoice, $cv, $has_coolant);
|
||||
break;
|
||||
case ServiceType::EMERGENCY_REFUEL:
|
||||
error_log('processing refuel');
|
||||
$ftype = $criteria->getCustomerVehicle()->getFuelType();
|
||||
$this->processRefuel($total, $invoice, $cv);
|
||||
break;
|
||||
// break;
|
||||
//case ServiceType::OVERHEAT_ASSISTANCE:
|
||||
// $this->processOverheat($total, $invoice, $cv, $has_coolant);
|
||||
// break;
|
||||
//case ServiceType::EMERGENCY_REFUEL:
|
||||
// error_log('processing refuel');
|
||||
// $ftype = $criteria->getCustomerVehicle()->getFuelType();
|
||||
// $this->processRefuel($total, $invoice, $cv);
|
||||
// break;
|
||||
}
|
||||
|
||||
// TODO: check if any promo is applied
|
||||
|
|
@ -229,7 +229,7 @@ class CMBInvoiceGenerator implements InvoiceGeneratorInterface
|
|||
// return error if there's a problem, false otherwise
|
||||
// check service type
|
||||
$stype = $criteria->getServiceType();
|
||||
if ($stype != ServiceType::BATTERY_REPLACEMENT_NEW)
|
||||
if ($stype != CMBServiceType::BATTERY_REPLACEMENT_NEW)
|
||||
return null;
|
||||
|
||||
|
||||
|
|
@ -252,7 +252,7 @@ class CMBInvoiceGenerator implements InvoiceGeneratorInterface
|
|||
{
|
||||
// check service type
|
||||
$stype = $criteria->getServiceType();
|
||||
if ($stype != ServiceType::BATTERY_REPLACEMENT_NEW && $stype != ServiceType::BATTERY_REPLACEMENT_WARRANTY)
|
||||
if ($stype != CMBServiceType::BATTERY_REPLACEMENT_NEW && $stype != CMBServiceType::BATTERY_REPLACEMENT_WARRANTY)
|
||||
return null;
|
||||
|
||||
// return error if there's a problem, false otherwise
|
||||
|
|
@ -500,7 +500,7 @@ class CMBInvoiceGenerator implements InvoiceGeneratorInterface
|
|||
{
|
||||
$item = new InvoiceItem();
|
||||
$item->setInvoice($invoice)
|
||||
->setTitle('Service - ' . ServiceType::getName($stype))
|
||||
->setTitle('Service - ' . CMBServiceType::getName($stype))
|
||||
->setQuantity(1)
|
||||
->setPrice(self::OTHER_SERVICES_FEE);
|
||||
$invoice->addItem($item);
|
||||
|
|
@ -581,7 +581,7 @@ class CMBInvoiceGenerator implements InvoiceGeneratorInterface
|
|||
|
||||
// service charge
|
||||
$item->setInvoice($invoice)
|
||||
->setTitle('Service - ' . ServiceType::getName(ServiceType::EMERGENCY_REFUEL))
|
||||
->setTitle('Service - ' . CMBServiceType::getName(CMBServiceType::EMERGENCY_REFUEL))
|
||||
->setQuantity(1)
|
||||
->setPrice($fee);
|
||||
$invoice->addItem($item);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ use App\Entity\Rider;
|
|||
use App\Entity\JORejection;
|
||||
|
||||
use App\Ramcar\InvoiceCriteria;
|
||||
use App\Ramcar\ServiceType;
|
||||
use App\Ramcar\CMBServiceType;
|
||||
use App\Ramcar\CMBTradeInType;
|
||||
use App\Ramcar\JOEventType;
|
||||
use App\Ramcar\JOStatus;
|
||||
|
|
@ -145,7 +145,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
|||
$obj_rows = $query_obj->getResult();
|
||||
|
||||
$statuses = JOStatus::getCollection();
|
||||
$service_types = ServiceType::getCollection();
|
||||
$service_types = CMBServiceType::getCollection();
|
||||
|
||||
// process rows
|
||||
$rows = [];
|
||||
|
|
@ -243,7 +243,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
|||
$job_orders = [];
|
||||
|
||||
foreach ($obj_rows as $jo) {
|
||||
$service_type = ServiceType::getName($jo[0]->getServiceType());
|
||||
$service_type = CMBServiceType::getName($jo[0]->getServiceType());
|
||||
|
||||
$job_orders[] = [
|
||||
'id' => $jo[0]->getID(),
|
||||
|
|
@ -1866,7 +1866,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
|||
|
||||
// insert invoice footer details
|
||||
$pdf->Cell($label_width, $line_height, 'Transaction Type:');
|
||||
$pdf->MultiCell($val_width, $line_height, ServiceType::getName($obj->getServiceType()), 0, 'L');
|
||||
$pdf->MultiCell($val_width, $line_height, CMBServiceType::getName($obj->getServiceType()), 0, 'L');
|
||||
|
||||
// get Y after left cell
|
||||
$y1 = $pdf->GetY();
|
||||
|
|
@ -1964,24 +1964,8 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
|||
$fac_hubs[$hub->getID()] = $hub->getName() . ' - ' . $hub->getBranch();
|
||||
}
|
||||
|
||||
// get the first two service types for POC
|
||||
$scount = 1;
|
||||
$selected_stypes = [];
|
||||
$stypes = ServiceType::getCollection();
|
||||
|
||||
foreach ($stypes as $key => $data)
|
||||
{
|
||||
if ($scount < 2)
|
||||
$selected_stypes[$key] = $data;
|
||||
else
|
||||
break;
|
||||
|
||||
$scount++;
|
||||
}
|
||||
|
||||
// name values
|
||||
//$params['service_types'] = ServiceType::getCollection();
|
||||
$params['service_types'] = $selected_stypes;
|
||||
$params['service_types'] = CMBServiceType::getCollection();
|
||||
$params['warranty_classes'] = WarrantyClass::getCollection();
|
||||
$params['modes_of_payment'] = ModeOfPayment::getCollection();
|
||||
$params['statuses'] = JOStatus::getCollection();
|
||||
|
|
@ -2129,7 +2113,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
|||
protected function updateVehicleBattery(JobOrder $jo)
|
||||
{
|
||||
// check if new battery
|
||||
if ($jo->getServiceType() != ServiceType::BATTERY_REPLACEMENT_NEW)
|
||||
if ($jo->getServiceType() != CMBServiceType::BATTERY_REPLACEMENT_NEW)
|
||||
return;
|
||||
|
||||
// customer vehicle
|
||||
|
|
|
|||
Loading…
Reference in a new issue