Add general service - under warranty service type #88

This commit is contained in:
Kendrick Chan 2018-04-09 22:30:00 +08:00
parent 32a6c979d8
commit 5b5fbd7555
3 changed files with 15 additions and 1 deletions

View file

@ -7,6 +7,7 @@ class ServiceType extends NameValue
const BATTERY_REPLACEMENT_NEW = 'battery_new';
const BATTERY_REPLACEMENT_WARRANTY = 'battery_warranty';
const JUMPSTART_TROUBLESHOOT = 'jumpstart_troubleshoot';
const JUMPSTART_WARRANTY = 'jumpstart_warranty';
const POST_RECHARGED = 'post_recharged';
const POST_REPLACEMENT = 'post_replacement';
const TIRE_REPAIR = 'tire';
@ -17,6 +18,7 @@ class ServiceType extends NameValue
'battery_new' => 'Battery Sales',
'battery_warranty' => 'Under Warranty',
'jumpstart_troubleshoot' => 'General Service',
'jumpstart_warranty' => 'General Service - Warranty',
'post_recharged' => 'Post - Recharged',
'post_replacement' => 'Post - Replacement',
'tire' => 'Flat Tire',

View file

@ -203,6 +203,16 @@ class InvoiceCreator
$total['total_price'] = 150.00;
}
public function processJumpstartWarranty(&$total, $invoice)
{
$item = new InvoiceItem();
$item->setInvoice($invoice)
->setTitle('Troubleshooting fee')
->setQuantity(1)
->setPrice(0.00);
$invoice->addItem($item);
}
public function processRecharge(&$total, $invoice)
{
// add recharge fee
@ -265,6 +275,8 @@ class InvoiceCreator
case ServiceType::JUMPSTART_TROUBLESHOOT:
$this->processJumpstart($total, $invoice);
break;
case ServiceType::JUMPSTART_WARRANTY:
$this->processJumpstartWarranty($total, $invoice);
case ServiceType::BATTERY_REPLACEMENT_NEW:
$this->processEntries($total, $criteria, $invoice);

View file

@ -461,8 +461,8 @@
{% for item in obj.getInvoice.getItems %}
<tr data-key="{{ loop.index0 }}">
<td>{{ item.getTitle }}</td>
<td class="text-right">{{ item.getPrice|number_format(2) }}</td>
<td class="text-right">{{ item.getQuantity|number_format }}</td>
<td class="text-right">{{ item.getPrice|number_format(2) }}</td>
<td class="text-right">{{ (item.getPrice * item.getQuantity)|number_format(2) }}</td>
</tr>
{% endfor %}