From 99aba58f34aa7cf7ec969e9ff88f45a9bc730273 Mon Sep 17 00:00:00 2001 From: DanielHaefliger Date: Thu, 19 Mar 2026 17:13:13 +0100 Subject: [PATCH] no message --- Abrechnung/form.json | 17 +++++++++++++++ Abrechnung/module.php | 50 +++++++++++++++++++++++++++++++++++++------ 2 files changed, 60 insertions(+), 7 deletions(-) diff --git a/Abrechnung/form.json b/Abrechnung/form.json index 92235cb..ae3ef07 100644 --- a/Abrechnung/form.json +++ b/Abrechnung/form.json @@ -19,6 +19,23 @@ "name": "FooterText", "caption": "Fusszeile" }, + { + "type": "Label", + "caption": "⚖️ Mehrwertsteuer (MWST)" + }, + { + "type": "CheckBox", + "name": "EnableVAT", + "caption": "Mehrwertsteuer berechnen und ausweisen" + }, + { + "type": "NumberSpinner", + "name": "VATPercentage", + "caption": "MWST-Satz in %", + "digits": 2, + "minimum": 0, + "maximum": 100 + }, { "type": "Label", "caption": "🏦 QR-Einzahlungsschein Daten" diff --git a/Abrechnung/module.php b/Abrechnung/module.php index 80c527e..6266c25 100644 --- a/Abrechnung/module.php +++ b/Abrechnung/module.php @@ -47,6 +47,10 @@ class Abrechnung extends IPSModule $this->RegisterPropertyInteger('LogoMediaID', 0); $this->RegisterPropertyString('PropertyText', 'Liegenschaft'); $this->RegisterPropertyString('FooterText', 'Belevo AG • 6122 Menznau • www.belevo.ch'); + + // NEU: MWST Variablen registrieren (Standard 8.1%) + $this->RegisterPropertyBoolean('EnableVAT', false); + $this->RegisterPropertyFloat('VATPercentage', 8.1); // Neue Felder für den QR-Schein $this->RegisterPropertyString('CreditorName', 'Belevo AG'); @@ -229,13 +233,45 @@ public function GenerateInvoices() $html .= $additionalResult['html']; $totalAdditional = $additionalResult['sum']; - // ========================= Gesamttotal ========================= - $grandTotal = $totalPower + $totalAdditional; - $html .= " -

- Gesamttotal: CHF " . number_format($grandTotal, 2) . ".- -

- "; + // ========================= Gesamttotal & MWST ========================= + $subTotal = $totalPower + $totalAdditional; + $enableVAT = $this->ReadPropertyBoolean('EnableVAT'); + + $html .= ""; + + if ($enableVAT) { + $vatPercent = $this->ReadPropertyFloat('VATPercentage'); + $vatAmount = $subTotal * ($vatPercent / 100); + $grandTotal = $subTotal + $vatAmount; + + $html .= " + + + + + + + + + + + + +
Zwischentotal (exkl. MWST):CHF " . number_format($subTotal, 2, '.', "'") . "
zuzüglich " . number_format($vatPercent, 1, '.', "'") . " % MWST:CHF " . number_format($vatAmount, 2, '.', "'") . "

Gesamttotal (inkl. MWST):

CHF " . number_format($grandTotal, 2, '.', "'") . "
"; + } else { + $grandTotal = $subTotal; + $html .= " + + Gesamttotal: + CHF " . number_format($grandTotal, 2, '.', "'") . " + + +
Nicht mehrwertsteuerpflichtig. + + + "; + } + $pdf->writeHTML($html, true, false, true, false, ''); // WICHTIG: Total zurückgeben für den Einzahlungsschein