From 9cad56c28373ff67b9507e0b466a7a62af23fe18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=A4fliger?= Date: Wed, 5 Nov 2025 14:36:06 +0100 Subject: [PATCH] no message --- Abrechnung/module.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Abrechnung/module.php b/Abrechnung/module.php index 6b8eccd..cb2105e 100644 --- a/Abrechnung/module.php +++ b/Abrechnung/module.php @@ -110,7 +110,7 @@ class Abrechnung extends IPSModule return $pdf->Output('Abrechnung.pdf', 'S'); } - private function BuildUserInvoice($pdf, array $user, array $power, array $water, array $tariffs, int $from, int $to) + private function BuildUserInvoice($pdf, $user, $power, $water, $tariffs, $from, $to) { $pdf->AddPage(); @@ -139,7 +139,7 @@ class Abrechnung extends IPSModule // ====================== Stromkosten ====================== - private function CalculatePowerCosts(array $powerMeters, array $tariffs, int $userId, int $from, int $to): array + private function CalculatePowerCosts($powerMeters, $tariffs, $userId, $from, $to) { $html = " @@ -165,7 +165,7 @@ class Abrechnung extends IPSModule // ====================== Nebenkosten ====================== - private function CalculateAdditionalCosts(array $waterMeters, array $tariffs, int $userId, int $from, int $to): array + private function CalculateAdditionalCosts($waterMeters, $tariffs, $userId, $from, $to) { $html = "
@@ -200,14 +200,10 @@ class Abrechnung extends IPSModule if (!IPS_VariableExists($varId)) return ['row' => '', 'value' => 0]; - date_default_timezone_set('Europe/Zurich'); - $filteredTariffs = array_filter($tariffs, fn($t) => strtolower(trim($t['unit_type'] ?? '')) === strtolower(trim($type)) ); - if (empty($filteredTariffs)) return ['row' => '', 'value' => 0]; - foreach ($filteredTariffs as &$t) { $t['start_ts'] = $this->toUnixTs($t['start'], false); $t['end_ts'] = $this->toUnixTs($t['end'], true); @@ -265,7 +261,7 @@ class Abrechnung extends IPSModule // ====================== Hilfsfunktionen ====================== - private function GetValueAt(int $varId, int $timestamp, bool $nearestAfter = true) + private function GetValueAt($varId, $timestamp, $nearestAfter = true) { $archiveID = @IPS_GetInstanceListByModuleID('{43192F0B-135B-4CE7-A0A7-1475603F3060}')[0]; if (!$archiveID || !IPS_VariableExists($varId)) return null; @@ -286,7 +282,7 @@ class Abrechnung extends IPSModule return $closest ?? floatval(GetValue($varId)); } - private function toUnixTs($val, bool $endOfDay = false): ?int + private function toUnixTs($val, $endOfDay = false) { if (is_int($val)) return $val; if (is_numeric($val)) return intval($val);