From 5b05c65a861d5091fd7a31296da38a9f68e0b744 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sat, 28 Mar 2026 02:53:10 +0000 Subject: [PATCH] Autosave: 20260328-025310 --- api/daily_report_cron.php | 14 ++------------ storage/cron_debug.log | 10 ++++++++++ storage/last_daily_report.txt | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/api/daily_report_cron.php b/api/daily_report_cron.php index ecc17b3..ab826b5 100644 --- a/api/daily_report_cron.php +++ b/api/daily_report_cron.php @@ -102,23 +102,13 @@ try { // --- 3. Per-Outlet Stats --- // Fetch outlets dynamically from DB - $stmtOutlets = $pdo->query("SELECT id, name FROM outlets WHERE is_deleted = 0 ORDER BY id ASC"); + $stmtOutlets = $pdo->query("SELECT id, name, name_ar FROM outlets WHERE is_deleted = 0 ORDER BY id ASC"); $outlets = $stmtOutlets->fetchAll(); cron_log("Fetched " . count($outlets) . " outlets from database."); - // Define excluded outlets (Demo data typically found in production databases seeded from dev) - // You can add more names here if you want to hide them from the report - $excludedOutlets = ['Main Downtown', 'Westside Hub', 'North Point Mall']; - foreach ($outlets as $outlet) { $outletId = $outlet['id']; - $outletName = $outlet['name']; - - // Skip excluded outlets - if (in_array($outletName, $excludedOutlets)) { - cron_log("Skipping excluded/demo outlet: " . $outletName); - continue; - } + $outletName = !empty($outlet['name_ar']) ? $outlet['name_ar'] : $outlet['name']; // Outlet Revenue $stmtRev = $pdo->prepare("SELECT SUM(total_amount) FROM orders WHERE outlet_id = ? AND created_at >= ? AND created_at <= ? AND status != 'cancelled'"); diff --git a/storage/cron_debug.log b/storage/cron_debug.log index c083bc1..47cff9d 100644 --- a/storage/cron_debug.log +++ b/storage/cron_debug.log @@ -21667,3 +21667,13 @@ Array [2026-03-26 23:59:02] Report sent successfully to 96897417667 [2026-03-26 23:59:02] Sending detailed report to: 96899359472 [2026-03-26 23:59:03] Report sent successfully to 96899359472 +[2026-03-27 23:59:01] Condition met: sending daily report for 2026-03-27 +[2026-03-27 23:59:01] Querying UTC Range: 2026-03-26 20:00:00 to 2026-03-27 19:59:59 +[2026-03-27 23:59:01] Fetched 4 outlets from database. +[2026-03-27 23:59:01] Skipping excluded/demo outlet: Main Downtown +[2026-03-27 23:59:01] Skipping excluded/demo outlet: Westside Hub +[2026-03-27 23:59:01] Skipping excluded/demo outlet: North Point Mall +[2026-03-27 23:59:01] Sending detailed report to: 96897417667 +[2026-03-27 23:59:02] Report sent successfully to 96897417667 +[2026-03-27 23:59:02] Sending detailed report to: 96899359472 +[2026-03-27 23:59:03] Report sent successfully to 96899359472 diff --git a/storage/last_daily_report.txt b/storage/last_daily_report.txt index c2e2650..64065cd 100644 --- a/storage/last_daily_report.txt +++ b/storage/last_daily_report.txt @@ -1 +1 @@ -2026-03-26 \ No newline at end of file +2026-03-27 \ No newline at end of file