Class: FE::Document::Exoneration
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/facturacr/document/exoneration.rb
Constant Summary collapse
- DOCUMENT_TYPES =
{ "01" => "Compras Autorizadas", "02" => "Ventas exentas a diplomáticos", "03" => "Autorizado por Ley especial", "04" => "Exenciones Dirección General de Hacienda", "05" => "Transitorio V", "06" => "Transitorio IX", "07" => "Transitorio XVII", "99" => "Otros" }.freeze
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
-
#document_number ⇒ Object
Returns the value of attribute document_number.
-
#document_type ⇒ Object
Returns the value of attribute document_type.
-
#institution ⇒ Object
Returns the value of attribute institution.
-
#net_total ⇒ Object
Returns the value of attribute net_total.
-
#percentage ⇒ Object
Returns the value of attribute percentage.
-
#total_tax ⇒ Object
Returns the value of attribute total_tax.
Attributes inherited from Element
Instance Method Summary collapse
- #build_xml(node, document) ⇒ Object
-
#initialize(args = {}) ⇒ Exoneration
constructor
A new instance of Exoneration.
Constructor Details
#initialize(args = {}) ⇒ Exoneration
Returns a new instance of Exoneration.
27 28 29 30 31 32 33 34 |
# File 'lib/facturacr/document/exoneration.rb', line 27 def initialize(args={}) @document_type = args[:document_type] @document_number = args[:document_number] @institution = args[:institution] @date = args[:date] @total_tax = args[:total_tax] @percentage = args[:percentage] end |
Instance Attribute Details
#date ⇒ Object
Returns the value of attribute date.
17 18 19 |
# File 'lib/facturacr/document/exoneration.rb', line 17 def date @date end |
#document_number ⇒ Object
Returns the value of attribute document_number.
17 18 19 |
# File 'lib/facturacr/document/exoneration.rb', line 17 def document_number @document_number end |
#document_type ⇒ Object
Returns the value of attribute document_type.
17 18 19 |
# File 'lib/facturacr/document/exoneration.rb', line 17 def document_type @document_type end |
#institution ⇒ Object
Returns the value of attribute institution.
17 18 19 |
# File 'lib/facturacr/document/exoneration.rb', line 17 def institution @institution end |
#net_total ⇒ Object
Returns the value of attribute net_total.
17 18 19 |
# File 'lib/facturacr/document/exoneration.rb', line 17 def net_total @net_total end |
#percentage ⇒ Object
Returns the value of attribute percentage.
17 18 19 |
# File 'lib/facturacr/document/exoneration.rb', line 17 def percentage @percentage end |
#total_tax ⇒ Object
Returns the value of attribute total_tax.
17 18 19 |
# File 'lib/facturacr/document/exoneration.rb', line 17 def total_tax @total_tax end |
Instance Method Details
#build_xml(node, document) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/facturacr/document/exoneration.rb', line 36 def build_xml(node, document) @document = document raise FE::Error.new("invalid exoneration",class: self.class, messages: errors.) unless valid? node = Nokogiri::XML::Builder.new if node.nil? node.Exoneracion do |xml| xml.TipoDocumento @document_type xml.NumeroDocumento @document_number xml.NombreInstitucion @institution xml.FechaEmision @date.xmlschema xml.PorcentajeExoneracion @percentage xml.MontoExoneracion @total_tax end end |