Added hourly chart logic for production in modules

This commit is contained in:
dhanabalan
2025-07-11 17:26:46 +05:30
parent b4ca4a9fcd
commit 4d5b14fe69

View File

@@ -233,11 +233,15 @@ class ModuleFilterDataController extends Controller
// ], 200); // ], 200);
$chartName = $request->header('chart-name'); $chartName = $request->header('chart-name');
if ($chartName == 'Production Hourly Count') { if ($chartName == 'Production Hourly Count')
{
$hourlyCounts = []; $hourlyCounts = [];
$hourStart = $startDate->copy(); // Force start at 8:00 AM today
while ($hourStart < $endDate) { $hourStart = now()->startOfDay()->addHours(8); // today 08:00 AM
$hourEndFinal = $hourStart->copy()->addDay(); // next day 08:00 AM
while ($hourStart < $hourEndFinal) {
$hourEnd = $hourStart->copy()->addHour(); $hourEnd = $hourStart->copy()->addHour();
$label = $hourStart->format('g:i A') . ' to ' . $hourEnd->format('g:i A'); $label = $hourStart->format('g:i A') . ' to ' . $hourEnd->format('g:i A');