Refactor invoice data report to improve status handling and styling
This commit is contained in:
@@ -263,7 +263,29 @@ class SendInvoiceDataReport extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($pendingInvoices as $inv) {
|
||||
// foreach ($pendingInvoices as $inv) {
|
||||
// $tableData[] = [
|
||||
// 'no' => $no++,
|
||||
// 'plant' => $plant->name,
|
||||
// // 'distribution_type' => $selectedDistribution,
|
||||
// // 'customer_code' => $inv->customer_code,
|
||||
// 'document_number' => $inv->document_number,
|
||||
// 'document_date' => $inv->document_date,
|
||||
// 'customer_trade_name' => $inv->customer_trade_name,
|
||||
// 'customer_location' => $inv->customer_location,
|
||||
// 'status' => 'Pending',
|
||||
// ];
|
||||
// }
|
||||
foreach ($pendingInvoices as $inv)
|
||||
{
|
||||
$documentDate = \Carbon\Carbon::parse($inv->document_date);
|
||||
|
||||
if ($documentDate->lt($startDate)) {
|
||||
$statusColor = 'status-pending-red';
|
||||
} else {
|
||||
$statusColor = 'status-pending-yellow';
|
||||
}
|
||||
|
||||
$tableData[] = [
|
||||
'no' => $no++,
|
||||
'plant' => $plant->name,
|
||||
@@ -274,6 +296,7 @@ class SendInvoiceDataReport extends Command
|
||||
'customer_trade_name' => $inv->customer_trade_name,
|
||||
'customer_location' => $inv->customer_location,
|
||||
'status' => 'Pending',
|
||||
'status_class' => $statusColor,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user