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:
parent
20238909c4
commit
b5dfb2317f
@ -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
@ -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);
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user