Added this month plan data logic in production dashboard
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Laravel Pint / pint (pull_request) Successful in 5m23s
Laravel Larastan / larastan (pull_request) Failing after 5m34s

This commit is contained in:
dhanabalan
2026-10-29 09:32:19 +05:30
parent db71f869dd
commit 4cea958297

View File

@@ -158,7 +158,25 @@ class ItemOverview extends ChartWidget
count($orderedData), count($orderedData),
$planQuantity $planQuantity
); );
} else { }
elseif ($activeFilter === 'this_month') {
$weeklyProduction = [];
foreach ($orderedData as $index => $quantity) {
$day = (int) date('j', strtotime($labels[$index]));
$weekNumber = (int) ceil($day / 7);
$weeklyProduction[$weekNumber] =
($weeklyProduction[$weekNumber] ?? 0) + $quantity;
}
$planData = [];
foreach ($weeklyProduction as $weekNumber => $quantity) {
$planData[] = round($quantity / 22.5, 2);
}
}
else {
// This Week: each day's production / 22.5 // This Week: each day's production / 22.5
// This Month: each week's production / 22.5 // This Month: each week's production / 22.5
$planData = array_map( $planData = array_map(