Commit 353b333eb48554079ab165756341a6c1abe0fbf0

Authored by Eric Fernandez
1 parent f80242782c
Exists in master

cantidad por numero de unidades por embalaje

Showing 2 changed files with 2 additions and 2 deletions   Show diff stats
1 module.exports = function(comprobante, afipTablas, entities, item) { 1 module.exports = function(comprobante, afipTablas, entities, item) {
2 2
3 return { 3 return {
4 TIP: afipTablas(comprobante.identificaxComprobante.tipo).letraComprobante, // [char](1) NOT NULL, LETRA DEL COMPROBANTE (A,B,C,M) 4 TIP: afipTablas(comprobante.identificaxComprobante.tipo).letraComprobante, // [char](1) NOT NULL, LETRA DEL COMPROBANTE (A,B,C,M)
5 TCO: afipTablas(comprobante.identificaxComprobante.tipo).tipoComprobante, // [char](2) NOT NULL, TIPO DE COMPROBANTE (FT,NC,ND) 5 TCO: afipTablas(comprobante.identificaxComprobante.tipo).tipoComprobante, // [char](2) NOT NULL, TIPO DE COMPROBANTE (FT,NC,ND)
6 SUC: parseInt(comprobante.identificaxComprobante.puntoVenta), // [int] NOT NULL, PUNTO DE VENTA DE LA FACTURA 6 SUC: parseInt(comprobante.identificaxComprobante.puntoVenta), // [int] NOT NULL, PUNTO DE VENTA DE LA FACTURA
7 NCO: parseInt(comprobante.identificaxComprobante.numero), // [bigint] NOT NULL, NUMERO DE COMPROBANTE 7 NCO: parseInt(comprobante.identificaxComprobante.numero), // [bigint] NOT NULL, NUMERO DE COMPROBANTE
8 PRO: entities.proveedores.COD, // [int] NOT NULL, CODIGO DEL PROVEEDOR NECESITAS RELACION -- BUSCAR SI ENVIAN EL CUIT DEL PROVEEDOR SELECT COD FROM PROVEED WHERE CUIT= '30-54775125-2' 8 PRO: entities.proveedores.COD, // [int] NOT NULL, CODIGO DEL PROVEEDOR NECESITAS RELACION -- BUSCAR SI ENVIAN EL CUIT DEL PROVEEDOR SELECT COD FROM PROVEED WHERE CUIT= '30-54775125-2'
9 ORD: parseInt(item.numeroLinea), // [int] NOT NULL, ORDEN DEL ITEM, EMPIEZA EN 1 Y SUMA DE A 1 POR CADA REGISTRO DE MOVIMIENTO 9 ORD: parseInt(item.numeroLinea), // [int] NOT NULL, ORDEN DEL ITEM, EMPIEZA EN 1 Y SUMA DE A 1 POR CADA REGISTRO DE MOVIMIENTO
10 COD: item.CodSec, // [int] NOT NULL, SECTOR DEBO DEL PRODUCTO 10 COD: item.CodSec, // [int] NOT NULL, SECTOR DEBO DEL PRODUCTO
11 ART: item.CodArt, // [int] NOT NULL, ARTICULO DEBO DEL PRODUCTO ESTOS 2 SE OBTIENEN A PARTIR DEL CODIGO DE BARRAS: SELECT CodSec AS SECTOR,CodArt AS ARTICULO FROM CODBAR WHERE CODBAR='03239210540' 11 ART: item.CodArt, // [int] NOT NULL, ARTICULO DEBO DEL PRODUCTO ESTOS 2 SE OBTIENEN A PARTIR DEL CODIGO DE BARRAS: SELECT CodSec AS SECTOR,CodArt AS ARTICULO FROM CODBAR WHERE CODBAR='03239210540'
12 RUB: item.CodRub, // [int] NOT NULL, CODIGO DE RUBRO SE OBTIENE DE LA TABLA ARTICULOS SELECT DET_LAR,CODRUB FROM ARTICULOS WHERE CODSEC=SECTOR AND CODART=ARTICULO (DATOS OBTENIDOS EN NOTA ANTERIOR 12 RUB: item.CodRub, // [int] NOT NULL, CODIGO DE RUBRO SE OBTIENE DE LA TABLA ARTICULOS SELECT DET_LAR,CODRUB FROM ARTICULOS WHERE CODSEC=SECTOR AND CODART=ARTICULO (DATOS OBTENIDOS EN NOTA ANTERIOR
13 TIO: item.DET_LAR, // [varchar](60) NOT NULL DESCRIPCION DEL PRODUCTO DEL PUNTO ANTERIOR DET_LAR 13 TIO: item.DET_LAR, // [varchar](60) NOT NULL DESCRIPCION DEL PRODUCTO DEL PUNTO ANTERIOR DET_LAR
14 LI0: item.descripcion, // [varchar](60) NOT NULL, DESCRIPCION ENVIADA POR EL PROVEEDOR 14 LI0: item.descripcion, // [varchar](60) NOT NULL, DESCRIPCION ENVIADA POR EL PROVEEDOR
15 CAN: item.cantidad, // [money] NOT NULL, CANTIDAD DEL ITEM 15 CAN: item.cantidad * item.numeroUnidadesPorUnidadEmbalaje, // [money] NOT NULL, CANTIDAD DEL ITEM
16 PUN: item.precioUnitario, // [decimal](20, 8) NOT NULL PRECIO UNITARIO DEL PRODUCTO ITEM 16 PUN: item.precioUnitario, // [decimal](20, 8) NOT NULL PRECIO UNITARIO DEL PRODUCTO ITEM
17 IMI: item.impuestoInterno ? item.impuestoInterno.importeImpuesto : 0, // [money] NOT NULL, IMPORTE IMPUESTOS INTERNOS DEL ITEM 17 IMI: item.impuestoInterno ? item.impuestoInterno.importeImpuesto : 0, // [money] NOT NULL, IMPORTE IMPUESTOS INTERNOS DEL ITEM
18 IVA: item.alicuotaIVAAplicable ? (item.precioUnitario * item.alicuotaIVAAplicable) / 100 : 0, 18 IVA: item.alicuotaIVAAplicable ? (item.precioUnitario * item.alicuotaIVAAplicable) / 100 : 0,
19 PUT: item.precioUnitario, // [money] NOT NULL, IGUAL AL PUN 19 PUT: item.precioUnitario, // [money] NOT NULL, IGUAL AL PUN
20 LEG: 0, // [int] NOT NULL, FIJO 0 20 LEG: 0, // [int] NOT NULL, FIJO 0
21 CMF: 0, // [int] NOT NULL, FIJO 0 21 CMF: 0, // [int] NOT NULL, FIJO 0
22 TUR: 0, // [int] NOT NULL, FIJO 0 22 TUR: 0, // [int] NOT NULL, FIJO 0
23 PLA: 0, // [int] NOT NULL, FIJO 0 23 PLA: 0, // [int] NOT NULL, FIJO 0
24 LUG: 0, // [int] NOT NULL, FIJO 0 24 LUG: 0, // [int] NOT NULL, FIJO 0
25 ESC: 0, // [bit] NOT NULL, FIJO 0 25 ESC: 0, // [bit] NOT NULL, FIJO 0
26 TAN: 0, // [int] NOT NULL, FIJO 0 26 TAN: 0, // [int] NOT NULL, FIJO 0
27 CCO: 0, // [bigint] NOT NULL, FIJO 0 27 CCO: 0, // [bigint] NOT NULL, FIJO 0
28 E_HD: '', // [varchar](8) NOT NULL, FIJO '' VACIO NO NULO 28 E_HD: '', // [varchar](8) NOT NULL, FIJO '' VACIO NO NULO
29 C_HD: '', // [varchar](1) NOT NULL, FIJO '' VACIO NO NULO 29 C_HD: '', // [varchar](1) NOT NULL, FIJO '' VACIO NO NULO
30 DTO: 0, // Comprobante.detalleDescuentosItemFactura.importeDescuento; [money] NOT NULL, IMPORTE DESCUENTO DE LA FACTURA 30 DTO: 0, // Comprobante.detalleDescuentosItemFactura.importeDescuento; [money] NOT NULL, IMPORTE DESCUENTO DE LA FACTURA
31 PTA: 0, // [int] NOT NULL, FIJO 0 31 PTA: 0, // [int] NOT NULL, FIJO 0
32 SUBM: 0, // [int] NOT NULL, FIJO 0 32 SUBM: 0, // [int] NOT NULL, FIJO 0
33 E_HD2: '', // [varchar](12) NOT NULL, FIJO '' VACIO NO NULO 33 E_HD2: '', // [varchar](12) NOT NULL, FIJO '' VACIO NO NULO
34 C_HD2: '', // [varchar](1) NOT NULL, FIJO '' VACIO NO NULO 34 C_HD2: '', // [varchar](1) NOT NULL, FIJO '' VACIO NO NULO
35 COMISION: 0, // [money] NOT NULL, FIJO 0 35 COMISION: 0, // [money] NOT NULL, FIJO 0
36 LIQ_VTA: '', // [varchar](20) NOT NULL, FIJO '' VACIO NO NULO 36 LIQ_VTA: '', // [varchar](20) NOT NULL, FIJO '' VACIO NO NULO
37 COSTO_PMOV: item.precioUnitario, // [money] NOT NULL, IGUAL AL PUN 37 COSTO_PMOV: item.precioUnitario, // [money] NOT NULL, IGUAL AL PUN
38 SAL_ITEM: 0, // [money] NOT NULL, fijo 0 es el que se llenara al mostrar en la tablet o telefono para que llene operador 38 SAL_ITEM: 0, // [money] NOT NULL, fijo 0 es el que se llenara al mostrar en la tablet o telefono para que llene operador
39 TASIVA: item.alicuotaIVAAplicable, // [money] NOT NULL, TASA DE IVA DEL ITEM = 21.00 / 10.50 / ETC. 39 TASIVA: item.alicuotaIVAAplicable, // [money] NOT NULL, TASA DE IVA DEL ITEM = 21.00 / 10.50 / ETC.
40 gln: comprobante.identificaxSucursalReceptorFactura.glnSucursal, //gln sucursal 40 gln: comprobante.identificaxSucursalReceptorFactura.glnSucursal, //gln sucursal
41 codigoBarras: item.codigoUPCEAN13 41 codigoBarras: item.codigoUPCEAN13
42 }; 42 };
43 } 43 }
44 44
1 module.exports = 1 module.exports =
2 config = require('./config/config.json'); 2 config = require('./config/config.json');
3 knex = require('knex')(config.db), 3 knex = require('knex')(config.db),
4 express = require('express'); 4 express = require('express');
5 app = express(); 5 app = express();
6 wsServer = require('./webSocketServer/index')(); 6 wsServer = require('./webSocketServer/index')();
7 moment = require('moment'); 7 moment = require('moment');
8 fs = require('fs'); 8 fs = require('fs');
9 9
10 10
11 app.listen(config.portWebService); 11 app.listen(config.portWebService);
12 app.use(express.json({ limit: '50mb' })); 12 app.use(express.json({ limit: '50mb' }));
13 13
14 require('./watch/index')(config.dir, onGetFile); 14 require('./watch/index')(config.dir, onGetFile);
15 15
16 app.use(function(req, res, next) { 16 app.use(function(req, res, next) {
17 res.setHeader('Access-Control-Allow-Origin', '*'); 17 res.setHeader('Access-Control-Allow-Origin', '*');
18 res.setHeader( 18 res.setHeader(
19 'Access-Control-Allow-Headers', 19 'Access-Control-Allow-Headers',
20 'Origin, X-Requested-With, Content-Type, Accept, X-Terminal-Key, X-Nombre-Usuario, X-Punto-Venta' 20 'Origin, X-Requested-With, Content-Type, Accept, X-Terminal-Key, X-Nombre-Usuario, X-Punto-Venta'
21 ); 21 );
22 res.setHeader('Access-Control-Allow-Methods', 'POST, GET, DELETE, OPTIONS'); 22 res.setHeader('Access-Control-Allow-Methods', 'POST, GET, DELETE, OPTIONS');
23 next(); 23 next();
24 }); 24 });
25 25
26 app.use('/gateway-debo', require('./rutas/comprobantes')); 26 app.use('/gateway-debo', require('./rutas/comprobantes'));
27 app.use('/gateway-debo', require('./rutas/login')); 27 app.use('/gateway-debo', require('./rutas/login'));
28 28
29 function onGetFile(fileString, nameFile) { 29 function onGetFile(fileString, nameFile) {
30 30
31 if (!fileString) { 31 if (!fileString) {
32 console.log(`no se pueden los datos del archivo ${nameFile}`); 32 console.log(`no se pueden los datos del archivo ${nameFile}`);
33 }; 33 };
34 34
35 require('./debo/validacion')(nameFile).then(function() { 35 require('./debo/validacion')(nameFile).then(function() {
36 36
37 console.log(`se valida que no exista... ${nameFile}`); 37 console.log(`se valida que no exista... ${nameFile}`);
38 38
39 var planex = require('./planex/index')(fileString); 39 var planex = require('./planex/index')(fileString);
40 40
41 console.log(`obtengo objeto planex de ${nameFile}`); 41 console.log(`obtengo objeto planex de ${nameFile}`);
42 // Traigo proveedor, empresa 42 // Traigo proveedor, empresa
43 require('./debo/relaciones')(planex, wsServer).then(function(result) { 43 require('./debo/relaciones')(planex, wsServer).then(function(result) {
44 44
45 console.log(`obtengo relaciones debo ${nameFile}`); 45 console.log(`obtengo relaciones debo ${nameFile}`);
46 var planex = result.planex; 46 var planex = result.planex;
47 47
48 var entities = {}; 48 var entities = {};
49 49
50 entities.proveedores = result.values[0]; 50 entities.proveedores = result.values[0];
51 entities.empresa = result.values[1]; 51 entities.empresa = result.values[1];
52 52 console.log(planex);
53 var debo = require('./debo/index')(planex, entities); 53 var debo = require('./debo/index')(planex, entities);
54 54
55 require('./db/index')(debo, nameFile); 55 require('./db/index')(debo, nameFile);
56 56
57 }).catch(function(e) { 57 }).catch(function(e) {
58 58
59 console.log(e); 59 console.log(e);
60 }); 60 });
61 }).catch(function(err) { 61 }).catch(function(err) {
62 62
63 console.log(err); 63 console.log(err);
64 }); 64 });
65 } 65 }
66 66
67 console.log('listen websocket port ' + config.port); 67 console.log('listen websocket port ' + config.port);
68 console.log('listen webservice port ' + config.portWebService); 68 console.log('listen webservice port ' + config.portWebService);
69 console.log('Ejecutar programa como administrador...'); 69 console.log('Ejecutar programa como administrador...');
70 70