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_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.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fm_layout/fm_layout.rb', line 14 def initialize @encabezado = Encabezado.new @datos_adicionales = DatosAdicionales.new @emisor = Emisor.new @receptor= Receptor.new @conceptos = [] @impuestos_trasladados = [] @impuestos_trasladados_locales = [] @impuestos_retenidos = [] end |
Instance Method Details
#concepto ⇒ Object
84 85 86 87 88 89 90 91 92 |
# File 'lib/fm_layout/fm_layout.rb', line 84 def concepto concepto = Concepto.new if block_given? yield(concepto) @conceptos << concepto else concepto end end |
#datos_adicionales ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/fm_layout/fm_layout.rb', line 33 def datos_adicionales if block_given? yield(@datos_adicionales) else @datos_adicionales end end |
#domicilio ⇒ Object
66 67 68 69 70 71 72 73 |
# File 'lib/fm_layout/fm_layout.rb', line 66 def domicilio @domicilio ||= Domicilio.new if block_given? yield(@domicilio) else @domicilio end end |
#domicilio_fiscal ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/fm_layout/fm_layout.rb', line 57 def domicilio_fiscal @domicilio_fiscal ||= Domicilio.new('DomicilioFiscal') if block_given? yield(@domicilio_fiscal) else @domicilio_fiscal end end |
#emisor ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/fm_layout/fm_layout.rb', line 41 def emisor if block_given? yield(@emisor) else @emisor end end |
#encabezado ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/fm_layout/fm_layout.rb', line 25 def encabezado if block_given? yield(@encabezado) else @encabezado end end |
#expedido_en ⇒ Object
75 76 77 78 79 80 81 82 |
# File 'lib/fm_layout/fm_layout.rb', line 75 def expedido_en @expedido_en ||= Domicilio.new('ExpedidoEn') if block_given? yield(@expedido_en) else @expedido_en end end |
#impuesto_retenido ⇒ Object
114 115 116 117 118 119 120 121 122 |
# File 'lib/fm_layout/fm_layout.rb', line 114 def impuesto_retenido impuesto = ImpuestoRetenido.new if block_given? yield(impuesto) @impuestos_retenidos << impuesto else impuesto end end |
#impuesto_trasladado ⇒ Object
94 95 96 97 98 99 100 101 102 |
# File 'lib/fm_layout/fm_layout.rb', line 94 def impuesto_trasladado impuesto = ImpuestoTrasladado.new if block_given? yield(impuesto) @impuestos_trasladados << impuesto else impuesto end end |
#impuesto_trasladado_local ⇒ Object
104 105 106 107 108 109 110 111 112 |
# File 'lib/fm_layout/fm_layout.rb', line 104 def impuesto_trasladado_local impuesto = ImpuestoTrasladadoLocal.new if block_given? yield(impuesto) @impuestos_trasladados_locales << impuesto else impuesto end end |
#nomina ⇒ Object
124 125 126 127 128 129 130 131 |
# File 'lib/fm_layout/fm_layout.rb', line 124 def nomina @nomina = Nomina::Nomina.new if block_given? yield(@nomina) else @nomina end end |
#receptor ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/fm_layout/fm_layout.rb', line 49 def receptor if block_given? yield(@receptor) else @receptor end end |
#to_h ⇒ Object
143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/fm_layout/fm_layout.rb', line 143 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) end |
#to_s ⇒ Object
133 134 135 136 137 138 139 140 141 |
# File 'lib/fm_layout/fm_layout.rb', line 133 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 += @nomina.to_s salida end |