diff --git a/app/Services/Payment/RefundPayment.php b/app/Services/Payment/RefundPayment.php index 0d10b83fa745..6d9f8a76e1eb 100644 --- a/app/Services/Payment/RefundPayment.php +++ b/app/Services/Payment/RefundPayment.php @@ -242,7 +242,8 @@ class RefundPayment $invoice->service()->updateBalance($refunded_invoice['amount'])->save(); $invoice->ledger()->updateInvoiceBalance($refunded_invoice['amount'], "Refund of payment # {$this->payment->number}")->save(); - + $invoice->paid_to_date -= $refunded_invoice['amount']; + if ($invoice->amount == $invoice->balance) { $invoice->service()->setStatus(Invoice::STATUS_SENT); } else {