Commit 585772b1bb4246884ab20e48780ac5fd71db599c

Authored by Eric Fernandez
1 parent f00ea060ad
Exists in master

avances

Showing 3 changed files with 32 additions and 26 deletions   Show diff stats
debo/cabeceraDebo.js
... ... @@ -14,22 +14,22 @@ module.exports = function(comprobante, afipTablas, entities) {
14 14 TCA: 1, // [money] NOT NULL, FIJO 1
15 15 DTO: comprobante.descuentosGlobalesFactura.importe, // [money] NOT NULL, DESCUENTO TOTAL SUMATORIA DE LOS DTO POR ITEM
16 16 PDT: 0, // [money] NOT NULL, FIJO 0
17   - NET: null, // [money] NOT NULL, SUMATORIA DE LOS NETOS POR ITEM QUE TIENEN IVA <> 0
18   - NEE: null, // [money] NOT NULL, SUMATORIA DE LOS NETOS POR ITEM QUE TIENEN IVA = 0
  17 + NET: comprobante.importesTotales.netoGravado, // [money] NOT NULL, SUMATORIA DE LOS NETOS POR ITEM QUE TIENEN IVA <> 0
  18 + NEE: comprobante.importesTotales.importeOperacionesExentas, // [money] NOT NULL, SUMATORIA DE LOS NETOS POR ITEM QUE TIENEN IVA = 0
19 19 IRI: comprobante.detallesImportesIVA.importeLiquidado, // [money] NOT NULL, SUMATORIA DE LOS IVA POR ITEM
20 20 IRS: 0, // [money] NOT NULL, FIJO 0
21 21 IMI: comprobante.importesTotales.importeImpuestosInternos, // [money] NOT NULL, SUMATORIA DE LOS IMPUESTOS INTERNOS POR ITEM
22   - RGA: null, // [money] NOT NULL, IMPORTE RETENCION DE GANANCIAS
23   - RIB: null, // [money] NOT NULL, IMPORTE RETENCION DE INGRESOS BRUTOS
24   - PIV: null, // [money] NOT NULL, IMPORTE PERCEPCION DE IVA
  22 + RGA: 0, // [money] NOT NULL, IMPORTE RETENCION DE GANANCIAS
  23 + RIB: 0, // [money] NOT NULL, IMPORTE RETENCION DE INGRESOS BRUTOS
  24 + PIV: null, // [money] NOT NULL, IMPORTE PERCEPCION DE IVA, SECTOR 90 C05
25 25 CNG: comprobante.importesTotales.totalConceptosNoNetoGravado, // [money] NULL, IMPORTE DE CONCEPTOS NO GRAVADOS
26   - TOT: null, // [money] NOT NULL, IMPORTE TOTAL DE LA FACTURA
  26 + TOT: comprobante.importesTotales.totalOperacion, // [money] NOT NULL, IMPORTE TOTAL DE LA FACTURA
27 27 ZON: entities.empresa.ZON, // [int] NOT NULL, NUMERO DE LA EMPRESA SELECT ZON FROM APAREMP
28   - FEV: comprobante.identificaxComprobante.fechaComprobante, // [datetime] NULL, FECHA DE VENCIMIENTO
29   - OCP: null, // [char](10) NOT NULL, SI VIENE LA ORDEN DE COMPRA FORMATO "0000000000" (DOS PRIMERO PARA PVE Y 8 ULTIMOS EL NUMERO DE LA OC)
  28 + FEV: comprobante.identificaxComprobante.fechaVencimiento, // [datetime] NULL, FECHA DE VENCIMIENTO
  29 + OCP: comprobante.comprobantesReferencia[0].numeroDocumentoReferencia, // [char](10) NOT NULL, SI VIENE LA ORDEN DE COMPRA FORMATO "0000000000" (DOS PRIMERO PARA PVE Y 8 ULTIMOS EL NUMERO DE LA OC)
30 30 OPE: 0, // [int] NOT NULL, FIJO 0
31 31 REC: 0, // [bigint] NOT NULL, FIJO 0
32   - FEP: null, // [datetime] NULL, ITEM FECHA FACTURA
  32 + FEP: comprobante.identificaxComprobante.fechaComprobante, // [datetime] NULL, ITEM FECHA FACTURA
33 33 NPE: 0, // [bigint] NOT NULL, NOTA DE PEDIDO FIJO 0
34 34 CPA: 0, // [int] NOT NULL, FIJO 0
35 35 ENV: 0, // [int] NOT NULL, FIJO 0
... ... @@ -52,21 +52,21 @@ module.exports = function(comprobante, afipTablas, entities) {
52 52 CCA8: 0, // [int] NOT NULL, FIJO 0
53 53 CCA0: 0, // [int] NOT NULL, FIJO 0
54 54 OBS: comprobante.importesTotales.observaciones, // [varchar](60) NOT NULL, SI VIENEN OBSERVACIONES PONER AQUI SINO VACIO NO NULO
55   - RIV: null, // [money] NOT NULL, IMPORTE RETENCION DE IVA
  55 + RIV: 0, // [money] NOT NULL, IMPORTE RETENCION DE IVA
56 56 FECCAI: comprobante.identificaxComprobante.fechaVencimientoCai, // [smalldatetime] NOT NULL, FECHA DEL CAI
57 57 CAI: comprobante.identificaxComprobante.cai, // [char](16) NOT NULL, NUMERO DE CAI
58 58 CHO: 0, // [int] NOT NULL, FIJO 0
59 59 CTR: '', // [char](1) NOT NULL, VACIO NO NULO
60   - PER: null, // [money] NOT NULL, IMPORTE DE PERCEPCIONES
  60 + PER: comprobante.importesTotales.importeIB, // [money] NOT NULL, IMPORTE DE PERCEPCIONES
61 61 CCA9: 0, // [int] NOT NULL, FIJO 0
62 62 FECVEN: comprobante.identificaxComprobante.fechaVencimiento, // [smalldatetime] NOT NULL, FECHA DE VENCIMIENTO DE LA FACTURA
63   - CNG2: null, // [money] NOT NULL, IMPORTE DE CONCEPTOS NO GRAVADOS 2
  63 + CNG2: 0, // [money] NOT NULL, IMPORTE DE CONCEPTOS NO GRAVADOS 2
64 64 E_HD: '', // [varchar](8) NOT NULL, VACIO NO NULO
65 65 C_HD: '', // [varchar](1) NOT NULL, VACIO NO NULO
66   - RSS: null, // [money] NOT NULL, IMPORTE RETENCIONS SUSS
  66 + RSS: 0, // [money] NOT NULL, IMPORTE RETENCIONS SUSS
67 67 E_HD2: '', // [varchar](12) NOT NULL, VACIO NO NULO
68 68 C_HD2: '', // [varchar](1) NOT NULL, VACIO NO NULO
69   - DTO2: null, // [money] NOT NULL, IMPORTE DE OTROS DESCUENTOS
  69 + DTO2: 0, // [money] NOT NULL, IMPORTE DE OTROS DESCUENTOS
70 70 ENLP: 0, // [bit] NOT NULL, FIJO 0
71 71 COD_TRANS: comprobante.identificaxComprobante.numeroRegistrado, // [bigint] NOT NULL, VER DE PONER EL NUMERO DE REFERENCIA QUE PUEDA UNIRNOS A LO QUE VIENE DESDE PLANEX
72 72 RETMUN: comprobante.importesTotales.importeImpuestosMunicipales, // [money] NOT NULL, IMPORTE DE RETENCIONES MUNICIPALES
... ... @@ -76,15 +76,15 @@ module.exports = function(comprobante, afipTablas, entities) {
76 76 AUX2: 0, // [money] NOT NULL, FIJO 0
77 77 AUX3: 0, // [money] NOT NULL, FIJO 0
78 78 AUX4: 0, // [money] NOT NULL, FIJO 0
79   - ARBA: null, // [money] NOT NULL, IMPORTE RETENCION ARBA
80   - DGR: null, // [money] NOT NULL, IMPORTE RETENCION DGR
81   - DTO_PIE: null, // [money] NOT NULL, IMPORTE DE DESCUENTO AL PIE, NO POR ITEM
  79 + ARBA: 0, // [money] NOT NULL, IMPORTE RETENCION ARBA
  80 + DGR: 0, // [money] NOT NULL, IMPORTE RETENCION DGR
  81 + DTO_PIE: 0, // [money] NOT NULL, IMPORTE DE DESCUENTO AL PIE, NO POR ITEM
82 82 OPERACIONES_3711: 1, // [int] NOT NULL, FIJO 1 (PORQUE SON BIENES)
83   - ORC: null, // [bigint] NOT NULL, NUMERO DE ORDEN DE COMPRA
  83 + ORC: 'TODO: comprobantesReferencia CUANDO ES PC', // [bigint] NOT NULL, NUMERO DE ORDEN DE COMPRA
84 84 NC_ES_NP: 0, // [bit] NOT NULL, FIJO 0
85   - CABA: null, // [money] NOT NULL, IMPORTE RETENCION CABA
86   - ARBA_PER: null, // [money] NOT NULL, IMPORTE PERCEPCION ARBA
87   - CABA_PER: null, // [money] NOT NULL, IMPORTE PERCEPCION CABA
  85 + CABA: 0, // [money] NOT NULL, IMPORTE RETENCION CABA
  86 + ARBA_PER: 0, // [money] NOT NULL, IMPORTE PERCEPCION ARBA
  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 90 };
... ... @@ -10,6 +10,8 @@ function onGetFile(event, fileString) {
10 10  
11 11 var planex = require('./planex/index')(fileString);
12 12  
  13 + console.log(planex);
  14 +
13 15 var entities = {};
14 16  
15 17 var tipoCuit = planex.identificaxEmisor.cuit.slice(0, 2);
... ... @@ -17,8 +17,8 @@ module.exports = function(comprobante) {
17 17 descuentosGlobalesFactura: {},
18 18 detalleOtrosImpuestosComprobante: {},
19 19 itemsFactura: [],
20   - detalleDescuentosItemFactura: {},
21   - detalleImpuestosItemFactura: {}
  20 + detalleDescuentosItemFactura: [],
  21 + detalleImpuestosItemFactura: []
22 22 };
23 23  
24 24 function returnFloatByDecimals(parameter, cantDecimal) {
... ... @@ -63,13 +63,17 @@ module.exports = function(comprobante) {
63 63 } else if (sector.slice(0, 3) == '110') {
64 64 objReturn.detalleDescuentosItemFactura = require('./detalleDescuentosItemFactura')(sector, returnFloatByDecimals); // 110
65 65 } else if (sector.slice(0, 3) == '120') {
66   - objReturn.detalleImpuestosItemFactura = require('./detalleImpuestosItemFactura')(sector, returnFloatByDecimals); // 120
  66 + objReturn.detalleImpuestosItemFactura.push(require('./detalleImpuestosItemFactura')(sector, returnFloatByDecimals)); // 120
67 67 }
68 68 });
69 69  
70   - objReturn.itemsFactura.array.forEach(item => {
  70 + if (!objReturn.detalleImpuestosItemFactura.length) {
  71 + return objReturn;
  72 + }
  73 +
  74 + objReturn.itemsFactura.forEach(item => {
71 75  
72   - var detalleDescuentos = planex.detalleImpuestosItemFactura.filter(function(descuento) {
  76 + var detalleDescuentos = objReturn.detalleImpuestosItemFactura.filter(function(descuento) {
73 77 return descuento.numeroLinea == item.numeroLinea;
74 78 })[0];
75 79