feat: refs #8388 add validation for missing VAT and Transaction fields in invoice booking
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
e3706094c2
commit
5147967bc0
|
@ -15,6 +15,20 @@ const { store } = useArrayData();
|
|||
async function checkToBook(id) {
|
||||
let messages = [];
|
||||
|
||||
const hasProblemWithTax = (
|
||||
await axios.get('InvoiceInTaxes/count', {
|
||||
params: {
|
||||
where: JSON.stringify({
|
||||
invoiceInFk: id,
|
||||
or: [{ taxTypeSageFk: null }, { transactionTypeSageFk: null }],
|
||||
}),
|
||||
},
|
||||
})
|
||||
).data?.count;
|
||||
|
||||
if (hasProblemWithTax)
|
||||
messages.push(t('The VAT and Transaction fields have not been informed'));
|
||||
|
||||
const { data: totals } = await axios.get(`InvoiceIns/${id}/getTotals`);
|
||||
const taxableBaseNotEqualDueDay = totals.totalDueDay != totals.totalTaxableBase;
|
||||
const vatNotEqualDueDay = totals.totalDueDay != totals.totalVat;
|
||||
|
@ -43,11 +57,7 @@ async function checkToBook(id) {
|
|||
title: t('Are you sure you want to book this invoice?'),
|
||||
message: messages.reduce((acc, msg) => `${acc}<p>${msg}</p>`, ''),
|
||||
},
|
||||
}).onOk(async () => {
|
||||
await toBook(id);
|
||||
|
||||
axios.get();
|
||||
});
|
||||
}).onOk(() => toBook(id));
|
||||
}
|
||||
|
||||
async function toBook(id) {
|
||||
|
@ -74,4 +84,5 @@ es:
|
|||
It was not able to book the invoice: No se pudo contabilizar la factura
|
||||
Some due dates are less than or equal to today: Algún vencimiento tiene una fecha menor o igual que hoy
|
||||
The sum of the taxable bases does not match the due dates: La suma de las bases imponibles no coincide con la de los vencimientos
|
||||
The VAT and Transaction fields have not been informed: No se han informado los campos de IVA y Transacción
|
||||
</i18n>
|
||||
|
|
Loading…
Reference in New Issue