FIX_Sorting Issues Cleared

This commit is contained in:
sanjeev.p 2025-12-24 17:45:17 +05:30
parent 17dd293e67
commit 2899e39c8a
2 changed files with 26 additions and 8 deletions

View File

@ -509,7 +509,7 @@ class DashboardController extends ResourceController
usort($data1, function($a, $b) use ($lastIndex1) { usort($data1, function($a, $b) use ($lastIndex1) {
$rowA = array_values($a); $rowA = array_values($a);
$rowB = array_values($b); $rowB = array_values($b);
return (float)$rowA[$lastIndex1] <=> (float)$rowB[$lastIndex1]; return (float)$rowB[$lastIndex1] <=> (float)$rowA[$lastIndex1];
}); });
} }
@ -522,7 +522,7 @@ class DashboardController extends ResourceController
usort($data2, function($a, $b) use ($lastIndex2) { usort($data2, function($a, $b) use ($lastIndex2) {
$rowC = array_values($a); $rowC = array_values($a);
$rowD = array_values($b); $rowD = array_values($b);
return (float)$rowC[$lastIndex2] <=> (float)$rowD[$lastIndex2]; return (float)$rowD[$lastIndex2] <=> (float)$rowC[$lastIndex2];
}); });
} }
$details['below50tPremiumTimeRange'] = $data2; $details['below50tPremiumTimeRange'] = $data2;

View File

@ -117,8 +117,11 @@ class ExcelExportController extends ResourceController
throw new \RuntimeException('No policies found...', 404); throw new \RuntimeException('No policies found...', 404);
} }
$lastIndex = count(reset($data)) - 1; $lastIndex = count(reset($data)) - 1;
// usort($data, function($a, $b) use ($lastIndex) {
// return (float)$a[$lastIndex] <=> (float)$b[$lastIndex];
// });
usort($data, function($a, $b) use ($lastIndex) { usort($data, function($a, $b) use ($lastIndex) {
return (float)$a[$lastIndex] <=> (float)$b[$lastIndex]; return (float)$b[$lastIndex] <=> (float)$a[$lastIndex];
}); });
$finalData = []; $finalData = [];
$serialNo = 1; $serialNo = 1;
@ -229,8 +232,11 @@ class ExcelExportController extends ResourceController
throw new \RuntimeException('No policies found for this vehicle type...', 404); throw new \RuntimeException('No policies found for this vehicle type...', 404);
} }
$lastIndex = count(reset($data)) - 1; $lastIndex = count(reset($data)) - 1;
// usort($data, function($a, $b) use ($lastIndex) {
// return (float)$a[$lastIndex] <=> (float)$b[$lastIndex];
// });
usort($data, function($a, $b) use ($lastIndex) { usort($data, function($a, $b) use ($lastIndex) {
return (float)$a[$lastIndex] <=> (float)$b[$lastIndex]; return (float)$b[$lastIndex] <=> (float)$a[$lastIndex];
}); });
$finalData = []; $finalData = [];
$serialNo = 1; $serialNo = 1;
@ -345,8 +351,11 @@ class ExcelExportController extends ResourceController
throw new \RuntimeException('No policies found for this insurer for the specified month.', 404); throw new \RuntimeException('No policies found for this insurer for the specified month.', 404);
} }
$lastIndex = count(reset($data)) - 1; $lastIndex = count(reset($data)) - 1;
// usort($data, function($a, $b) use ($lastIndex) {
// return (float)$a[$lastIndex] <=> (float)$b[$lastIndex];
// });
usort($data, function($a, $b) use ($lastIndex) { usort($data, function($a, $b) use ($lastIndex) {
return (float)$a[$lastIndex] <=> (float)$b[$lastIndex]; return (float)$b[$lastIndex] <=> (float)$a[$lastIndex];
}); });
$finalData = []; $finalData = [];
$serialNo = 1; $serialNo = 1;
@ -554,8 +563,11 @@ class ExcelExportController extends ResourceController
throw new \RuntimeException('No policies found for this agent for the specified month.', 404); throw new \RuntimeException('No policies found for this agent for the specified month.', 404);
} }
$lastIndex = count(reset($data)) - 1; $lastIndex = count(reset($data)) - 1;
// usort($data, function($a, $b) use ($lastIndex) {
// return (float)$a[$lastIndex] <=> (float)$b[$lastIndex];
// });
usort($data, function($a, $b) use ($lastIndex) { usort($data, function($a, $b) use ($lastIndex) {
return (float)$a[$lastIndex] <=> (float)$b[$lastIndex]; return (float)$b[$lastIndex] <=> (float)$a[$lastIndex];
}); });
$finalData = []; $finalData = [];
$serialNo = 1; $serialNo = 1;
@ -669,8 +681,11 @@ class ExcelExportController extends ResourceController
} }
$lastIndex = count(reset($data)) - 1; $lastIndex = count(reset($data)) - 1;
// usort($data, function($a, $b) use ($lastIndex) {
// return (float)$a[$lastIndex] <=> (float)$b[$lastIndex];
// });
usort($data, function($a, $b) use ($lastIndex) { usort($data, function($a, $b) use ($lastIndex) {
return (float)$a[$lastIndex] <=> (float)$b[$lastIndex]; return (float)$b[$lastIndex] <=> (float)$a[$lastIndex];
}); });
$finalData = []; $finalData = [];
$serialNo = 1; $serialNo = 1;
@ -865,8 +880,11 @@ class ExcelExportController extends ResourceController
throw new \RuntimeException('No policies found for the specified month.', 404); throw new \RuntimeException('No policies found for the specified month.', 404);
} }
$lastIndex = count(reset($data)) - 1; $lastIndex = count(reset($data)) - 1;
// usort($data, function($a, $b) use ($lastIndex) {
// return (float)$a[$lastIndex] <=> (float)$b[$lastIndex];
// });
usort($data, function($a, $b) use ($lastIndex) { usort($data, function($a, $b) use ($lastIndex) {
return (float)$a[$lastIndex] <=> (float)$b[$lastIndex]; return (float)$b[$lastIndex] <=> (float)$a[$lastIndex];
}); });
$finalData = []; $finalData = [];
$serialNo = 1; $serialNo = 1;