Class: Xrechnung::TaxCategory

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

Overview

cbc:IDS</cbc:ID> cbc:Percent16.00</cbc:Percent> cac:TaxScheme cbc:IDVAT</cbc:ID> </cac:TaxScheme>

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MemberContainer

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

Instance Attribute Details

#idString

Returns:

  • (String)


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

member :id, type: String

#percentBigDecimal

Returns:

  • (BigDecimal)


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

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

#tax_exemption_reasonString

Returns:

  • (String)


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

member :tax_exemption_reason, type: String

#tax_exemption_reason_codeString

Returns:

  • (String)


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

member :tax_exemption_reason_code, type: String

#tax_scheme_idString

Returns:

  • (String)


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

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

Instance Method Details

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

noinspection RubyResolve



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/xrechnung/tax_category.rb', line 47

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