Merge pull request #2171 from brkcvn/total-currency-conversion

Currency conversion total edited for Invoices and Bills page.
This commit is contained in:
Cüneyt Şentürk 2021-07-01 10:59:36 +03:00 committed by GitHub
commit 183abc86f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 9 deletions

View File

@ -49,7 +49,6 @@ export default {
conversion: '',
rate: this.currencyRate,
texts: [],
texts_split: []
};
},
@ -57,12 +56,13 @@ export default {
let conver = this.currencyConversionText.split(':price');
this.texts.push(conver[0]);
this.texts.push(conver[1].replace(':currency_code', this.currecyCode).replace(':currency_rate', ''));
this.texts.push(conver[1].replace(':currency_code', company_currency_code).replace(':currency_rate', ''));
},
methods: {
onChange() {
this.$emit('change', this.rate);
this.currencySymbol.rate = this.rate;
}
},

View File

@ -64,7 +64,8 @@
"symbol_first":1,
"decimal_mark":".",
"thousands_separator":","
}
},
dropdown_visible: true
}
},
@ -72,6 +73,24 @@
if ((document.getElementById('items') != null) && (document.getElementById('items').rows)) {
this.colspan = document.getElementById("items").rows[0].cells.length - 1;
}
if (!this.edit.status) {
this.dropdown_visible = false;
}
this.currency_symbol.rate = this.form.currency_rate;
if (company_currency_code) {
let default_currency_symbol = null;
for (let symbol of this.currencies) {
if(symbol.code == company_currency_code) {
default_currency_symbol = symbol.symbol;
}
}
this.currency_symbol.symbol = default_currency_symbol;
}
},
methods: {
@ -529,11 +548,10 @@
// Change currency get money
onChangeCurrency(currency_code) {
if (this.edit.status && this.edit.currency <= 3) {
if (this.edit.status && this.edit.currency <= 2) {
this.edit.currency++;
return;
}
if (!this.currencies.length) {
let currency_promise = Promise.resolve(window.axios.get((url + '/settings/currencies')));
@ -553,11 +571,9 @@
this.form.currency_code = currency.code;
this.form.currency_rate = currency.rate;
this.currencyConversion();
}
if (document_default_currency == currency.code) {
if (company_currency_code == currency.code) {
this.currency_symbol = currency;
}
}, this);

View File

@ -131,7 +131,7 @@
@stack('grand_total_td_end')
@stack('currency_conversion_td_start')
<tr id="tr-currency-conversion" class="d-none" :class="[{'d-table-row': (('{{ $currency->code }}' != form.currency_code) && totals.total)}]">
<tr id="tr-currency-conversion" class="d-none" :class="[{'d-table-row': (('{{ $currency->code }}' != form.currency_code) && totals.total || dropdown_visible)}]">
<td class="border-top-0 pb-0"></td>
<td class="text-right border-top-0 border-right-0 align-middle pb-0 pr-3 pr-0" colspan="2">
<akaunting-currency-conversion

View File

@ -3,6 +3,10 @@
<script src="{{ asset('public/vendor/bootstrap/dist/js/bootstrap.bundle.min.js') }}"></script>
<script src="{{ asset('public/vendor/js-cookie/js.cookie.js') }}"></script>
<script type="text/javascript">
var company_currency_code = '{{ setting("default.currency") }}';
</script>
@stack('scripts_start')
@stack('charts')