From f82dd74d9d0d02dc0eb0a8d9cbbbd57c1f0400da Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Thu, 6 Nov 2025 13:52:03 +0530 Subject: [PATCH] Refactor status color logic in SendInvoiceDataReport to improve document date comparison --- app/Console/Commands/SendInvoiceDataReport.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/SendInvoiceDataReport.php b/app/Console/Commands/SendInvoiceDataReport.php index f82b58f..5087478 100644 --- a/app/Console/Commands/SendInvoiceDataReport.php +++ b/app/Console/Commands/SendInvoiceDataReport.php @@ -297,11 +297,22 @@ class SendInvoiceDataReport extends Command // $documentDate = \Carbon\Carbon::parse($inv->document_date); // $now = \Carbon\Carbon::now(); - $endDate = now()->copy()->subDay()->setTime(10, 0, 0); + //$endDate = now()->copy()->subDay()->setTime(10, 0, 0); //$hoursDiff = $documentDate->diffInHours($now); - $statusColor = $endDate <= $inv->document_date ? 'status-pending-yellow' : 'status-pending-red'; + //$statusColor = $endDate <= $inv->document_date ? 'status-pending-yellow' : 'status-pending-red'; + + $yesterday = now()->subDay()->toDateString(); + $today = now()->toDateString(); + + $documentDate = \Carbon\Carbon::parse($inv->document_date); + + if (in_array($documentDate->toDateString(), [$today, $yesterday])) { + $statusColor = 'status-pending-yellow'; + } else { + $statusColor = 'status-pending-red'; + } $tableData[] = [ 'no' => $no++,