is_numeric($id)); $selectedIdsList = implode(',', array_map('intval', $selectedIds)); if (empty($selectedIdsList)) { die('Invalid selection.'); } // Fetch only selected records $query = "SELECT * FROM `road_challans` WHERE id IN ($selectedIdsList) ORDER BY `id` DESC"; $result = $conn->query($query); // Set headers for Excel file download header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=transit_loss_" . date("Ymd_His") . ".xls"); header("Pragma: no-cache"); header("Expires: 0"); // Begin table output echo "
Sl No. | Seller Company | Purchaser Company | Challan No. | Challan Date | Quantity Dispatch | Quantity Unloaded | Difference (Kgs) |
---|---|---|---|---|---|---|---|
{$index} | " . htmlspecialchars($row['consignorName'] ?? '') . " | " . htmlspecialchars($row['name'] ?? '') . " | " . htmlspecialchars($row['challan_no'] ?? '') . " | " . htmlspecialchars($row['date'] ?? '') . " | " . htmlspecialchars($row['quantity'] ?? '') . " | " . htmlspecialchars($row['quantity_billed'] ?? '') . " | " . htmlspecialchars((string)$difference) . " |
No matching data found. |