Merge pull request 'changed logic in process order report' (#1467) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 24s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 24s
Reviewed-on: #1467
This commit was merged in pull request #1467.
This commit is contained in:
@@ -180,37 +180,37 @@ class ProcessOrderChart extends ChartWidget
|
|||||||
")
|
")
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$totalOrderQuantity = DB::table('process_orders')
|
// $totalOrderQuantity = DB::table('process_orders')
|
||||||
->where('plant_id', $selectedPlant)
|
// ->where('plant_id', $selectedPlant)
|
||||||
->where('line_id', $selectedLine)
|
// ->where('line_id', $selectedLine)
|
||||||
->whereIn('process_order', function ($query) use ($selectedPlant, $selectedLine) {
|
// ->whereIn('process_order', function ($query) use ($selectedPlant, $selectedLine) {
|
||||||
$query->select('process_order')
|
// $query->select('process_order')
|
||||||
->from('characteristic_values')
|
// ->from('characteristic_values')
|
||||||
->where('plant_id', $selectedPlant)
|
// ->where('plant_id', $selectedPlant)
|
||||||
->where('line_id', $selectedLine)
|
// ->where('line_id', $selectedLine)
|
||||||
->distinct();
|
// ->distinct();
|
||||||
})
|
// })
|
||||||
->where('created_at', '>=', $startDate)
|
// ->where('created_at', '>=', $startDate)
|
||||||
->where('created_at', '<', $endDate)
|
// ->where('created_at', '<', $endDate)
|
||||||
->sum('order_quantity');
|
// ->sum('order_quantity');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'datasets' => [
|
'datasets' => [
|
||||||
[
|
[
|
||||||
'label' => 'Quantity',
|
'label' => 'Quantity',
|
||||||
'data' => [
|
'data' => [
|
||||||
(int) ($totalOrderQuantity ?? 0),
|
// (int) ($totalOrderQuantity ?? 0),
|
||||||
(int) ($records->ok_count ?? 0),
|
(int) ($records->ok_count ?? 0),
|
||||||
(int) ($records->not_ok_count ?? 0),
|
(int) ($records->not_ok_count ?? 0),
|
||||||
],
|
],
|
||||||
'backgroundColor' => [
|
'backgroundColor' => [
|
||||||
'#3B82F6',
|
// '#3B82F6',
|
||||||
'#16A34A',
|
'#16A34A',
|
||||||
'#DC2626',
|
'#DC2626',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'labels' => ['Order Quantity', 'OK', 'Not OK'],
|
'labels' => ['OK', 'Not OK'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user