From 4af4f2a2a8f0ff57ad30e16f75668439726922e5 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 21 Dec 2021 10:53:17 +1100 Subject: [PATCH] Ensure zero balance invoices are marked as Paid --- app/Services/Invoice/InvoiceService.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index 72119404bc6e..a6d40175d24a 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -299,7 +299,10 @@ class InvoiceService if($this->invoice->status_id == Invoice::STATUS_DRAFT) return $this; - if ($this->invoice->balance > 0 && $this->invoice->balance < $this->invoice->amount) { + if($this->invoice->balance == 0){ + $this->setStatus(Invoice::STATUS_PAID); + } + elseif ($this->invoice->balance > 0 && $this->invoice->balance < $this->invoice->amount) { $this->setStatus(Invoice::STATUS_PARTIAL); }