changed logic in process order report
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 21s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Laravel Pint / pint (pull_request) Successful in 3m46s
Laravel Larastan / larastan (pull_request) Failing after 4m33s

This commit is contained in:
dhanabalan
2026-11-18 12:13:20 +05:30
parent e4050c050f
commit 161822dbef

View File

@@ -180,37 +180,37 @@ class ProcessOrderChart extends ChartWidget
")
->first();
$totalOrderQuantity = DB::table('process_orders')
->where('plant_id', $selectedPlant)
->where('line_id', $selectedLine)
->whereIn('process_order', function ($query) use ($selectedPlant, $selectedLine) {
$query->select('process_order')
->from('characteristic_values')
->where('plant_id', $selectedPlant)
->where('line_id', $selectedLine)
->distinct();
})
->where('created_at', '>=', $startDate)
->where('created_at', '<', $endDate)
->sum('order_quantity');
// $totalOrderQuantity = DB::table('process_orders')
// ->where('plant_id', $selectedPlant)
// ->where('line_id', $selectedLine)
// ->whereIn('process_order', function ($query) use ($selectedPlant, $selectedLine) {
// $query->select('process_order')
// ->from('characteristic_values')
// ->where('plant_id', $selectedPlant)
// ->where('line_id', $selectedLine)
// ->distinct();
// })
// ->where('created_at', '>=', $startDate)
// ->where('created_at', '<', $endDate)
// ->sum('order_quantity');
return [
'datasets' => [
[
'label' => 'Quantity',
'data' => [
(int) ($totalOrderQuantity ?? 0),
// (int) ($totalOrderQuantity ?? 0),
(int) ($records->ok_count ?? 0),
(int) ($records->not_ok_count ?? 0),
],
'backgroundColor' => [
'#3B82F6',
// '#3B82F6',
'#16A34A',
'#DC2626',
],
],
],
'labels' => ['Order Quantity', 'OK', 'Not OK'],
'labels' => ['OK', 'Not OK'],
];
}