no message

This commit is contained in:
dh
2025-11-04 11:23:01 +01:00
parent a8edc86994
commit 45490523e3
393 changed files with 19530 additions and 34342 deletions
+7 -12
View File
@@ -1,6 +1,7 @@
<?php
declare(strict_types=1);
include_once __DIR__ . '/libs/vendor/autoload.php'; // TCPDF Autoloader laden
class Abrechnung extends IPSModule
{
@@ -24,16 +25,10 @@ class Abrechnung extends IPSModule
// Abrechnungs-Button
$this->RegisterScript('StartBilling', 'Abrechnung starten', "<?php IPS_RequestAction(" . $this->InstanceID . ", 'StartBilling', ''); ?>");
// 🧾 Media-Objekt für das PDF
// 🧾 Media-Objekt (PDF) anlegen
$this->RegisterMediaDocument('InvoicePDF', 'Letzte Rechnung', 'pdf');
}
public function ApplyChanges()
{
parent::ApplyChanges();
}
private function RegisterMediaDocument($Ident, $Name, $Extension, $Position = 0)
{
$this->RegisterMedia(5, $Ident, $Name, $Extension, $Position);
@@ -74,14 +69,14 @@ class Abrechnung extends IPSModule
SetValue($this->GetIDForIdent('LastResult'), 'Abrechnung ' . date('Y-m-d H:i'));
echo "✅ Abrechnung erfolgreich erstellt.";
} else {
IPS_LogMessage('Abrechnung', '❌ Fehler bei der PDF-Erstellung oder leeres PDF');
IPS_LogMessage('Abrechnung', '❌ Fehler bei der PDF-Erstellung');
echo "❌ Fehler bei der PDF-Erstellung";
}
break;
}
}
// 🧾 Hauptfunktion: PDF erzeugen (wie SymconReport)
// 🧾 Hauptfunktion: PDF erzeugen (wie in PDFReportMulti)
public function GenerateInvoices()
{
$from = GetValue($this->GetIDForIdent('FromDate'));
@@ -99,7 +94,7 @@ class Abrechnung extends IPSModule
IPS_LogMessage('Abrechnung', 'Starte PDF-Erstellung mit TCPDF...');
// TCPDF initialisieren
// TCPDF initialisieren (wie im SymconReport)
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('IPSymcon Abrechnung');
@@ -154,8 +149,8 @@ class Abrechnung extends IPSModule
$pdf->writeHTML("</table><br><h3>Gesamt: " . number_format($total, 2) . " CHF</h3>", true, false, true, false, '');
}
// Rückgabe als String
return $pdf->Output('Abrechnung.pdf', 'S');
// Ausgabe als String (nicht auf Datei)
return $pdf->Output('Abrechnung.pdf', 'S'); // "S" = return as string
}
private function GetValueAt(int $varId, int $timestamp)