no message

This commit is contained in:
2026-03-19 17:13:13 +01:00
parent 584d69b471
commit 99aba58f34
2 changed files with 60 additions and 7 deletions

View File

@@ -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"

View File

@@ -48,6 +48,10 @@ class Abrechnung extends IPSModule
$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');
$this->RegisterPropertyString('CreditorAddress', 'Musterstrasse 1');
@@ -229,13 +233,45 @@ public function GenerateInvoices()
$html .= $additionalResult['html'];
$totalAdditional = $additionalResult['sum'];
// ========================= Gesamttotal =========================
$grandTotal = $totalPower + $totalAdditional;
// ========================= Gesamttotal & MWST =========================
$subTotal = $totalPower + $totalAdditional;
$enableVAT = $this->ReadPropertyBoolean('EnableVAT');
$html .= "<table width='100%' style='font-size:10px;' cellpadding='2'>";
if ($enableVAT) {
$vatPercent = $this->ReadPropertyFloat('VATPercentage');
$vatAmount = $subTotal * ($vatPercent / 100);
$grandTotal = $subTotal + $vatAmount;
$html .= "
<h2 style='margin:0 0 0 0; font-size:11px;'>
Gesamttotal: <strong>CHF " . number_format($grandTotal, 2) . ".-</strong>
</h2>
<tr>
<td width='75%' align='right'>Zwischentotal (exkl. MWST):</td>
<td width='25%' align='right'>CHF " . number_format($subTotal, 2, '.', "'") . "</td>
</tr>
<tr>
<td width='75%' align='right'>zuzüglich " . number_format($vatPercent, 1, '.', "'") . " % MWST:</td>
<td width='25%' align='right'>CHF " . number_format($vatAmount, 2, '.', "'") . "</td>
</tr>
<tr>
<td width='75%' align='right' style='font-size:12px;'><br><strong>Gesamttotal (inkl. MWST):</strong></td>
<td width='25%' align='right' style='font-size:12px;'><br><strong>CHF " . number_format($grandTotal, 2, '.', "'") . "</strong></td>
</tr>
</table>";
} else {
$grandTotal = $subTotal;
$html .= "
<tr>
<td width='75%' align='right' style='font-size:12px;'><strong>Gesamttotal:</strong></td>
<td width='25%' align='right' style='font-size:12px;'><strong>CHF " . number_format($grandTotal, 2, '.', "'") . "</strong></td>
</tr>
<tr>
<td colspan='2' align='right' style='font-size:8px; color:#555;'><br>Nicht mehrwertsteuerpflichtig.</td>
</tr>
</table>
";
}
$pdf->writeHTML($html, true, false, true, false, '');
// WICHTIG: Total zurückgeben für den Einzahlungsschein