feat: refs #8395 added computed to calculate and display amounts

This commit is contained in:
PAU ROVIRA ROSALENY 2025-01-21 10:04:18 +01:00
parent 57804f9f2d
commit 402b2882da
1 changed files with 22 additions and 13 deletions

View File

@ -92,7 +92,7 @@ const columns = computed(() => [
{
name: 'total',
label: t('Total'),
sortable: true,
align: 'left',
},
]);
@ -136,6 +136,24 @@ function autocompleteExpense(evt, row, col) {
if (lookup) row[col.model] = lookup;
}
const taxableBaseTotal = computed(() => {
return getTotal(invoiceInFormRef.value.formData, 'taxableBase', );
});
const taxRateTotal = computed(() => {
return getTotal(invoiceInFormRef.value.formData, null, {
cb: taxRate,
});
});
const combinedTotal = computed(() => {
return +taxableBaseTotal.value + +taxRateTotal.value;
});
</script>
<template>
<FetchData
@ -276,25 +294,16 @@ function autocompleteExpense(evt, row, col) {
<QTd />
<QTd />
<QTd>
{{ getTotal(rows, 'taxableBase', { currency: 'default' }) }}
{{ toCurrency(taxableBaseTotal) }}
</QTd>
<QTd />
<QTd />
<QTd>
{{
getTotal(rows, null, { cb: taxRate, currency: 'default' })
}}
{{ toCurrency(taxRateTotal) }}
</QTd>
<QTd />
<QTd>
{{
getTotal(rows, null, {
cb: (row) =>
parseFloat(row.taxableBase || 0) +
parseFloat(taxRate(row) || 0),
currency: 'default',
})
}}
{{ toCurrency(combinedTotal) }}
</QTd>
</QTr>
</template>