<?php
function rupiah(int $nominal): string {
    return 'Rp ' . number_format($nominal, 0, ',', '.');
}
function bulanIndo(int $n): string {
    return ['','Januari','Februari','Maret','April','Mei','Juni',
            'Juli','Agustus','September','Oktober','November','Desember'][$n] ?? '-';
}
function e(string $s): string { return htmlspecialchars($s, ENT_QUOTES, 'UTF-8'); }
function isRole(string ...$roles): bool {
    return in_array($_SESSION['admin_role'] ?? '', $roles);
}
function redirect(string $url): void {
    // Buang semua output buffer sebelum kirim header
    while (ob_get_level() > 0) {
        ob_end_clean();
    }
    header("Location: $url");
    exit;
}