From faa1a9f2b32d291b1096bf96b30d4909b0f807ff Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Tue, 28 Apr 2026 08:20:31 +0000 Subject: [PATCH] Autosave: 20260428-082031 --- configuracion.php | 3 +- download_shalom.php | 72 +++++++++++++++++++++++++++++++++++++++++++++ pedidos.php | 1 + 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 download_shalom.php diff --git a/configuracion.php b/configuracion.php index 2371eed..86eccbb 100644 --- a/configuracion.php +++ b/configuracion.php @@ -54,7 +54,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['sync_shalom'])) { $count = 0; foreach ($sedes as $sede) { $id = $sede['ter_id']; - $nombre = $sede['lugar']; + // Usamos el campo 'nombre' que es más completo (Departamento / Provincia / Distrito / Lugar) + $nombre = $sede['nombre']; $stmt = $conn->prepare("INSERT INTO sedes_shalom (id_terminal, nombre_sede, activo, permite_origen, permite_destino) VALUES (?, ?, 1, 1, 1) ON DUPLICATE KEY UPDATE nombre_sede = VALUES(nombre_sede)"); diff --git a/download_shalom.php b/download_shalom.php new file mode 100644 index 0000000..217eee9 --- /dev/null +++ b/download_shalom.php @@ -0,0 +1,72 @@ +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 ''; +} +?> \ No newline at end of file diff --git a/pedidos.php b/pedidos.php index 89405aa..1edd031 100644 --- a/pedidos.php +++ b/pedidos.php @@ -137,6 +137,7 @@ include 'layout_header.php'; Limpiar Descargar Todos los Rotulados + Descargar Shalom