Class: Xrechnung::TaxCategory

Inherits:
Object
  • Object
show all
Includes:
MemberContainer
Defined in:
lib/xrechnung/tax_category.rb

Overview

<cbc:ID>S</cbc:ID>

<cbc:Percent>16.00</cbc:Percent>
<cac:TaxScheme>
  <cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MemberContainer

#[], #[]=, included, #initialize

Instance Attribute Details

#idString

Returns:

  • (String)


22
# File 'lib/xrechnung/tax_category.rb', line 22

member :id, type: String

#percentBigDecimal

Returns:

  • (BigDecimal)


26
# File 'lib/xrechnung/tax_category.rb', line 26

member :percent, type: BigDecimal, transform_value: ->(v) { v.nil? ? nil : BigDecimal(v, 0) }

#tax_exemption_reasonString

Returns:

  • (String)


38
# File 'lib/xrechnung/tax_category.rb', line 38

member :tax_exemption_reason, type: String

#tax_exemption_reason_codeString

Returns:

  • (String)


34
# File 'lib/xrechnung/tax_category.rb', line 34

member :tax_exemption_reason_code, type: String

#tax_scheme_idString

Returns:

  • (String)


30
# File 'lib/xrechnung/tax_category.rb', line 30

member :tax_scheme_id, type: String, default: "VAT"

Instance Method Details

#to_xml(xml, root_tag_name: :TaxCategory) ⇒ Object

noinspection RubyResolve



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/xrechnung/tax_category.rb', line 41

def to_xml(xml, root_tag_name: :TaxCategory)
  xml.cac root_tag_name do
    xml.cbc :ID, id
    xml.cbc :Percent, format("%.2f", percent) unless percent.nil?

    unless tax_exemption_reason_code.nil?
      xml.cbc :TaxExemptionReasonCode, tax_exemption_reason_code
      xml.cbc :TaxExemptionReason, tax_exemption_reason
    end

    xml.cac :TaxScheme do
      xml.cbc :ID, tax_scheme_id
    end
  end
end