Tax Report calculating incorrectly when discount is applied #554

This commit is contained in:
Hillel Coren 2023-02-11 20:04:40 +02:00
parent 43ad767127
commit 1b3415bda8
1 changed files with 1 additions and 11 deletions

View File

@ -143,16 +143,6 @@ abstract class CalculateInvoiceTotal {
lineItems.forEach((invoiceItem) {
double lineTotal = invoiceItem.quantity * invoiceItem.cost;
if (discount != 0) {
if (isAmountDiscount) {
if (total != 0) {
lineTotal -= round(lineTotal / total * discount, precision);
}
} else {
lineTotal -= round(lineTotal * discount / 100, precision);
}
}
if (invoiceItem.discount != 0) {
if (isAmountDiscount) {
lineTotal -= invoiceItem.discount;
@ -164,7 +154,7 @@ abstract class CalculateInvoiceTotal {
total += lineTotal;
});
if (discount > 0) {
if (discount != 0) {
if (isAmountDiscount) {
total -= discount;
} else {