ascending order in eid list
This commit is contained in:
parent
f9e55d0ef0
commit
4e6f8a4404
@ -69,7 +69,7 @@ $deliveryStatus = trim((string) ($_GET['delivery_status'] ?? ''));
|
||||
$dateFrom = trim((string) ($_GET['date_from'] ?? ''));
|
||||
$dateTo = trim((string) ($_GET['date_to'] ?? ''));
|
||||
$sort = trim((string) ($_GET['sort'] ?? 'delivery_date'));
|
||||
$dir = strtolower(trim((string) ($_GET['dir'] ?? 'desc')));
|
||||
$dir = strtolower(trim((string) ($_GET['dir'] ?? 'asc')));
|
||||
$sortMap = [
|
||||
'receipt_no' => 'receipt_no',
|
||||
'customer' => 'customer_name',
|
||||
@ -174,10 +174,11 @@ try {
|
||||
$total = (int) $countStmt->fetchColumn();
|
||||
$totalPages = max(1, (int) ceil($total / $limit));
|
||||
|
||||
$primarySort = $sortMap[$sort] . ' ' . strtoupper($dir);
|
||||
$sortDirection = strtoupper($dir);
|
||||
$primarySort = $sortMap[$sort] . ' ' . $sortDirection;
|
||||
$secondarySort = $sort === 'delivery_date'
|
||||
? ', sale_date DESC, id DESC'
|
||||
: ', COALESCE(delivery_date, DATE(sale_date)) DESC, sale_date DESC, id DESC';
|
||||
? ', sale_date ' . $sortDirection . ', id ' . $sortDirection
|
||||
: ', COALESCE(delivery_date, DATE(sale_date)) ' . $sortDirection . ', sale_date ' . $sortDirection . ', id ' . $sortDirection;
|
||||
|
||||
$sql = "SELECT sales_orders.*, (
|
||||
SELECT COUNT(*)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user