1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

Fix rounding for line item discounts

This commit is contained in:
Hillel Coren 2018-03-19 09:28:32 +02:00
parent 20238909c4
commit b5dfb2317f
5 changed files with 6 additions and 6 deletions

View File

@ -549,7 +549,7 @@ class InvoiceRepository extends BaseRepository
if ($invoice->is_amount_discount) { if ($invoice->is_amount_discount) {
$lineTotal -= $discount; $lineTotal -= $discount;
} else { } else {
$lineTotal -= $lineTotal * $discount / 100; $lineTotal -= round($lineTotal * $discount / 100, 2);
} }
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -595,7 +595,7 @@ function calculateAmounts(invoice) {
if (parseInt(invoice.is_amount_discount)) { if (parseInt(invoice.is_amount_discount)) {
lineTotal -= discount; lineTotal -= discount;
} else { } else {
lineTotal -= (lineTotal * discount / 100); lineTotal -= roundToTwo(lineTotal * discount / 100);
} }
} }
} }
@ -652,7 +652,7 @@ function calculateAmounts(invoice) {
if (parseInt(invoice.is_amount_discount)) { if (parseInt(invoice.is_amount_discount)) {
lineTotal -= discount; lineTotal -= discount;
} else { } else {
lineTotal -= (lineTotal * discount / 100); lineTotal -= roundToTwo(lineTotal * discount / 100);
} }
} }
lineTotal = roundToTwo(lineTotal); lineTotal = roundToTwo(lineTotal);

View File

@ -904,7 +904,7 @@ function ItemModel(data) {
if (parseInt(model.invoice().is_amount_discount())) { if (parseInt(model.invoice().is_amount_discount())) {
value -= discount; value -= discount;
} else { } else {
value -= (value * discount / 100); value -= roundToTwo(value * discount / 100);
} }
} }
return value ? roundToTwo(value) : 0; return value ? roundToTwo(value) : 0;