7525-devToTest #419

Merged
alexm merged 177 commits from 7525-devToTest into test 2024-06-04 08:06:27 +00:00
5 changed files with 65 additions and 70 deletions
Showing only changes of commit 4a6d09ae2c - Show all commits

View File

@ -370,7 +370,10 @@ const createInvoiceInCorrection = async () => {
<template #body="{ entity }">
<VnLv :label="t('invoiceIn.card.issued')" :value="toDate(entity.issued)" />
<VnLv :label="t('invoiceIn.summary.booked')" :value="toDate(entity.booked)" />
<VnLv :label="t('invoiceIn.card.amount')" :value="toCurrency(totalAmount)" />
<VnLv
:label="t('invoiceIn.card.amount')"
:value="toCurrency(totalAmount, entity.currency?.code)"
/>
<VnLv :label="t('invoiceIn.summary.supplier')">
<template #value>
<span class="link">

View File

@ -23,11 +23,7 @@ const invoiceId = route.params.id;
const placeholder = 'yyyy/mm/dd';
const filter = {
where: {
invoiceInFk: invoiceId,
},
};
const filter = { where: { invoiceInFk: invoiceId } };
const columns = computed(() => [
{
@ -192,8 +188,9 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
<QTd />
<QTd />
<QTd>
{{ getTotalAmount(rows) }} ||
{{ toCurrency(getTotalAmount(rows)) }}
{{
toCurrency(getTotalAmount(rows), invoiceIn.currency.code)
}}
</QTd>
<QTd />
</QTr>

View File

@ -6,26 +6,18 @@ import { toCurrency } from 'src/filters';
import CrudModel from 'src/components/CrudModel.vue';
import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import { useArrayData } from 'src/composables/useArrayData';
const { t } = useI18n();
const route = useRoute();
const currency = computed(() => useArrayData('invoiceIn').store.data?.currency?.code);
const invoceInIntrastat = ref([]);
const amountTotal = computed(() => getTotal('amount'));
const netTotal = computed(() => getTotal('net'));
const stemsTotal = computed(() => getTotal('stems'));
const rowsSelected = ref([]);
const countries = ref([]);
const intrastats = ref([]);
const invoiceInFormRef = ref();
const filter = {
where: {
invoiceInFk: route.params.id,
},
};
const invoiceInId = computed(() => +useRoute().params.id);
const filter = { where: { invoiceInFk: invoiceInId.value } };
const columns = computed(() => [
{
name: 'code',
@ -77,13 +69,8 @@ const columns = computed(() => [
},
]);
function getTotal(type) {
if (!invoceInIntrastat.value.length) return 0.0;
return invoceInIntrastat.value.reduce(
(total, intrastat) => total + intrastat[type],
0.0
);
}
const getTotal = (data, key) =>
data.reduce((acc, cur) => acc + +String(cur[key]).replace(',', '.'), 0);
</script>
<template>
<FetchData
@ -99,30 +86,12 @@ function getTotal(type) {
@on-fetch="(data) => (intrastats = data)"
/>
<div class="invoiceIn-intrastat">
<QCard v-if="invoceInIntrastat.length" class="full-width q-mb-md q-pa-sm">
<QItem class="justify-end">
<div>
<QItemLabel>
<VnLv
:label="t('Total amount')"
:value="toCurrency(amountTotal)"
/>
</QItemLabel>
<QItemLabel>
<VnLv :label="t('Total net')" :value="netTotal" />
</QItemLabel>
<QItemLabel>
<VnLv :label="t('Total stems')" :value="stemsTotal" />
</QItemLabel>
</div>
</QItem>
</QCard>
<CrudModel
ref="invoiceInFormRef"
data-key="InvoiceInIntrastats"
url="InvoiceInIntrastats"
auto-load
:data-required="{ invoiceInFk: route.params.id }"
:auto-load="!currency"
:data-required="{ invoiceInFk: invoiceInId }"
:filter="filter"
v-model:selected="rowsSelected"
@on-fetch="(data) => (invoceInIntrastat = data)"
@ -172,6 +141,22 @@ function getTotal(type) {
/>
</QTd>
</template>
<template #bottom-row>
<QTr class="bg">
<QTd />
<QTd />
<QTd>
{{ toCurrency(getTotal(rows, 'amount'), currency) }}
</QTd>
<QTd>
{{ getTotal(rows, 'net') }}
</QTd>
<QTd>
{{ getTotal(rows, 'stems') }}
</QTd>
<QTd />
</QTr>
</template>
<template #item="props">
<div class="q-pa-xs col-xs-12 col-sm-6 grid-style-transition">
<QCard>

View File

@ -16,7 +16,7 @@ const { t } = useI18n();
const entityId = computed(() => props.id || useRoute().params.id);
const invoiceIn = computed(() => useArrayData('InvoiceIn').store.data);
const currency = computed(() => invoiceIn.value?.currency?.code);
const invoiceInUrl = ref();
const amountsNotMatch = ref(null);
const intrastatTotals = ref({ amount: 0, net: 0, stems: 0 });
@ -33,7 +33,7 @@ const vatColumns = ref([
name: 'landed',
label: 'invoiceIn.summary.taxableBase',
field: (row) => row.taxableBase,
format: (value) => toCurrency(value),
format: (value) => toCurrency(value, currency.value),
sortable: true,
align: 'left',
},
@ -62,7 +62,7 @@ const vatColumns = ref([
name: 'rate',
label: 'invoiceIn.summary.rate',
field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate),
format: (value) => toCurrency(value),
format: (value) => toCurrency(value, currency.value),
sortable: true,
align: 'left',
},
@ -95,7 +95,7 @@ const dueDayColumns = ref([
name: 'amount',
label: 'invoiceIn.summary.amount',
field: (row) => row.amount,
format: (value) => toCurrency(value),
format: (value) => toCurrency(value, currency.value),
sortable: true,
align: 'left',
},
@ -122,7 +122,7 @@ const intrastatColumns = ref([
{
name: 'amount',
label: 'invoiceIn.summary.amount',
field: (row) => toCurrency(row.amount),
field: (row) => toCurrency(row.amount, currency.value),
sortable: true,
align: 'left',
},
@ -278,7 +278,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
/>
<VnLv
:label="t('invoiceIn.summary.booked')"
:value="invoiceIn.isBooked"
:value="invoiceIn?.isBooked"
/>
</QCard>
<QCard class="vn-one">
@ -291,9 +291,12 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<QCardSection class="q-pa-none">
<VnLv
:label="t('invoiceIn.summary.taxableBase')"
:value="toCurrency(entity.totals.totalTaxableBase)"
:value="toCurrency(entity.totals.totalTaxableBase, currency)"
/>
<VnLv
label="Total"
:value="toCurrency(entity.totals.totalVat, currency)"
/>
<VnLv label="Total" :value="toCurrency(entity.totals.totalVat)" />
<VnLv :label="t('invoiceIn.summary.dueTotal')">
<template #value>
<QChip
@ -306,7 +309,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
: t('invoiceIn.summary.dueTotal')
"
>
{{ toCurrency(entity.totals.totalDueDay) }}
{{ toCurrency(entity.totals.totalDueDay, currency) }}
</QChip>
</template>
</VnLv>
@ -335,10 +338,14 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<template #bottom-row>
<QTr class="bg">
<QTd></QTd>
<QTd>{{ toCurrency(entity.totals.totalTaxableBase) }}</QTd>
<QTd>{{
toCurrency(entity.totals.totalTaxableBase, currency)
}}</QTd>
<QTd></QTd>
<QTd></QTd>
<QTd>{{ toCurrency(getTotalTax(entity.invoiceInTax)) }}</QTd>
<QTd>{{
toCurrency(getTotalTax(entity.invoiceInTax, currency))
}}</QTd>
<QTd></QTd>
</QTr>
</template>
@ -368,7 +375,9 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<QTr class="bg">
<QTd></QTd>
<QTd></QTd>
<QTd>{{ toCurrency(entity.totals.totalDueDay) }}</QTd>
<QTd>{{
toCurrency(entity.totals.totalDueDay, currency)
}}</QTd>
<QTd></QTd>
</QTr>
</template>
@ -399,7 +408,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<template #bottom-row>
<QTr class="bg">
<QTd></QTd>
<QTd>{{ toCurrency(intrastatTotals.amount) }}</QTd>
<QTd>{{ toCurrency(intrastatTotals.amount, currency) }}</QTd>
<QTd>{{ intrastatTotals.net }}</QTd>
<QTd>{{ intrastatTotals.stems }}</QTd>
<QTd></QTd>

View File

@ -17,8 +17,8 @@ const quasar = useQuasar();
const arrayData = useArrayData('InvoiceIn');
const invoiceIn = computed(() => arrayData.store.data);
const invoiceId = currentRoute.value.params.id;
const invoiceId = +currentRoute.value.params.id;
const currency = computed(() => invoiceIn.value?.currency?.code);
const expenses = ref([]);
const sageTaxTypes = ref([]);
const sageTransactionTypes = ref([]);
@ -56,7 +56,7 @@ const columns = computed(() => [
{
name: 'taxablebase',
label: t('Taxable base'),
field: (row) => toCurrency(row.taxableBase),
field: (row) => toCurrency(row.taxableBase, currency.value),
model: 'taxableBase',
sortable: true,
tabIndex: 2,
@ -91,7 +91,7 @@ const columns = computed(() => [
label: t('Rate'),
sortable: true,
tabIndex: 5,
field: (row) => toCurrency(taxRate(row, row.taxTypeSageFk)),
field: (row) => toCurrency(taxRate(row, row.taxTypeSageFk), currency.value),
align: 'left',
},
{
@ -162,8 +162,9 @@ async function addExpense() {
});
}
}
const getTotalTaxableBase = (rows) => rows.reduce((acc, cur) => acc + cur.taxableBase, 0);
const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + taxRate(cur), 0);
const getTotalTaxableBase = (rows) =>
rows.reduce((acc, { taxableBase }) => acc + +taxableBase, 0);
const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0);
</script>
<template>
<FetchData
@ -195,7 +196,7 @@ const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + taxRate(cur), 0);
selection="multiple"
:columns="columns"
:rows="rows"
row-key="$index"
row-key="$index"
:grid="$q.screen.lt.sm"
>
<template #body-cell-expense="{ row, col }">
@ -312,11 +313,11 @@ const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + taxRate(cur), 0);
<QTd />
<QTd />
<QTd>
{{ toCurrency(getTotalTaxableBase(rows)) }}
{{ toCurrency(getTotalTaxableBase(rows), currency) }}
</QTd>
<QTd />
<QTd />
<QTd> {{ toCurrency(getTotalRate(rows)) }}</QTd>
<QTd> {{ toCurrency(getTotalRate(rows), currency) }}</QTd>
<QTd />
</QTr>
</template>
@ -408,7 +409,7 @@ const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + taxRate(cur), 0);
</VnSelect>
</QItem>
<QItem>
{{ toCurrency(taxRate(props.row)) }}
{{ toCurrency(taxRate(props.row), currency) }}
</QItem>
<QItem>
<QInput