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 +4 -4
- data/lib/sw_fac/facturacion.rb +21 -4
- data/lib/sw_fac/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0eda9f6e6d717cc5d8122e06cb4b4464f00de864
|
4
|
+
data.tar.gz: 1edf4d110c9a274d96d97897e3d414be60c33bf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55f50080a01e105fe7b6380993c3673250997d3a944363c0cf685ae99cbbbbacc3db7cc27b6a8d9ae27d5cd3d5be603fac00d078bf9c0d0d55a18bd7938a111c
|
7
|
+
data.tar.gz: 0ac7c2b1e6220a89bdc4f4bb5ff8f80c4c6996e80e3341c4437aff1db0be69467928833b31c26f0cb3a5e02e2ba9d532cb7570697a6e35500927469fd679a8af
|
data/lib/sw_fac/facturacion.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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'] =
|
512
|
+
child_traslado['Impuesto'] = '002'
|
503
513
|
child_traslado['TipoFactor'] = "Tasa"
|
504
|
-
|
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
|
data/lib/sw_fac/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2018-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|