update summery report

This commit is contained in:
Flatlogic Bot 2026-03-13 18:37:17 +00:00
parent aebf7d0667
commit 486d54348f
2 changed files with 62 additions and 6 deletions

View File

@ -18,10 +18,12 @@ $templates = [
];
foreach ($templates as $t) {
// Check if exists
$stmt = $pdo->prepare("SELECT id FROM notification_templates WHERE event_name = ?");
$stmt->execute([$t['event_name']]);
if (!$stmt->fetch()) {
$existing = $stmt->fetch();
if (!$existing) {
$sql = "INSERT INTO notification_templates (event_name, email_subject_en, email_body_en, email_subject_ar, email_body_ar, whatsapp_body_en, whatsapp_body_ar) VALUES (?, ?, ?, ?, ?, ?, ?)";
$pdo->prepare($sql)->execute([
$t['event_name'],
@ -34,7 +36,21 @@ foreach ($templates as $t) {
]);
echo "Added template: {$t['event_name']}\n";
} else {
echo "Template already exists: {$t['event_name']}\n";
// Update existing template to match file content (useful for development)
$sql = "UPDATE notification_templates SET
email_subject_en = ?, email_body_en = ?,
email_subject_ar = ?, email_body_ar = ?,
whatsapp_body_en = ?, whatsapp_body_ar = ?
WHERE event_name = ?";
$pdo->prepare($sql)->execute([
$t['email_subject_en'],
$t['email_body_en'],
$t['email_subject_ar'],
$t['email_body_ar'],
$t['whatsapp_body_en'],
$t['whatsapp_body_ar'],
$t['event_name']
]);
echo "Updated template: {$t['event_name']}\n";
}
}
}

View File

@ -111,6 +111,26 @@ $translations = [
'dashboard' => 'Dashboard',
'shipments' => 'Shipments',
'reports' => 'Reports',
'summary_report' => 'Summary Report',
'shipments_by_origin_country' => 'Shipments by Origin Country',
'shipments_by_dest_country' => 'Shipments by Destination Country',
'shipments_by_origin_city' => 'Shipments by Origin City',
'shipments_by_dest_city' => 'Shipments by Destination City',
'shipments_by_shipper' => 'Shipments by Shipper',
'generated' => 'Generated',
'report_type' => 'Report Type',
'period' => 'Period',
'analyze_performance' => 'Analyze platform performance and metrics.',
'print' => 'Print',
'start_date' => 'Start Date',
'end_date' => 'End Date',
'apply_filter' => 'Apply Filter',
'no_paid_shipments' => 'No paid shipments found for this period.',
'name' => 'Name',
'total_amount' => 'Total Amount',
'profit' => 'Profit',
'total_label' => 'Total',
'printed_by' => 'Printed By',
'analytics' => 'Analytics',
'shipper_shipments' => 'Shipper Shipments',
'truck_owners_statements' => 'Truck Owners Statements',
@ -334,6 +354,26 @@ $translations = [
'dashboard' => 'لوحة القيادة',
'shipments' => 'الشحنات',
'reports' => 'التقارير',
'summary_report' => 'تقرير ملخص',
'shipments_by_origin_country' => 'الشحنات حسب بلد المنشأ',
'shipments_by_dest_country' => 'الشحنات حسب بلد الوجهة',
'shipments_by_origin_city' => 'الشحنات حسب مدينة المنشأ',
'shipments_by_dest_city' => 'الشحنات حسب مدينة الوجهة',
'shipments_by_shipper' => 'الشحنات حسب الشاحن',
'generated' => 'تم الإنشاء',
'report_type' => 'نوع التقرير',
'period' => 'الفترة',
'analyze_performance' => 'تحليل أداء المنصة والمقاييس.',
'print' => 'طباعة',
'start_date' => 'تاريخ البدء',
'end_date' => 'تاريخ الانتهاء',
'apply_filter' => 'تطبيق الفلتر',
'no_paid_shipments' => 'لم يتم العثور على شحنات مدفوعة لهذه الفترة.',
'name' => 'الاسم',
'total_amount' => 'المبلغ الإجمالي',
'profit' => 'الربح',
'total_label' => 'المجموع',
'printed_by' => 'طبع بواسطة',
'analytics' => 'التحليلات',
'shipper_shipments' => 'شحنات الشاحنين',
'truck_owners_statements' => 'كشوف حساب أصحاب الشاحنات',
@ -671,4 +711,4 @@ function has_permission(string $permissionSlug, ?int $userId = null): bool
function format_currency(float $amount): string
{
return number_format($amount, 3) . ' OMR';
}
}