feat: refs #7134 use tableFooter

This commit is contained in:
Javier Segarra 2024-11-21 12:47:33 +01:00
parent e948253bea
commit 994a22a195
1 changed files with 21 additions and 11 deletions

View File

@ -197,18 +197,8 @@ function setFooter(data) {
tableRef.value.footer = tableFooter(initialFooter, data); tableRef.value.footer = tableFooter(initialFooter, data);
} }
async function onFetch(data) { async function onFetch(data) {
setFooter(data);
return; return;
// balances.value = [];
// for (const [index, balance] of data.entries()) {
// if (index === 0) {
// balance.balance = await getCurrentBalance();
// continue;
// }
// const previousBalance = data[index - 1];
// balance.balance =
// previousBalance?.balance - (previousBalance?.debit - previousBalance?.credit);
// }
// balances.value = data;
} }
const showNewPaymentDialog = () => { const showNewPaymentDialog = () => {
@ -227,6 +217,9 @@ const showNewPaymentDialog = () => {
const showBalancePdf = ({ id }) => { const showBalancePdf = ({ id }) => {
openReport(`InvoiceOuts/${id}/download`, {}, '_blank'); openReport(`InvoiceOuts/${id}/download`, {}, '_blank');
}; };
function round(value) {
return Math.round(value * 100) / 100;
}
</script> </script>
<template> <template>
@ -267,6 +260,7 @@ const showBalancePdf = ({ id }) => {
:column-search="false" :column-search="false"
@on-fetch="onFetch" @on-fetch="onFetch"
:disable-option="{ card: true }" :disable-option="{ card: true }"
:footer="true"
auto-load auto-load
> >
<template #column-balance="{ rowIndex }"> <template #column-balance="{ rowIndex }">
@ -300,6 +294,22 @@ const showBalancePdf = ({ id }) => {
/> />
</QPopupEdit> </QPopupEdit>
</template> </template>
<template #column-footer-invoiceEuros>
<span>
{{ round(tableRef.footer.invoiceEuros) }}
</span>
</template>
<template #column-footer-paymentEuros>
<span>
{{ round(tableRef.footer.paymentEuros) }}
</span>
</template>
<template #column-footer-euroBalance>
<span>
{{ round(tableRef.footer.euroBalance) }}
</span>
</template>
</VnTable> </VnTable>
<QPageSticky :offset="[18, 18]" style="z-index: 2"> <QPageSticky :offset="[18, 18]" style="z-index: 2">
<QBtn <QBtn