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