Refactor status color logic in SendInvoiceDataReport to improve document date comparison

This commit is contained in:
dhanabalan
2025-11-06 13:52:03 +05:30
parent 8ba21630d8
commit f82dd74d9d

View File

@@ -297,11 +297,22 @@ class SendInvoiceDataReport extends Command
// $documentDate = \Carbon\Carbon::parse($inv->document_date); // $documentDate = \Carbon\Carbon::parse($inv->document_date);
// $now = \Carbon\Carbon::now(); // $now = \Carbon\Carbon::now();
$endDate = now()->copy()->subDay()->setTime(10, 0, 0); //$endDate = now()->copy()->subDay()->setTime(10, 0, 0);
//$hoursDiff = $documentDate->diffInHours($now); //$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[] = [ $tableData[] = [
'no' => $no++, 'no' => $no++,