sw_fac 0.3.3 → 0.3.4

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
  SHA1:
3
- metadata.gz: 4ee501432b2f8e0d99a3a9404e829053ba11c46a
4
- data.tar.gz: f2f38d0e94cb9293050541434b9c57c44e65c019
3
+ metadata.gz: 0eda9f6e6d717cc5d8122e06cb4b4464f00de864
4
+ data.tar.gz: 1edf4d110c9a274d96d97897e3d414be60c33bf0
5
5
  SHA512:
6
- metadata.gz: 5cf43d3ca0e88e38fc6bc2e78ae819cbe3d736096a3d829a41afeb2ac54323f32ecee305bb67be624c4ae8f6fda22fa5a9366654daa50d50d79c4233664af251
7
- data.tar.gz: d5c870afb38a2bed7cabf86c722107f84bdf1fd68ed2a1e1771d002231dac67014fdd4c0e782cf38faefbfc95dcb43cdb74d1dd5c4600c1ade514b92b98bac20
6
+ metadata.gz: 55f50080a01e105fe7b6380993c3673250997d3a944363c0cf685ae99cbbbbacc3db7cc27b6a8d9ae27d5cd3d5be603fac00d078bf9c0d0d55a18bd7938a111c
7
+ data.tar.gz: 0ac7c2b1e6220a89bdc4f4bb5ff8f80c4c6996e80e3341c4437aff1db0be69467928833b31c26f0cb3a5e02e2ba9d532cb7570697a6e35500927469fd679a8af
@@ -469,14 +469,24 @@ module SwFac
469
469
  descuento = line.fetch(:descuento, 0.00).to_f
470
470
 
471
471
  if line[:tax_included] == true
472
- unitario = ((line[:valor_unitario]).to_f - descuento) / 1.16
472
+ if line[:tipo_impuesto] == '004'
473
+ unitario = (line[:valor_unitario].to_f) - descuento
474
+ else
475
+ unitario = ((line[:valor_unitario]).to_f - descuento) / 1.16
476
+ end
473
477
  else
474
478
  unitario = (line[:valor_unitario].to_f) - descuento
475
479
  end
476
480
 
477
481
  cantidad = line[:cantidad].to_f
478
482
  total_line = cantidad * unitario
479
- total_acumulator = cantidad * unitario * 1.16
483
+
484
+ if line[:tipo_impuesto] == '004'
485
+ total_acumulator = cantidad * unitario
486
+ else
487
+ total_acumulator = cantidad * unitario * 1.16
488
+ end
489
+
480
490
  importe_iva = total_acumulator - total_line
481
491
 
482
492
  subtotal += total_line
@@ -499,9 +509,16 @@ module SwFac
499
509
  child_traslados = Nokogiri::XML::Node.new "cfdi:Traslados", xml
500
510
  child_traslado = Nokogiri::XML::Node.new "cfdi:Traslado", xml
501
511
  child_traslado['Base'] = total_line.round(6).to_s
502
- child_traslado['Impuesto'] = line.fetch(:tipo_impuesto, '002')
512
+ child_traslado['Impuesto'] = '002'
503
513
  child_traslado['TipoFactor'] = "Tasa"
504
- child_traslado['TasaOCuota'] = '0.160000'
514
+
515
+ if line[:tipo_impuesto] == '004'
516
+ child_traslado['TasaOCuota'] = '0.000000'
517
+ else
518
+ child_traslado['TasaOCuota'] = '0.160000'
519
+ end
520
+
521
+
505
522
  child_traslado['Importe'] = importe_iva.round(6).to_s
506
523
 
507
524
  # Joining all up
@@ -1,3 +1,3 @@
1
1
  module SwFac
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
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.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Angel Padilla
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-25 00:00:00.000000000 Z
11
+ date: 2018-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler