query("SELECT * FROM charity_plans ORDER BY created_at DESC"); $plans = $plans_stmt->fetchAll(PDO::FETCH_ASSOC); $total_plans = count($plans); $completed_plans = 0; $total_target = 0; $total_achieved = 0; foreach ($plans as $plan) { if ($plan['status'] === 'completed') { $completed_plans++; } $total_target += $plan['target_value']; $total_achieved += $plan['achieved_value']; } $completion_rate = $total_plans > 0 ? round(($completed_plans / $total_plans) * 100) : 0; $kpi_score = $total_target > 0 ? min(100, round(($total_achieved / $total_target) * 100)) : 0; $overall_score = round(($completion_rate * 0.4) + ($kpi_score * 0.6)); // Fetch Members $members_stmt = $db->query("SELECT * FROM charity_members ORDER BY name ASC"); $members = $members_stmt->fetchAll(PDO::FETCH_ASSOC); $status_labels = [ 'pending' => 'قيد الانتظار', 'in_progress' => 'قيد التنفيذ', 'completed' => 'مكتمل', 'cancelled' => 'ملغي' ]; ?>
تقرير الجمعية الشامل (الخطط، الأهداف والأعضاء)
تاريخ التقرير: = date('Y-m-d') ?>| م | الخطة / الهدف | الفترة | المستهدف | المحقق | النسبة | الحالة |
|---|---|---|---|---|---|---|
| = $index + 1 ?> |
= htmlspecialchars($plan['title'] ?? '') ?>
= htmlspecialchars($plan['description'] ?? '') ?> |
من = $plan['start_date'] ?> إلى = $plan['end_date'] ?> |
= number_format($plan['target_value']) ?> | = number_format($plan['achieved_value']) ?> | = $plan_rate ?>% | = $status_labels[$plan['status']] ?? $plan['status'] ?> |
| م | اسم العضو | الدور/الصفة | رقم الجوال | البريد الإلكتروني | تاريخ الانضمام | الحالة |
|---|---|---|---|---|---|---|
| = $index + 1 ?> | = htmlspecialchars($m['name'] ?? '') ?> | = htmlspecialchars($m['role'] ?: '-') ?> | = htmlspecialchars($m['phone'] ?: '-') ?> | = htmlspecialchars($m['email'] ?: '-') ?> | = htmlspecialchars($m['join_date'] ?: '-') ?> | = $m['status'] == 'active' ? 'نشط' : 'غير نشط' ?> |