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\InvoiceStatus;
|
||||||
use App\Ramcar\CMBTradeInType;
|
use App\Ramcar\CMBTradeInType;
|
||||||
use App\Ramcar\DiscountApply;
|
use App\Ramcar\DiscountApply;
|
||||||
use App\Ramcar\ServiceType;
|
use App\Ramcar\CMBServiceType;
|
||||||
use App\Ramcar\FuelType;
|
use App\Ramcar\FuelType;
|
||||||
|
|
||||||
use App\Entity\Invoice;
|
use App\Entity\Invoice;
|
||||||
|
|
@ -68,13 +68,13 @@ class CMBInvoiceGenerator implements InvoiceGeneratorInterface
|
||||||
$has_coolant = $criteria->hasCoolant();
|
$has_coolant = $criteria->hasCoolant();
|
||||||
switch ($stype)
|
switch ($stype)
|
||||||
{
|
{
|
||||||
case ServiceType::JUMPSTART_TROUBLESHOOT:
|
case CMBServiceType::JUMPSTART:
|
||||||
$this->processJumpstart($total, $invoice);
|
$this->processJumpstart($total, $invoice);
|
||||||
break;
|
break;
|
||||||
case ServiceType::JUMPSTART_WARRANTY:
|
//case ServiceType::JUMPSTART_WARRANTY:
|
||||||
$this->processJumpstartWarranty($total, $invoice);
|
// $this->processJumpstartWarranty($total, $invoice);
|
||||||
|
|
||||||
case ServiceType::BATTERY_REPLACEMENT_NEW:
|
case CMBServiceType::BATTERY_REPLACEMENT_NEW:
|
||||||
$this->processEntries($total, $criteria, $invoice);
|
$this->processEntries($total, $criteria, $invoice);
|
||||||
/*
|
/*
|
||||||
$this->processBatteries($total, $criteria, $invoice);
|
$this->processBatteries($total, $criteria, $invoice);
|
||||||
|
|
@ -83,27 +83,27 @@ class CMBInvoiceGenerator implements InvoiceGeneratorInterface
|
||||||
$this->processDiscount($total, $criteria, $invoice);
|
$this->processDiscount($total, $criteria, $invoice);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ServiceType::BATTERY_REPLACEMENT_WARRANTY:
|
case CMBServiceType::BATTERY_REPLACEMENT_WARRANTY:
|
||||||
$this->processWarranty($total, $criteria, $invoice);
|
$this->processWarranty($total, $criteria, $invoice);
|
||||||
break;
|
break;
|
||||||
case ServiceType::POST_RECHARGED:
|
//case ServiceType::POST_RECHARGED:
|
||||||
$this->processRecharge($total, $invoice);
|
// $this->processRecharge($total, $invoice);
|
||||||
break;
|
// break;
|
||||||
case ServiceType::POST_REPLACEMENT:
|
//case ServiceType::POST_REPLACEMENT:
|
||||||
$this->processReplacement($total, $invoice);
|
// $this->processReplacement($total, $invoice);
|
||||||
break;
|
// break;
|
||||||
case ServiceType::TIRE_REPAIR:
|
//case ServiceType::TIRE_REPAIR:
|
||||||
$this->processTireRepair($total, $invoice, $cv);
|
// $this->processTireRepair($total, $invoice, $cv);
|
||||||
// $this->processOtherServices($total, $invoice, $stype);
|
// $this->processOtherServices($total, $invoice, $stype);
|
||||||
break;
|
// break;
|
||||||
case ServiceType::OVERHEAT_ASSISTANCE:
|
//case ServiceType::OVERHEAT_ASSISTANCE:
|
||||||
$this->processOverheat($total, $invoice, $cv, $has_coolant);
|
// $this->processOverheat($total, $invoice, $cv, $has_coolant);
|
||||||
break;
|
// break;
|
||||||
case ServiceType::EMERGENCY_REFUEL:
|
//case ServiceType::EMERGENCY_REFUEL:
|
||||||
error_log('processing refuel');
|
// error_log('processing refuel');
|
||||||
$ftype = $criteria->getCustomerVehicle()->getFuelType();
|
// $ftype = $criteria->getCustomerVehicle()->getFuelType();
|
||||||
$this->processRefuel($total, $invoice, $cv);
|
// $this->processRefuel($total, $invoice, $cv);
|
||||||
break;
|
// break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: check if any promo is applied
|
// TODO: check if any promo is applied
|
||||||
|
|
@ -229,7 +229,7 @@ class CMBInvoiceGenerator implements InvoiceGeneratorInterface
|
||||||
// return error if there's a problem, false otherwise
|
// return error if there's a problem, false otherwise
|
||||||
// check service type
|
// check service type
|
||||||
$stype = $criteria->getServiceType();
|
$stype = $criteria->getServiceType();
|
||||||
if ($stype != ServiceType::BATTERY_REPLACEMENT_NEW)
|
if ($stype != CMBServiceType::BATTERY_REPLACEMENT_NEW)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -252,7 +252,7 @@ class CMBInvoiceGenerator implements InvoiceGeneratorInterface
|
||||||
{
|
{
|
||||||
// check service type
|
// check service type
|
||||||
$stype = $criteria->getServiceType();
|
$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 null;
|
||||||
|
|
||||||
// return error if there's a problem, false otherwise
|
// return error if there's a problem, false otherwise
|
||||||
|
|
@ -500,7 +500,7 @@ class CMBInvoiceGenerator implements InvoiceGeneratorInterface
|
||||||
{
|
{
|
||||||
$item = new InvoiceItem();
|
$item = new InvoiceItem();
|
||||||
$item->setInvoice($invoice)
|
$item->setInvoice($invoice)
|
||||||
->setTitle('Service - ' . ServiceType::getName($stype))
|
->setTitle('Service - ' . CMBServiceType::getName($stype))
|
||||||
->setQuantity(1)
|
->setQuantity(1)
|
||||||
->setPrice(self::OTHER_SERVICES_FEE);
|
->setPrice(self::OTHER_SERVICES_FEE);
|
||||||
$invoice->addItem($item);
|
$invoice->addItem($item);
|
||||||
|
|
@ -581,7 +581,7 @@ class CMBInvoiceGenerator implements InvoiceGeneratorInterface
|
||||||
|
|
||||||
// service charge
|
// service charge
|
||||||
$item->setInvoice($invoice)
|
$item->setInvoice($invoice)
|
||||||
->setTitle('Service - ' . ServiceType::getName(ServiceType::EMERGENCY_REFUEL))
|
->setTitle('Service - ' . CMBServiceType::getName(CMBServiceType::EMERGENCY_REFUEL))
|
||||||
->setQuantity(1)
|
->setQuantity(1)
|
||||||
->setPrice($fee);
|
->setPrice($fee);
|
||||||
$invoice->addItem($item);
|
$invoice->addItem($item);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ use App\Entity\Rider;
|
||||||
use App\Entity\JORejection;
|
use App\Entity\JORejection;
|
||||||
|
|
||||||
use App\Ramcar\InvoiceCriteria;
|
use App\Ramcar\InvoiceCriteria;
|
||||||
use App\Ramcar\ServiceType;
|
use App\Ramcar\CMBServiceType;
|
||||||
use App\Ramcar\CMBTradeInType;
|
use App\Ramcar\CMBTradeInType;
|
||||||
use App\Ramcar\JOEventType;
|
use App\Ramcar\JOEventType;
|
||||||
use App\Ramcar\JOStatus;
|
use App\Ramcar\JOStatus;
|
||||||
|
|
@ -145,7 +145,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$obj_rows = $query_obj->getResult();
|
$obj_rows = $query_obj->getResult();
|
||||||
|
|
||||||
$statuses = JOStatus::getCollection();
|
$statuses = JOStatus::getCollection();
|
||||||
$service_types = ServiceType::getCollection();
|
$service_types = CMBServiceType::getCollection();
|
||||||
|
|
||||||
// process rows
|
// process rows
|
||||||
$rows = [];
|
$rows = [];
|
||||||
|
|
@ -243,7 +243,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$job_orders = [];
|
$job_orders = [];
|
||||||
|
|
||||||
foreach ($obj_rows as $jo) {
|
foreach ($obj_rows as $jo) {
|
||||||
$service_type = ServiceType::getName($jo[0]->getServiceType());
|
$service_type = CMBServiceType::getName($jo[0]->getServiceType());
|
||||||
|
|
||||||
$job_orders[] = [
|
$job_orders[] = [
|
||||||
'id' => $jo[0]->getID(),
|
'id' => $jo[0]->getID(),
|
||||||
|
|
@ -1866,7 +1866,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
||||||
|
|
||||||
// insert invoice footer details
|
// insert invoice footer details
|
||||||
$pdf->Cell($label_width, $line_height, 'Transaction Type:');
|
$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
|
// get Y after left cell
|
||||||
$y1 = $pdf->GetY();
|
$y1 = $pdf->GetY();
|
||||||
|
|
@ -1964,24 +1964,8 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$fac_hubs[$hub->getID()] = $hub->getName() . ' - ' . $hub->getBranch();
|
$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
|
// name values
|
||||||
//$params['service_types'] = ServiceType::getCollection();
|
$params['service_types'] = CMBServiceType::getCollection();
|
||||||
$params['service_types'] = $selected_stypes;
|
|
||||||
$params['warranty_classes'] = WarrantyClass::getCollection();
|
$params['warranty_classes'] = WarrantyClass::getCollection();
|
||||||
$params['modes_of_payment'] = ModeOfPayment::getCollection();
|
$params['modes_of_payment'] = ModeOfPayment::getCollection();
|
||||||
$params['statuses'] = JOStatus::getCollection();
|
$params['statuses'] = JOStatus::getCollection();
|
||||||
|
|
@ -2129,7 +2113,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
||||||
protected function updateVehicleBattery(JobOrder $jo)
|
protected function updateVehicleBattery(JobOrder $jo)
|
||||||
{
|
{
|
||||||
// check if new battery
|
// check if new battery
|
||||||
if ($jo->getServiceType() != ServiceType::BATTERY_REPLACEMENT_NEW)
|
if ($jo->getServiceType() != CMBServiceType::BATTERY_REPLACEMENT_NEW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// customer vehicle
|
// customer vehicle
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue