Fix setting of invoice criteria for vat computations and battery entries. #753

This commit is contained in:
Korina Cordero 2023-07-21 06:25:48 +00:00
parent 49ff4b604b
commit da419dd257
3 changed files with 27 additions and 4 deletions

View file

@ -1026,8 +1026,15 @@ class APIController extends Controller implements LoggedController
break;
}
// right now, the app does not include trade-ins but this might change in the future
if (empty($trade_in))
$icrit->addEntry($batt, null, 1);
else
$icrit->addEntry($batt, $trade_in, 1);
// set if taxable
$icrit->setIsTaxable();
// send to invoice generator
$invoice = $ic->generateInvoice($icrit);
$jo->setInvoice($invoice);
@ -1307,6 +1314,9 @@ class APIController extends Controller implements LoggedController
$icrit->addBattery($batt);
*/
// set taxable
$icrit->setIsTaxable(true);
// check trade-in
// only allow motolite, other, none
$trade_in = $req->request->get('trade_in');
@ -1321,6 +1331,10 @@ class APIController extends Controller implements LoggedController
break;
}
// right now, the app does not include trade-ins but this might change in the future
if (empty($trade_in))
$icrit->addEntry($batt, null, 1);
else
$icrit->addEntry($batt, $trade_in, 1);
// send to invoice generator

View file

@ -92,6 +92,10 @@ class InvoiceController extends ApiController
break;
}
// right now, the app does not include trade-ins but this might change in the future
if (empty($trade_in))
$icrit->addEntry($batt, null, 1);
else
$icrit->addEntry($batt, $trade_in, 1);
// set if taxable

View file

@ -874,7 +874,12 @@ class ResqRiderAPIHandler implements RiderAPIHandlerInterface
if ($battery != null)
{
$crit->addEntry($battery, $trade_in, 1);
// right now, the app does not include trade-ins but this might change in the future
if ($trade_in == null)
$icrit->addEntry($batt, null, 1);
else
$icrit->addEntry($batt, $trade_in, 1);
// error_log('adding entry for battery - ' . $battery->getID());
}