From 7933aa98bfa68e2466cb9953a975418f3994d5db Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 2 Mar 2017 11:08:53 +0200 Subject: [PATCH] Fix discounts on tax rate report --- app/Models/Invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 0e817722a545..8a57bd0c9772 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -1268,7 +1268,7 @@ class Invoice extends EntityModel implements BalanceAffecting if ($this->discount > 0) { if ($this->is_amount_discount) { - $total -= $invoiceTotal ? ($total / $invoiceTotal * $this->discount) : 0; + $total -= $invoiceTotal ? ($total / ($invoiceTotal + $this->discount) * $this->discount) : 0; } else { $total *= (100 - $this->discount) / 100; $total = round($total, 2);