cfdi40 0.1.0 → 0.1.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: cf7ce0ac8de4ab678da94ef6a052c68ea8a403c0b9c349b252654d4bf9771cde
4
- data.tar.gz: bc02e70bc14b70576f178b3fed467970d36cc6f72693e9bc78415963cab435e4
3
+ metadata.gz: d6259abaa6dfa3e4dfb6ae269df819f9b655d9ff41b1adefae1b7aecb4ef4bcb
4
+ data.tar.gz: 22c78d216df7cbeb071d76fc4770226ac9516ecd73537b8d01bfd4ae61d1891a
5
5
  SHA512:
6
- metadata.gz: a2b13b7fccfdf28774032f0b7e9b95028d7b96c0d6803d1f04b547f26435a0532f7b43c1644ae1309fe4168409ba34543d3164b99995c62b4b70a1d32f4bfaef
7
- data.tar.gz: 37637f8e76f129a3582b963b3ef3e8206fb5a997d527feb6ec507b75f2f5983346fcdcef93d63684265d6846debde1539d04b7c836c50ca390a33934b1d2b688
6
+ metadata.gz: 513278acd109f261b9e848b08d0506c4b2cdae2e16da783a8306f6416226994ffd98bba6764f07f7b56f9620b25c6e97d767936fcadbb9e9503cff710fe7d2a6
7
+ data.tar.gz: f904dbf8c75d7afa4dbe02812d45773b0a60fe5d2eadc171321b02c3baf080fbd5fad1839c05b6a0ccf54adfd779f6a5253ef6aa4bc1c90b7a014fe99658142c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cfdi40 (0.0.9)
4
+ cfdi40 (0.1.1)
5
5
  nokogiri (>= 1.10.10)
6
6
 
7
7
  GEM
@@ -152,6 +152,7 @@ module Cfdi40
152
152
  concepto = Concepto.new
153
153
  concepto.parent_node = @conceptos
154
154
  concepto.load_from_ng_node(ng_node)
155
+ concepto.precio_bruto = concepto.valor_unitario.to_f
155
156
  @conceptos.children_nodes << concepto
156
157
  concepto
157
158
  end
@@ -82,6 +82,7 @@ module Cfdi40
82
82
 
83
83
  def load_traslado_iva(ng_node)
84
84
  traslado_iva_node.load_from_ng_node(ng_node)
85
+ calculate_from_gross_price
85
86
  end
86
87
 
87
88
  private
@@ -99,15 +100,15 @@ module Cfdi40
99
100
  calculate_taxes
100
101
  # May be can not be rounded with 2 decimals.
101
102
  # Example gross_price = 1.99512
102
- @precio_neto = (@importe_neto / cantidad).round(6)
103
+ @precio_neto = (@importe_neto / cantidad.to_f).round(6)
103
104
  update_xml_attributes
104
105
  end
105
106
 
106
107
  def calculate_taxes
107
- @base_ieps = (@precio_bruto * cantidad.to_f).round(2)
108
- @ieps = (@base_ieps * tasa_ieps.to_f).round(2)
109
- @base_iva = (@base_ieps + @ieps).round(2)
110
- @iva = (@base_iva * tasa_iva.to_f).round(2)
108
+ @base_ieps = (@precio_bruto * cantidad.to_f).round(6)
109
+ @ieps = (@base_ieps * tasa_ieps.to_f).round(4)
110
+ @base_iva = (@base_ieps + @ieps).round(6)
111
+ @iva = (@base_iva * tasa_iva.to_f).round(4)
111
112
  @importe_bruto = @base_ieps
112
113
  @importe_neto = (@base_iva + @iva).round(2)
113
114
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cfdi40
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.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.1.0
4
+ version: 0.1.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-06-11 00:00:00.000000000 Z
11
+ date: 2025-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri