$year_id,
':month' => $month,
':account_type' => $col['account_type'],
':side' => $col['side'],
];
if (($col['account_type'] === 'wareneingang' || $col['account_type'] === 'erloese') && $col['category_id']) {
$where .= " AND a.revenue_category_id = :rev_cat_id";
$params[':rev_cat_id'] = $col['category_id'];
} elseif (($col['account_type'] === 'expense' || $col['account_type'] === 'deduction') && $col['category_id']) {
$where .= " AND a.expense_category_id = :exp_cat_id";
$params[':exp_cat_id'] = $col['category_id'];
}
$sql = "SELECT e.id, e.entry_date, e.description, e.attachment_note, e.amount AS entry_amount,
a.amount AS col_amount, a.note AS acct_note,
s.name AS supplier_name
FROM journal_entries e
JOIN journal_entry_accounts a ON a.entry_id = e.id
LEFT JOIN journal_suppliers s ON e.supplier_id = s.id
WHERE $where
ORDER BY e.entry_date, e.sort_order, e.id";
$stmt = $pdo->prepare($sql);
$stmt->execute($params);
$entries = $stmt->fetchAll(PDO::FETCH_ASSOC);
$total = array_sum(array_column($entries, 'col_amount'));
$month_name = journal_month_name_full($month);
$year_val = $current_year ? (int)$current_year['year'] : $year_id;
$back_url = url_for('journal_summary.php?year_id=' . $year_id);
?>
= htmlspecialchars($col['label']) ?> – = $month_name ?> = $year_val ?>
= htmlspecialchars($col['label']) ?>
– = $month_name ?> = $year_val ?>
(= htmlspecialchars($col['group']) ?>, = $col['side'] === 'soll' ? 'Soll' : 'Haben' ?>)
Keine Buchungen in diesem Zeitraum.
| Datum |
B |
Text |
Buchungsbetrag |
= htmlspecialchars($col['label']) ?> |
Notiz |
| = htmlspecialchars(date('d.m.Y', strtotime($row['entry_date']))) ?> |
= htmlspecialchars($row['attachment_note'] ?? '') ?> |
= htmlspecialchars($row['description']) ?>
· = htmlspecialchars($row['supplier_name']) ?>
|
= journal_format_amount((float)$row['entry_amount']) ?> |
= journal_format_amount((float)$row['col_amount']) ?> |
= htmlspecialchars($row['acct_note'] ?? '') ?> |
| Summe |
= journal_format_amount($total) ?> |
|
= count($entries) ?> Buchung(en)