no message
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
include_once __DIR__ . '/libs/vendor/autoload.php'; // TCPDF Autoloader laden
|
||||
include_once __DIR__ . '/libs/vendor/autoload.php'; // TCPDF-Autoloader laden
|
||||
|
||||
class Abrechnung extends IPSModule
|
||||
{
|
||||
@@ -25,10 +25,20 @@ class Abrechnung extends IPSModule
|
||||
// Abrechnungs-Button
|
||||
$this->RegisterScript('StartBilling', 'Abrechnung starten', "<?php IPS_RequestAction(" . $this->InstanceID . ", 'StartBilling', ''); ?>");
|
||||
|
||||
// 🧾 Media-Objekt (PDF) anlegen
|
||||
// 🧾 Media-Objekt für das PDF
|
||||
$this->RegisterMediaDocument('InvoicePDF', 'Letzte Rechnung', 'pdf');
|
||||
}
|
||||
|
||||
public function ApplyChanges()
|
||||
{
|
||||
parent::ApplyChanges();
|
||||
|
||||
// Sicherheit: falls TCPDF nicht vorhanden ist
|
||||
if (!class_exists('TCPDF')) {
|
||||
IPS_LogMessage('Abrechnung', '⚠️ TCPDF nicht gefunden! Stelle sicher, dass libs/vendor/autoload.php existiert.');
|
||||
}
|
||||
}
|
||||
|
||||
private function RegisterMediaDocument($Ident, $Name, $Extension, $Position = 0)
|
||||
{
|
||||
$this->RegisterMedia(5, $Ident, $Name, $Extension, $Position);
|
||||
@@ -69,14 +79,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');
|
||||
IPS_LogMessage('Abrechnung', '❌ Fehler bei der PDF-Erstellung oder leeres PDF');
|
||||
echo "❌ Fehler bei der PDF-Erstellung";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 🧾 Hauptfunktion: PDF erzeugen (wie in PDFReportMulti)
|
||||
// 🧾 Hauptfunktion: PDF erzeugen (wie SymconReport)
|
||||
public function GenerateInvoices()
|
||||
{
|
||||
$from = GetValue($this->GetIDForIdent('FromDate'));
|
||||
@@ -94,7 +104,7 @@ class Abrechnung extends IPSModule
|
||||
|
||||
IPS_LogMessage('Abrechnung', 'Starte PDF-Erstellung mit TCPDF...');
|
||||
|
||||
// TCPDF initialisieren (wie im SymconReport)
|
||||
// TCPDF initialisieren
|
||||
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
||||
$pdf->SetCreator(PDF_CREATOR);
|
||||
$pdf->SetAuthor('IPSymcon Abrechnung');
|
||||
@@ -149,8 +159,8 @@ class Abrechnung extends IPSModule
|
||||
$pdf->writeHTML("</table><br><h3>Gesamt: " . number_format($total, 2) . " CHF</h3>", true, false, true, false, '');
|
||||
}
|
||||
|
||||
// Ausgabe als String (nicht auf Datei)
|
||||
return $pdf->Output('Abrechnung.pdf', 'S'); // "S" = return as string
|
||||
// Rückgabe als String
|
||||
return $pdf->Output('Abrechnung.pdf', 'S');
|
||||
}
|
||||
|
||||
private function GetValueAt(int $varId, int $timestamp)
|
||||
|
||||
Reference in New Issue
Block a user