Class: FmLayout::FmLayout
- Inherits:
-
Object
- Object
- FmLayout::FmLayout
- Defined in:
- lib/fm_layout/fm_layout.rb
Instance Method Summary collapse
- #concepto ⇒ Object
- #datos_adicionales ⇒ Object
- #domicilio ⇒ Object
- #domicilio_fiscal ⇒ Object
- #emisor ⇒ Object
- #encabezado ⇒ Object
- #expedido_en ⇒ Object
- #impuesto_retenido ⇒ Object
- #impuesto_retenido_local ⇒ Object
- #impuesto_trasladado ⇒ Object
- #impuesto_trasladado_local ⇒ Object
-
#initialize ⇒ FmLayout
constructor
A new instance of FmLayout.
- #nomina ⇒ Object
- #receptor ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ FmLayout
Returns a new instance of FmLayout.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fm_layout/fm_layout.rb', line 15 def initialize @encabezado = Encabezado.new @datos_adicionales = DatosAdicionales.new @emisor = Emisor.new @receptor= Receptor.new @conceptos = [] @impuestos_trasladados = [] @impuestos_trasladados_locales = [] @impuestos_retenidos = [] @impuestos_retenidos_locales = [] end |
Instance Method Details
#concepto ⇒ Object
86 87 88 89 90 91 92 93 94 |
# File 'lib/fm_layout/fm_layout.rb', line 86 def concepto concepto = Concepto.new if block_given? yield(concepto) @conceptos << concepto else concepto end end |
#datos_adicionales ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/fm_layout/fm_layout.rb', line 35 def datos_adicionales if block_given? yield(@datos_adicionales) else @datos_adicionales end end |
#domicilio ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/fm_layout/fm_layout.rb', line 68 def domicilio @domicilio ||= Domicilio.new if block_given? yield(@domicilio) else @domicilio end end |
#domicilio_fiscal ⇒ Object
59 60 61 62 63 64 65 66 |
# File 'lib/fm_layout/fm_layout.rb', line 59 def domicilio_fiscal @domicilio_fiscal ||= Domicilio.new('DomicilioFiscal') if block_given? yield(@domicilio_fiscal) else @domicilio_fiscal end end |
#emisor ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/fm_layout/fm_layout.rb', line 43 def emisor if block_given? yield(@emisor) else @emisor end end |
#encabezado ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/fm_layout/fm_layout.rb', line 27 def encabezado if block_given? yield(@encabezado) else @encabezado end end |
#expedido_en ⇒ Object
77 78 79 80 81 82 83 84 |
# File 'lib/fm_layout/fm_layout.rb', line 77 def expedido_en @expedido_en ||= Domicilio.new('ExpedidoEn') if block_given? yield(@expedido_en) else @expedido_en end end |
#impuesto_retenido ⇒ Object
116 117 118 119 120 121 122 123 124 |
# File 'lib/fm_layout/fm_layout.rb', line 116 def impuesto_retenido impuesto = ImpuestoRetenido.new if block_given? yield(impuesto) @impuestos_retenidos << impuesto else impuesto end end |
#impuesto_retenido_local ⇒ Object
126 127 128 129 130 131 132 133 134 |
# File 'lib/fm_layout/fm_layout.rb', line 126 def impuesto_retenido_local impuesto = ImpuestoRetenidoLocal.new if block_given? yield(impuesto) @impuestos_retenidos_locales << impuesto else impuesto end end |
#impuesto_trasladado ⇒ Object
96 97 98 99 100 101 102 103 104 |
# File 'lib/fm_layout/fm_layout.rb', line 96 def impuesto_trasladado impuesto = ImpuestoTrasladado.new if block_given? yield(impuesto) @impuestos_trasladados << impuesto else impuesto end end |
#impuesto_trasladado_local ⇒ Object
106 107 108 109 110 111 112 113 114 |
# File 'lib/fm_layout/fm_layout.rb', line 106 def impuesto_trasladado_local impuesto = ImpuestoTrasladadoLocal.new if block_given? yield(impuesto) @impuestos_trasladados_locales << impuesto else impuesto end end |
#nomina ⇒ Object
136 137 138 139 140 141 142 143 |
# File 'lib/fm_layout/fm_layout.rb', line 136 def nomina @nomina = Nomina::Nomina.new if block_given? yield(@nomina) else @nomina end end |
#receptor ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/fm_layout/fm_layout.rb', line 51 def receptor if block_given? yield(@receptor) else @receptor end end |
#to_h ⇒ Object
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/fm_layout/fm_layout.rb', line 156 def to_h encabezado.to_h .merge(@datos_adicionales.to_h) .merge(@emisor.to_h) .merge(@domicilio_fiscal.to_h) .merge(@expedido_en.to_h) .merge(@receptor.to_h) .merge(@domicilio.to_h) .merge(obtener_hash_conceptos) .merge(obtener_hash_traslados) .merge(obtener_hash_retenciones) .merge(@nomina.to_h) .merge(obtener_hash_traslados_locales) .merge(obtener_hash_retenciones_locales) end |
#to_s ⇒ Object
145 146 147 148 149 150 151 152 153 154 |
# File 'lib/fm_layout/fm_layout.rb', line 145 def to_s salida = @encabezado.to_s + @datos_adicionales.to_s + @emisor.to_s + @domicilio_fiscal.to_s + @expedido_en.to_s + @receptor.to_s + @domicilio.to_s salida += @conceptos.map(&:to_s).reduce(:+).to_s salida += @impuestos_trasladados.map(&:to_s).reduce(:+).to_s salida += @impuestos_retenidos.map(&:to_s).reduce(:+).to_s salida += @impuestos_trasladados_locales.map(&:to_s).reduce(:+).to_s salida += @impuestos_retenidos_locales.map(&:to_s).reduce(:+).to_s salida += @nomina.to_s salida end |