Document transaction convert amount issue solved..
This commit is contained in:
parent
addf3cd681
commit
0c4476e4ff
|
|
@ -104,17 +104,13 @@ class CreateBankingDocumentTransaction extends Job implements ShouldCreate
|
|||
$compare = bccomp($amount, $total_amount, $precision);
|
||||
|
||||
if ($compare === 1) {
|
||||
$error_amount = $total_amount;
|
||||
if ($this->model->currency_code == $code) {
|
||||
$message = trans('messages.error.over_payment', ['amount' => money($total_amount, $code)]);
|
||||
|
||||
if ($this->model->currency_code != $code) {
|
||||
$converted_amount = $this->convertBetween($total_amount, $this->model->currency_code, $this->model->currency_rate, $code, $rate);
|
||||
|
||||
$error_amount = round($converted_amount, $precision);
|
||||
throw new \Exception($message);
|
||||
} else {
|
||||
$this->model->status = 'paid';
|
||||
}
|
||||
|
||||
$message = trans('messages.error.over_payment', ['amount' => money($error_amount, $code)]);
|
||||
|
||||
throw new \Exception($message);
|
||||
} else {
|
||||
$this->model->status = ($compare === 0) ? 'paid' : 'partial';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -339,6 +339,10 @@ class Document extends Model
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($this->status == 'paid' ) {
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
$paid = 0;
|
||||
|
||||
$code = $this->currency_code;
|
||||
|
|
|
|||
|
|
@ -161,8 +161,6 @@ const app = new Vue({
|
|||
return;
|
||||
}
|
||||
|
||||
this.form.error_amount = 0;
|
||||
|
||||
let code = this.form.currency_code;
|
||||
let rate = this.form.currency_rate;
|
||||
let precision = this.currency.precision;
|
||||
|
|
@ -187,11 +185,6 @@ const app = new Vue({
|
|||
}
|
||||
|
||||
this.form.default_amount = amount;
|
||||
|
||||
if (error_amount) {
|
||||
this.form.error_amount = error_amount;
|
||||
//this.form.error_amount = new Money(this.form.currency_code, error_amount, true).format();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -64,16 +64,6 @@
|
|||
input="onChangeAmount($event)"
|
||||
/>
|
||||
|
||||
<div class="sm:col-span-6 grid sm:grid-cols-6 gap-x-4 -mt-6" v-if="form.error_amount">
|
||||
<div class="relative col-span-6 text-xs flex mt-5">
|
||||
<div class="rounded-xl px-5 py-3 bg-red-100">
|
||||
<div class="w-auto text-xs mr-2 text-red-600"
|
||||
v-html="'{{ trans('invoices.over_payment', ['amount' => '#amount']) }}'.replace('#amount', form.error_amount)"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sm:col-span-2 text-xs absolute right-0 top-1">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<x-form.input.checkbox
|
||||
|
|
|
|||
Loading…
Reference in New Issue