cfdi40 0.2.0 → 0.2.1

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: cad6896abeef260eaf8d4f9e659da6b6572fd693e51713261c982addf854373a
4
- data.tar.gz: c68c19bb783b5864c81103899d5ab46b1281d6eccaecbd43efee35cf927777d6
3
+ metadata.gz: ecf98bb6f090122a8deb1fd4efdcc536452a130971dde09b6edcfb78fe4edc85
4
+ data.tar.gz: 940ed9335fd2c541476f287b577a40574d2a07734278b730392533302755ad94
5
5
  SHA512:
6
- metadata.gz: 0ffc2e71680140e910f44dc35c5201ad28747454d4167290c57f52836bbd75dcae1aaa6768735d7435b2510cd96b6d9be6d271dddddce59e598c86ae71a502f1
7
- data.tar.gz: 8649c8ade0dbbbee0caf4e9a31692d30874eb86ee5712ae3144501cd41614e6739c3d7d90b9e2584d561d7856345ad6b37063921671d50daa76c60b95d907d62
6
+ metadata.gz: 796605c919c80f6e2de32b7055da870e46b8af0df71b4a5775943948f11be9b73c356a748d21615527a00aa2e4c6ba85ca5599e2105081e946a24d73755381fe
7
+ data.tar.gz: f858dcd68742d342fdaa1790beaeafbcc8122f5f54a7f4d2bcbed70b74def6ad3108e3000d35eec221bafb5056d9e7e9347fbc86383b96ea458cfa05dee95b2a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cfdi40 (0.1.2)
4
+ cfdi40 (0.2.0)
5
5
  nokogiri (>= 1.10.10)
6
6
 
7
7
  GEM
@@ -89,9 +89,11 @@ module Cfdi40
89
89
 
90
90
  def calculate_from_net_price
91
91
  set_defaults
92
- @precio_neto = @precio_neto.round(2)
93
- @precio_bruto = (@precio_neto / ((1 + tasa_iva.to_f) * (1 + tasa_ieps.to_f))).round(6)
92
+ @precio_neto = @precio_neto.round(6)
93
+ @precio_bruto = (@precio_neto / ((1 + tasa_iva.to_f) * (1 + tasa_ieps.to_f)))
94
94
  calculate_taxes
95
+
96
+ @precio_bruto = (((@precio_neto * cantidad.to_f) - @iva - @ieps) / cantidad.to_f.round(6)).round(6)
95
97
  update_xml_attributes
96
98
  end
97
99
 
@@ -106,9 +108,9 @@ module Cfdi40
106
108
 
107
109
  def calculate_taxes
108
110
  @base_ieps = (@precio_bruto * cantidad.to_f).round(6)
109
- @ieps = (@base_ieps * tasa_ieps.to_f).round(4)
111
+ @ieps = (@base_ieps * tasa_ieps.to_f).round(6)
110
112
  @base_iva = (@base_ieps + @ieps).round(6)
111
- @iva = (@base_iva * tasa_iva.to_f).round(4)
113
+ @iva = (@base_iva * tasa_iva.to_f).round(6)
112
114
  @importe_bruto = @base_ieps
113
115
  @importe_neto = (@base_iva + @iva).round(2)
114
116
  end
@@ -3,8 +3,8 @@
3
3
  # /cfdi:Comprobante/cfdi:Impuestos
4
4
  module Cfdi40
5
5
  class Impuestos < Node
6
- define_attribute :total_impuestos_retenidos, xml_attribute: "TotalImpuestosRetenidos", format: :t_Importe
7
- define_attribute :total_impuestos_trasladados, xml_attribute: "TotalImpuestosTrasladados", format: :t_Importe
6
+ define_attribute :total_impuestos_retenidos, xml_attribute: "TotalImpuestosRetenidos", format: :t_ImporteMXN
7
+ define_attribute :total_impuestos_trasladados, xml_attribute: "TotalImpuestosTrasladados", format: :t_ImporteMXN
8
8
 
9
9
  def traslados
10
10
  return @traslados if defined?(@traslados)
@@ -3,10 +3,10 @@
3
3
  # /cfdi:Comprobante/cfdi:Impuestos/cfdi:Traslados/cfdi:Traslado
4
4
  module Cfdi40
5
5
  class Traslado < Node
6
- define_attribute :base, xml_attribute: "Base", format: :t_Importe
6
+ define_attribute :base, xml_attribute: "Base", format: :t_ImporteMXN
7
7
  define_attribute :impuesto, xml_attribute: "Impuesto"
8
8
  define_attribute :tipo_factor, xml_attribute: "TipoFactor", default: "Tasa"
9
9
  define_attribute :tasa_o_cuota, xml_attribute: "TasaOCuota", format: :t_Importe
10
- define_attribute :importe, xml_attribute: "Importe", format: :t_Importe
10
+ define_attribute :importe, xml_attribute: "Importe", format: :t_ImporteMXN
11
11
  end
12
12
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cfdi40
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfdi40
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Israel Benítez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-08-15 00:00:00.000000000 Z
11
+ date: 2025-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri