0, 'today_revenue' => 0.0, 'pos_count' => 0, 'normal_count' => 0, 'recent' => []]; $reportMetrics = ['branch_totals' => [], 'payment_totals' => [], 'product_totals' => []]; try { $metrics = dashboard_metrics(); $reportMetrics = report_metrics(); } catch (Throwable $e) { $dbError = $e->getMessage(); } $branchLabels = []; $branchData = []; foreach ($reportMetrics['branch_totals'] as $code => $total) { $branchLabels[] = branch_label((string)$code); $branchData[] = (float)$total; } $productLabels = []; $productData = []; $topProducts = array_slice($reportMetrics['product_totals'], 0, 5, true); foreach ($topProducts as $sku => $qty) { $productLabels[] = product_label((string)$sku); $productData[] = (int)$qty; } $monthlyLabels = []; $monthlyData = []; if (isset($reportMetrics['monthly_totals'])) { foreach ($reportMetrics['monthly_totals'] as $month => $total) { // format month: "2026-04" -> "Apr 2026" $time = strtotime($month . '-01'); $monthlyLabels[] = date('M Y', $time); $monthlyData[] = (float)$total; } } require __DIR__ . '/includes/header.php'; ?>

POS