0) { $where.append("q.client_id = ?"); $params[] = $clientId; } if ($q !== '') { $where.append("(q.customer LIKE ? OR q.id = ?)"); $params[] = "%$q%"; $params[] = (int)$q; } if ($where) { $sql .= " WHERE " . implode(" AND ", $where); } $sql .= " ORDER BY q.id DESC"; $stmt = $this->db->prepare($sql); $stmt->execute($params); $quotes = $stmt->fetchAll(); $title = 'Cotizaciones'; require __DIR__ . '/../views/partials/header.php'; require __DIR__ . '/../views/quotes/index.php'; require __DIR__ . '/../views/partials/footer.php'; } public function create(): void { $p = $this->db->query("SELECT id, sku, name, price, stock FROM products ORDER BY name ASC"); $products = $p->fetchAll(); $c = $this->db->query("SELECT id, name, company FROM clients ORDER BY name ASC"); $clients = $c->fetchAll(); $title = 'Nueva cotización'; require __DIR__ . '/../views/partials/header.php'; require __DIR__ . '/../views/quotes/create.php'; require __DIR__ . '/../views/partials/footer.php'; } public function store(): void {/* igual que parte 2 */} public function view(): void {/* igual que parte 2 */} public function printView(): void {/* igual que parte 2 */} }