close #2613 Fixed: Document transaction edit amount validation issue solved.

This commit is contained in:
Cüneyt Şentürk 2022-09-01 10:32:15 +03:00
parent 3f20c1f8c4
commit 0d1170e944
2 changed files with 5 additions and 4 deletions

View File

@ -204,7 +204,7 @@ class DocumentTransactions extends Controller
$response['redirect'] = route($route . '.show', $document->id);
$message = trans('messages.success.added', ['type' => trans_choice('general.payments', 1)]);
$message = trans('messages.success.updated', ['type' => trans_choice('general.payments', 1)]);
flash($message)->success();
} else {

View File

@ -92,7 +92,8 @@ class UpdateBankingDocumentTransaction extends Job implements ShouldUpdate
$amount = round($converted_amount, $precision);
}
$this->model->paid_amount = $this->model->paid;
// if you edit transaction before remove transaction amount
$this->model->paid_amount = ($this->model->paid - $this->transaction->amount);
event(new PaidAmountCalculated($this->model));
$total_amount = round($this->model->amount - $this->model->paid_amount, $precision);