Fixes for deleting a payment

This commit is contained in:
David Bomba 2021-02-12 09:01:39 +11:00
parent 3c23d5e31f
commit ac2c7b2bbe

View File

@ -69,7 +69,7 @@ class DeletePayment
private function updateClient() private function updateClient()
{ {
$this->payment->client->service()->updatePaidToDate(-1 * $this->payment->amount)->save(); //$this->payment->client->service()->updatePaidToDate(-1 * $this->payment->amount)->save();
return $this; return $this;
} }
@ -92,6 +92,7 @@ class DeletePayment
$paymentable_invoice->client $paymentable_invoice->client
->service() ->service()
->updateBalance($paymentable_invoice->pivot->amount) ->updateBalance($paymentable_invoice->pivot->amount)
->updatePaidToDate($paymentable_invoice->pivot->amount * -1)
->save(); ->save();
if ($paymentable_invoice->balance == $paymentable_invoice->amount) { if ($paymentable_invoice->balance == $paymentable_invoice->amount) {