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'; ?>
= h(tr('يمكنك معاينة الهيكل والتصميم الآن، ثم تسجيل الدخول لتجربة سير العمل الكامل.', 'You can preview the structure and design now, then sign in to try the full workflow.')) ?>
= h(tr('لا توجد بيانات كافية لعرض الرسم البياني', 'Not enough data to show chart')) ?>
= h(tr('لا توجد بيانات كافية لعرض الرسم البياني', 'Not enough data to show chart')) ?>
= h(tr('ابدأ بأول فاتورة من صفحة نقاط البيع.', 'Start your first receipt from the POS page.')) ?>
= h(tr('إنشاء بيع POS', 'Create POS sale')) ?>| = h(tr('رقم الإيصال', 'Receipt No')) ?> | = h(tr('الفرع', 'Branch')) ?> | = h(tr('النوع', 'Type')) ?> | = h(tr('التاريخ', 'Date')) ?> | = h(tr('الإجمالي', 'Total')) ?> |
|---|---|---|---|---|
| #= h($sale['receipt_no']) ?> | = h(branch_label((string) $sale['branch_code'])) ?> | = h(sale_mode_label((string) $sale['sale_mode'])) ?> = h(sale_mode_label((string) $sale['sale_mode'])) ?> | = h(date('M d, H:i', strtotime((string) $sale['sale_date']))) ?> | = h(currency((float) $sale['total_amount'])) ?> |
= h(current_lang() === 'ar' ? $user['name_ar'] : $user['name_en']) ?>
= h(role_label($user['role'])) ?> • = h(branch_label($user['branch_code'])) ?>= h(tr('جرّب المالك أو مدير الفرع أو الكاشير لرؤية اختلاف الصلاحيات.', 'Try owner, branch manager, or cashier to see different permissions.')) ?>
= h(tr('تسجيل الدخول للبدء', 'Sign in to start')) ?>= h(tr('لا توجد بيانات كافية لعرض الرسم البياني', 'Not enough data to show chart')) ?>