close #3120 Fixed: Invoice items price gets multiplied when currency accuracy is changed

This commit is contained in:
Cüneyt Şentürk 2024-02-12 15:14:43 +03:00
parent 0599090252
commit a217e44d6d
12 changed files with 87 additions and 6 deletions

View File

@ -1600,5 +1600,11 @@ export default {
setMinDate(date) {
this.min_date = date;
},
},
created() {
if (aka_currency) {
this.currency = aka_currency;
}
}
}

View File

@ -159,7 +159,7 @@ const app = new Vue({
}
this.tax_summary = true;
this.tax_summary_total = tax_total.toFixed(2);
this.tax_summary_total = tax_total.toFixed(this.currency.precision ?? 2);
},
},
});

View File

@ -901,11 +901,11 @@ const app = new Vue({
name: item.name,
description: item.description === null ? "" : item.description,
quantity: item.quantity,
price: (item.price).toFixed(2),
price: (item.price).toFixed(this.currency.precision ?? 2),
tax_ids: item.tax_ids,
discount: item.discount_rate,
discount_type: item.discount_type,
total: (item.total).toFixed(2)
total: (item.total).toFixed(this.currency.precision ?? 2)
});
if (item.tax_ids) {
@ -928,7 +928,7 @@ const app = new Vue({
item_taxes.push({
id: item_tax.tax_id,
name: item_tax.name,
price: (item_tax.amount).toFixed(2),
price: (item_tax.amount).toFixed(this.currency.precision ?? 2),
});
});
@ -937,13 +937,13 @@ const app = new Vue({
name: item.name,
description: item.description === null ? "" : item.description,
quantity: item.quantity,
price: (item.price).toFixed(2),
price: (item.price).toFixed(this.currency.precision ?? 2),
add_tax: false,
tax_ids: item_taxes,
add_discount: (item.discount_rate) ? true : false,
discount: item.discount_rate,
discount_type: item.discount_type,
total: (item.total).toFixed(2),
total: (item.total).toFixed(this.currency.precision ?? 2),
// @todo
// invoice_item_checkbox_sample: [],
});

View File

@ -63,5 +63,15 @@
</x-form.container>
</x-slot>
@push('scripts_start')
<script type="text/javascript">
if (typeof aka_currency !== 'undefined') {
aka_currency = {!! json_encode(! empty($currency) ? $currency : company()->currency) !!};
} else {
var aka_currency = {!! json_encode(! empty($currency) ? $currency : company()->currency) !!};
}
</script>
@endpush
<x-script folder="banking" file="accounts" />
</x-layouts.admin>

View File

@ -61,5 +61,15 @@
</x-form.container>
</x-slot>
@push('scripts_start')
<script type="text/javascript">
if (typeof aka_currency !== 'undefined') {
aka_currency = {!! json_encode(! empty($account) ? $account->currency : company()->currency) !!};
} else {
var aka_currency = {!! json_encode(! empty($account) ? $account->currency : company()->currency) !!};
}
</script>
@endpush
<x-script folder="banking" file="accounts" />
</x-layouts.admin>

View File

@ -106,5 +106,15 @@
</x-form.container>
</x-slot>
@push('scripts_start')
<script type="text/javascript">
if (typeof aka_currency !== 'undefined') {
aka_currency = {!! json_encode(! empty($currency) ? $currency : company()->currency) !!};
} else {
var aka_currency = {!! json_encode(! empty($currency) ? $currency : company()->currency) !!};
}
</script>
@endpush
<x-script folder="banking" file="transactions" />
</x-layouts.admin>

View File

@ -111,5 +111,15 @@
</x-form.container>
</x-slot>
@push('scripts_start')
<script type="text/javascript">
if (typeof aka_currency !== 'undefined') {
aka_currency = {!! json_encode(! empty($recurring_transaction) ? $recurring_transaction->currency : company()->currency) !!};
} else {
var aka_currency = {!! json_encode(! empty($recurring_transaction) ? $recurring_transaction->currency : company()->currency) !!};
}
</script>
@endpush
<x-script folder="banking" file="transactions" />
</x-layouts.admin>

View File

@ -76,7 +76,14 @@
@push('scripts_start')
<script type="text/javascript">
var transaction_taxes = {!! $taxes !!};
if (typeof aka_currency !== 'undefined') {
aka_currency = {!! json_encode(! empty($currency) ? $currency : company()->currency) !!};
} else {
var aka_currency = {!! json_encode(! empty($currency) ? $currency : company()->currency) !!};
}
</script>
@endpush
<x-script folder="banking" file="transactions" />
</x-layouts.admin>

View File

@ -100,6 +100,12 @@
@push('scripts_start')
<script type="text/javascript">
var transaction_taxes = {!! $taxes !!};
if (typeof aka_currency !== 'undefined') {
aka_currency = {!! json_encode(! empty($transaction) ? $transaction->currency : company()->currency) !!};
} else {
var aka_currency = {!! json_encode(! empty($transaction) ? $transaction->currency : company()->currency) !!};
}
</script>
@endpush
<x-script folder="banking" file="transactions" />

View File

@ -68,5 +68,15 @@
</x-form.container>
</x-slot>
@push('scripts_start')
<script type="text/javascript">
if (typeof aka_currency !== 'undefined') {
aka_currency = {!! json_encode(! empty($currency) ? $currency : company()->currency) !!};
} else {
var aka_currency = {!! json_encode(! empty($currency) ? $currency : company()->currency) !!};
}
</script>
@endpush
<x-script folder="banking" file="transfers" />
</x-layouts.admin>

View File

@ -81,6 +81,12 @@
@push('scripts_start')
<script type="text/javascript">
var transfer_edit = {{ $transfer->id }};
if (typeof aka_currency !== 'undefined') {
aka_currency = {!! json_encode(! empty($currency) ? $currency : company()->currency) !!};
} else {
var aka_currency = {!! json_encode(! empty($currency) ? $currency : company()->currency) !!};
}
</script>
@endpush

View File

@ -16,6 +16,12 @@
var document_currencies = {!! $currencies !!};
var document_taxes = {!! $taxes !!};
var document_app_env = '{{ $document_app_env }}';
if (typeof aka_currency !== 'undefined') {
aka_currency = {!! json_encode(! empty($document) ? $document->currency : company()->currency) !!};
} else {
var aka_currency = {!! json_encode(! empty($document) ? $document->currency : company()->currency) !!};
}
</script>
@endpush