'id', 'product_name' => 'product_name', 'quantity' => 'quantity', 'purchase_place' => 'purchase_place', 'price_per_unit' => 'price_per_unit', 'delivery_date' => 'delivery_date', 'status' => 'status']; if (!array_key_exists($sort_col, $allowed_sort_cols)) $sort_col = 'id'; if ($sort_dir !== 'asc' && $sort_dir !== 'desc') $sort_dir = 'desc'; function getSortLink($col_key, $label, $current_sort, $current_dir) { global $status_filter, $date_from, $date_to, $search_query, $limit, $is_archived; $new_dir = ($current_sort === $col_key && $current_dir === 'asc') ? 'desc' : 'asc'; $icon = ($current_sort === $col_key) ? ($current_dir === 'asc' ? '' : '') : ''; $text_class = ($current_sort === $col_key) ? 'text-warning' : 'text-white'; // Dodano parametr 'archive' do link贸w sortowania $params = ['archive' => $is_archived, 'status' => $status_filter, 'date_from' => $date_from, 'date_to' => $date_to, 'q' => $search_query, 'limit' => $limit, 'sort' => $col_key, 'dir' => $new_dir]; $url = '?' . http_build_query($params); return "$label $icon"; } // BAZOWY WARUNEK ARCHIWUM $where = ["is_archived = ?"]; $params = [$is_archived]; if ($status_filter) { $where[] = "status = ?"; $params[] = $status_filter; } if ($date_from) { $where[] = "delivery_date >= ?"; $params[] = $date_from; } if ($date_to) { $where[] = "delivery_date <= ?"; $params[] = $date_to; } if ($search_query !== '') { $where[] = "(product_name LIKE ? OR part_number LIKE ? OR purchase_place LIKE ? OR recipient LIKE ? OR delivery_address LIKE ? OR notes LIKE ? OR company LIKE ?)"; $like_term = "%" . $search_query . "%"; for ($i = 0; $i < 7; $i++) { $params[] = $like_term; } } $where_sql = implode(" AND ", $where); $count_stmt = $pdo->prepare("SELECT COUNT(*) FROM " . DB_PREFIX . "orders WHERE $where_sql"); $count_stmt->execute($params); $total_rows = $count_stmt->fetchColumn(); $total_pages = ceil($total_rows / $limit); $sql = "SELECT * FROM " . DB_PREFIX . "orders WHERE $where_sql ORDER BY $sort_col $sort_dir LIMIT $limit OFFSET $offset"; $stmt = $pdo->prepare($sql); $stmt->execute($params); $orders = $stmt->fetchAll(); $logo_path = $pdo->query("SELECT setting_value FROM " . DB_PREFIX . "settings WHERE setting_key = 'logo_path'")->fetchColumn() ?: 'assets/default_logo.png'; $csrf_token = getCsrfToken(); function getStatusClass($status) { return match($status) { 'nowe' => 'bg-info text-dark', 'w trakcie realizacji' => 'bg-warning text-dark', 'zrealizowane' => 'bg-success', 'anulowane' => 'bg-danger', default => 'bg-secondary', }; } ?> <?php echo $is_archived ? 'Archiwum' : 'Zam贸wienia IT'; ?> - <?php echo APP_NAME; ?>

Archiwum zam贸wie艅 Lista zam贸wie艅

Widok Aktualnych Widok Archiwum Import Pe艂ny formularz
Akcje
Brak wynik贸w w tej sekcji.
#
PN:
kliknij...'; ?> z艂 dodaj dat臋'; ?>
1): ?>