no message

This commit is contained in:
2025-11-05 14:36:06 +01:00
parent 3a4bb00b57
commit 9cad56c283
+5 -9
View File
@@ -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 = "<table border='1' cellspacing='0' cellpadding='3' width='100%' style='font-size:8px;'>
<tr style='background-color:#f0f0f0;'>
@@ -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 = "<table border='1' cellspacing='0' cellpadding='3' width='100%' style='font-size:8px;'>
<tr style='background-color:#f0f0f0;'>
@@ -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);