Set taxable for invoice criteria when app requests a job order. #744

This commit is contained in:
Korina Cordero 2023-06-18 23:40:09 -04:00
parent 9840ecf633
commit 822bc59c6c
2 changed files with 7 additions and 1 deletions

View file

@ -2865,6 +2865,9 @@ class APIController extends Controller implements LoggedController
$icrit = new InvoiceCriteria();
$icrit->setServiceType($stype);
// set taxable
$icrit->setIsTaxable(true);
// check promo
$promo_id = $req->request->get('promo_id');
if (!empty($promo_id))

View file

@ -94,6 +94,8 @@ class InvoiceManager implements InvoiceGeneratorInterface
->setCustomerVehicle($jo->getCustomerVehicle());
// set if taxable
// NOTE: ideally, this should be a parameter when calling generateInvoiceCriteria. But that
// would mean adding it as a parameter to the call, impacting all calls
$criteria->setIsTaxable();
$ierror = $this->validatePromo($criteria, $promo_id);
@ -152,11 +154,12 @@ class InvoiceManager implements InvoiceGeneratorInterface
}
// this is called by JobOrderController when JS script generateInvoice is called
// this is also called by the APIController from newRequestJobOrder
// this is also called by generateInvoiceCriteria
public function generateInvoice($criteria)
{
// no need to validate since generateDraftInvoice was called before this was called
// generate the invoice
// generate the invoice and from APIController, the fields were validated
// check which rules to apply
$rules = $this->check($criteria);