feat: refs #8277 enhance pre-accounting process and integrate user warehouse data
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
This commit is contained in:
parent
998cde58a1
commit
1badf92b1c
|
@ -14,10 +14,11 @@ import axios from 'axios';
|
||||||
import useNotify from 'src/composables/useNotify';
|
import useNotify from 'src/composables/useNotify';
|
||||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||||
import VnDms from 'src/components/common/VnDms.vue';
|
import VnDms from 'src/components/common/VnDms.vue';
|
||||||
import { date } from 'quasar';
|
import { useState } from 'src/composables/useState';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
const user = useState().getUser();
|
||||||
const dialog = ref();
|
const dialog = ref();
|
||||||
const dmsDialog = ref();
|
const dmsDialog = ref();
|
||||||
const MAXDAYS = 365;
|
const MAXDAYS = 365;
|
||||||
|
@ -237,7 +238,7 @@ async function preAccount() {
|
||||||
await axios.get('InvoiceIns/getMaxRef', {
|
await axios.get('InvoiceIns/getMaxRef', {
|
||||||
params: { companyFk: selectedAgri.companyFk, year },
|
params: { companyFk: selectedAgri.companyFk, year },
|
||||||
})
|
})
|
||||||
).data?.supplierRef;
|
).data;
|
||||||
|
|
||||||
return createInvoice(true);
|
return createInvoice(true);
|
||||||
} else if (selectedGestDoc) {
|
} else if (selectedGestDoc) {
|
||||||
|
@ -247,28 +248,19 @@ async function preAccount() {
|
||||||
// If There's no gestDoc, upload the file
|
// If There's no gestDoc, upload the file
|
||||||
uploadFile();
|
uploadFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generar factura
|
|
||||||
// Cabecera,
|
|
||||||
// ..........................................
|
|
||||||
// lineas...
|
|
||||||
// Actualizar entradas (contabilizada, numero de factura) MAS TARDE
|
|
||||||
|
|
||||||
// await axios.post('Entries/preAccount', {
|
|
||||||
// ids: selectedRows.value.map((row) => row.id),
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateFile() {
|
async function updateFile() {
|
||||||
await axios.post(`Dms/${selectedGestDoc.gestDocFk}/updateFile`, { dmsTypeId: 1 });
|
await axios.post(`Dms/${selectedGestDoc.gestDocFk}/updateFile`, { dmsTypeId: 1 });
|
||||||
|
table.value.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function uploadFile() {
|
async function uploadFile() {
|
||||||
const firstSelectedEntry = selectedRows.value.at(0);
|
const firstSelectedEntry = selectedRows.value.at(0);
|
||||||
const { supplier, warehouseInFk, companyFk, invoiceNumber } = firstSelectedEntry;
|
const { supplier, companyFk, invoiceNumber } = firstSelectedEntry;
|
||||||
dmsData.value = {
|
dmsData.value = {
|
||||||
dmsTypeFk: 1,
|
dmsTypeFk: 1,
|
||||||
warehouseFk: warehouseInFk,
|
warehouseFk: user.value.warehouseFk,
|
||||||
companyFk: companyFk,
|
companyFk: companyFk,
|
||||||
description: supplier + '.Fact: ' + invoiceNumber,
|
description: supplier + '.Fact: ' + invoiceNumber,
|
||||||
reference: invoiceNumber,
|
reference: invoiceNumber,
|
||||||
|
@ -285,18 +277,32 @@ async function createInvoice(isAgricultural) {
|
||||||
currencyFk,
|
currencyFk,
|
||||||
gestDocFk: docFk,
|
gestDocFk: docFk,
|
||||||
} = selectedRows.value.at(0);
|
} = selectedRows.value.at(0);
|
||||||
const lastDay = new Date(landed.getFullYear(), landed.getMonth() + 1, 0).getDate();
|
const dateLanded = new Date(landed);
|
||||||
|
const lastDay = new Date(dateLanded.getFullYear(), dateLanded.getMonth() + 1, 0);
|
||||||
const issued = isAgricultural ? lastDay : shipped;
|
const issued = isAgricultural ? lastDay : shipped;
|
||||||
const siiTrascendencyInvoiceInFk = isAgricultural ? 2 : 1;
|
const siiTrascendencyInvoiceInFk = isAgricultural ? 2 : 1;
|
||||||
await axios.post('InvoiceIns', {
|
let err;
|
||||||
supplierFk,
|
|
||||||
supplierRef,
|
try {
|
||||||
issued,
|
// Create invoice
|
||||||
companyFk,
|
await axios.post('InvoiceIns', {
|
||||||
docFk,
|
supplierFk,
|
||||||
currencyFk,
|
supplierRef,
|
||||||
siiTrascendencyInvoiceInFk,
|
issued,
|
||||||
});
|
companyFk,
|
||||||
|
docFk,
|
||||||
|
currencyFk,
|
||||||
|
siiTrascendencyInvoiceInFk,
|
||||||
|
});
|
||||||
|
|
||||||
|
// create tax, due-day and intrastat
|
||||||
|
|
||||||
|
// update entries
|
||||||
|
} catch (e) {
|
||||||
|
throw e;
|
||||||
|
} finally {
|
||||||
|
table.value.reload();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
Loading…
Reference in New Issue