diff --git a/Abrechnung/module.php b/Abrechnung/module.php
index e7aa366..215f45e 100644
--- a/Abrechnung/module.php
+++ b/Abrechnung/module.php
@@ -301,6 +301,49 @@ private function CalculatePowerCosts($powerMeters, $tariffs, $userId, $from, $to
return ['html'=>$html, 'sum'=>$grand];
}
+
+
+
+ // ====================== Nebenkosten ======================
+
+private function CalculateAdditionalCosts($waterMeters, $tariffs, $userId, $from, $to)
+{
+ $html = "
+
+ | Zähler | Typ | Start | Ende |
+ Zähler Start | Zähler Ende | Verbrauch | Tarif (Rp) | Kosten (CHF) |
+
";
+
+ $total = 0.0;
+ $usedTariffs = [];
+
+ foreach ($waterMeters as $m) {
+ if ($m['user_id'] != $userId) continue;
+ $type = $m['meter_type'] ?? 'Warmwasser';
+ $cost = $this->AddMeterToPDFRow($m, $tariffs, $from, $to, $type);
+ $html .= $cost['row'];
+ $total += $cost['value'];
+ $usedTariffs = array_merge($usedTariffs, $cost['tariffs']);
+ }
+
+ $html .= "
+ | Total Nebenkosten: |
+ " . number_format($total, 2) . " |
+
";
+
+ // 👇 Tarifliste anhängen
+ if (!empty($usedTariffs)) {
+ $html .= "Angewendete Nebenkostentarife:
";
+ foreach ($usedTariffs as $t) {
+ $html .= "- " . date('d.m.Y', $t['start']) . " – " . date('d.m.Y', $t['end']) . ": " .
+ number_format($t['price'], 2) . " Rp
";
+ }
+ $html .= "
";
+ }
+
+ return ['html' => $html, 'sum' => $total];
+}
+
// ====================== Kernberechnung ======================
private function AddMeterToPDFRow($meter, $tariffs, $from, $to, $type)