From 397f3d144ac2e20395150d859962ecb08d3d0554 Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Fri, 27 Jul 2018 00:24:10 +0800 Subject: [PATCH 1/2] Update prices for refuel and overheat services #161 --- src/Service/InvoiceCreator.php | 42 ++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/src/Service/InvoiceCreator.php b/src/Service/InvoiceCreator.php index bd44f76e..837f2db8 100644 --- a/src/Service/InvoiceCreator.php +++ b/src/Service/InvoiceCreator.php @@ -268,6 +268,27 @@ class InvoiceCreator $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 processRefuel(&$total, $invoice, $ftype) { @@ -282,23 +303,28 @@ class InvoiceCreator $total['total_price'] = 200.00; $fuel = new InvoiceItem(); + $sfee = new InvoiceItem(); error_log('fuel type - ' . $ftype); switch ($ftype) { case FuelType::GAS: $fuel->setInvoice($invoice) - ->setTitle('Fuel - Gas') + ->setTitle('4L Fuel - Gas') ->setQuantity(1) - ->setPrice(200); + ->setPrice(240); $invoice->addItem($fuel); - $total['total_price'] += 200.00; + $total['total_price'] += 240.00; + $total['vat'] = 52.80; + $total['vat_ex_price'] = 387.20; break; case FuelType::DIESEL: $fuel->setInvoice($invoice) - ->setTitle('Fuel - Diesel') + ->setTitle('4L Fuel - Diesel') ->setQuantity(1) - ->setPrice(150); - $total['total_price'] += 150.00; + ->setPrice(200); + $total['total_price'] += 200.00; + $total['vat'] = 48.00; + $total['vat_ex_price'] = 352.00; $invoice->addItem($fuel); break; default: @@ -355,9 +381,11 @@ class InvoiceCreator $this->processReplacement($total, $invoice); break; case ServiceType::TIRE_REPAIR: - case ServiceType::OVERHEAT_ASSISTANCE: $this->processOtherServices($total, $invoice, $stype); break; + case ServiceType::OVERHEAT_ASSISTANCE: + $this->processOverheat($total, $invoice); + break; case ServiceType::EMERGENCY_REFUEL: error_log('processing refuel'); $ftype = $criteria->getCustomerVehicle()->getFuelType(); From 2fe3448e8fc97a7a3bedebc1643074a01deac445 Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Fri, 27 Jul 2018 00:43:02 +0800 Subject: [PATCH 2/2] Change pricing for tire repair service #161 --- src/Service/InvoiceCreator.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Service/InvoiceCreator.php b/src/Service/InvoiceCreator.php index 837f2db8..589141bb 100644 --- a/src/Service/InvoiceCreator.php +++ b/src/Service/InvoiceCreator.php @@ -290,6 +290,20 @@ class InvoiceCreator $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) { $item = new InvoiceItem(); @@ -381,7 +395,8 @@ class InvoiceCreator $this->processReplacement($total, $invoice); break; case ServiceType::TIRE_REPAIR: - $this->processOtherServices($total, $invoice, $stype); + $this->processTireRepair($total, $invoice); + // $this->processOtherServices($total, $invoice, $stype); break; case ServiceType::OVERHEAT_ASSISTANCE: $this->processOverheat($total, $invoice);