no message
This commit is contained in:
@@ -110,7 +110,7 @@ class Abrechnung extends IPSModule
|
|||||||
return $pdf->Output('Abrechnung.pdf', 'S');
|
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();
|
$pdf->AddPage();
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ class Abrechnung extends IPSModule
|
|||||||
|
|
||||||
// ====================== Stromkosten ======================
|
// ====================== 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;'>
|
$html = "<table border='1' cellspacing='0' cellpadding='3' width='100%' style='font-size:8px;'>
|
||||||
<tr style='background-color:#f0f0f0;'>
|
<tr style='background-color:#f0f0f0;'>
|
||||||
@@ -165,7 +165,7 @@ class Abrechnung extends IPSModule
|
|||||||
|
|
||||||
// ====================== Nebenkosten ======================
|
// ====================== 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;'>
|
$html = "<table border='1' cellspacing='0' cellpadding='3' width='100%' style='font-size:8px;'>
|
||||||
<tr style='background-color:#f0f0f0;'>
|
<tr style='background-color:#f0f0f0;'>
|
||||||
@@ -200,14 +200,10 @@ class Abrechnung extends IPSModule
|
|||||||
|
|
||||||
if (!IPS_VariableExists($varId)) return ['row' => '', 'value' => 0];
|
if (!IPS_VariableExists($varId)) return ['row' => '', 'value' => 0];
|
||||||
|
|
||||||
date_default_timezone_set('Europe/Zurich');
|
|
||||||
|
|
||||||
$filteredTariffs = array_filter($tariffs, fn($t) =>
|
$filteredTariffs = array_filter($tariffs, fn($t) =>
|
||||||
strtolower(trim($t['unit_type'] ?? '')) === strtolower(trim($type))
|
strtolower(trim($t['unit_type'] ?? '')) === strtolower(trim($type))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (empty($filteredTariffs)) return ['row' => '', 'value' => 0];
|
|
||||||
|
|
||||||
foreach ($filteredTariffs as &$t) {
|
foreach ($filteredTariffs as &$t) {
|
||||||
$t['start_ts'] = $this->toUnixTs($t['start'], false);
|
$t['start_ts'] = $this->toUnixTs($t['start'], false);
|
||||||
$t['end_ts'] = $this->toUnixTs($t['end'], true);
|
$t['end_ts'] = $this->toUnixTs($t['end'], true);
|
||||||
@@ -265,7 +261,7 @@ class Abrechnung extends IPSModule
|
|||||||
|
|
||||||
// ====================== Hilfsfunktionen ======================
|
// ====================== 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];
|
$archiveID = @IPS_GetInstanceListByModuleID('{43192F0B-135B-4CE7-A0A7-1475603F3060}')[0];
|
||||||
if (!$archiveID || !IPS_VariableExists($varId)) return null;
|
if (!$archiveID || !IPS_VariableExists($varId)) return null;
|
||||||
@@ -286,7 +282,7 @@ class Abrechnung extends IPSModule
|
|||||||
return $closest ?? floatval(GetValue($varId));
|
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_int($val)) return $val;
|
||||||
if (is_numeric($val)) return intval($val);
|
if (is_numeric($val)) return intval($val);
|
||||||
|
|||||||
Reference in New Issue
Block a user