Refactor status color logic in SendInvoiceDataReport to improve document date comparison
This commit is contained in:
@@ -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++,
|
||||
|
||||
Reference in New Issue
Block a user