Class: Planik::Lohnausweis::Rechnung

Inherits:
Eintrag
  • Object
show all
Defined in:
lib/lohnausweis/daten_eintrag.rb

Instance Attribute Summary

Attributes inherited from Eintrag

#ansatz, #einheit, #menge, #name

Instance Method Summary collapse

Methods inherited from Eintrag

#ansatz_to_s, #betrag_gerundet_to_s, #menge_to_s

Constructor Details

#initialize(name, positive, negative, einheit = "Fr") ⇒ Rechnung

Returns a new instance of Rechnung.



124
125
126
127
# File 'lib/lohnausweis/daten_eintrag.rb', line 124

def initialize name, positive, negative, einheit = "Fr"
  super(name, nil, nil, einheit)
  @positive, @negative = positive, negative
end

Instance Method Details

#betragObject



129
130
131
132
133
134
# File 'lib/lohnausweis/daten_eintrag.rb', line 129

def betrag
  v = 0
  v = @positive.inject(v) { |v, x| v + x.betrag }
  v = @negative.inject(v) { |v, x| v - x.betrag }
  v
end