sw_fac 0.3.52 → 0.3.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb327e24193da6c0131c01ade9786fba17737262f14d7e3690b450e13058f088
4
- data.tar.gz: f5b920024a9f21119025cd91648711aa309427f4a15001f8ad64b8254a110921
3
+ metadata.gz: 2b42c257daa8d42e001986d905ffab338db35601a8ddc082815ce3a9000440d2
4
+ data.tar.gz: f513ba041875e90d46cbc9ca47e57a4f3d216e669fa814fadb5539677094e050
5
5
  SHA512:
6
- metadata.gz: 2ce4fc23ed12c56ea94498617f4a9181cd93a12b00743e672653393403f58d3f0404465bf89562749ebd34f17ab08cc142117dbc07a078a5f60113f093a3f376
7
- data.tar.gz: 37f7374fc442dc6df3d0db5fdabdd98dcf6c4000bcc49d49ebd8f55b6b1a73c9da12510a6fab302fa2886917d8bcf32f3b00b300a39dde104211e76b6f6b1b20
6
+ metadata.gz: 69ecc08be4f9d4f5c97199b964085f6574a571271806c0ef7ff7b428c72072ab805ace8f8e1641cab06383c0befeac7b95fb1ed97a2a24383e5839fe0ea82c8c
7
+ data.tar.gz: 2140988d0cd6d7a09a58e80cbc10224c7385ff87196b9aa35d39665be54a9a9535ab47f21206f67593ae9ecb2a2c5cb64154d92bfdc9e1fa5637b3fbf5c39425
@@ -9,9 +9,9 @@ module SwFac
9
9
  # venta_folio: '',
10
10
  # cp: '',
11
11
  # receptor_razon: 'Car zone',
12
- # receptor_rfc: 'XAXX010101000',
13
- # forma_pago: '01',
14
- # total: 100.00,
12
+ # receptor_rfc: 'XAXX010101000',
13
+ # forma_pago: '01',
14
+ # total: 100.00,
15
15
  # time: '',
16
16
  # modena: '',
17
17
  # line_items: [
@@ -23,15 +23,17 @@ module SwFac
23
23
  # }
24
24
 
25
25
  puts " Datos --------"
26
- puts "-- Total: #{params[:total]}"
26
+ puts "-- Total params: #{params[:total]}"
27
27
  puts "--- Line items: "
28
28
  params[:line_items].each do |line|
29
29
  puts "--- #{line[:monto]}"
30
- end
31
- puts "-- Suma de line_items: #{params[:line_items].inject(0) {|sum, x| sum + x[:monto].to_f.round(2) }}"
30
+ end
31
+ lines_total = params[:line_items].inject(0) {|sum, x| sum + x[:monto].to_f}
32
+
33
+ puts "-- Suma de line_items: #{lines_total}"
32
34
 
33
- if (params[:line_items].inject(0) {|sum, x| sum + x[:monto].to_f }) > params[:total].to_f.round(2)
34
- raise 'Error - la suma de los complementos de pago es mayor al total reportado'
35
+ if (lines_total > params[:total].to_f)
36
+ raise 'Error SW - la suma de los complementos de pago es mayor al total reportado'
35
37
  end
36
38
 
37
39
  uri = @production ? URI("#{SwFac::UrlProduction}cfdi33/stamp/customv1/b64") : URI("#{SwFac::UrlDev}cfdi33/stamp/customv1/b64")
@@ -79,7 +81,7 @@ module SwFac
79
81
  child_pago['MonedaP'] = params.fetch(:moneda, 'MXN')
80
82
  child_pago['Monto'] = params[:total].round(2).to_s
81
83
 
82
- saldo_anterior = params[:total].to_f
84
+ saldo_anterior = params[:total]
83
85
 
84
86
  params[:line_items].each_with_index do |line, index|
85
87
  monto = line[:monto].to_f
@@ -89,9 +91,9 @@ module SwFac
89
91
  child_pago_relacionado['MetodoDePagoDR'] = 'PPD'
90
92
  child_pago_relacionado['NumParcialidad'] = (index + 1).to_s
91
93
 
92
- child_pago_relacionado['ImpSaldoAnt'] = (saldo_anterior).to_s
94
+ child_pago_relacionado['ImpSaldoAnt'] = (saldo_anterior).round(2).to_s
93
95
  child_pago_relacionado['ImpPagado'] = monto.round(2).to_s
94
- child_pago_relacionado['ImpSaldoInsoluto'] = (saldo_anterior - monto).to_s
96
+ child_pago_relacionado['ImpSaldoInsoluto'] = (saldo_anterior - monto).round(2).to_s
95
97
  saldo_anterior -= monto
96
98
 
97
99
  child_pago.add_child(child_pago_relacionado)
@@ -513,6 +515,7 @@ module SwFac
513
515
  suma_iva += importe_iva
514
516
  suma_total += total_acumulator
515
517
 
518
+ puts "--- 01"
516
519
  ## calculando retencion de IVA en caso de tener
517
520
  if ret_iva > 0
518
521
  if ret_iva == 6
@@ -523,7 +526,7 @@ module SwFac
523
526
  else
524
527
  importe_ret_linea = 0
525
528
  end
526
- puts "--- 01"
529
+ puts "--- 02"
527
530
  suma_ret += importe_ret_linea
528
531
 
529
532
 
@@ -535,8 +538,8 @@ module SwFac
535
538
  child_concepto['Unidad'] = line[:unidad].to_s
536
539
  child_concepto['Descripcion'] = line[:descripcion].to_s
537
540
  child_concepto['Cantidad'] = cantidad.to_s
538
- child_concepto['ValorUnitario'] = valor_unitario.round(2).to_s
539
- child_concepto['Importe'] = total_line.round(2).to_s
541
+ child_concepto['ValorUnitario'] = valor_unitario.round(4).to_s
542
+ child_concepto['Importe'] = total_line.round(4).to_s
540
543
  # child_concepto['Descuento'] = line.fetch(:descuento, 0.00).round(6).to_s
541
544
 
542
545
 
@@ -546,11 +549,11 @@ module SwFac
546
549
  ## Creando cfdi:Traslados para cada linea
547
550
  child_traslados = Nokogiri::XML::Node.new "cfdi:Traslados", xml
548
551
  child_traslado = Nokogiri::XML::Node.new "cfdi:Traslado", xml
549
- child_traslado['Base'] = total_line.round(2).to_s
552
+ child_traslado['Base'] = total_line.round(4).to_s
550
553
  child_traslado['Impuesto'] = '002'
551
554
  child_traslado['TipoFactor'] = "Tasa"
552
555
  child_traslado['TasaOCuota'] = '0.160000'
553
- child_traslado['Importe'] = importe_iva.round(2).to_s
556
+ child_traslado['Importe'] = importe_iva.round(4).to_s
554
557
 
555
558
  # if line[:tipo_impuesto] == '004'
556
559
  # child_traslado['TasaOCuota'] = '0.000000'
@@ -568,7 +571,7 @@ module SwFac
568
571
  if ret_iva > 0
569
572
  child_retenciones = Nokogiri::XML::Node.new "cfdi:Retenciones", xml
570
573
  child_retencion = Nokogiri::XML::Node.new "cfdi:Retencion", xml
571
- child_retencion['Base'] = total_line.round(2).to_s
574
+ child_retencion['Base'] = total_line.round(4).to_s
572
575
  child_retencion['Impuesto'] = '002'
573
576
  child_retencion['TipoFactor'] = "Tasa"
574
577
 
@@ -578,7 +581,7 @@ module SwFac
578
581
  child_retencion['TasaOCuota'] = "0.160000"
579
582
  end
580
583
 
581
- child_retencion['Importe'] = importe_ret_linea.round(2).to_s
584
+ child_retencion['Importe'] = importe_ret_linea.round(4).to_s
582
585
 
583
586
  child_retenciones.add_child(child_retencion)
584
587
  child_impuestos.add_child(child_retenciones)
@@ -617,7 +620,7 @@ module SwFac
617
620
  comprobante['Total'] = suma_total.round(2).to_s
618
621
  end
619
622
 
620
-
623
+
621
624
  ## filling traslado info
622
625
  traslado_child = Nokogiri::XML::Node.new "cfdi:Traslado", xml
623
626
  traslado_child['Impuesto'] = '002'
@@ -1,3 +1,3 @@
1
1
  module SwFac
2
- VERSION = "0.3.52"
2
+ VERSION = "0.3.57"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sw_fac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.52
4
+ version: 0.3.57
5
5
  platform: ruby
6
6
  authors:
7
7
  - Angel Padilla
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-20 00:00:00.000000000 Z
11
+ date: 2020-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler