Add processing of battery entries and invoice item titles. #782
This commit is contained in:
parent
70ee7fdd89
commit
29ad8d57a4
1 changed files with 70 additions and 7 deletions
|
|
@ -38,11 +38,18 @@ class PriceTier implements InvoiceRuleInterface
|
|||
// price tier is default
|
||||
if ($pt == null)
|
||||
{
|
||||
// check if service type is battery sales
|
||||
if ($service_type == ServiceType::BATTERY_REPLACEMENT_NEW)
|
||||
// check if service type is battery sales and battery warranty (sometimes they add a battery
|
||||
// for battery warranty
|
||||
if (($service_type == ServiceType::BATTERY_REPLACEMENT_NEW) ||
|
||||
($service_type == ServiceType::BATTERY_REPLACEMENT_WARRANTY))
|
||||
{
|
||||
$items = $this->processBatteryEntries($criteria, $total);
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: process the service fees
|
||||
$items = $this->processServiceEntries($criteria, $total);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -54,6 +61,8 @@ class PriceTier implements InvoiceRuleInterface
|
|||
// make item price hash
|
||||
$pt_prices[$pt_item->getItemID()] = $pt_item->getPrice();
|
||||
}
|
||||
|
||||
// TODO: finish this
|
||||
}
|
||||
|
||||
return $items;
|
||||
|
|
@ -123,14 +132,17 @@ class PriceTier implements InvoiceRuleInterface
|
|||
|
||||
if ($trade_in == null)
|
||||
{
|
||||
// battery purchase
|
||||
// check if battery purchase or battery replacement
|
||||
if ($service_type == ServiceType::BATTERY_REPLACEMENT_NEW)
|
||||
$price = $batt->getSellingPrice();
|
||||
else
|
||||
$price = 0;
|
||||
|
||||
$items[] = [
|
||||
'service_type' => $this->getID(),
|
||||
'battery' => $batt,
|
||||
'qty' => $qty,
|
||||
'title' => $this->getTitle($criteria->getServiceType(), $batt),
|
||||
'title' => $this->getItemTitle($criteria->getServiceType(), $batt),
|
||||
'price' => $price,
|
||||
];
|
||||
|
||||
|
|
@ -144,12 +156,63 @@ class PriceTier implements InvoiceRuleInterface
|
|||
return $items;
|
||||
}
|
||||
|
||||
protected function getTitle($service_type, $battery)
|
||||
protected function processServiceEntries($criteria, &$total)
|
||||
{
|
||||
}
|
||||
|
||||
protected function getItemTitle($service_type, $battery)
|
||||
{
|
||||
$title ='';
|
||||
|
||||
// TODO: check for service type
|
||||
switch ($service_type) {
|
||||
case (ServiceType::BATTERY_REPLACEMENT_NEW):
|
||||
$title = $battery->getModel()->getName() . ' ' . $battery->getSize()->getName();
|
||||
break;
|
||||
case (ServiceType::BATTERY_REPLACEMENT_WARRANTY):
|
||||
$title = $battery->getModel()->getName() . ' ' . $battery->getSize()->getName() . ' - Service Unit';
|
||||
break;
|
||||
default:
|
||||
$title = '';
|
||||
break;
|
||||
}
|
||||
|
||||
return $title;
|
||||
|
||||
protected function getServiceTitle($service_type, $fuel_type)
|
||||
{
|
||||
$title = '';
|
||||
|
||||
switch ($service_type) {
|
||||
case (ServiceType::JUMPSTART_TROUBLESHOOT):
|
||||
case (ServiceType::JUMPSTART_WARRANTY):
|
||||
$title = 'Service - Troubleshooting fee';
|
||||
break;
|
||||
case (ServiceType::OVERHEAT_ASSISTANCE):
|
||||
$title = 'Service - ' . ServiceType::getName(ServiceType::OVERHEAT_ASSISTANCE);
|
||||
break;
|
||||
case (ServiceType::POST_RECHARGED):
|
||||
$title = 'Recharge fee';
|
||||
break;
|
||||
case (ServiceType::POST_REPLACEMENT):
|
||||
$title = 'Battery replacement';
|
||||
break;
|
||||
case (ServiceType::TIRE_REPAIR):
|
||||
$title = 'Service - Flat Tire';
|
||||
break;
|
||||
case (ServiceType::EMERGENCY_REFUEL):
|
||||
$title = '4L - ' . ucfirst($fuel_type);
|
||||
break;
|
||||
default:
|
||||
$title = '';
|
||||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
|
||||
protected function getServiceCoolantTitle()
|
||||
{
|
||||
$title = '4L Coolant';
|
||||
|
||||
return $title;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue