refactor(EntryControl): refs #8277 clean up supplierRef assignment and update comments
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Jorge Penadés 2025-04-01 09:18:33 +02:00
parent 3545d8f5a4
commit ec7a578bbc
1 changed files with 6 additions and 8 deletions

View File

@ -265,12 +265,10 @@ async function preAccount() {
params: { companyFk: selectedAgri.companyFk, year },
})
).data;
if (!supplierRef) supplierRef = year + '001';
return createInvoice(true);
} else if (selectedGestDoc) {
// If There's an allocated file for an entry? Ask to (update/updload) the file
supplierRef = +(
supplierRef = (
await axios.get(`Dms/${selectedGestDoc.gestDocFk}`, {
params: { filter: JSON.stringify({ fields: { reference: true } }) },
})
@ -280,13 +278,15 @@ async function preAccount() {
// If There's no gestDoc, upload the file
uploadFile();
}
} catch (e) {
throw e;
}
}
async function updateFile() {
await axios.post(`Dms/${selectedGestDoc.gestDocFk}/updateFile`, { dmsTypeId: 1 });
await axios.post(`Dms/${selectedGestDoc.gestDocFk}/updateFile`, { dmsTypeId: 1 }); // Sacar el id de invIN de dmsTYpe
await createInvoice(false);
}
@ -297,12 +297,11 @@ async function uploadFile() {
dmsTypeFk: 1,
warehouseFk: user.value.warehouseFk,
companyFk: companyFk,
description: supplier + '.Fact: ' + invoiceNumber,
description: supplier + '.Fact: ' + invoiceNumber, // Crear col InvocieInConfig, defaultDmsDescription
reference: invoiceNumber,
};
dmsDialog.value.show();
// Actualizo el gestDocFk de la entrada?
await createInvoice(false); // Revisar
}
async function createInvoice(isAgricultural) {
@ -312,7 +311,6 @@ async function createInvoice(isAgricultural) {
supplierRef,
isAgricultural,
});
// Una vez marcada las entradas como contabilizadas, no permitir contabilizarla otra vez?? Carlos
} catch (e) {
throw e;
} finally {