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\', ?, ?, ?)',
[
(int)$original['customer_id'],
'Stornorechnung zu Rechnung ' . $original['rechnungs_nr'],
$original['betreff'],
$original['leistungszeitraum'],
$today,
$today,

View file

@ -106,10 +106,10 @@ class PdfInvoiceService
$isStorno = !empty($inv['storno_of_id']);
$docTitle = $isStorno ? 'STORNORECHNUNG' : 'Rechnung';
// Referenzzeile für Stornorechnung
// Referenzzeile direkt unter dem Dokumententitel (rechte Spalte im Adressblock)
$stornoRefHtml = '';
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>'
. ' vom ' . $fmtDate($inv['original_rechnungs_datum'] ?? '')
. '</div>';
@ -121,6 +121,10 @@ class PdfInvoiceService
$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
$posRows = '';
foreach ($lines as $line) {
@ -167,12 +171,12 @@ class PdfInvoiceService
</div>
</td>
<!-- 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>
</table>
{$stornoRefHtml}
<!-- Meta-Felder -->
<div style="height:20mm"></div>
<table class="meta-table">
@ -225,7 +229,7 @@ class PdfInvoiceService
</table>
<!-- 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>
HTML;

View file

@ -102,7 +102,14 @@ $badgeClass = match($invoice['status']) {
<?php if ($invoice['land'] !== 'DE'): ?><br><?= $h($invoice['land']) ?><?php endif; ?>
</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>
<!-- Meta-Tabelle -->