Class: XmlLaborabrechnungsdaten::MwstGruppe

Inherits:
Object
  • Object
show all
Includes:
MemberContainer
Defined in:
lib/xml_laborabrechnungsdaten/mwst_gruppe.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MemberContainer

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

Instance Attribute Details

#mehrwertsteuerbetragString

Returns VAT amount.

Returns:

  • (String)

    VAT amount



15
# File 'lib/xml_laborabrechnungsdaten/mwst_gruppe.rb', line 15

member :mehrwertsteuerbetrag, type: String

#mehrwertsteuersatzString

Returns VAT rate.

Returns:

  • (String)

    VAT rate



11
# File 'lib/xml_laborabrechnungsdaten/mwst_gruppe.rb', line 11

member :mehrwertsteuersatz, type: String

#positionenArray<Position>

Returns List of positions in this VAT group.

Returns:

  • (Array<Position>)

    List of positions in this VAT group



19
# File 'lib/xml_laborabrechnungsdaten/mwst_gruppe.rb', line 19

member :positionen, type: Array, default: []

#zwischensumme_nettoString

Returns Net subtotal amount.

Returns:

  • (String)

    Net subtotal amount



7
# File 'lib/xml_laborabrechnungsdaten/mwst_gruppe.rb', line 7

member :zwischensumme_netto, type: String

Instance Method Details

#add_position(position) ⇒ Array<Position>

Adds a position to the VAT group

Parameters:

  • position (Position)

    Position to add

Returns:

  • (Array<Position>)

    Updated list of positions



24
25
26
27
# File 'lib/xml_laborabrechnungsdaten/mwst_gruppe.rb', line 24

def add_position(position)
  positionen << position
  positionen
end

#to_xml(xml) ⇒ void

This method returns an undefined value.

Generates XML representation of the VAT group

Parameters:

  • xml (Builder::XmlMarkup)

    XML builder instance



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/xml_laborabrechnungsdaten/mwst_gruppe.rb', line 32

def to_xml(xml)
  attributes = {
    Zwischensumme_netto: zwischensumme_netto,
    Mehrwertsteuersatz: mehrwertsteuersatz,
    Mehrwertsteuerbetrag: mehrwertsteuerbetrag
  }.compact # Removes nil values

  xml.tag!(:"MWST-Gruppe", attributes) do
    # Add all positions as child elements
    positionen.each do |position|
      position.to_xml(xml)
    end
  end
end