Skip to content

Commit

Permalink
close #3063 Fixed: Payment issues in both invoicing and bills
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Oct 4, 2023
1 parent b6d10f2 commit 9074540
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions resources/assets/js/views/common/documents.js
Expand Up @@ -118,12 +118,13 @@ const app = new Vue({

methods: {
onChangeCurrencyPaymentAccount(currency_code) {
let code = currency_code;
let rate = this.form.currency_rate;
let precision = this.currency.precision;

let amount = parseFloat(this.form.document_default_amount).toFixed(precision);
let paid_amount = parseFloat(this.form.paid_amount).toFixed(precision);
let total_amount = parseFloat(amount - paid_amount).toFixed(precision);
let code = currency_code;
let rate = this.form.currency_rate;
let precision = this.currency.precision;
let error_amount = 0;

if (this.form.document_currency_code != code) {
Expand Down Expand Up @@ -160,7 +161,7 @@ const app = new Vue({
let code = this.form.currency_code;

if (this.form.document_currency_code != code) {
let rate = this.form.currency_rate;
let rate = (this.form.pay_in_full) ? parseFloat(this.form.amount / this.form.document_default_amount).toFixed(4): this.form.currency_rate;
let precision = this.currency.precision;
let paid_amount = parseFloat(this.form.paid_amount).toFixed(precision);
let total_amount = parseFloat(amount - paid_amount).toFixed(precision);
Expand All @@ -183,18 +184,22 @@ const app = new Vue({
}
},

onChangeRatePayment() {

onChangeRatePayment(rate) {
this.onChangeAmount(this.form.amount);
},

onChangePayInFull(event) {
this.$forceUpdate();

if (! event) {
return;
}

let rate = parseFloat(this.form.amount / this.form.document_default_amount).toFixed(4);

this.form.currency_rate = rate;

this.onChangeAmount(this.form.amount);
},

checkAmount() {
Expand Down
2 changes: 1 addition & 1 deletion resources/views/modals/documents/payment.blade.php
Expand Up @@ -88,7 +88,7 @@
form-group-class="col-span-6"
::disabled="form.pay_in_full"
not-required
@change="onChangeRatePayment($event)"
@input="onChangeRatePayment($event)"
/>

<div class="relative col-span-6 text-xs flex mt-2">
Expand Down

0 comments on commit 9074540

Please sign in to comment.