Changed logic in process order report
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 19s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 22s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 17s
Laravel Pint / pint (pull_request) Successful in 4m24s
Laravel Larastan / larastan (pull_request) Failing after 8m8s

This commit is contained in:
dhanabalan
2026-11-17 16:56:53 +05:30
parent 48849bc395
commit 518736fd11

View File

@@ -126,22 +126,21 @@ class SendProcessOrderReport extends Command
$processOrder = $order->process_order; $processOrder = $order->process_order;
$total = $processOrderTotals[$processOrder]->total_count ?? 0;
$notOk = $statusCounts[$processOrder]->notok_count ?? 0; $notOk = $statusCounts[$processOrder]->notok_count ?? 0;
$ok = $statusCounts[$processOrder]->ok_count ?? 0; $ok = $statusCounts[$processOrder]->ok_count ?? 0;
// Calculate percentages using OK + Not OK records // Use order quantity as denominator
$validTotal = $ok + $notOk; $totalOrderQuantity = (float) $order->order_quantity;
$notOkPerc = $validTotal > 0 $notOkPerc = $totalOrderQuantity > 0
? round(($notOk / $validTotal) * 100, 2) ? round(($notOk / $totalOrderQuantity) * 100, 2)
: 0; : 0;
$okPerc = $validTotal > 0 $okPerc = $totalOrderQuantity > 0
? round(($ok / $validTotal) * 100, 2) ? round(($ok / $totalOrderQuantity) * 100, 2)
: 0; : 0;
$tableData[] = [ $tableData[] = [
'no' => $no++, 'no' => $no++,
'plant' => $plant->name, 'plant' => $plant->name,