fix: refs #8277 validate supplier and company consistency in preAccount function
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
26e6427277
commit
06f721ae02
|
@ -11,8 +11,10 @@ import SupplierDescriptorProxy from '../Supplier/Card/SupplierDescriptorProxy.vu
|
|||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify';
|
||||
|
||||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
const MAXDAYS = 365;
|
||||
const DEFAULTDAYS = 60;
|
||||
const dataKey = 'entryControl';
|
||||
|
@ -203,18 +205,26 @@ function filterByDaysAgo(val) {
|
|||
}
|
||||
|
||||
async function preAccount() {
|
||||
// MIsmo proveedor
|
||||
let selectedAgri;
|
||||
const entries = selectedRows.value;
|
||||
|
||||
for (const i in entries) {
|
||||
const { supplierFk, companyFk, isAgricultural } = entries[i];
|
||||
const nextEntry = entries[+i + 1];
|
||||
|
||||
if (!selectedAgri && isAgricultural) selectedAgri = entries[i];
|
||||
if (!nextEntry) return;
|
||||
else if (nextEntry.supplierFk !== supplierFk || nextEntry.companyFk !== companyFk)
|
||||
return notify('Entries must have the same supplier and company', 'negative');
|
||||
|
||||
}
|
||||
|
||||
// Check if it is agricultural
|
||||
// si , sacar referencia de factura()
|
||||
|
||||
if(selectedAgri){
|
||||
const supplierYearRef = new Date(selectedAgri.landed).getFullYear();
|
||||
}
|
||||
|
||||
/* If vIsFarmer Then
|
||||
|
||||
vYearSupplierRef = db.getValueV("SELECT YEAR(t.landed) " & _
|
||||
"FROM vn.entry e " & _
|
||||
"JOIN vn.travel t ON t.id = e.travelFk " & _
|
||||
"WHERE e.id = # ", vEntry)
|
||||
|
||||
vSupplierRef = Nz(db.getValueV("SELECT IFNULL(MAX(CAST(ii.supplierRef AS UNSIGNED)) + 1, YEAR('" & vnNow() & "') * 1000 + 1) " & _
|
||||
"FROM vn.invoiceIn ii " & _
|
||||
"JOIN vn.supplier s ON s.id = ii.supplierFk " & _
|
||||
|
@ -226,27 +236,27 @@ vSupplierRef = Nz(db.getValueV("SELECT IFNULL(MAX(CAST(ii.supplierRef AS UNSIGNE
|
|||
vYearSupplierRef), 0)
|
||||
|
||||
If vSupplierRef = 0 Then
|
||||
vSupplierRef = vYearSupplierRef & "001"
|
||||
vSupplierRef = vYearSupplierRef & "001"
|
||||
End If
|
||||
|
||||
Else
|
||||
vSupplierRef = db.getValueV("SELECT reference FROM vn.dms WHERE id = #", Nz(Me.gestdoc_id, 0))
|
||||
End If */
|
||||
|
||||
// no es agricultural
|
||||
// no es agricultural
|
||||
// check if has gestdoc
|
||||
// Yes, ask for inherit gestdoc or not
|
||||
// No, open VNDms popup con los argumentos del codigo access
|
||||
|
||||
// Generar factura
|
||||
// Cabecera,
|
||||
// ..........................................
|
||||
// Generar factura
|
||||
// Cabecera,
|
||||
// ..........................................
|
||||
// lineas...<
|
||||
// Actualizar entradas (contabilizada, numero de factura) MAS TARDE
|
||||
|
||||
await axios.post('Entries/preAccount', {
|
||||
ids: selectedRows.value.map((row) => row.id),
|
||||
});
|
||||
// await axios.post('Entries/preAccount', {
|
||||
// ids: selectedRows.value.map((row) => row.id),
|
||||
// });
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
|
|
Loading…
Reference in New Issue