prepare($query); $stmt->execute(); $pedidos = $stmt->fetchAll(PDO::FETCH_ASSOC); header('Content-Type: application/vnd.ms-excel; charset=utf-8'); header('Content-Disposition: attachment; filename="masivo_shalom.xls"'); header('Pragma: no-cache'); header('Expires: 0'); $output = ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; foreach ($pedidos as $pedido) { // Formato: Nombre (DNI) $destinatario = htmlspecialchars($pedido['nombre_completo'] . ' (' . ($pedido['dni_cliente'] ?? '') . ')'); $celular = htmlspecialchars($pedido['celular'] ?? ''); $destino = htmlspecialchars($pedido['sede_envio'] ?? ''); $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; // NRO GRR $output .= ''; // ORIGEN $output .= ''; $output .= ''; } $output .= ''; $output .= '
DESTINATARIO (DOC)TELF. DESTINATARIOCONTACTO (DOC)TELF. CONTACTONRO GRRORIGENDESTINO
' . $destinatario . '' . $celular . '' . $destinatario . '' . $celular . '' . $destino . '
'; $output .= ''; echo $output; } catch (Exception $e) { header('HTTP/1.1 500 Internal Server Error'); echo ''; } ?>