Commit ded337bfb5466447aa46fbec7cc4bbc38f09135c

Authored by Eric Fernandez
1 parent a1c0bdd94e
Exists in master

refaktor

... ... @@ -12,6 +12,7 @@ module.exports = function(comprobante, nameFile) {
12 12 .then(saveDebo);
13 13  
14 14 function saveDebo(id) {
  15 +
15 16 comprobante.cabecera.idTransaccion = id;
16 17 var promesas = [knex('PMAEFACT_TEMP').insert(comprobante.cabecera)];
17 18  
debo/cabeceraDebo.js
... ... @@ -87,6 +87,7 @@ module.exports = function(comprobante, afipTablas, entities) {
87 87 CABA_PER: 0, // [money] NOT NULL, IMPORTE PERCEPCION CABA
88 88 PERMUN: comprobante.importesTotales.importeImpuestosMunicipales, // [money] NOT NULL, IMPORTE PERCEPCIONES MUNICIPALES
89 89 IMI2: 0, // [money] NOT NULL, FIJO 0
90   - GLN: comprobante.identificaxSucursalReceptorFactura.glnSucursal
  90 + GLN: comprobante.identificaxSucursalReceptorFactura.glnSucursal,
  91 + origen: 'planex'
91 92 };
92 93 }
... ... @@ -1,47 +0,0 @@
1   -// Update with your config settings.
2   -
3   -module.exports = {
4   -
5   - development: {
6   - client: 'mssql',
7   - connection: {
8   - host: '10.231.45.211',
9   - user: 'sa',
10   - password: 'xxzza',
11   - database: 'UNITYOIL_28082017'
12   - }
13   - },
14   -
15   - staging: {
16   - client: 'postgresql',
17   - connection: {
18   - database: 'my_db',
19   - user: 'username',
20   - password: 'password'
21   - },
22   - pool: {
23   - min: 2,
24   - max: 10
25   - },
26   - migrations: {
27   - tableName: 'knex_migrations'
28   - }
29   - },
30   -
31   - production: {
32   - client: 'postgresql',
33   - connection: {
34   - database: 'my_db',
35   - user: 'username',
36   - password: 'password'
37   - },
38   - pool: {
39   - min: 2,
40   - max: 10
41   - },
42   - migrations: {
43   - tableName: 'knex_migrations'
44   - }
45   - }
46   -
47   -};
migrations/20190626112130_v0.0.1.js
... ... @@ -1,37 +0,0 @@
1   -
2   -exports.up = function(knex, Promise) {
3   - return Promise.all([
4   - knex.schema
5   - .createTable('planex_transacciones', function(table) {
6   -
7   - table.increments();
8   - table.string('archivoRecibido', 1024);
9   - table.string('archivoEnviado', 1024);
10   - // 0: insertado, 1 enviado
11   - table.integer('estado');
12   - table.string('apies');
13   - table.string('GLN');
14   - })
15   - .table('PMAEFACT_TEMP', function(table) {
16   -
17   - table.string('GLN');
18   - table.bigInteger('idTransaccion');
19   - })
20   - .table('PMOVFACT_TEMP', function(table) {
21   -
22   - table.string('GLN');
23   - table.bigInteger('codigoBarras');
24   - })
25   - ]);
26   -};
27   -
28   -exports.down = function(knex, Promise) {
29   - return Promise.all([
30   - knex.schema
31   - .dropTable('planex_transacciones')
32   - .table('PMAEFACT_TEMP', function(table) {
33   -
34   - table.dropColumns('GLN', 'idTransaccion');
35   - })
36   - ]);
37   -};
rutas/comprobantes.js
... ... @@ -27,7 +27,7 @@ router.get('/comprobantes/:gln*?', function(req, res) {
27 27  
28 28 var cuerpos = data[1].filter((cuerpo) => {
29 29 let idCuerpo = cuerpo.TIP + cuerpo.TCO + cuerpo.SUC + cuerpo.NCO;
30   - return idCuerpo == idCabecera
  30 + return idCuerpo == idCabecera;
31 31 });
32 32  
33 33 result.push({
... ... @@ -103,7 +103,7 @@ router.post('/comprobante', function(req, res) {
103 103 PVE: req.body.cabecera.SUC,
104 104 NCO: req.body.cabecera.NCO,
105 105 ORD: cuerpo.ORD,
106   - CAN: cuerpo.recibido || cuerpo.CAN,
  106 + CAN: cuerpo.cantidadRecibida,
107 107 PUN: cuerpo.PUN,
108 108 COD: req.body.cabecera.COD,
109 109 DTO: cuerpo.DTO,