diff --git a/db/index.js b/db/index.js index e490926..bb55fea 100644 --- a/db/index.js +++ b/db/index.js @@ -27,7 +27,7 @@ module.exports = function(comprobante, nameFile) { fs.rename(nameFile, pathDest, function(err) { if(err) console.log(err); - console.log('COMPROBANTE GUARDADO CON ÉXITO'); + console.log('COMPROBANTE PROCESADO Y GUARDADO EN PMAEFACT_TEMP CON ÉXITO'); }); }).catch(function(e) { console.log(e); diff --git a/debo/relaciones.js b/debo/relaciones.js index 5d8e0c4..306e166 100644 --- a/debo/relaciones.js +++ b/debo/relaciones.js @@ -8,8 +8,8 @@ module.exports = function(planex, wsServer) { var digitoVerificador = planex.identificaxEmisor.cuit[planex.identificaxEmisor.cuit.length - 1]; var cuitToDebo = tipoCuit + '-' + planex.identificaxEmisor.cuit.slice(2, 10) + '-' + digitoVerificador; - var promiseProveedores = wsServer.getEntidad(planex.identificaxReceptorFactura.glnReceptor, 'PROVEED', {CUIT: cuitToDebo}); - var promiseEmp = wsServer.getEntidad(planex.identificaxReceptorFactura.glnReceptor, 'APAREMP'); + var promiseProveedores = wsServer.getEntidad(planex.identificaxSucursalReceptorFactura.glnSucursal, 'PROVEED', {CUIT: cuitToDebo}); + var promiseEmp = wsServer.getEntidad(planex.identificaxSucursalReceptorFactura.glnSucursal, 'APAREMP'); planex.itemsFactura.forEach(item => { @@ -18,7 +18,7 @@ module.exports = function(planex, wsServer) { item.codigoUPCEAN13 + '\''; promesasArticulo.push( - wsServer.getEntidad(planex.identificaxReceptorFactura.glnReceptor, null, {}, queryString) + wsServer.getEntidad(planex.identificaxSucursalReceptorFactura.glnSucursal, null, {}, queryString) ); }); @@ -48,9 +48,7 @@ module.exports = function(planex, wsServer) { resolve({planex, values}); - }).catch(function(e) { - reject(e); - }); + }).catch(reject); }); } diff --git a/index.js b/index.js index f005a9b..31573dc 100644 --- a/index.js +++ b/index.js @@ -55,6 +55,7 @@ function onGetFile(fileString, nameFile) { require('./db/index')(debo, nameFile); }).catch(function(e) { + console.log(e); }); }).catch(function(err) { diff --git a/rutas/comprobantes.js b/rutas/comprobantes.js index 56471d8..8f437ec 100644 --- a/rutas/comprobantes.js +++ b/rutas/comprobantes.js @@ -125,7 +125,7 @@ router.post('/comprobante', function(req, res) { })); }; - cuerpo.estado == 'rechazado' ? cuerpo.CAN = 0 : false; + cuerpo.estado == 'rechazado' ? cuerpo.cantidadRecibida = 0 : false; delete cuerpo.GLN; delete cuerpo.C_HD2;