fix: refs #8388 update invoice total validation and enhance UI feedback for discrepancies
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Jorge Penadés 2025-03-17 17:13:41 +01:00
parent 5a49d72986
commit a01be2d0c1
3 changed files with 17 additions and 13 deletions

View File

@ -26,6 +26,7 @@ const invoiceId = +route.params.id;
const filter = { where: { invoiceInFk: invoiceId } };
const areRows = ref(false);
const totalTaxableBase = ref();
const noMatch = computed(() => totalAmount.value != totalTaxableBase.value);
const columns = computed(() => [
{
name: 'duedate',
@ -74,12 +75,12 @@ async function insert() {
notify(t('globals.dataSaved'), 'positive');
}
const getTaxableBase = async () => {
async function setTaxableBase() {
const { data } = await axios.get(`InvoiceIns/${invoiceId}/getTotals`);
return data.totalTaxableBase;
};
totalTaxableBase.value = data.totalTaxableBase;
}
onBeforeMount(async () => (totalTaxableBase.value = await getTaxableBase()));
onBeforeMount(async () => await setTaxableBase());
</script>
<template>
<CrudModel
@ -92,14 +93,14 @@ onBeforeMount(async () => (totalTaxableBase.value = await getTaxableBase()));
:data-required="{ invoiceInFk: invoiceId }"
v-model:selected="rowsSelected"
@on-fetch="(data) => (areRows = !!data.length)"
@save-changes="() => {}"
@save-changes="setTaxableBase"
>
<template #body="{ rows }">
<QTable
v-model:selected="rowsSelected"
selection="multiple"
:columns="columns"
:rows="rows"
:columns
:rows
row-key="$index"
:grid="$q.screen.lt.sm"
>
@ -157,13 +158,13 @@ onBeforeMount(async () => (totalTaxableBase.value = await getTaxableBase()));
<QTd>
<QChip
dense
:color="
totalAmount != totalTaxableBase
? 'negative'
: 'transparent'
"
:color="noMatch ? 'negative' : 'transparent'"
class="q-pa-xs"
:title="t('invoiceIn.summary.noMatch')"
:title="
noMatch
? t('invoiceIn.noMatch', { totalTaxableBase })
: ''
"
>
{{ toCurrency(totalAmount) }}
</QChip>

View File

@ -68,3 +68,4 @@ invoiceIn:
isBooked: Is booked
account: Ledger account
correctingFk: Rectificative
noMatch: No match with the vat({totalTaxableBase})

View File

@ -60,9 +60,11 @@ invoiceIn:
net: Neto
stems: Tallos
country: País
noMatch: No cuadra
params:
search: Id o nombre proveedor
correctedFk: Rectificada
isBooked: Contabilizada
account: Cuenta contable
correctingFk: Rectificativa
noMatch: No cuadra con el iva({totalTaxableBase})