Proyecto_venta_boletos/js/comprobante.js

30 lines
1.2 KiB
JavaScript

function imprimirComprobante() {
const contenido = document.getElementById('comprobante-imprimible').innerHTML;
const ventanaImpresion = window.open('', '_blank');
ventanaImpresion.document.write(`
<html>
<head>
<title>Comprobante de Venta</title>
<style>
body { font-family: Arial, sans-serif; }
.header { border-bottom: 2px solid #333; padding-bottom: 10px; margin-bottom: 20px; }
.info-venta { display: flex; justify-content: space-between; margin-bottom: 20px; }
.info-item { margin-bottom: 10px; }
.info-label { font-weight: bold; }
table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
th { background-color: #f8f9fa; }
.total { font-size: 18px; font-weight: bold; text-align: right; margin-top: 20px; padding-top: 10px; border-top: 1px solid #ddd; }
</style>
</head>
<body>
${contenido}
</body>
</html>
`);
ventanaImpresion.document.close();
ventanaImpresion.focus();
ventanaImpresion.print();
}