Feature: Bankbuchungs-Badge in Beleganzeige unterhalb der Buchungszeilen
This commit is contained in:
parent
d7cc7c2661
commit
ce7a64534b
3 changed files with 38 additions and 0 deletions
|
|
@ -243,6 +243,8 @@ class BelegController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$linkedBankTx = BankTransaction::findByBelegId((int)$beleg['id']);
|
||||||
|
|
||||||
$view = new View();
|
$view = new View();
|
||||||
$view->render('layout/base.php', [
|
$view->render('layout/base.php', [
|
||||||
'pageTitle' => 'Beleg ' . $beleg['beleg_nr'],
|
'pageTitle' => 'Beleg ' . $beleg['beleg_nr'],
|
||||||
|
|
@ -260,6 +262,7 @@ class BelegController
|
||||||
'bankTxSupplier' => $bankTxSupplier,
|
'bankTxSupplier' => $bankTxSupplier,
|
||||||
'bankTxBrutto' => $bankTxBrutto,
|
'bankTxBrutto' => $bankTxBrutto,
|
||||||
'formData' => $bankFormData,
|
'formData' => $bankFormData,
|
||||||
|
'linkedBankTx' => $linkedBankTx,
|
||||||
]),
|
]),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,19 @@ class BankTransaction
|
||||||
return ['new' => $new, 'dup' => $dup];
|
return ['new' => $new, 'dup' => $dup];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function findByBelegId(int $belegId): ?array
|
||||||
|
{
|
||||||
|
$row = Database::fetchOne(
|
||||||
|
'SELECT bt.*, bib.filename AS batch_filename
|
||||||
|
FROM bank_transactions bt
|
||||||
|
JOIN bank_import_batches bib ON bib.id = bt.batch_id
|
||||||
|
WHERE bt.beleg_id = ?
|
||||||
|
LIMIT 1',
|
||||||
|
[$belegId]
|
||||||
|
);
|
||||||
|
return $row ?: null;
|
||||||
|
}
|
||||||
|
|
||||||
public static function createBatch(int $formatId, string $filename, int $rowCount): int
|
public static function createBatch(int $formatId, string $filename, int $rowCount): int
|
||||||
{
|
{
|
||||||
Database::execute(
|
Database::execute(
|
||||||
|
|
|
||||||
|
|
@ -295,6 +295,28 @@ $suppliers = $suppliers ?? [];
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Gespeicherte Bankbuchungs-Verknüpfung -->
|
||||||
|
<?php if ($linkedBankTx ?? null): ?>
|
||||||
|
<?php $lbt = $linkedBankTx; $lbwert = (float)$lbt['wert']; ?>
|
||||||
|
<a href="/bank/<?= (int)$lbt['id'] ?>" class="card mb-2"
|
||||||
|
style="display:block;text-decoration:none;color:inherit;border-left:4px solid var(--color-success)">
|
||||||
|
<div class="card-body" style="padding:.6rem 1.25rem">
|
||||||
|
<div style="display:flex;align-items:center;gap:.75rem;flex-wrap:wrap">
|
||||||
|
<span class="badge badge-green" style="font-size:.8rem">Bankbuchung</span>
|
||||||
|
<span class="td-mono text-sm"><?= View::formatDate($lbt['wertstellung']) ?></span>
|
||||||
|
<?php if ($lbt['vorgang']): ?>
|
||||||
|
<span class="text-sm text-muted"><?= $h($lbt['vorgang']) ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
<span class="text-sm" style="flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap"
|
||||||
|
title="<?= $h($lbt['buchungstext']) ?>"><?= $h($lbt['buchungstext']) ?></span>
|
||||||
|
<strong style="white-space:nowrap;color:<?= $lbwert >= 0 ? 'var(--color-success)' : 'var(--color-danger)' ?>">
|
||||||
|
<?= $lbwert >= 0 ? '+' : '' ?><?= number_format($lbwert, 2, ',', '.') ?> €
|
||||||
|
</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<!-- BankBuchung-Badge (ersetzt KI-Badge wenn aus Bank-Kontext) -->
|
<!-- BankBuchung-Badge (ersetzt KI-Badge wenn aus Bank-Kontext) -->
|
||||||
<?php if (!$beleg['locked'] && ($bankTx ?? null)): ?>
|
<?php if (!$beleg['locked'] && ($bankTx ?? null)): ?>
|
||||||
<div class="card mb-2" style="border-left:4px solid var(--color-primary,#3b82f6)">
|
<div class="card mb-2" style="border-left:4px solid var(--color-primary,#3b82f6)">
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue