Class: Cfdi40::ConceptoRep
Instance Attribute Summary collapse
-
#base_iva ⇒ Object
readonly
Returns the value of attribute base_iva.
-
#iedu_aut_rvoe ⇒ Object
accesors for instEducativas.
-
#iedu_curp ⇒ Object
accesors for instEducativas.
-
#iedu_nivel_educativo ⇒ Object
accesors for instEducativas.
-
#iedu_nombre_alumno ⇒ Object
accesors for instEducativas.
-
#iedu_rfc_pago ⇒ Object
accesors for instEducativas.
-
#ieps ⇒ Object
readonly
Returns the value of attribute ieps.
-
#importe_bruto ⇒ Object
readonly
Returns the value of attribute importe_bruto.
-
#importe_neto ⇒ Object
readonly
Returns the value of attribute importe_neto.
-
#iva ⇒ Object
readonly
Returns the value of attribute iva.
-
#precio_bruto ⇒ Object
Returns the value of attribute precio_bruto.
-
#precio_neto ⇒ Object
Returns the value of attribute precio_neto.
-
#tasa_ieps ⇒ Object
Returns the value of attribute tasa_ieps.
-
#tasa_iva ⇒ Object
Returns the value of attribute tasa_iva.
Attributes inherited from Node
#children_nodes, #element_name, #parent_node, #readonly, #xml_document, #xml_parent
Instance Method Summary collapse
-
#calculate! ⇒ Object
Calculate taxes, amounts from gross price or net price.
- #descripcion=(desc) ⇒ Object
-
#initialize ⇒ ConceptoRep
constructor
A new instance of ConceptoRep.
- #load_traslado_iva(ng_node) ⇒ Object
- #objeto_impuestos? ⇒ Boolean
- #traslado_iva_node ⇒ Object
- #traslado_nodes ⇒ Object
-
#update(attributes = {}) ⇒ Object
Ver Comprobante#add_concepto.
Methods inherited from Node
#add_attributes_to, #add_child_node, #add_children_to, #add_namespaces_to, #attibute_is_null?, attributes, #clean_cached_xml, #create_xml_node, #current_namespace, default_values, define_attribute, define_element_name, define_namespace, define_reader, define_writer, #delete_child, element_name, #expanded_element_name, formats, #formatted_value, #load_from_ng_node, #lock, namespaces, #set_defaults, verify_class_variables
Constructor Details
#initialize ⇒ ConceptoRep
Returns a new instance of ConceptoRep.
28 29 30 31 32 |
# File 'lib/cfdi40/concepto_rep.rb', line 28 def initialize @tasa_iva = 0.16 @tasa_ieps = nil super end |
Instance Attribute Details
#base_iva ⇒ Object (readonly)
Returns the value of attribute base_iva.
23 24 25 |
# File 'lib/cfdi40/concepto_rep.rb', line 23 def base_iva @base_iva end |
#iedu_aut_rvoe ⇒ Object
accesors for instEducativas
26 27 28 |
# File 'lib/cfdi40/concepto_rep.rb', line 26 def iedu_aut_rvoe @iedu_aut_rvoe end |
#iedu_curp ⇒ Object
accesors for instEducativas
26 27 28 |
# File 'lib/cfdi40/concepto_rep.rb', line 26 def iedu_curp @iedu_curp end |
#iedu_nivel_educativo ⇒ Object
accesors for instEducativas
26 27 28 |
# File 'lib/cfdi40/concepto_rep.rb', line 26 def iedu_nivel_educativo @iedu_nivel_educativo end |
#iedu_nombre_alumno ⇒ Object
accesors for instEducativas
26 27 28 |
# File 'lib/cfdi40/concepto_rep.rb', line 26 def iedu_nombre_alumno @iedu_nombre_alumno end |
#iedu_rfc_pago ⇒ Object
accesors for instEducativas
26 27 28 |
# File 'lib/cfdi40/concepto_rep.rb', line 26 def iedu_rfc_pago @iedu_rfc_pago end |
#ieps ⇒ Object (readonly)
Returns the value of attribute ieps.
23 24 25 |
# File 'lib/cfdi40/concepto_rep.rb', line 23 def ieps @ieps end |
#importe_bruto ⇒ Object (readonly)
Returns the value of attribute importe_bruto.
23 24 25 |
# File 'lib/cfdi40/concepto_rep.rb', line 23 def importe_bruto @importe_bruto end |
#importe_neto ⇒ Object (readonly)
Returns the value of attribute importe_neto.
23 24 25 |
# File 'lib/cfdi40/concepto_rep.rb', line 23 def importe_neto @importe_neto end |
#iva ⇒ Object (readonly)
Returns the value of attribute iva.
23 24 25 |
# File 'lib/cfdi40/concepto_rep.rb', line 23 def iva @iva end |
#precio_bruto ⇒ Object
Returns the value of attribute precio_bruto.
22 23 24 |
# File 'lib/cfdi40/concepto_rep.rb', line 22 def precio_bruto @precio_bruto end |
#precio_neto ⇒ Object
Returns the value of attribute precio_neto.
22 23 24 |
# File 'lib/cfdi40/concepto_rep.rb', line 22 def precio_neto @precio_neto end |
#tasa_ieps ⇒ Object
Returns the value of attribute tasa_ieps.
22 23 24 |
# File 'lib/cfdi40/concepto_rep.rb', line 22 def tasa_ieps @tasa_ieps end |
#tasa_iva ⇒ Object
Returns the value of attribute tasa_iva.
22 23 24 |
# File 'lib/cfdi40/concepto_rep.rb', line 22 def tasa_iva @tasa_iva end |
Instance Method Details
#calculate! ⇒ Object
Calculate taxes, amounts from gross price or net price
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/cfdi40/concepto_rep.rb', line 50 def calculate! set_defaults assign_objeto_imp # TODO: accept discount if defined?(@precio_neto) && !@precio_neto.nil? calculate_from_net_price elsif defined?(@precio_bruto) && !@precio_bruto.nil? calculate_from_gross_price elsif !valor_unitario.nil? @precio_bruto = valor_unitario calculate_from_gross_price end add_info_to_traslado_iva # TODO: add_info_to_traslado_ieps if @ieps > 0 add_inst_educativas true end |
#descripcion=(desc) ⇒ Object
89 90 91 |
# File 'lib/cfdi40/concepto_rep.rb', line 89 def descripcion=(desc) @descripcion = desc.to_s[0..999] end |
#load_traslado_iva(ng_node) ⇒ Object
84 85 86 87 |
# File 'lib/cfdi40/concepto_rep.rb', line 84 def load_traslado_iva(ng_node) traslado_iva_node.load_from_ng_node(ng_node) calculate_from_gross_price end |
#objeto_impuestos? ⇒ Boolean
68 69 70 |
# File 'lib/cfdi40/concepto_rep.rb', line 68 def objeto_impuestos? objeto_impuestos == "02" end |
#traslado_iva_node ⇒ Object
78 79 80 81 82 |
# File 'lib/cfdi40/concepto_rep.rb', line 78 def traslado_iva_node return nil unless impuestos_node.is_a?(ConceptoImpuestos) impuestos_node.traslado_iva end |
#traslado_nodes ⇒ Object
72 73 74 75 76 |
# File 'lib/cfdi40/concepto_rep.rb', line 72 def traslado_nodes return [] if impuestos_node.nil? impuestos_node.traslado_nodes end |
#update(attributes = {}) ⇒ Object
Ver Comprobante#add_concepto
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/cfdi40/concepto_rep.rb', line 35 def update(attributes = {}) attributes.each do |key, value| method_name = "#{key}=".to_sym raise Error, ":#{key} no se puede asignar al concepto" unless respond_to?(method_name) public_send(method_name, value) end calculate! parent_node.parent_node.calculate! true end |