v1.3.1 - Zahlerlogik verbessert

This commit is contained in:
Borgal
2025-11-19 20:40:09 +01:00
parent 2046d80c9b
commit 654157f174
6 changed files with 136 additions and 77 deletions

View File

@@ -36,7 +36,7 @@ $userIds = array_keys($alleBenutzer);
$bisDatum = $berichtsMonatEnde->format('Y-m-d');
$stmt = mysqli_prepare($conn, "
SELECT m.id AS meeting_id, m.meeting_date,
mt.user_id, mt.wore_color, mt.paid
mt.user_id, mt.wore_color, mt.paid, mt.birthday_pay
FROM meetings m
LEFT JOIN meeting_teilnehmer mt ON m.id = mt.meeting_id AND mt.attended = 1
WHERE m.meeting_date <= ? AND m.is_completed = 1
@@ -107,12 +107,15 @@ foreach ($berichtsMeetingsMeta as $meta) {
$teilgenommen = false;
$wore_color = null;
$paid_this = false;
$paid_this_birthday = false; // NEU
// Finde Teilnahme-Daten für dieses Meeting
foreach ($alleMeetingsMitTeilnehmern as $mt) {
if ($mt['meeting_id'] == $mid && $mt['user_id'] == $uid) {
$teilgenommen = true;
$wore_color = !empty($mt['wore_color']);
$paid_this = !empty($mt['paid']);
$paid_this = ($mt['paid'] == 1);
$paid_this_birthday = ($mt['birthday_pay'] == 1); // Explizit prüfen
break;
}
}
@@ -135,14 +138,22 @@ foreach ($berichtsMeetingsMeta as $meta) {
$offeneStrafen++;
}
}
if (!empty($mt['paid'])) {
// 🔹 NUR normale Zahlungen zählen (birthday_pay = 0)
$is_paid = ($mt['paid'] == 1);
$is_birthday = ($mt['birthday_pay'] == 1);
if ($is_paid && !$is_birthday) {
$rechnungenGesamt++;
}
}
// Name mit Symbolen
$userNameAnzeige = htmlspecialchars($username);
if ($paid_this) {
$userNameAnzeige .= ' <span class="paid-symbol">€</span>';
if ($paid_this_birthday) {
$userNameAnzeige .= ' <span class="birthday-symbol">(G)</span>';
}
}
if (!$teilgenommen) {
@@ -196,6 +207,7 @@ $html = '
th, td { border: 1px solid #333; padding: 4pt 6pt; text-align: left; }
th { background-color: #f0f0f0; font-weight: bold; }
.paid-symbol { color: red; font-weight: bold; }
.birthday-symbol { color: #d63384; font-size: 0.85em; }
.color-ok { color: green; }
.color-fail { color: red; }
.page-break { page-break-after: always; }
@@ -260,6 +272,7 @@ $html .= '
<div class="meta">
<p>Erstellt am: ' . date('d.m.Y') . '</p>
<p><em>* = "€" hat Restaurant-Rechnung bezahlt</em></p>
<p><em>(G) = Geburtstagszahlung (zählt nicht zur Rechnungsanzahl)</em></p>
</div>
</body>