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);
}
async function onFetch(data) {
setFooter(data);
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 = () => {
@ -227,6 +217,9 @@ const showNewPaymentDialog = () => {
const showBalancePdf = ({ id }) => {
openReport(`InvoiceOuts/${id}/download`, {}, '_blank');
};
function round(value) {
return Math.round(value * 100) / 100;
}
</script>
<template>
@ -267,6 +260,7 @@ const showBalancePdf = ({ id }) => {
:column-search="false"
@on-fetch="onFetch"
:disable-option="{ card: true }"
:footer="true"
auto-load
>
<template #column-balance="{ rowIndex }">
@ -300,6 +294,22 @@ const showBalancePdf = ({ id }) => {
/>
</QPopupEdit>
</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>
<QPageSticky :offset="[18, 18]" style="z-index: 2">
<QBtn