Merge branch 'master-fix' of gitlab.com:jankstudio/resq into 632-resq-1-5-changes

This commit is contained in:
Korina Cordero 2021-10-27 07:15:13 +00:00
commit 3f7075f26d
2 changed files with 30 additions and 6 deletions

View file

@ -35,8 +35,8 @@ class ResqInvoiceGenerator implements InvoiceGeneratorInterface
const WARRANTY_FEE = 0;
const OTHER_SERVICES_FEE = 200;
const COOLANT_FEE = 1600;
const REFUEL_FEE_GAS = 260;
const REFUEL_FEE_DIESEL = 220;
const REFUEL_FEE_GAS = 300;
const REFUEL_FEE_DIESEL = 260;
private $security;
protected $em;
@ -363,6 +363,7 @@ class ResqInvoiceGenerator implements InvoiceGeneratorInterface
$this->processBatteries($total, $con_batts, $invoice);
$this->processTradeIns($total, $con_tis, $invoice);
$this->processVAT($total);
}
protected function processBatteries(&$total, $con_batts, Invoice $invoice)
@ -374,12 +375,13 @@ class ResqInvoiceGenerator implements InvoiceGeneratorInterface
$qty = $con_data['qty'];
$sell_price = $batt->getSellingPrice();
$vat = $this->getTaxAmount($sell_price);
// comment out the getting of tax amount
// $vat = $this->getTaxAmount($sell_price);
// $vat_ex_price = $this->getTaxExclusivePrice($sell_price);
$total['sell_price'] += $sell_price * $qty;
$total['vat'] += $vat * $qty;
$total['vat_ex_price'] += ($sell_price - $vat) * $qty;
// $total['vat'] += $vat * $qty;
// $total['vat_ex_price'] += ($sell_price - $vat) * $qty;
$total['total_price'] += $sell_price * $qty;
@ -816,4 +818,26 @@ class ResqInvoiceGenerator implements InvoiceGeneratorInterface
}
return $cust_tag_info;
}
protected function processVAT(&$total)
{
// total trade in amount to deduct from SRP before we compute VAT
$total_ti_amt = 0;
// need to check if there are trade-ins
if (isset($total['ti_rate']))
$total_ti_amt = $total['ti_rate'];
// compute the vat for battery
// get the total selling price. That should be SRP.
// we need to deduct the trade-ins before computing VAT
$total_srp = $total['sell_price'];
$total_price_minus_ti = bcsub($total_srp, $total_ti_amt, 2);
$total_vat = $this->getTaxAmount($total_price_minus_ti);
$total_vat_ex_price = bcsub($total_price_minus_ti, $total_vat, 2);
$total['vat'] = $total_vat;
$total['vat_ex_price'] = $total_vat_ex_price;
}
}

View file

@ -552,7 +552,7 @@
</div>
<div class="col-lg-3">
<label>VAT</label>
<input type="text" id="invoice-vat" class="form-control m-input text-right" value="{{ obj.getInvoice ? obj.getInvoice.getVAT|number_format : '0.00' }}" disabled>
<input type="text" id="invoice-vat" class="form-control m-input text-right" value="{{ obj.getInvoice ? obj.getInvoice.getVAT|number_format(2) : '0.00' }}" disabled>
</div>
<div class="col-lg-6">
<label>Total Amount</label>