<?php
require_once __DIR__ . '/../inc/helpers.php';
require_once __DIR__ . '/../inc/docs.php';
require_login();
ensure_part2_tables();
if(!is_admin()){ http_response_code(403); exit('Solo admin'); }

$id=(int)($_GET['id']??0);
if($_SERVER['REQUEST_METHOD']!=='POST'){ http_response_code(405); exit('Método no permitido'); }
csrf_check();

db()->prepare("DELETE FROM documents WHERE id=? AND doc_type='quote'")->execute([$id]);
flash_set('success','Presupuesto eliminado.');
redirect('presupuestos/list.php');
