class MediServ::API::Batch

Public Instance Methods

anzahl_rechnungen() click to toggle source

Anzahl Rechnungen

# File lib/mediserv/api/types.rb, line 277
def anzahl_rechnungen
  rechnungen.length
end
stringify_keys(h) click to toggle source
# File lib/mediserv/api/types.rb, line 349
def stringify_keys(h)
  h.reduce({}) do |h, (k,v)|
    v = stringify_keys(v) if v.kind_of?(Hash)
    h.merge({k.to_s => v})
  end
end
to_h() click to toggle source
# File lib/mediserv/api/types.rb, line 326
def to_h
  h = {
    Allgemein: allgemein.to_h.merge({
      Total: total,
      TotalPkt: total_pkt,
      TotalLeis: total_leis,
      TotalMed: total_med,
      TotalLabor: total_labor,
      TotalDiverse: total_diverse,
      TotalRabatt: total_rabatt,
      TotalVz: total_vz,
      TotalNetto: total_netto,
      Datum: fmt_date(created_at),
      Zeit: fmt_time(created_at),
      AnzRech: anzahl_rechnungen,
    }),
  }
  rechnungen.each.with_index(1) do |r,i|
    h["R#{i}"] = r.to_h
  end
  stringify_keys h
end
total() click to toggle source

Gesamtsumme Total (ist auch die Summe von TotalLeis + TotalMed + TotalLabor + TotalDiverse + TotalRabatt)

# File lib/mediserv/api/types.rb, line 317
def total
  total_leis + total_med + total_labor + total_diverse + total_rabatt
end
total_diverse() click to toggle source

Gesamtsumme Diverse Positionen

# File lib/mediserv/api/types.rb, line 302
def total_diverse
  rechnungen.map(&:total_diverse).reduce(0.0, :+)
end
total_labor() click to toggle source

Gesamtsumme aller Laborkosten

# File lib/mediserv/api/types.rb, line 297
def total_labor
  rechnungen.map(&:total_labor).reduce(0.0, :+)
end
total_leis() click to toggle source

Gesamtsumme aller Leistungen

# File lib/mediserv/api/types.rb, line 287
def total_leis
  rechnungen.map(&:total_leis).reduce(0.0, :+)
end
total_med() click to toggle source

Gesamtsumme aller Medikamente

# File lib/mediserv/api/types.rb, line 292
def total_med
  rechnungen.map(&:total_med).reduce(0.0, :+)
end
total_netto() click to toggle source

Nettosumme (Total – Vorauszahlung)

# File lib/mediserv/api/types.rb, line 322
def total_netto
  total - total_vz
end
total_pkt() click to toggle source

Gesamtsumme Taxpunkte

# File lib/mediserv/api/types.rb, line 282
def total_pkt
  rechnungen.map(&:total_punkte).reduce(0.0, :+)
end
total_rabatt() click to toggle source

Gesamtsumme Rabatte

# File lib/mediserv/api/types.rb, line 307
def total_rabatt
  rechnungen.map(&:total_rabatt).reduce(0.0, :+)
end
total_vz() click to toggle source

Gesamtsumme der abgezogenen Vorauszahlungen

# File lib/mediserv/api/types.rb, line 312
def total_vz
  rechnungen.map(&:total_vz).reduce(0.0, :+)
end