<?php require_once 'connection.php'; if (!isset($_GET['id']) || !is_numeric($_GET['id'])) { die('ID de entrega no válido'); } $id = intval($_GET['id']); $conn = connection(); $stmt = $conn->prepare("SELECT * FROM entregas WHERE id = ?"); $stmt->bind_param("i", $id); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows === 0) { die('No se encontró la entrega especificada'); } $entrega = $result->fetch_assoc(); $stmt->close(); $conn->close(); ?> <!DOCTYPE html> <html lang="es"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Comprobante de Entrega #<?= $entrega['id'] ?></title> <link rel="icon" type="image/png" href="img/icono.png"><!-- Cambia el icono de los titulos en las pestañas ico 16X16 --> <style> body { font-family: 'Arial', sans-serif; margin: 0; padding: 25px; color: #333; background-image: linear-gradient(to right, #d29531, #ffe5c9); min-height: 100vh; } .container { max-width: 800px; margin: 20px auto; padding: 30px; background: rgba(255, 255, 255, 0.97); border: 1px solid rgba(0, 0, 0, 0.1); border-radius: 8px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); } .header { text-align: center; margin-bottom: 35px; border-bottom: 2px solid #eee; padding-bottom: 15px; } .header h1 { margin: 0; color: #2c3e50; font-size: 28px; } .header .subtitle { color: #7f8c8d; margin-top: 8px; font-size: 16px; } .details { margin-bottom: 40px; } .details table { width: 100%; border-collapse: collapse; background: white; box-shadow: 0 2px 5px rgba(0,0,0,0.05); } .details th, .details td { border: 1px solid #ddd; padding: 12px; text-align: left; } .details th { background-color: #F29D33; color: white; font-weight: 600; width: 30%; } .signatures { display: flex; justify-content: space-between; margin-top: 60px; flex-wrap: wrap; } .signature { text-align: center; width: 48%; margin-bottom: 20px; } .signature img { max-width: 100%; height: 120px; margin-bottom: 15px; border-bottom: 1px solid #ddd; padding-bottom: 15px; background: white; padding: 10px; border: 1px solid #eee; } .signature div { font-weight: 600; color: #2c3e50; margin-top: 10px; } .footer { margin-top: 60px; text-align: center; font-size: 13px; color: #7f8c8d; border-top: 1px solid #eee; padding-top: 15px; } .no-print { text-align: center; margin-top: 30px; } .print-btn { background: #F29D33; color: white; border: none; padding: 12px 25px; border-radius: 6px; cursor: pointer; transition: all 0.3s; font-size: 16px; font-weight: 500; margin: 5px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); } .print-btn:hover { background: #e08c2a; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); } .close-btn { background: #e74c3c; color: white; border: none; padding: 12px 25px; border-radius: 6px; cursor: pointer; transition: all 0.3s; font-size: 16px; font-weight: 500; margin: 5px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); } .close-btn:hover { background: #d62c1a; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); } .logo { display: block; margin: 0 auto 1.5rem; } .footer { text-align: center; padding: 20px; margin-top: auto; } .copyright { display: inline-block; padding: 10px 25px; background-color: var(--primary-color); color: black; border-radius: 4px; font-size: 14px; font-weight: bold; } @media print { .no-print { display: none; } body { padding: 0; background: none; } .container { box-shadow: none; border: none; padding: 0; margin: 0; max-width: 100%; background: transparent; } .details th { background-color: #F29D33 !important; color: white !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; } } @media (max-width: 768px) { body { padding: 15px; } .container { padding: 20px; } .signatures { flex-direction: column; } .signature { width: 100%; margin-bottom: 30px; } .signature img { height: 100px; } .print-btn, .close-btn { padding: 10px 20px; width: 100%; max-width: 250px; margin: 5px auto; } } @media (max-width: 480px) { .container { padding: 15px; } .header h1 { font-size: 24px; } .details th, .details td { padding: 10px 8px; font-size: 14px; } .signature img { height: 80px; } } </style> </head> <body> <div class="container" translate="no"> <div class="header"> <img src="img/LOGO.png" alt="" width="37" height="37" class="logo" style="width: 200px; height: auto;" /> <h1>Comprobante de Entrega</h1> <div class="subtitle">N° <?= $entrega['id'] ?></div> <div class="subtitle">Fecha: <?= date('d/m/Y H:i', strtotime($entrega['fecha'])) ?></div> </div> <div class="details"> <table> <tr> <th>Tipo Mov:</th> <td><?= htmlspecialchars($entrega['tipoMV'] . ' - ' . $entrega['proceso']) ?></td> </tr> <tr> <th>Ítem:</th> <td><?= htmlspecialchars($entrega['item'] . ' - ' . $entrega['descripcion']) ?></td> </tr> <tr> <th>Cantidad:</th> <td><?= htmlspecialchars($entrega['cantidad']) ?></td> </tr> <tr> <th>Área:</th> <td><?= htmlspecialchars($entrega['area']) ?></td> </tr> <tr> <th>Observaciones:</th> <td><?= htmlspecialchars($entrega['observacion']) ?></td> </tr> </table> </div> <div class="signatures"> <div class="signature"> <div>Firma quien entrega</div> <img src="<?= htmlspecialchars($entrega['firma_entrega']) ?>" alt="Firma quien entrega"> </div> <div class="signature"> <div>Firma quien recibe</div> <img src="<?= htmlspecialchars($entrega['firma_recibe']) ?>" alt="Firma quien recibe"> </div> </div> <div class="footer"> Documento generado el <?= date('d/m/Y H:i') ?> | Sistema de Gestión de Entregas </div> </div> <div class="no-print" style="text-align: center; margin-top: 20px;"> <button onclick="window.print()" style="padding: 10px 20px; background: #3498db; color: white; border: none; border-radius: 4px; cursor: pointer;"> Imprimir o Guardar PDF </button> <button onclick="window.close()" style="padding: 10px 20px; background: #e74c3c; color: white; border: none; border-radius: 4px; cursor: pointer; margin-left: 10px;"> Cerrar </button> </div> <script> // Opción para abrir directamente el diálogo de impresión window.onload = function() { // Descomentar la siguiente línea para abrir automáticamente el diálogo de impresión // setTimeout(() => window.print(), 500); }; </script> </body> </html>