Feature: Lieferantenname im Buchungsjournal unter Belegnr. anzeigen und in Suche einbeziehen
This commit is contained in:
parent
134ac84bb2
commit
93d6aacbae
2 changed files with 14 additions and 4 deletions
|
|
@ -44,7 +44,8 @@ class Booking
|
||||||
$params[] = (int)$filter['konto'];
|
$params[] = (int)$filter['konto'];
|
||||||
}
|
}
|
||||||
if (!empty($filter['search'])) {
|
if (!empty($filter['search'])) {
|
||||||
$where[] = 'bk.buchungstext LIKE ?';
|
$where[] = '(bk.buchungstext LIKE ? OR s.name LIKE ?)';
|
||||||
|
$params[] = '%' . $filter['search'] . '%';
|
||||||
$params[] = '%' . $filter['search'] . '%';
|
$params[] = '%' . $filter['search'] . '%';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -53,13 +54,15 @@ class Booking
|
||||||
k.kontonummer as kategorie_nr, k.bezeichnung as kategorie_name,
|
k.kontonummer as kategorie_nr, k.bezeichnung as kategorie_name,
|
||||||
z.kontonummer as zahlungs_nr, z.bezeichnung as zahlungs_name,
|
z.kontonummer as zahlungs_nr, z.bezeichnung as zahlungs_name,
|
||||||
bl.beleg_nr, fy.year as fiscal_year_nr,
|
bl.beleg_nr, fy.year as fiscal_year_nr,
|
||||||
a.anlage_nr, a.bezeichnung as anlage_bezeichnung
|
a.anlage_nr, a.bezeichnung as anlage_bezeichnung,
|
||||||
|
s.name as supplier_name
|
||||||
FROM bookings bk
|
FROM bookings bk
|
||||||
JOIN accounts k ON bk.kategorie_konto_id = k.id
|
JOIN accounts k ON bk.kategorie_konto_id = k.id
|
||||||
JOIN accounts z ON bk.zahlungskonto_id = z.id
|
JOIN accounts z ON bk.zahlungskonto_id = z.id
|
||||||
JOIN belege bl ON bk.beleg_id = bl.id
|
JOIN belege bl ON bk.beleg_id = bl.id
|
||||||
JOIN fiscal_years fy ON bk.fiscal_year_id = fy.id
|
JOIN fiscal_years fy ON bk.fiscal_year_id = fy.id
|
||||||
LEFT JOIN assets a ON bk.asset_id = a.id
|
LEFT JOIN assets a ON bk.asset_id = a.id
|
||||||
|
LEFT JOIN suppliers s ON bl.supplier_id = s.id
|
||||||
WHERE ' . implode(' AND ', $where) . '
|
WHERE ' . implode(' AND ', $where) . '
|
||||||
ORDER BY bk.buchungs_datum DESC, bk.id DESC
|
ORDER BY bk.buchungs_datum DESC, bk.id DESC
|
||||||
LIMIT ? OFFSET ?';
|
LIMIT ? OFFSET ?';
|
||||||
|
|
@ -71,6 +74,8 @@ class Booking
|
||||||
|
|
||||||
$countSql = 'SELECT COUNT(*) as cnt FROM bookings bk
|
$countSql = 'SELECT COUNT(*) as cnt FROM bookings bk
|
||||||
JOIN fiscal_years fy ON bk.fiscal_year_id = fy.id
|
JOIN fiscal_years fy ON bk.fiscal_year_id = fy.id
|
||||||
|
JOIN belege bl ON bk.beleg_id = bl.id
|
||||||
|
LEFT JOIN suppliers s ON bl.supplier_id = s.id
|
||||||
WHERE ' . implode(' AND ', $where);
|
WHERE ' . implode(' AND ', $where);
|
||||||
$countParams = array_slice($params, 0, -2);
|
$countParams = array_slice($params, 0, -2);
|
||||||
$total = (int)(Database::fetchOne($countSql, $countParams)['cnt'] ?? 0);
|
$total = (int)(Database::fetchOne($countSql, $countParams)['cnt'] ?? 0);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<div class="toolbar-left">
|
<div class="toolbar-left">
|
||||||
<form method="get" style="display:flex;gap:.5rem;flex-wrap:wrap;align-items:center">
|
<form method="get" style="display:flex;gap:.5rem;flex-wrap:wrap;align-items:center">
|
||||||
<input type="search" name="search" placeholder="Buchungstext suchen…"
|
<input type="search" name="search" placeholder="Buchungstext / Lieferant…"
|
||||||
value="<?= $h($filter['search'] ?? '') ?>" style="width:220px">
|
value="<?= $h($filter['search'] ?? '') ?>" style="width:220px">
|
||||||
<select name="year" style="width:80px">
|
<select name="year" style="width:80px">
|
||||||
<option value="">Alle Jahre</option>
|
<option value="">Alle Jahre</option>
|
||||||
|
|
@ -64,7 +64,12 @@
|
||||||
<?= $h($bk['buchungs_nr']) ?>
|
<?= $h($bk['buchungs_nr']) ?>
|
||||||
</td>
|
</td>
|
||||||
<td class="td-muted"><?= View::formatDate($bk['buchungs_datum']) ?></td>
|
<td class="td-muted"><?= View::formatDate($bk['buchungs_datum']) ?></td>
|
||||||
<td><a href="/belege/<?= $h($bk['beleg_id']) ?>" class="td-mono text-sm"><?= $h($bk['beleg_nr']) ?></a></td>
|
<td>
|
||||||
|
<a href="/belege/<?= $h($bk['beleg_id']) ?>" class="td-mono text-sm"><?= $h($bk['beleg_nr']) ?></a>
|
||||||
|
<?php if (!empty($bk['supplier_name'])): ?>
|
||||||
|
<br><span class="td-muted"><?= $h(mb_strimwidth($bk['supplier_name'], 0, 25, '…')) ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
<td><span class="badge <?= $bk['buchungstyp'] === 'Einnahme' ? 'badge-green' : 'badge-red' ?>"><?= $h($bk['buchungstyp']) ?></span></td>
|
<td><span class="badge <?= $bk['buchungstyp'] === 'Einnahme' ? 'badge-green' : 'badge-red' ?>"><?= $h($bk['buchungstyp']) ?></span></td>
|
||||||
<td class="td-mono text-sm">
|
<td class="td-mono text-sm">
|
||||||
<?= $h($bk['kategorie_nr']) ?><br>
|
<?= $h($bk['kategorie_nr']) ?><br>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue