From 920bbf8b75268eeae1cce456acedf0e3dc5c5bdf Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 5 Jul 2020 20:24:13 +1000 Subject: [PATCH] Adjust client balance when deleting payment --- app/Services/Payment/DeletePayment.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Services/Payment/DeletePayment.php b/app/Services/Payment/DeletePayment.php index 11b29c370693..f4ad8fbb23f2 100644 --- a/app/Services/Payment/DeletePayment.php +++ b/app/Services/Payment/DeletePayment.php @@ -71,7 +71,8 @@ class DeletePayment $paymentable_invoice->service()->updateBalance($paymentable_invoice->pivot->amount)->save(); $paymentable_invoice->ledger()->updateInvoiceBalance($paymentable_invoice->pivot->amount)->save(); - + $paymentable_invoice->client->service()->updateBalance($paymentable_invoice->pivot->amount)->save(); + if(floatval($paymentable_invoice->balance) == 0) $paymentable_invoice->service()->setStatus(Invoice::STATUS_SENT)->save(); else