From bbb72875e334c46a48bca2c98832d1311bf53607 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 21 Jul 2019 10:59:16 +0300 Subject: [PATCH] Bug fix --- app/Models/Invoice.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 808728f1e5..7e10e880b4 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -1302,7 +1302,9 @@ class Invoice extends EntityModel implements BalanceAffecting if ($this->discount != 0) { if ($this->is_amount_discount) { - $total -= $invoiceTotal ? ($total / ($invoiceTotal + $this->discount) * $this->discount) : 0; + if ($invoiceTotal + $this->discount != 0) { + $total -= $invoiceTotal ? ($total / ($invoiceTotal + $this->discount) * $this->discount) : 0; + } } else { $total *= (100 - $this->discount) / 100; }