Fix: Stornorechnung – Syntaxfehler PDF, Betreff vom Original, Referenzzeile unter Titel

This commit is contained in:
fds2610-bot 2026-05-05 09:16:03 +02:00
parent 38cc8f885e
commit 3b235db4f7
3 changed files with 19 additions and 8 deletions

View file

@ -205,7 +205,7 @@ class Invoice
VALUES (?, ?, ?, ?, ?, \'Finalisiert\', ?, ?, ?)', VALUES (?, ?, ?, ?, ?, \'Finalisiert\', ?, ?, ?)',
[ [
(int)$original['customer_id'], (int)$original['customer_id'],
'Stornorechnung zu Rechnung ' . $original['rechnungs_nr'], $original['betreff'],
$original['leistungszeitraum'], $original['leistungszeitraum'],
$today, $today,
$today, $today,

View file

@ -106,10 +106,10 @@ class PdfInvoiceService
$isStorno = !empty($inv['storno_of_id']); $isStorno = !empty($inv['storno_of_id']);
$docTitle = $isStorno ? 'STORNORECHNUNG' : 'Rechnung'; $docTitle = $isStorno ? 'STORNORECHNUNG' : 'Rechnung';
// Referenzzeile für Stornorechnung // Referenzzeile direkt unter dem Dokumententitel (rechte Spalte im Adressblock)
$stornoRefHtml = ''; $stornoRefHtml = '';
if ($isStorno && !empty($inv['original_rechnungs_nr'])) { if ($isStorno && !empty($inv['original_rechnungs_nr'])) {
$stornoRefHtml = '<div style="margin-top:4mm;font-size:7pt;color:#c00">' $stornoRefHtml = '<div style="font-size:7pt;margin-top:2mm">'
. 'Stornierung der Rechnung Nr. <strong>' . $h($inv['original_rechnungs_nr']) . '</strong>' . 'Stornierung der Rechnung Nr. <strong>' . $h($inv['original_rechnungs_nr']) . '</strong>'
. ' vom ' . $fmtDate($inv['original_rechnungs_datum'] ?? '') . ' vom ' . $fmtDate($inv['original_rechnungs_datum'] ?? '')
. '</div>'; . '</div>';
@ -121,6 +121,10 @@ class PdfInvoiceService
$fälligText = ' Fällig am: <strong>' . $fmtDate($inv['faellig_datum']) . '</strong>'; $fälligText = ' Fällig am: <strong>' . $fmtDate($inv['faellig_datum']) . '</strong>';
} }
$zahlungsHinweis = $isStorno ? '' :
'<p class="payment-note">Bitte überweisen Sie den Rechnungsbetrag innerhalb '
. $h($payDays) . ' Tagen auf das unten genannte Konto.' . $fälligText . '</p>';
// Positionszeilen // Positionszeilen
$posRows = ''; $posRows = '';
foreach ($lines as $line) { foreach ($lines as $line) {
@ -167,12 +171,12 @@ class PdfInvoiceService
</div> </div>
</td> </td>
<!-- Rechte Spalte: Dokumententitel --> <!-- Rechte Spalte: Dokumententitel -->
<td class="address-right" style="text-align:right;vertical-align:top;font-size:16pt">{$docTitle}</td> <td class="address-right" style="text-align:right;vertical-align:top;font-size:16pt">
{$docTitle}{$stornoRefHtml}
</td>
</tr> </tr>
</table> </table>
{$stornoRefHtml}
<!-- Meta-Felder --> <!-- Meta-Felder -->
<div style="height:20mm"></div> <div style="height:20mm"></div>
<table class="meta-table"> <table class="meta-table">
@ -225,7 +229,7 @@ class PdfInvoiceService
</table> </table>
<!-- Zahlungshinweis (nicht bei Stornorechnungen) --> <!-- Zahlungshinweis (nicht bei Stornorechnungen) -->
{$isStorno ? '' : '<p class="payment-note">Bitte überweisen Sie den Rechnungsbetrag innerhalb ' . $h($payDays) . ' Tagen auf das unten genannte Konto.' . $fälligText . '</p>'} {$zahlungsHinweis}
</div> </div>
HTML; HTML;

View file

@ -102,7 +102,14 @@ $badgeClass = match($invoice['status']) {
<?php if ($invoice['land'] !== 'DE'): ?><br><?= $h($invoice['land']) ?><?php endif; ?> <?php if ($invoice['land'] !== 'DE'): ?><br><?= $h($invoice['land']) ?><?php endif; ?>
</div> </div>
</div> </div>
<div style="text-align:right;font-size:15pt"><?= !empty($invoice['storno_of_id']) ? 'STORNORECHNUNG' : 'Rechnung' ?></div> <div style="text-align:right;font-size:15pt">
<?= !empty($invoice['storno_of_id']) ? 'STORNORECHNUNG' : 'Rechnung' ?>
<?php if (!empty($invoice['storno_of_id']) && !empty($originalrechnung)): ?>
<div style="font-size:.65rem;margin-top:.3rem;font-weight:normal">
Stornierung der Rechnung Nr. <strong><?= $h($originalrechnung['rechnungs_nr']) ?></strong>
</div>
<?php endif; ?>
</div>
</div> </div>
<!-- Meta-Tabelle --> <!-- Meta-Tabelle -->