prepare('SELECT id, name, slug FROM tenants WHERE slug = ? LIMIT 1'); $stmt->execute([$defaultTenantSlug]); $tenant = $stmt->fetch(); if ($tenant !== false) { $hasAccess = true; $tenantId = (int)$tenant['id']; $tenantName = (string)$tenant['name']; $tenantSlug = (string)$tenant['slug']; } } $year = ledger_current_year(); $tenantTotals = $hasAccess ? ledger_fetch_tenant_totals($pdo, $tenantId, $year) : ledger_empty_totals(); $participantSummaries = $hasAccess ? ledger_fetch_participant_summaries($pdo, $tenantId, [ 'active_only' => true, 'year' => $year, ]) : []; $recentEntries = $hasAccess ? ledger_fetch_recent_entries($pdo, $tenantId, ['limit' => 25]) : []; function ledger_preview_money(int $cents): string { return saas_format_money_cents($cents) . ' EUR'; } function ledger_preview_entry_type(string $type): string { if ($type === 'payment') { return 'Einzahlung'; } if ($type === 'consumption') { return 'Kaffeeverbrauch'; } return $type; } include 'header.php'; include 'headerline.php'; include 'nav.php'; ?>