<?php require_once __DIR__.'/../../config/auth.php';$id=(int)($_GET['id']??0);$p=$conn->query("SELECT p.*,c.nombre cliente FROM presupuestos p JOIN clientes c ON c.id=p.cliente_id WHERE p.id=$id")->fetch_assoc();if(!$p){http_response_code(404);exit('Presupuesto no encontrado.');}?><!doctype html><html lang="es"><head><meta charset="utf-8"><title><?=e($p['numero'])?></title><style>@page{size:A4;margin:18mm}body{font-family:Arial;color:#263238}header{display:flex;justify-content:space-between;border-bottom:3px solid #1769aa;padding-bottom:12px}img{width:170px}h1{color:#1769aa}table{width:100%;border-collapse:collapse;margin-top:25px}td{border:1px solid #ccd6dd;padding:10px;vertical-align:top}.monto{font-size:22px;font-weight:bold;text-align:right}.detalle{min-height:260px}.no-print{margin:15px}@media print{.no-print{display:none}}</style></head><body><button class="no-print" onclick="window.print()">Imprimir</button><header><img src="/HM/assets/img/logo_hm.png"><div><h1>PRESUPUESTO</h1><b><?=e($p['numero'])?></b></div></header><table><tr><td><b>Cliente</b><br><?=e($p['cliente'])?></td><td><b>Fecha</b><br><?=e(date('d/m/Y',strtotime($p['fecha'])))?></td></tr><tr><td colspan="2"><b>Contacto</b><br><?=e($p['contacto']?:'—')?></td></tr><tr><td colspan="2" class="detalle"><b>Detalle del presupuesto</b><br><br><?=nl2br(e($p['detalle']))?></td></tr><tr><td colspan="2" class="monto">Total: <?=numero_py($p['monto'])?></td></tr></table></body></html>
