diff --git a/api/settings.php b/api/settings.php index 9cd53bf..e3c5c9a 100644 --- a/api/settings.php +++ b/api/settings.php @@ -12,7 +12,7 @@ if (!in_array($user['role'], ['owner', 'manager'])) { if ($_SERVER['REQUEST_METHOD'] === 'POST') { $pdo = db(); $keys = [ - 'company_name_ar', 'company_name_en', 'vat_percentage', + 'timezone', 'company_name_ar', 'company_name_en', 'vat_percentage', 'company_vat_number', 'company_phone', 'company_email', 'company_address', 'smtp_host', 'smtp_port', 'smtp_user', 'smtp_pass', 'smtp_secure', 'mail_from', 'mail_from_name' ]; @@ -54,4 +54,4 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $referer = $_SERVER['HTTP_REFERER'] ?? '../index.php'; header('Location: ' . $referer); exit; -} +} \ No newline at end of file diff --git a/includes/app.php b/includes/app.php index bb69dbf..27fe2c7 100644 --- a/includes/app.php +++ b/includes/app.php @@ -7,7 +7,7 @@ if (session_status() !== PHP_SESSION_ACTIVE) { require_once __DIR__ . '/../db/config.php'; -date_default_timezone_set('UTC'); + function get_settings(): array { @@ -33,6 +33,15 @@ function get_setting(string $key, $default = '') return $settings[$key] ?? $default; } +$app_tz = get_setting('timezone', 'UTC'); +if (empty($app_tz)) { + $app_tz = 'UTC'; +} +date_default_timezone_set($app_tz); +try { + db()->exec("SET time_zone = '" . date('P') . "'"); +} catch (Throwable $e) {} + function app_name(): string diff --git a/includes/footer_settings.php b/includes/footer_settings.php index 4b25295..059ed01 100644 --- a/includes/footer_settings.php +++ b/includes/footer_settings.php @@ -10,6 +10,17 @@
= h(tr('تاريخ الإصدار:', 'Generated on:')) ?> = date('Y-m-d H:i') ?>
+= h(tr('لا توجد مصروفات في هذه الفترة.', 'No expenses found in this period.')) ?>
+| = h(tr('التاريخ', 'Date')) ?> | += h(tr('الفرع', 'Branch')) ?> | += h(tr('التصنيف', 'Category')) ?> | += h(tr('الوصف', 'Description')) ?> | += h(tr('المسجل', 'Logged By')) ?> | += h(tr('المبلغ', 'Amount')) ?> | +
|---|---|---|---|---|---|
| = h(date('Y-m-d', strtotime((string)$exp['expense_date']))) ?> | ++ + = h(tr('عام', 'General')) ?> + + | += h($exp['category_name_ar'] . ' / ' . $exp['category_name_en']) ?> | += h((string)$exp['description']) ?> | += h((string)$exp['created_by_name']) ?> | += h(currency((float)$exp['amount'])) ?> | +
| = h(tr('الإجمالي الكلي', 'Grand Total')) ?> | += h(currency($totalSum)) ?> | +||||
= h(tr('المحاسب / المُعد', 'Prepared by / Accountant')) ?>
+= h(tr('المراجع', 'Checked by')) ?>
+= h(tr('المدير العام', 'General Manager')) ?>
+= h(tr('لا توجد طلبات متجر نشطة حالياً.', 'No active online orders currently.')) ?>
+ +| = h(tr('التاريخ', 'Date')) ?> | += h(tr('رقم الطلب', 'Order ID')) ?> | += h(tr('العميل', 'Customer')) ?> | += h(tr('هاتف العميل', 'Customer Phone')) ?> | += h(tr('العنوان', 'Address')) ?> | += h(tr('الحالة', 'Status')) ?> | += h(tr('الإجمالي', 'Total')) ?> | +
|---|---|---|---|---|---|---|
| = h(date('Y-m-d H:i', strtotime((string)$order['created_at']))) ?> | +#= h((string)$order['id']) ?> | += h((string)($order['customer_name'] ?: '-')) ?> | += h((string)($order['customer_phone'] ?: '-')) ?> | += h((string)($order['customer_address'] ?: '-')) ?> | ++ + = h(tr('قيد الانتظار', 'Pending')) ?> + + = h(tr('مقبول', 'Accepted')) ?> + + | += h(currency((float)$order['total_amount'])) ?> | +