is_numeric($id)); $selectedIdsList = implode(',', array_map('intval', $selectedIds)); if (empty($selectedIdsList)) { die('Invalid selection.'); } // Fetch records $query = "SELECT * FROM `road_challans` WHERE id IN ($selectedIdsList) ORDER BY `id` DESC"; $result = $conn->query($query); // Excel headers header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=sales_report_" . date("Ymd_His") . ".xls"); header("Pragma: no-cache"); header("Expires: 0"); // Output table echo "
Sl No. | Seller Company | Purchaser Company | Challan No. | Challan Date | Unloaded Date | Quantity Unloaded | Rate | Value | CGST | SGST | IGST | Total |
---|---|---|---|---|---|---|---|---|---|---|---|---|
{$index} | " . htmlspecialchars((string)($row['consignorName'] ?? '')) . " | " . htmlspecialchars((string)($row['name'] ?? '')) . " | " . htmlspecialchars((string)($row['challan_no'] ?? '')) . " | " . htmlspecialchars((string)($row['date'] ?? '')) . " | {$unloading_date} | " . htmlspecialchars((string)($row['quantity_billed'] ?? '')) . " | " . htmlspecialchars((string)($row['rate'] ?? '')) . " | " . htmlspecialchars((string)($row['amount'] ?? '')) . " | {$cgst} | {$sgst} | {$igst} | " . htmlspecialchars((string)($row['finalAmount'] ?? '')) . " |
No matching data found. |