fm_layout 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/fm_layout/fm_layout.rb +29 -1
- data/lib/fm_layout/impuesto_trasladado_local.rb +28 -0
- data/lib/fm_layout/version.rb +1 -1
- data/spec/fm_layout_spec.rb +13 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bbf408e1d72d8bcb38d71b08152ee7d9cf545fb
|
4
|
+
data.tar.gz: 5dadd19c36648d3c543be57b936a4ceff34cdc4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89fbd0164ed86115799c3a6fb14b0a610ca21eb7212668480a60e7772fe2bc6c7ff99f5e6c19223d570c8d3689f9a66ee209cf916de11f84aa44d1328a4cca02
|
7
|
+
data.tar.gz: 0d258e12094fe168e6a2b1bf082c54374f88b6713929d547bb79a325060342790b8d5b82b90dfbb53a5d97c251ae897b6b02961b10a77eab035805117ccbcd54
|
data/.gitignore
CHANGED
data/lib/fm_layout/fm_layout.rb
CHANGED
@@ -5,6 +5,7 @@ require 'fm_layout/receptor'
|
|
5
5
|
require 'fm_layout/domicilio'
|
6
6
|
require 'fm_layout/concepto'
|
7
7
|
require 'fm_layout/impuesto_trasladado'
|
8
|
+
require 'fm_layout/impuesto_trasladado_local'
|
8
9
|
require 'fm_layout/impuesto_retenido'
|
9
10
|
require 'fm_layout/nomina/nomina'
|
10
11
|
|
@@ -17,6 +18,7 @@ module FmLayout
|
|
17
18
|
@receptor= Receptor.new
|
18
19
|
@conceptos = []
|
19
20
|
@impuestos_trasladados = []
|
21
|
+
@impuestos_trasladados_locales = []
|
20
22
|
@impuestos_retenidos = []
|
21
23
|
end
|
22
24
|
|
@@ -99,6 +101,16 @@ module FmLayout
|
|
99
101
|
end
|
100
102
|
end
|
101
103
|
|
104
|
+
def impuesto_trasladado_local
|
105
|
+
impuesto = ImpuestoTrasladadoLocal.new
|
106
|
+
if block_given?
|
107
|
+
yield(impuesto)
|
108
|
+
@impuestos_trasladados_locales << impuesto
|
109
|
+
else
|
110
|
+
impuesto
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
102
114
|
def impuesto_retenido
|
103
115
|
impuesto = ImpuestoRetenido.new
|
104
116
|
if block_given?
|
@@ -123,12 +135,24 @@ module FmLayout
|
|
123
135
|
salida += @conceptos.map(&:to_s).reduce(:+).to_s
|
124
136
|
salida += @impuestos_trasladados.map(&:to_s).reduce(:+).to_s
|
125
137
|
salida += @impuestos_retenidos.map(&:to_s).reduce(:+).to_s
|
138
|
+
salida += @impuestos_trasladados_locales.map(&:to_s).reduce(:+).to_s
|
126
139
|
salida += @nomina.to_s
|
127
140
|
salida
|
128
141
|
end
|
129
142
|
|
130
143
|
def to_h
|
131
|
-
|
144
|
+
encabezado.to_h
|
145
|
+
.merge(@datos_adicionales.to_h)
|
146
|
+
.merge(@emisor.to_h)
|
147
|
+
.merge(@domicilio_fiscal.to_h)
|
148
|
+
.merge(@expedido_en.to_h)
|
149
|
+
.merge(@receptor.to_h)
|
150
|
+
.merge(@domicilio.to_h)
|
151
|
+
.merge(obtener_hash_conceptos)
|
152
|
+
.merge(obtener_hash_traslados)
|
153
|
+
.merge(obtener_hash_retenciones)
|
154
|
+
.merge(@nomina.to_h)
|
155
|
+
.merge(obtener_hash_traslados_locales)
|
132
156
|
end
|
133
157
|
|
134
158
|
private
|
@@ -145,5 +169,9 @@ module FmLayout
|
|
145
169
|
{ 'ImpuestosTrasladados' => @impuestos_trasladados.map(&:to_h) }
|
146
170
|
end
|
147
171
|
|
172
|
+
def obtener_hash_traslados_locales
|
173
|
+
{ 'ImpuestosTrasladadosLocales' => @impuestos_trasladados_locales.map(&:to_h) }
|
174
|
+
end
|
175
|
+
|
148
176
|
end
|
149
177
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'fm_layout/fm_seccion'
|
2
|
+
|
3
|
+
module FmLayout
|
4
|
+
class ImpuestoTrasladadoLocal
|
5
|
+
include FmSeccion
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@titulo = 'TrasladoLocal'
|
9
|
+
@datos = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.campos_vs_metodos
|
13
|
+
{
|
14
|
+
'ImpLocTrasladado' => '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
|
data/lib/fm_layout/version.rb
CHANGED
data/spec/fm_layout_spec.rb
CHANGED
@@ -96,6 +96,11 @@ describe 'DSL para generar el layout de Facturación moderna' do
|
|
96
96
|
i.importe 150.00
|
97
97
|
i.tasa 16.00
|
98
98
|
end
|
99
|
+
f.impuesto_trasladado_local do |i|
|
100
|
+
i.impuesto 'ISH'
|
101
|
+
i.importe 110.00
|
102
|
+
i.tasa 11.00
|
103
|
+
end
|
99
104
|
|
100
105
|
f.impuesto_retenido do |i|
|
101
106
|
i.impuesto 'IVA'
|
@@ -228,6 +233,13 @@ describe 'DSL para generar el layout de Facturación moderna' do
|
|
228
233
|
it{ expect(retencion['importe']).to eq(10.00) }
|
229
234
|
end
|
230
235
|
|
236
|
+
context 'primer impuesto trasladado local' do
|
237
|
+
let(:traslado_local){ prueba.to_h['ImpuestosTrasladadosLocales'].first['TrasladoLocal'] }
|
238
|
+
it{ expect(traslado_local['ImpLocTrasladado']).to eq('ISH') }
|
239
|
+
it{ expect(traslado_local['Importe']).to eq(110.00) }
|
240
|
+
it{ expect(traslado_local['TasadeTraslado']).to eq(11.00) }
|
241
|
+
end
|
242
|
+
|
231
243
|
context 'salida en texto' do
|
232
244
|
let(:salida){ prueba.to_s }
|
233
245
|
it{ expect(salida).to match(/\[Encabezado\]/) }
|
@@ -240,6 +252,7 @@ describe 'DSL para generar el layout de Facturación moderna' do
|
|
240
252
|
it{ expect(salida).to match(/\[Concepto\]/) }
|
241
253
|
it{ expect(salida).to match(/\[ImpuestoTrasladado\]/) }
|
242
254
|
it{ expect(salida).to match(/\[ImpuestoRetenido\]/) }
|
255
|
+
it{ expect(salida).to match(/\[TrasladoLocal\]/) }
|
243
256
|
end
|
244
257
|
end
|
245
258
|
|
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.
|
4
|
+
version: 0.0.3
|
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-
|
11
|
+
date: 2014-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -79,6 +79,7 @@ files:
|
|
79
79
|
- lib/fm_layout/fm_seccion.rb
|
80
80
|
- lib/fm_layout/impuesto_retenido.rb
|
81
81
|
- lib/fm_layout/impuesto_trasladado.rb
|
82
|
+
- lib/fm_layout/impuesto_trasladado_local.rb
|
82
83
|
- lib/fm_layout/nomina/complemento_nomina.rb
|
83
84
|
- lib/fm_layout/nomina/deduccion.rb
|
84
85
|
- lib/fm_layout/nomina/horas_extra.rb
|