From f1fb1b1949794b64c7271398588fa3bb579c257a Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Mon, 13 Apr 2026 05:29:49 +0000 Subject: [PATCH] update charity all --- accounting.php | 8 +- accounts.php | 6 +- charity_members.php | 22 +++-- charity_plans.php | 22 +++-- committee_reports.php | 42 +++++++--- committees.php | 8 +- db/config.php | 9 +- .../033_add_user_id_to_charity_members.php | 17 ++++ db/migrations/034_add_audit_columns.sql | 82 +++++++++++++++++++ expense_categories.php | 4 + expenses.php | 12 ++- hr_attendance.php | 8 +- hr_employees.php | 6 +- hr_holidays.php | 6 +- hr_leaves.php | 6 +- hr_payroll.php | 6 +- inbound.php | 6 +- includes/permissions.php | 16 ++++ internal_inbox.php | 8 +- internal_outbox.php | 8 +- meetings.php | 8 +- outbound.php | 6 +- print_charity_report.php | 28 +++++-- print_committees_report.php | 39 ++++++--- stock_items.php | 6 +- stock_lending.php | 8 +- users.php | 8 +- view_committee.php | 16 ++++ 28 files changed, 346 insertions(+), 75 deletions(-) create mode 100644 db/migrations/033_add_user_id_to_charity_members.php create mode 100644 db/migrations/034_add_audit_columns.sql diff --git a/accounting.php b/accounting.php index ffb8055..a30ba7a 100644 --- a/accounting.php +++ b/accounting.php @@ -237,10 +237,12 @@ $ledger = get_ledger_paginated($search, $date_from, $date_to, $limit, $offset);

دفتر الأستاذ (General Ledger)

- + + + - + @@ -250,6 +252,8 @@ $ledger = get_ledger_paginated($search, $date_from, $date_to, $limit, $offset); + + - + + + @@ -141,6 +143,8 @@ $typeMap = [ + + + + @@ -113,13 +115,15 @@ $members = $stmt->fetchAll(); غير نشط - + + - + diff --git a/charity_plans.php b/charity_plans.php index 31846e3..3fef0a8 100644 --- a/charity_plans.php +++ b/charity_plans.php @@ -1,14 +1,14 @@ غير مصرح لك بالوصول لهذه الصفحة."; require_once 'includes/footer.php'; exit; } if ($_SERVER['REQUEST_METHOD'] === 'POST') { - if (isset($_POST['add_plan']) && (isAdmin() || canAdd('committees'))) { + if (isset($_POST['add_plan']) && (isAdmin() || canAdd('charity_plans'))) { $title = $_POST['title']; $description = $_POST['description'] ?? ''; $start_date = $_POST['start_date'] ?? date('Y-m-d'); @@ -21,7 +21,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $stmt->execute([$title, $description, $start_date, $end_date, $target_value, $achieved_value, $status]); $_SESSION['success'] = "تمت إضافة الخطة بنجاح."; redirect('charity_plans.php'); - } elseif (isset($_POST['edit_plan']) && (isAdmin() || canEdit('committees'))) { + } elseif (isset($_POST['edit_plan']) && (isAdmin() || canEdit('charity_plans'))) { $id = $_POST['id']; $title = $_POST['title']; $description = $_POST['description'] ?? ''; @@ -35,7 +35,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $stmt->execute([$title, $description, $start_date, $end_date, $target_value, $achieved_value, $status, $id]); $_SESSION['success'] = "تم تحديث الخطة بنجاح."; redirect('charity_plans.php'); - } elseif (isset($_POST['delete_plan']) && (isAdmin() || canDelete('committees'))) { + } elseif (isset($_POST['delete_plan']) && (isAdmin() || canDelete('charity_plans'))) { $id = $_POST['id']; $stmt = db()->prepare("DELETE FROM charity_plans WHERE id = ?"); $stmt->execute([$id]); @@ -84,7 +84,7 @@ $status_labels = [ طباعة تقرير الجمعية - + @@ -161,6 +161,8 @@ $status_labels = [ + + @@ -190,13 +192,15 @@ $status_labels = [ - + + - + diff --git a/committee_reports.php b/committee_reports.php index 595c745..119c8fb 100644 --- a/committee_reports.php +++ b/committee_reports.php @@ -8,17 +8,37 @@ if (!canView('committees')) { } // Fetch all committees and calculate stats -$stmt = db()->query(" - SELECT - c.id, c.name, - (SELECT COUNT(*) FROM committee_members WHERE committee_id = c.id) as members_count, - (SELECT COUNT(*) FROM committee_plans WHERE committee_id = c.id) as total_plans, - (SELECT COUNT(*) FROM committee_plans WHERE committee_id = c.id AND status = 'completed') as completed_plans, - (SELECT COUNT(*) FROM committee_activities WHERE committee_id = c.id) as activities_count - FROM committees c - ORDER BY c.name ASC -"); -$committees = $stmt->fetchAll(PDO::FETCH_ASSOC); +if (isAdmin()) { + $stmt = db()->query(" + SELECT + c.id, c.name, + (SELECT COUNT(*) FROM committee_members WHERE committee_id = c.id) as members_count, + (SELECT COUNT(*) FROM committee_plans WHERE committee_id = c.id) as total_plans, + (SELECT COUNT(*) FROM committee_plans WHERE committee_id = c.id AND status = 'completed') as completed_plans, + (SELECT COUNT(*) FROM committee_activities WHERE committee_id = c.id) as activities_count + FROM committees c + ORDER BY c.name ASC + "); + $committees = $stmt->fetchAll(PDO::FETCH_ASSOC); +} else { + $stmt = db()->prepare(" + SELECT + c.id, c.name, + (SELECT COUNT(*) FROM committee_members WHERE committee_id = c.id) as members_count, + (SELECT COUNT(*) FROM committee_plans WHERE committee_id = c.id) as total_plans, + (SELECT COUNT(*) FROM committee_plans WHERE committee_id = c.id AND status = 'completed') as completed_plans, + (SELECT COUNT(*) FROM committee_activities WHERE committee_id = c.id) as activities_count + FROM committees c + JOIN committee_members m ON c.id = m.committee_id + JOIN charity_members cm ON m.charity_member_id = cm.id + JOIN users u ON (u.id = cm.user_id) OR (cm.email != '' AND cm.email = u.email) OR (cm.name = u.full_name) OR (cm.name = u.username) + WHERE u.id = ? + GROUP BY c.id + ORDER BY c.name ASC + "); + $stmt->execute([$_SESSION['user_id']]); + $committees = $stmt->fetchAll(PDO::FETCH_ASSOC); +} // Overall stats $total_committees = count($committees); diff --git a/committees.php b/committees.php index a8a8db1..05657f7 100644 --- a/committees.php +++ b/committees.php @@ -99,6 +99,8 @@ if (isset($_SESSION['error'])) { + + @@ -109,7 +111,9 @@ if (isset($_SESSION['error'])) { - + + - + diff --git a/db/config.php b/db/config.php index 300160b..fd0c258 100644 --- a/db/config.php +++ b/db/config.php @@ -12,6 +12,13 @@ function db() { PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, ]); + + if (session_status() === PHP_SESSION_NONE) { + @session_start(); + } + if (isset($_SESSION['user_id'])) { + $pdo->exec("SET @app_user_id = " . (int)$_SESSION['user_id']); + } } return $pdo; } @@ -48,4 +55,4 @@ function generateRefNo($type) { } return $prefix . '-' . $year . '-' . str_pad($serial, 3, '0', STR_PAD_LEFT); -} \ No newline at end of file +} diff --git a/db/migrations/033_add_user_id_to_charity_members.php b/db/migrations/033_add_user_id_to_charity_members.php new file mode 100644 index 0000000..11de3af --- /dev/null +++ b/db/migrations/033_add_user_id_to_charity_members.php @@ -0,0 +1,17 @@ +exec("ALTER TABLE charity_members ADD COLUMN user_id INT NULL"); + $db->exec("ALTER TABLE charity_members ADD CONSTRAINT fk_charity_members_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL"); + echo "Migration 033 completed successfully.\n"; +} catch (PDOException $e) { + if (strpos($e->getMessage(), 'Duplicate column name') !== false) { + echo "Column user_id already exists.\n"; + } else { + echo "Error: " . $e->getMessage() . "\n"; + } +} + diff --git a/db/migrations/034_add_audit_columns.sql b/db/migrations/034_add_audit_columns.sql new file mode 100644 index 0000000..7852383 --- /dev/null +++ b/db/migrations/034_add_audit_columns.sql @@ -0,0 +1,82 @@ +ALTER TABLE `committees` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `committees` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `committee_plans` ADD COLUMN `created_by` INT DEFAULT NULL; +ALTER TABLE `committee_plans` ADD FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `committee_plans` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `committee_plans` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `charity_members` ADD COLUMN `created_by` INT DEFAULT NULL; +ALTER TABLE `charity_members` ADD FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `charity_members` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `charity_members` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `charity_plans` ADD COLUMN `created_by` INT DEFAULT NULL; +ALTER TABLE `charity_plans` ADD FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `charity_plans` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `charity_plans` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `expenses` ADD COLUMN `created_by` INT DEFAULT NULL; +ALTER TABLE `expenses` ADD FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `expenses` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `expenses` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `expense_categories` ADD COLUMN `created_by` INT DEFAULT NULL; +ALTER TABLE `expense_categories` ADD FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `expense_categories` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `expense_categories` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `accounting_accounts` ADD COLUMN `created_by` INT DEFAULT NULL; +ALTER TABLE `accounting_accounts` ADD FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `accounting_accounts` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `accounting_accounts` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `accounting_journal` ADD COLUMN `created_by` INT DEFAULT NULL; +ALTER TABLE `accounting_journal` ADD FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `accounting_journal` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `accounting_journal` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `hr_employees` ADD COLUMN `created_by` INT DEFAULT NULL; +ALTER TABLE `hr_employees` ADD FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `hr_employees` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `hr_employees` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `hr_attendance` ADD COLUMN `created_by` INT DEFAULT NULL; +ALTER TABLE `hr_attendance` ADD FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `hr_attendance` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `hr_attendance` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `hr_holidays` ADD COLUMN `created_by` INT DEFAULT NULL; +ALTER TABLE `hr_holidays` ADD FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `hr_holidays` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `hr_holidays` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `hr_leaves` ADD COLUMN `created_by` INT DEFAULT NULL; +ALTER TABLE `hr_leaves` ADD FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `hr_leaves` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `hr_leaves` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `hr_payroll` ADD COLUMN `created_by` INT DEFAULT NULL; +ALTER TABLE `hr_payroll` ADD FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `hr_payroll` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `hr_payroll` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `stock_items` ADD COLUMN `created_by` INT DEFAULT NULL; +ALTER TABLE `stock_items` ADD FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `stock_items` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `stock_items` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `stock_categories` ADD COLUMN `created_by` INT DEFAULT NULL; +ALTER TABLE `stock_categories` ADD FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `stock_categories` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `stock_categories` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `stock_stores` ADD COLUMN `created_by` INT DEFAULT NULL; +ALTER TABLE `stock_stores` ADD FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `stock_stores` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `stock_stores` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `stock_transactions` ADD COLUMN `created_by` INT DEFAULT NULL; +ALTER TABLE `stock_transactions` ADD FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `stock_transactions` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `stock_transactions` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `stock_lending` ADD COLUMN `created_by` INT DEFAULT NULL; +ALTER TABLE `stock_lending` ADD FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `stock_lending` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `stock_lending` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `users` ADD COLUMN `created_by` INT DEFAULT NULL; +ALTER TABLE `users` ADD FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `users` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `users` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `inbound_mail` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `inbound_mail` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `outbound_mail` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `outbound_mail` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `internal_mail` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `internal_mail` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; +ALTER TABLE `meetings` ADD COLUMN `updated_by` INT DEFAULT NULL; +ALTER TABLE `meetings` ADD FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON DELETE SET NULL; \ No newline at end of file diff --git a/expense_categories.php b/expense_categories.php index 71a98a5..a346f1d 100644 --- a/expense_categories.php +++ b/expense_categories.php @@ -101,6 +101,8 @@ if (isset($_SESSION['error'])) { + + @@ -116,6 +118,8 @@ if (isset($_SESSION['error'])) { + + + + - + @@ -305,7 +307,9 @@ if (isset($_SESSION['success'])) { - + + - + - + diff --git a/hr_attendance.php b/hr_attendance.php index 81302af..0fbbe05 100644 --- a/hr_attendance.php +++ b/hr_attendance.php @@ -99,13 +99,15 @@ $records = $stmt->fetchAll(); + + - + @@ -140,7 +142,9 @@ $records = $stmt->fetchAll(); - + + + + @@ -303,7 +305,9 @@ $pagination = getPagination($page, $totalEmployees, $perPage); - + + + + - + query("SELECT * FROM hr_holidays ORDER BY date_from DESC")->fe + + + + - + @@ -251,6 +253,8 @@ $requests = $stmt->fetchAll(); + + + + - + @@ -229,6 +231,8 @@ $total_salaries = $sumStmt->fetchColumn() ?: 0; + + + + - @@ -275,6 +277,8 @@ if (isset($_GET['id'])) { + + + + @@ -140,14 +142,16 @@ function getStatusBadgeInternal($mail) { - + + - diff --git a/internal_outbox.php b/internal_outbox.php index 28d0ca6..a4c3e97 100644 --- a/internal_outbox.php +++ b/internal_outbox.php @@ -206,6 +206,8 @@ function getStatusBadgeInternal($mail) { + + @@ -242,14 +244,16 @@ function getStatusBadgeInternal($mail) { - + + - diff --git a/meetings.php b/meetings.php index 9b7cdec..b4efb42 100644 --- a/meetings.php +++ b/meetings.php @@ -210,13 +210,15 @@ if (isset($_SESSION['success'])) { + + - + @@ -256,7 +258,9 @@ if (isset($_SESSION['success'])) { - + + + + - @@ -256,6 +258,8 @@ if (isset($_GET['id'])) { + +
التاريخالوصفالمرجعالحسابمديندائنالإجراءات
التاريخالوصفالمرجعالحسابمديندائنأضيف بواسطةعُدل بواسطةالإجراءات
لا توجد قيود.
لا توجد قيود.
diff --git a/accounts.php b/accounts.php index 6d6ce95..ff8b20d 100644 --- a/accounts.php +++ b/accounts.php @@ -129,7 +129,9 @@ $typeMap = [
الاسم النوعإجراءاتأضيف بواسطةعُدل بواسطةإجراءات
@@ -86,6 +86,8 @@ $members = $stmt->fetchAll(); البريد الإلكتروني تاريخ الانضمام الحالةأضيف بواسطةعُدل بواسطة الإجراءات
- + + - + @@ -204,7 +208,7 @@ $members = $stmt->fetchAll();
لا يوجد أعضاء مضافين حتى الآنلا يوجد أعضاء مضافين حتى الآن
المحقق النسبة الحالةأضيف بواسطةعُدل بواسطة الإجراءات
- + + - + @@ -290,7 +294,7 @@ $status_labels = [
لا توجد خطط مضافة حتى الآنلا توجد خطط مضافة حتى الآن
الرقم اسم اللجنة الوصفأضيف بواسطةعُدل بواسطة الإجراءات
+ إدارة
لا توجد لجان مضافة حتى الآن.لا توجد لجان مضافة حتى الآن.
اسم التصنيف الحساب المحاسبي المرتبط الوصفأضيف بواسطةعُدل بواسطة الإجراءات
المبلغ طريقة الدفع الإيصالأضيف بواسطةعُدل بواسطة الإجراءات
لا توجد سجلات مطابقةلا توجد سجلات مطابقة
+ @@ -330,13 +334,13 @@ if (isset($_SESSION['success'])) {
إجمالي الصفحة:إجمالي الصفحة:
الإجمالي الكلي (للبحث الحالي):الإجمالي الكلي (للبحث الحالي):
وقت الحضور وقت الانصراف ملاحظاتأضيف بواسطةعُدل بواسطة إجراء
لا يوجد موظفين نشطين.لا يوجد موظفين نشطين.
+ الحالة بصمة (UID)أضيف بواسطةعُدل بواسطة الإجراءات
+
من تاريخ إلى تاريخ الحالةأضيف بواسطةعُدل بواسطة إجراءات
لا توجد عطلات مسجلة.
لا توجد عطلات مسجلة.
السبب الحالة المعتمدأضيف بواسطةعُدل بواسطة إجراءات
لا توجد طلبات.
لا توجد طلبات.
خصومات الصافي الحالةأضيف بواسطةعُدل بواسطة إجراءات
لا توجد بيانات لهذا الشهر. اضغط على "توليد الرواتب" للبدء.
لا توجد بيانات لهذا الشهر. اضغط على "توليد الرواتب" للبدء.
الحالة المسؤولأضيف بواسطةعُدل بواسطة الإجراءات
+

لا يوجد بريد وارد حالياً.

المرفقات التاريخ الحالةأضيف بواسطةعُدل بواسطة الإجراء
+ عرض
+

لا توجد رسائل واردة حالياً

المرفقات التاريخ الحالةأضيف بواسطةعُدل بواسطة الإجراء
+ عرض
+

لم يتم إرسال أي رسائل حالياً

المكان المنظم الحالةأضيف بواسطةعُدل بواسطة الإجراءات
لا توجد اجتماعات مطابقةلا توجد اجتماعات مطابقة
+ الموضوع الجهة المستلمة الحالةأضيف بواسطةعُدل بواسطة الإجراءات
+

لا يوجد بريد صادر حالياً.

diff --git a/print_charity_report.php b/print_charity_report.php index d916335..135d5a9 100644 --- a/print_charity_report.php +++ b/print_charity_report.php @@ -4,7 +4,7 @@ require_once __DIR__ . '/db/config.php'; require_once __DIR__ . '/includes/permissions.php'; require_once __DIR__ . '/includes/settings.php'; -if (!isLoggedIn() || !canView('committees')) { +if (!isLoggedIn() || (!canView('charity_members') && !canView('charity_plans'))) { exit("لا توجد صلاحية للوصول لهذه الصفحة."); } @@ -61,10 +61,25 @@ $status_labels = [ th, td { border: 1px solid #dee2e6; padding: 8px; text-align: right; } th { background-color: #f1f3f5; } @media print { - body { margin: 0; padding: 0; } + body { margin: 0; padding: 0; font-size: 10pt; } .btn-print { display: none !important; } - @page { margin: 1cm; } - .page-break { page-break-before: always; } + @page { margin: 1cm; size: A4; } + .container { width: 100% !important; max-width: none !important; padding: 0 !important; } + .print-header { padding-bottom: 10px; margin-bottom: 15px; } + .print-logo { max-height: 60px; } + h2.fw-bold { font-size: 16pt; } + p.fs-5 { font-size: 12pt !important; } + h3.text-decoration-underline { font-size: 14pt; margin-bottom: 15px !important; } + .section-title { margin-top: 15px; margin-bottom: 10px; padding: 5px 10px; font-size: 11pt; } + .kpi-box { padding: 10px; } + .kpi-box h2 { font-size: 14pt; margin: 0; } + .kpi-box h5 { font-size: 10pt; margin-bottom: 2px; } + table { margin-top: 10px; margin-bottom: 10px; } + th, td { padding: 4px 6px; font-size: 9pt; } + .page-break { page-break-before: auto; } /* Removed forced page break */ + .mb-5 { margin-bottom: 15px !important; } + .py-4 { padding-top: 10px !important; padding-bottom: 10px !important; } + .mt-5 { margin-top: 20px !important; } } @@ -157,11 +172,8 @@ $status_labels = [
- -
- -
2. أعضاء الجمعية
+
2. أعضاء الجمعية
لا يوجد أعضاء مسجلين.
diff --git a/print_committees_report.php b/print_committees_report.php index 73f5231..6e2c794 100644 --- a/print_committees_report.php +++ b/print_committees_report.php @@ -12,16 +12,35 @@ $settings = get_settings(); $db = db(); // Fetch committees and members -$committees_query = $db->query(" - SELECT - c.id, c.name, c.description, - (SELECT COUNT(*) FROM committee_plans WHERE committee_id = c.id) as total_plans, - (SELECT COUNT(*) FROM committee_plans WHERE committee_id = c.id AND status = 'completed') as completed_plans, - (SELECT COUNT(*) FROM committee_activities WHERE committee_id = c.id) as activities_count - FROM committees c - ORDER BY c.name ASC -"); -$committees = $committees_query->fetchAll(PDO::FETCH_ASSOC); +if (isAdmin()) { + $committees_query = $db->query(" + SELECT + c.id, c.name, c.description, + (SELECT COUNT(*) FROM committee_plans WHERE committee_id = c.id) as total_plans, + (SELECT COUNT(*) FROM committee_plans WHERE committee_id = c.id AND status = 'completed') as completed_plans, + (SELECT COUNT(*) FROM committee_activities WHERE committee_id = c.id) as activities_count + FROM committees c + ORDER BY c.name ASC + "); + $committees = $committees_query->fetchAll(PDO::FETCH_ASSOC); +} else { + $committees_query = $db->prepare(" + SELECT + c.id, c.name, c.description, + (SELECT COUNT(*) FROM committee_plans WHERE committee_id = c.id) as total_plans, + (SELECT COUNT(*) FROM committee_plans WHERE committee_id = c.id AND status = 'completed') as completed_plans, + (SELECT COUNT(*) FROM committee_activities WHERE committee_id = c.id) as activities_count + FROM committees c + JOIN committee_members m ON c.id = m.committee_id + JOIN charity_members cm ON m.charity_member_id = cm.id + JOIN users u ON (u.id = cm.user_id) OR (cm.email != '' AND cm.email = u.email) OR (cm.name = u.full_name) OR (cm.name = u.username) + WHERE u.id = ? + GROUP BY c.id + ORDER BY c.name ASC + "); + $committees_query->execute([$_SESSION['user_id']]); + $committees = $committees_query->fetchAll(PDO::FETCH_ASSOC); +} foreach ($committees as &$c) { // Calculate performance score diff --git a/stock_items.php b/stock_items.php index e872dc6..427cec5 100644 --- a/stock_items.php +++ b/stock_items.php @@ -157,13 +157,15 @@ $categories = db()->query("SELECT * FROM stock_categories ORDER BY name ASC")->f الكمية الحالية الحد الأدنى الوحدة + أضيف بواسطة + عُدل بواسطة الإجراءات - +

لا يوجد أصناف مطابقة.

@@ -183,6 +185,8 @@ $categories = db()->query("SELECT * FROM stock_categories ORDER BY name ASC")->f + +