no message
This commit is contained in:
@@ -4,6 +4,17 @@
|
||||
"type": "Label",
|
||||
"caption": "🧾 Abrechnungseinstellungen"
|
||||
},
|
||||
{
|
||||
"type": "Image",
|
||||
"name": "Logo",
|
||||
"caption": "Firmenlogo"
|
||||
},
|
||||
{
|
||||
"type": "ValidationTextBox",
|
||||
"name": "FooterText",
|
||||
"caption": "Fusszeile"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
@@ -3,6 +3,19 @@ declare(strict_types=1);
|
||||
|
||||
include_once __DIR__ . '/libs/vendor/autoload.php'; // TCPDF via Composer
|
||||
|
||||
|
||||
class PDFWithFooter extends TCPDF {
|
||||
public $footerText = '';
|
||||
|
||||
public function Footer() {
|
||||
$this->SetY(-15);
|
||||
$this->SetFont('dejavusans', '', 8);
|
||||
$this->Cell(0, 10, $this->footerText, 0, 0, 'C');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class Abrechnung extends IPSModule
|
||||
{
|
||||
public function Create()
|
||||
@@ -13,6 +26,8 @@ class Abrechnung extends IPSModule
|
||||
$this->RegisterPropertyString('PowerMeters', '[]');
|
||||
$this->RegisterPropertyString('WaterMeters', '[]');
|
||||
$this->RegisterPropertyString('Tariffs', '[]');
|
||||
$this->RegisterPropertyString('Logo', '');
|
||||
$this->RegisterPropertyString('FooterText', 'Belevo AG • 6122 Menznau • www.belevo.ch');
|
||||
|
||||
$this->RegisterVariableInteger('FromDate', 'Startdatum', '~UnixTimestamp', 1);
|
||||
$this->RegisterVariableInteger('ToDate', 'Enddatum', '~UnixTimestamp', 2);
|
||||
@@ -92,7 +107,8 @@ class Abrechnung extends IPSModule
|
||||
// Stromkosten einmal für alle User berechnen (15-Minuten-Logik)
|
||||
$this->CalculateAllPowerCosts($power, $tariffs, $from, $to);
|
||||
|
||||
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
|
||||
$pdf = new PDFWithFooter('P', 'mm', 'A4', true, 'UTF-8', false);
|
||||
$pdf->footerText = $this->ReadPropertyString('FooterText');
|
||||
$pdf->SetCreator('IPSymcon Abrechnung');
|
||||
$pdf->SetMargins(15, 15, 15);
|
||||
$pdf->SetAutoPageBreak(true, 20);
|
||||
@@ -107,6 +123,13 @@ class Abrechnung extends IPSModule
|
||||
|
||||
private function BuildUserInvoice($pdf, $user, $power, $water, $tariffs, $from, $to)
|
||||
{
|
||||
$logoData = $this->ReadPropertyString('Logo');
|
||||
if ($logoData !== '') {
|
||||
$img = base64_decode($logoData);
|
||||
$pdf->Image('@' . $img, 15, 10, 40);
|
||||
$pdf->Ln(25);
|
||||
}
|
||||
|
||||
$pdf->AddPage();
|
||||
|
||||
// Kopfbereich
|
||||
|
||||
Reference in New Issue
Block a user