Class: FE::Document::OtherCharges
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/facturacr/document/other_charges.rb
Constant Summary collapse
- OTHER_DOCUMENT_TYPES =
{ "01" => "Contribución parafiscal", "02" => "Timbre de la Cruz Roja", "03" => "Timbre de Benemérito Cuerpo de Bomberos de Costa Rica", "04" => "Cobro de un tercero", "05" => "Costos de Exportación", "06" => "Impuesto de servicio 10%", "07" => "Timbre de Colegios Profesionales", "99" => "Otros Cargos" }.freeze
Instance Attribute Summary collapse
-
#collector_id_number ⇒ Object
Returns the value of attribute collector_id_number.
-
#collector_name ⇒ Object
Returns the value of attribute collector_name.
-
#detail ⇒ Object
Returns the value of attribute detail.
-
#document_type ⇒ Object
Returns the value of attribute document_type.
-
#percentage ⇒ Object
Returns the value of attribute percentage.
-
#total_charge ⇒ Object
Returns the value of attribute total_charge.
Attributes inherited from Element
Instance Method Summary collapse
- #build_xml(node, document) ⇒ Object
-
#initialize(args = {}) ⇒ OtherCharges
constructor
A new instance of OtherCharges.
Constructor Details
#initialize(args = {}) ⇒ OtherCharges
Returns a new instance of OtherCharges.
27 28 29 30 31 32 33 34 |
# File 'lib/facturacr/document/other_charges.rb', line 27 def initialize(args={}) @document_type = args[:document_type] @collector_id_number=args[:collector_id_number] @collector_name = args[:collector_name] @detail = args[:detail] @percentage =args[:percentage] @total_charge = args[:total_charge] end |
Instance Attribute Details
#collector_id_number ⇒ Object
Returns the value of attribute collector_id_number.
19 20 21 |
# File 'lib/facturacr/document/other_charges.rb', line 19 def collector_id_number @collector_id_number end |
#collector_name ⇒ Object
Returns the value of attribute collector_name.
19 20 21 |
# File 'lib/facturacr/document/other_charges.rb', line 19 def collector_name @collector_name end |
#detail ⇒ Object
Returns the value of attribute detail.
19 20 21 |
# File 'lib/facturacr/document/other_charges.rb', line 19 def detail @detail end |
#document_type ⇒ Object
Returns the value of attribute document_type.
19 20 21 |
# File 'lib/facturacr/document/other_charges.rb', line 19 def document_type @document_type end |
#percentage ⇒ Object
Returns the value of attribute percentage.
19 20 21 |
# File 'lib/facturacr/document/other_charges.rb', line 19 def percentage @percentage end |
#total_charge ⇒ Object
Returns the value of attribute total_charge.
19 20 21 |
# File 'lib/facturacr/document/other_charges.rb', line 19 def total_charge @total_charge end |
Instance Method Details
#build_xml(node, document) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/facturacr/document/other_charges.rb', line 36 def build_xml(node, document) raise FE::Error.new("other charges invalid",class: self.class, messages: errors.) unless valid? node = Nokogiri::XML::Builder.new if node.nil? node.OtrosCargos do |xml| xml.TipoDocumento @document_type xml.NumeroIdentidadTercero @third_id_number if @third_id_number.present? xml.NombreTercero @third_name if @third_name.present? xml.Detalle @detail xml.Porcentaje @percentage if @percentage.present? xml.MontoCargo @total_charge end end |