fm_layout 0.0.3 → 0.0.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: 2bbf408e1d72d8bcb38d71b08152ee7d9cf545fb
4
- data.tar.gz: 5dadd19c36648d3c543be57b936a4ceff34cdc4e
3
+ metadata.gz: 91dd0d5d10eb529165607b1904477fb4b4e49049
4
+ data.tar.gz: 7aa2cad830e0e01ed4487bfa92c01d391c9f7f0b
5
5
  SHA512:
6
- metadata.gz: 89fbd0164ed86115799c3a6fb14b0a610ca21eb7212668480a60e7772fe2bc6c7ff99f5e6c19223d570c8d3689f9a66ee209cf916de11f84aa44d1328a4cca02
7
- data.tar.gz: 0d258e12094fe168e6a2b1bf082c54374f88b6713929d547bb79a325060342790b8d5b82b90dfbb53a5d97c251ae897b6b02961b10a77eab035805117ccbcd54
6
+ metadata.gz: 3b880ff00c5fb67cd543e204f2bba856c2e0e173316270343fc547dc77bbe650a38ee7203717306bc7babcab37cf57998c1fbfd15675596c05248729e30b29e8
7
+ data.tar.gz: 840892c22ec1b6bb6dc6386c307117b7087a0636ed6df88e70e0a555d7ae8278e798b5df758c54717829c257693beff6f368bea77ce0db0aaf1ed65ee0363850
@@ -7,6 +7,7 @@ require 'fm_layout/concepto'
7
7
  require 'fm_layout/impuesto_trasladado'
8
8
  require 'fm_layout/impuesto_trasladado_local'
9
9
  require 'fm_layout/impuesto_retenido'
10
+ require 'fm_layout/impuesto_retenido_local'
10
11
  require 'fm_layout/nomina/nomina'
11
12
 
12
13
  module FmLayout
@@ -20,6 +21,7 @@ module FmLayout
20
21
  @impuestos_trasladados = []
21
22
  @impuestos_trasladados_locales = []
22
23
  @impuestos_retenidos = []
24
+ @impuestos_retenidos_locales = []
23
25
  end
24
26
 
25
27
  def encabezado
@@ -121,6 +123,16 @@ module FmLayout
121
123
  end
122
124
  end
123
125
 
126
+ def impuesto_retenido_local
127
+ impuesto = ImpuestoRetenidoLocal.new
128
+ if block_given?
129
+ yield(impuesto)
130
+ @impuestos_retenidos_locales << impuesto
131
+ else
132
+ impuesto
133
+ end
134
+ end
135
+
124
136
  def nomina
125
137
  @nomina = Nomina::Nomina.new
126
138
  if block_given?
@@ -136,6 +148,7 @@ module FmLayout
136
148
  salida += @impuestos_trasladados.map(&:to_s).reduce(:+).to_s
137
149
  salida += @impuestos_retenidos.map(&:to_s).reduce(:+).to_s
138
150
  salida += @impuestos_trasladados_locales.map(&:to_s).reduce(:+).to_s
151
+ salida += @impuestos_retenidos_locales.map(&:to_s).reduce(:+).to_s
139
152
  salida += @nomina.to_s
140
153
  salida
141
154
  end
@@ -153,6 +166,7 @@ module FmLayout
153
166
  .merge(obtener_hash_retenciones)
154
167
  .merge(@nomina.to_h)
155
168
  .merge(obtener_hash_traslados_locales)
169
+ .merge(obtener_hash_retenciones_locales)
156
170
  end
157
171
 
158
172
  private
@@ -173,5 +187,8 @@ module FmLayout
173
187
  { 'ImpuestosTrasladadosLocales' => @impuestos_trasladados_locales.map(&:to_h) }
174
188
  end
175
189
 
190
+ def obtener_hash_retenciones_locales
191
+ { 'ImpuestosRetenidosLocales' => @impuestos_retenidos_locales.map(&:to_h) }
192
+ end
176
193
  end
177
194
  end
@@ -0,0 +1,28 @@
1
+ require 'fm_layout/fm_seccion'
2
+
3
+ module FmLayout
4
+ class ImpuestoRetenidoLocal
5
+ include FmSeccion
6
+
7
+ def initialize
8
+ @titulo = 'RetencionLocal'
9
+ @datos = {}
10
+ end
11
+
12
+ def self.campos_vs_metodos
13
+ {
14
+ 'ImpLocRetenido' => 'impuesto',
15
+ 'Importe' => 'importe',
16
+ 'TasadeTraslado' => 'tasa',
17
+ }
18
+ end
19
+
20
+ # Creación de los métodos de acceso dinámicamente
21
+ campos_vs_metodos.each do |campo, metodo|
22
+ define_method(metodo) do |dato|
23
+ @datos[campo] = dato
24
+ end
25
+ end
26
+
27
+ end
28
+ end
@@ -1,3 +1,3 @@
1
1
  module FmLayout
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -111,6 +111,19 @@ describe 'DSL para generar el layout de Facturación moderna' do
111
111
  i.impuesto 'ISR'
112
112
  i.importe 10.00
113
113
  end
114
+
115
+ f.impuesto_retenido_local do |i|
116
+ i.impuesto 'IVA LOCAL'
117
+ i.importe 110.00
118
+ i.tasa 16.00
119
+ end
120
+
121
+ f.impuesto_retenido_local do |i|
122
+ i.impuesto 'ISR LOCAL'
123
+ i.importe 110.00
124
+ i.tasa 16.00
125
+ end
126
+
114
127
  end
115
128
  end
116
129
 
@@ -213,7 +226,7 @@ describe 'DSL para generar el layout de Facturación moderna' do
213
226
  it{ expect(concepto['importe']).to eq(20.00) }
214
227
  it{ expect(concepto['CuentaPredial']).to eq(nil) }
215
228
  end
216
-
229
+
217
230
  context 'primer impuesto trasladado' do
218
231
  let(:traslado){ prueba.to_h['ImpuestosTrasladados'].first['ImpuestoTrasladado'] }
219
232
  it{ expect(traslado['impuesto']).to eq('IVA') }
@@ -240,6 +253,20 @@ describe 'DSL para generar el layout de Facturación moderna' do
240
253
  it{ expect(traslado_local['TasadeTraslado']).to eq(11.00) }
241
254
  end
242
255
 
256
+ context 'primer impuesto retenido local' do
257
+ let(:retencion_local){ prueba.to_h['ImpuestosRetenidosLocales'].first['RetencionLocal'] }
258
+ it{ expect(retencion_local['ImpLocRetenido']).to eq('IVA LOCAL') }
259
+ it{ expect(retencion_local['Importe']).to eq(110.00) }
260
+ it{ expect(retencion_local['TasadeTraslado']).to eq(16.00) }
261
+ end
262
+
263
+ context 'segundo impuesto retenido local' do
264
+ let(:retencion_local){ prueba.to_h['ImpuestosRetenidosLocales'].last['RetencionLocal'] }
265
+ it{ expect(retencion_local['ImpLocRetenido']).to eq('ISR LOCAL') }
266
+ it{ expect(retencion_local['Importe']).to eq(110.00) }
267
+ it{ expect(retencion_local['TasadeTraslado']).to eq(16.00) }
268
+ end
269
+
243
270
  context 'salida en texto' do
244
271
  let(:salida){ prueba.to_s }
245
272
  it{ expect(salida).to match(/\[Encabezado\]/) }
@@ -253,6 +280,7 @@ describe 'DSL para generar el layout de Facturación moderna' do
253
280
  it{ expect(salida).to match(/\[ImpuestoTrasladado\]/) }
254
281
  it{ expect(salida).to match(/\[ImpuestoRetenido\]/) }
255
282
  it{ expect(salida).to match(/\[TrasladoLocal\]/) }
283
+ it{ expect(salida).to match(/\[RetencionLocal\]/) }
256
284
  end
257
285
  end
258
286
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fm_layout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hermes Ojeda Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-10 00:00:00.000000000 Z
11
+ date: 2014-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,6 +78,7 @@ files:
78
78
  - lib/fm_layout/fm_layout.rb
79
79
  - lib/fm_layout/fm_seccion.rb
80
80
  - lib/fm_layout/impuesto_retenido.rb
81
+ - lib/fm_layout/impuesto_retenido_local.rb
81
82
  - lib/fm_layout/impuesto_trasladado.rb
82
83
  - lib/fm_layout/impuesto_trasladado_local.rb
83
84
  - lib/fm_layout/nomina/complemento_nomina.rb
@@ -111,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
112
  version: '0'
112
113
  requirements: []
113
114
  rubyforge_project:
114
- rubygems_version: 2.1.11
115
+ rubygems_version: 2.1.8
115
116
  signing_key:
116
117
  specification_version: 4
117
118
  summary: Generador del Layout para la conexión con Facturación Moderna a través de