Add promo selection to job order invoice form
This commit is contained in:
parent
92715265b3
commit
fb5d36aca6
3 changed files with 47 additions and 17 deletions
|
|
@ -8,6 +8,11 @@ jo_in_submit:
|
|||
controller: App\Controller\JobOrderController::incomingSubmit
|
||||
methods: [POST]
|
||||
|
||||
jo_in_invoice:
|
||||
path: /job-order/generate-invoice
|
||||
controller: App\Controller\JobOrderController::generateInvoice
|
||||
methods: [POST]
|
||||
|
||||
jo_proc:
|
||||
path: /job-order/processing
|
||||
controller: App\Controller\JobOrderController::listRows
|
||||
|
|
|
|||
|
|
@ -6,13 +6,17 @@ use App\Ramcar\BaseController;
|
|||
use App\Ramcar\ServiceType;
|
||||
use App\Ramcar\JOStatus;
|
||||
use App\Ramcar\WarrantyClass;
|
||||
use App\Ramcar\DiscountApply;
|
||||
use App\Ramcar\InvoiceCriteria;
|
||||
use App\Entity\JobOrder;
|
||||
use App\Entity\BatteryManufacturer;
|
||||
use App\Entity\Customer;
|
||||
use App\Entity\CustomerVehicle;
|
||||
use App\Entity\Outlet;
|
||||
use App\Entity\Promo;
|
||||
use App\Entity\Rider;
|
||||
|
||||
use App\Service\InvoiceCreator;
|
||||
use App\Service\MapTools;
|
||||
|
||||
use Doctrine\ORM\Query;
|
||||
|
|
@ -41,11 +45,11 @@ class JobOrderController extends BaseController
|
|||
// get parent associations
|
||||
$params['bmfgs'] = $em->getRepository(BatteryManufacturer::class)->findAll();
|
||||
$params['customers'] = $em->getRepository(Customer::class)->findAll();
|
||||
$params['outlet'] = $em->getRepository(Outlet::class)->findAll();
|
||||
$params['rider'] = $em->getRepository(Rider::class)->findAll();
|
||||
$params['promos'] = $em->getRepository(Promo::class)->findAll();
|
||||
$params['service_types'] = ServiceType::getCollection();
|
||||
$params['warranty_classes'] = WarrantyClass::getCollection();
|
||||
$params['statuses'] = JOStatus::getCollection();
|
||||
$params['discount_apply'] = DiscountApply::getCollection();
|
||||
|
||||
// response
|
||||
return $this->render('job-order/form.html.twig', $params);
|
||||
|
|
@ -281,6 +285,8 @@ class JobOrderController extends BaseController
|
|||
$params['service_types'] = ServiceType::getCollection();
|
||||
$params['warranty_classes'] = WarrantyClass::getCollection();
|
||||
$params['statuses'] = JOStatus::getCollection();
|
||||
$params['promos'] = $em->getRepository(Promo::class)->findAll();
|
||||
$params['discount_apply'] = DiscountApply::getCollection();
|
||||
|
||||
// get closest outlets
|
||||
$outlets = $map_tools->getClosestOutlets($obj->getCoordinates(), 10, date("H:i:s"));
|
||||
|
|
@ -418,6 +424,8 @@ class JobOrderController extends BaseController
|
|||
$params['service_types'] = ServiceType::getCollection();
|
||||
$params['warranty_classes'] = WarrantyClass::getCollection();
|
||||
$params['statuses'] = JOStatus::getCollection();
|
||||
$params['promos'] = $em->getRepository(Promo::class)->findAll();
|
||||
$params['discount_apply'] = DiscountApply::getCollection();
|
||||
|
||||
// get closest outlets
|
||||
$outlets = $map_tools->getClosestOutlets($obj->getCoordinates(), 10, date("H:i:s"));
|
||||
|
|
@ -540,7 +548,8 @@ class JobOrderController extends BaseController
|
|||
// TODO: re-enable search, figure out how to group the orWhere filters into one, so can execute that plus the pending filter
|
||||
|
||||
// check if datatable filter is present and append to query
|
||||
protected function setQueryFilters($datatable, &$query, $qb, $status) {
|
||||
protected function setQueryFilters($datatable, &$query, $qb, $status)
|
||||
{
|
||||
$query->where('q.status = :status')
|
||||
->setParameter('status', $status);
|
||||
|
||||
|
|
@ -560,4 +569,12 @@ class JobOrderController extends BaseController
|
|||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public function generateInvoice(Request $req, InvoiceCreator $ic)
|
||||
{
|
||||
// create new invoice object
|
||||
$invoice = new InvoiceCriteria();
|
||||
|
||||
//$invoice->
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -263,27 +263,35 @@
|
|||
</h3>
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-2">
|
||||
<label>Price</label>
|
||||
<input type="text" id="invoice-price" class="form-control m-input text-right" value="0.00" disabled>
|
||||
<div class="col-lg-6">
|
||||
<label>Discount Type</label>
|
||||
<select class="form-control m-input" id="invoice-promo" name="invoice-promo">
|
||||
<option value="">None</option>
|
||||
{% for promo in promos %}
|
||||
<option value="{{ promo.getID() }}">{{ promo.getName() ~ ' (' ~ promo.getDiscountRate * 100 ~ '% applied to ' ~ discount_apply[promo.getDiscountApply] ~ ')' }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div class="form-control-feedback hide" data-field="invoice_promo"></div>
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<label>VAT</label>
|
||||
<input type="text" id="invoice-vat" class="form-control m-input text-right" value="0.00" disabled>
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<div class="col-lg-3">
|
||||
<label>Promo Discount</label>
|
||||
<input type="text" id="invoice-promo-discount" class="form-control m-input text-right" value="0.00" disabled>
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<label>Discount Type</label>
|
||||
<input type="text" id="invoice-discount-type" class="form-control m-input" value="PVC" disabled>
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<div class="col-lg-3">
|
||||
<label>Trade In</label>
|
||||
<input type="text" id="invoice-trade-in" class="form-control m-input text-right" value="0.00" disabled>
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-3">
|
||||
<label>Price</label>
|
||||
<input type="text" id="invoice-price" class="form-control m-input text-right" value="0.00" disabled>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<label>VAT</label>
|
||||
<input type="text" id="invoice-vat" class="form-control m-input text-right" value="0.00" disabled>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<label>Total Amount</label>
|
||||
<input type="text" id="invoice-total-amount" class="form-control m-input text-right" value="0.00" disabled>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue