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 VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import useNotify from 'src/composables/useNotify';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const { notify } = useNotify();
|
||||||
const MAXDAYS = 365;
|
const MAXDAYS = 365;
|
||||||
const DEFAULTDAYS = 60;
|
const DEFAULTDAYS = 60;
|
||||||
const dataKey = 'entryControl';
|
const dataKey = 'entryControl';
|
||||||
|
@ -203,18 +205,26 @@ function filterByDaysAgo(val) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function preAccount() {
|
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
|
// Check if it is agricultural
|
||||||
// si , sacar referencia de factura()
|
if(selectedAgri){
|
||||||
|
const supplierYearRef = new Date(selectedAgri.landed).getFullYear();
|
||||||
|
}
|
||||||
|
|
||||||
/* If vIsFarmer Then
|
/* 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) " & _
|
vSupplierRef = Nz(db.getValueV("SELECT IFNULL(MAX(CAST(ii.supplierRef AS UNSIGNED)) + 1, YEAR('" & vnNow() & "') * 1000 + 1) " & _
|
||||||
"FROM vn.invoiceIn ii " & _
|
"FROM vn.invoiceIn ii " & _
|
||||||
"JOIN vn.supplier s ON s.id = ii.supplierFk " & _
|
"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)
|
vYearSupplierRef), 0)
|
||||||
|
|
||||||
If vSupplierRef = 0 Then
|
If vSupplierRef = 0 Then
|
||||||
vSupplierRef = vYearSupplierRef & "001"
|
vSupplierRef = vYearSupplierRef & "001"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
vSupplierRef = db.getValueV("SELECT reference FROM vn.dms WHERE id = #", Nz(Me.gestdoc_id, 0))
|
vSupplierRef = db.getValueV("SELECT reference FROM vn.dms WHERE id = #", Nz(Me.gestdoc_id, 0))
|
||||||
End If */
|
End If */
|
||||||
|
|
||||||
// no es agricultural
|
// no es agricultural
|
||||||
// check if has gestdoc
|
// check if has gestdoc
|
||||||
// Yes, ask for inherit gestdoc or not
|
// Yes, ask for inherit gestdoc or not
|
||||||
// No, open VNDms popup con los argumentos del codigo access
|
// No, open VNDms popup con los argumentos del codigo access
|
||||||
|
|
||||||
// Generar factura
|
// Generar factura
|
||||||
// Cabecera,
|
// Cabecera,
|
||||||
// ..........................................
|
// ..........................................
|
||||||
// lineas...<
|
// lineas...<
|
||||||
// Actualizar entradas (contabilizada, numero de factura) MAS TARDE
|
// Actualizar entradas (contabilizada, numero de factura) MAS TARDE
|
||||||
|
|
||||||
await axios.post('Entries/preAccount', {
|
// await axios.post('Entries/preAccount', {
|
||||||
ids: selectedRows.value.map((row) => row.id),
|
// ids: selectedRows.value.map((row) => row.id),
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
Loading…
Reference in New Issue