Refactor invoice data report to improve status handling and styling

This commit is contained in:
dhanabalan
2025-11-05 17:39:33 +05:30
parent 59430dec32
commit 5aa45834fe
2 changed files with 37 additions and 5 deletions

View File

@@ -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,
];
}
}