Fix for negative line item taxes

This commit is contained in:
Hillel Coren 2017-06-21 14:02:03 +03:00
parent 4fd2329f6d
commit 2c9eb3e7aa

View File

@ -508,15 +508,19 @@ class InvoiceRepository extends BaseRepository
} }
} }
if (isset($item['tax_rate1'])) {
$taxRate1 = Utils::parseFloat($item['tax_rate1']); $taxRate1 = Utils::parseFloat($item['tax_rate1']);
if ($taxRate1 != 0) { if ($taxRate1 != 0) {
$itemTax += round($lineTotal * $taxRate1 / 100, 2); $itemTax += round($lineTotal * $taxRate1 / 100, 2);
} }
}
if (isset($item['tax_rate2'])) {
$taxRate2 = Utils::parseFloat($item['tax_rate2']); $taxRate2 = Utils::parseFloat($item['tax_rate2']);
if ($taxRate2 != 0) { if ($taxRate2 != 0) {
$itemTax += round($lineTotal * $taxRate2 / 100, 2); $itemTax += round($lineTotal * $taxRate2 / 100, 2);
} }
} }
}
if ($invoice->discount > 0) { if ($invoice->discount > 0) {
if ($invoice->is_amount_discount) { if ($invoice->is_amount_discount) {