Feature: Gebuchte Bankbuchungen verlinken auf Beleg; Belegnummer in Statuszeile

This commit is contained in:
fds2610-bot 2026-05-15 17:09:35 +02:00
parent aa0dd01e66
commit d7cc7c2661
2 changed files with 10 additions and 2 deletions

View file

@ -50,10 +50,12 @@ class BankTransaction
)['n'] ?? 0);
$rows = Database::fetchAll(
"SELECT bt.*, bib.filename AS batch_filename, bif.name AS format_name
"SELECT bt.*, bib.filename AS batch_filename, bif.name AS format_name,
b.id AS beleg_id, b.beleg_nr
FROM bank_transactions bt
JOIN bank_import_batches bib ON bt.batch_id = bib.id
JOIN bank_import_formats bif ON bib.format_id = bif.id
LEFT JOIN belege b ON b.id = bt.beleg_id
WHERE $whereStr
ORDER BY bt.wertstellung DESC, bt.id DESC
LIMIT ? OFFSET ?",

View file

@ -82,8 +82,11 @@ $months = ['Jan','Feb','Mär','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','D
$wert = (float)$row['wert'];
$isPlus = $wert >= 0;
$color = $isPlus ? 'var(--color-success)' : 'var(--color-danger)';
$ziel = ($row['status'] === 'gebucht' && !empty($row['beleg_id']))
? '/belege/' . (int)$row['beleg_id']
: '/bank/' . (int)$row['id'];
?>
<tr style="cursor:pointer" onclick="window.location='/bank/<?= (int)$row['id'] ?>'">
<tr style="cursor:pointer" onclick="window.location='<?= $ziel ?>'">
<td class="td-mono"><?= $h(View::formatDate($row['wertstellung'])) ?></td>
<td>
<div><?= $h($row['buchungstext']) ?></div>
@ -103,6 +106,9 @@ $months = ['Jan','Feb','Mär','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','D
};
?>
<span class="badge <?= $badgeClass ?>"><?= $h(ucfirst($row['status'])) ?></span>
<?php if ($row['status'] === 'gebucht' && !empty($row['beleg_nr'])): ?>
<div class="text-muted text-sm" style="margin-top:.25rem"><?= $h($row['beleg_nr']) ?></div>
<?php endif; ?>
</td>
<td onclick="event.stopPropagation()">
<?php if ($row['status'] !== 'ignoriert'): ?>