Resolve "Fix pricing for services" #977
1 changed files with 50 additions and 7 deletions
|
|
@ -268,6 +268,41 @@ class InvoiceCreator
|
||||||
|
|
||||||
$total['total_price'] = 200.00;
|
$total['total_price'] = 200.00;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function processOverheat(&$total, $invoice)
|
||||||
|
{
|
||||||
|
$item = new InvoiceItem();
|
||||||
|
$item->setInvoice($invoice)
|
||||||
|
->setTitle('Service - Overheat Assitance')
|
||||||
|
->setQuantity(1)
|
||||||
|
->setPrice(200.00);
|
||||||
|
$invoice->addItem($item);
|
||||||
|
|
||||||
|
$coolant = new InvoiceItem();
|
||||||
|
$coolant->setInvoice($invoice)
|
||||||
|
->setTitle('4L Coolant')
|
||||||
|
->setQuantity(1)
|
||||||
|
->setPrice(1600);
|
||||||
|
$invoice->addItem($coolant);
|
||||||
|
|
||||||
|
$total['total_price'] = 1800;
|
||||||
|
$total['vat_ex_price'] = 1584;
|
||||||
|
$total['vat'] = 216;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function processTireRepair(&$total, $invoice)
|
||||||
|
{
|
||||||
|
$item = new InvoiceItem();
|
||||||
|
$item->setInvoice($invoice)
|
||||||
|
->setTitle('Service - Flat Tire')
|
||||||
|
->setQuantity(1)
|
||||||
|
->setPrice(200.00);
|
||||||
|
$invoice->addItem($item);
|
||||||
|
|
||||||
|
$total['total_price'] = 200;
|
||||||
|
$total['vat_ex_price'] = 176;
|
||||||
|
$total['vat'] = 24;
|
||||||
|
}
|
||||||
|
|
||||||
public function processRefuel(&$total, $invoice, $ftype)
|
public function processRefuel(&$total, $invoice, $ftype)
|
||||||
{
|
{
|
||||||
|
|
@ -282,23 +317,28 @@ class InvoiceCreator
|
||||||
$total['total_price'] = 200.00;
|
$total['total_price'] = 200.00;
|
||||||
|
|
||||||
$fuel = new InvoiceItem();
|
$fuel = new InvoiceItem();
|
||||||
|
$sfee = new InvoiceItem();
|
||||||
error_log('fuel type - ' . $ftype);
|
error_log('fuel type - ' . $ftype);
|
||||||
switch ($ftype)
|
switch ($ftype)
|
||||||
{
|
{
|
||||||
case FuelType::GAS:
|
case FuelType::GAS:
|
||||||
$fuel->setInvoice($invoice)
|
$fuel->setInvoice($invoice)
|
||||||
->setTitle('Fuel - Gas')
|
->setTitle('4L Fuel - Gas')
|
||||||
->setQuantity(1)
|
->setQuantity(1)
|
||||||
->setPrice(200);
|
->setPrice(240);
|
||||||
$invoice->addItem($fuel);
|
$invoice->addItem($fuel);
|
||||||
$total['total_price'] += 200.00;
|
$total['total_price'] += 240.00;
|
||||||
|
$total['vat'] = 52.80;
|
||||||
|
$total['vat_ex_price'] = 387.20;
|
||||||
break;
|
break;
|
||||||
case FuelType::DIESEL:
|
case FuelType::DIESEL:
|
||||||
$fuel->setInvoice($invoice)
|
$fuel->setInvoice($invoice)
|
||||||
->setTitle('Fuel - Diesel')
|
->setTitle('4L Fuel - Diesel')
|
||||||
->setQuantity(1)
|
->setQuantity(1)
|
||||||
->setPrice(150);
|
->setPrice(200);
|
||||||
$total['total_price'] += 150.00;
|
$total['total_price'] += 200.00;
|
||||||
|
$total['vat'] = 48.00;
|
||||||
|
$total['vat_ex_price'] = 352.00;
|
||||||
$invoice->addItem($fuel);
|
$invoice->addItem($fuel);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -355,8 +395,11 @@ class InvoiceCreator
|
||||||
$this->processReplacement($total, $invoice);
|
$this->processReplacement($total, $invoice);
|
||||||
break;
|
break;
|
||||||
case ServiceType::TIRE_REPAIR:
|
case ServiceType::TIRE_REPAIR:
|
||||||
|
$this->processTireRepair($total, $invoice);
|
||||||
|
// $this->processOtherServices($total, $invoice, $stype);
|
||||||
|
break;
|
||||||
case ServiceType::OVERHEAT_ASSISTANCE:
|
case ServiceType::OVERHEAT_ASSISTANCE:
|
||||||
$this->processOtherServices($total, $invoice, $stype);
|
$this->processOverheat($total, $invoice);
|
||||||
break;
|
break;
|
||||||
case ServiceType::EMERGENCY_REFUEL:
|
case ServiceType::EMERGENCY_REFUEL:
|
||||||
error_log('processing refuel');
|
error_log('processing refuel');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue