Merge branch '270-final-cmb-fixes' of gitlab.com:jankstudio/resq into 357-transition-fix-resq-s-geteditroute
This commit is contained in:
commit
6d14677bd7
5 changed files with 42 additions and 10 deletions
|
|
@ -698,7 +698,7 @@ class JobOrderController extends Controller
|
||||||
$items = $req->request->get('items');
|
$items = $req->request->get('items');
|
||||||
$promo_id = $req->request->get('promo');
|
$promo_id = $req->request->get('promo');
|
||||||
$cvid = $req->request->get('cvid');
|
$cvid = $req->request->get('cvid');
|
||||||
$service_charges = $req->request->get('service_charges');
|
$service_charges = $req->request->get('service_charges', []);
|
||||||
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
|
@ -742,14 +742,7 @@ class JobOrderController extends Controller
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO: this snippet should be in the invoice generator
|
$error = $ic->generateDraftInvoice($criteria, $promo_id, $service_charges, $items);
|
||||||
$error = $ic->validateDiscount($criteria, $promo_id);
|
|
||||||
|
|
||||||
// process service charges
|
|
||||||
$error = $ic->invoiceServiceCharges($criteria, $service_charges);
|
|
||||||
|
|
||||||
if (!$error)
|
|
||||||
$error = $ic->invoiceBatteries($criteria, $items);
|
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,25 @@ class CMBInvoiceGenerator implements InvoiceGeneratorInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// prepare draft for invoice
|
||||||
|
public function generateDraftInvoice($criteria, $discount, $service_charges, $items)
|
||||||
|
{
|
||||||
|
$ierror = $this->validateDiscount($criteria, $discount);
|
||||||
|
|
||||||
|
if (!$ierror)
|
||||||
|
{
|
||||||
|
// process service charges
|
||||||
|
$ierror = $this->invoiceServiceCharges($criteria, $service_charges);
|
||||||
|
|
||||||
|
if (!$ierror)
|
||||||
|
{
|
||||||
|
$ierror = $this->invoiceBatteries($criteria, $items);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ierror;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getTaxAmount($price)
|
protected function getTaxAmount($price)
|
||||||
{
|
{
|
||||||
$vat_ex_price = $this->getTaxExclusivePrice($price);
|
$vat_ex_price = $this->getTaxExclusivePrice($price);
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,20 @@ class ResqInvoiceGenerator implements InvoiceGeneratorInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// prepare draft for invoice
|
||||||
|
public function generateDraftInvoice($criteria, $promo_id, $service_charges, $items)
|
||||||
|
{
|
||||||
|
$ierror = $this->invoicePromo($criteria, $promo_id);
|
||||||
|
|
||||||
|
if (!$ierror)
|
||||||
|
{
|
||||||
|
$ierror = $this->invoiceBatteries($criteria, $items);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ierror;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function getTaxAmount($price)
|
protected function getTaxAmount($price)
|
||||||
{
|
{
|
||||||
$vat_ex_price = $this->getTaxExclusivePrice($price);
|
$vat_ex_price = $this->getTaxExclusivePrice($price);
|
||||||
|
|
@ -227,7 +241,7 @@ class ResqInvoiceGenerator implements InvoiceGeneratorInterface
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function invoicePromo(InvoiceCriteria $criteria, $promo_id)
|
protected function invoicePromo(InvoiceCriteria $criteria, $promo_id)
|
||||||
{
|
{
|
||||||
// return error if there's a problem, false otherwise
|
// return error if there's a problem, false otherwise
|
||||||
// check service type
|
// check service type
|
||||||
|
|
|
||||||
|
|
@ -15,4 +15,7 @@ interface InvoiceGeneratorInterface
|
||||||
// generate invoice criteria
|
// generate invoice criteria
|
||||||
public function generateInvoiceCriteria(JobOrder $jo, int $promo_id, array $invoice_items, array &$error_array);
|
public function generateInvoiceCriteria(JobOrder $jo, int $promo_id, array $invoice_items, array &$error_array);
|
||||||
|
|
||||||
|
// prepare draft for invoice
|
||||||
|
public function generateDraftInvoice(InvoiceCriteria $criteria, int $promo_id, array $service_charges, array $items);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,9 @@
|
||||||
<form id="row-form" class="m-form m-form--fit m-form--label-align-right" method="post" action="{{ submit_url }}">
|
<form id="row-form" class="m-form m-form--fit m-form--label-align-right" method="post" action="{{ submit_url }}">
|
||||||
<input type="hidden" id="invoice-change" name="invoice_change" value="0">
|
<input type="hidden" id="invoice-change" name="invoice_change" value="0">
|
||||||
<input type="hidden" id="cid" name="cid" value="0">
|
<input type="hidden" id="cid" name="cid" value="0">
|
||||||
|
{% if mode in ['update-assigning', 'update-processing', 'update-reassign-hub', 'update-reassign-rider', 'update-all', 'open_edit'] %}
|
||||||
|
<input type="hidden" id="cid" name="cid" value="{{ obj.getCustomer.getID }}">
|
||||||
|
{% endif %}
|
||||||
<div class="m-portlet__body">
|
<div class="m-portlet__body">
|
||||||
|
|
||||||
{% if ftags.vehicle_dropdown %}
|
{% if ftags.vehicle_dropdown %}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue