diff --git a/app/Helpers/Invoice/InvoiceSumInclusive.php b/app/Helpers/Invoice/InvoiceSumInclusive.php index 8f63230335bf..2356f7612bd0 100644 --- a/app/Helpers/Invoice/InvoiceSumInclusive.php +++ b/app/Helpers/Invoice/InvoiceSumInclusive.php @@ -230,14 +230,16 @@ class InvoiceSumInclusive private function setCalculatedAttributes() { /* If amount != balance then some money has been paid on the invoice, need to subtract this difference from the total to set the new balance */ - if ($this->invoice->amount != $this->invoice->balance) { - $paid_to_date = $this->invoice->amount - $this->invoice->balance; + if ($this->invoice->status_id != Invoice::STATUS_DRAFT) { + if ($this->invoice->amount != $this->invoice->balance) { + $paid_to_date = $this->invoice->amount - $this->invoice->balance; - $this->invoice->balance = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision) - $paid_to_date; - } else { - $this->invoice->balance = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision); + $this->invoice->balance = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision) - $paid_to_date; + } else { + $this->invoice->balance = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision); + } } - + /* Set new calculated total */ $this->invoice->amount = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision);