public function registrarDetallesCotizacion(DetallesCotizacionDTO $detallesCotizacionDTO, PDO $conexion)
 {
     try {
         $query = $conexion->prepare("INSERT INTO detallescotizacion (Cantidad, Iva, Total) VALUES (?,?,?)");
         $query->bindParam(1, $detallesCotizacionDTO->getCantidad());
         $query->bindParam(2, $detallesCotizacionDTO->getIva());
         $query->bindParam(3, $detallesCotizacionDTO->getTotal());
         $query->execute();
         $this->mensaje = "DetallesCotizacion Registrada con exito";
     } catch (Exception $ex) {
         $this->mensaje = $ex->getMessage();
     }
     $conexion = null;
     return $this->mensaje;
 }
 public function ModificarDetallesCotizacion(DetallesCotizacionDTO $detallesCotizacionDTO, PDO $cnn)
 {
     try {
         $query = $cnn->prepare("UPDATE DetallesCotizacion SET Cantidad=?, Iva=?, Total=? WHERE IdCotizacion=?");
         $query->bindParam(1, $detallesCotizacionDTO->getCantidad());
         $query->bindParam(2, $detallesCotizacionDTO->getIva());
         $query->bindParam(3, $detallesCotizacionDTO->getTotal());
         $query->bindParam(4, $detallesCotizacionDTO->getTotal());
         //traer IdCotizacion de la clase CotizacionesDAO
         $query->execute();
         $mensaje = "OK ModificarDetallesCotizacion";
     } catch (Exception $ex) {
         $mensaje = $ex->getMessage();
     }
     $cnn = null;
     return $mensaje;
 }
 public function agregarProducto(DetallesCotizacionDTO $dto, PDO $conexion)
 {
     try {
         var_dump($dto->getIdCotizacion());
         $query = $conexion->prepare("INSERT INTO DetallesCotizacion  VALUES (?,?,?,?,?)");
         $query->bindParam(1, $dto->getIdCotizacion());
         $query->bindParam(2, $dto->getIdProducto());
         $query->bindParam(3, $dto->getCantidad());
         $query->bindParam(4, $dto->getIva());
         $query->bindParam(5, $dto->getTotal());
         $query->execute();
         $updateCotizacion = $conexion->prepare("update Cotizaciones set ValorTotalCotizacion=ValorTotalCotizacion+? where IdCotizacion=?");
         $updateCotizacion->bindParam(1, $dto->getTotal());
         $updateCotizacion->bindParam(2, $dto->getIdCotizacion());
         $updateCotizacion->execute();
         $this->mensaje = "CotizaciĆ³n registrada exitosamente";
     } catch (Exception $ex) {
         $this->mensaje = $ex->getMessage();
     }
     $conexion = null;
     return $this->mensaje;
 }
 public function CancelarDetallesCotizacion(DetallesCotizacionDTO $detallesCotizacionDTO, PDO $cnn)
 {
     try {
         $query = $cnn->prepare("UPDATE Detallescotizacion SET IdProducto=?, Cantidad=?, Iva=?, Total=? WHERE IdCotizacion=?");
         $query->bindParam(1, $detallesCotizacionDTO->getIdProducto());
         $query->bindParam(2, $detallesCotizacionDTO->getCantidad());
         $query->bindParam(3, $detallesCotizacionDTO->getIva());
         $query->bindParam(4, $detallesCotizacionDTO->getTotal());
         $query->bindParam(5, $detallesCotizacionDTO->getIdCotizacion());
         $query->execute();
         $mensaje = "OK CancelarDetallesCotizacion";
     } catch (Exception $ex) {
         $mensaje = $ex->getMessage();
     }
     $cnn = null;
     return $mensaje;
 }
<?php

include_once '../models/CotizacionesDTO.php';
include_once '../models/DetallesCotizacionDTO.php';
include_once '../facades/FacadeCotizaciones.php';
include_once '../facades/FacadeProducto.php';
include_once '../models/ProductosCotizados.php';
session_start();
$dto = new CotizacionesDTO();
$facade = new FacadeCotizaciones();
$facadeProducto = new Facade();
$detalles = new DetallesCotizacionDTO();
if (isset($_GET['buscar'])) {
    $criterio = $_POST['criterio'];
    $busqueda = $_POST['busqueda'];
    $comobuscar = $_POST['comobuscar'];
    $resul = $facade->buscarConCriterio($criterio, $busqueda, $comobuscar);
    $_SESSION['consulta'] = $resul;
    if ($resul == null) {
        header("Location: ../views/buscarCotizaciones.php?encontrados=false&criterio=" . $criterio . "&busqueda=" . $busqueda . "&comobuscar=" . $comobuscar);
    } else {
        header("Location: ../views/buscarCotizaciones.php?encontrados=true&criterio=" . $criterio . "&busqueda=" . $busqueda . "&comobuscar=" . $comobuscar);
    }
}
if (isset($_GET['listar'])) {
    unset($_SESSION['consulta']);
    $resul = $facade->listarCotizaciones();
    $_SESSION['consulta'] = $resul;
    if ($resul == null) {
        header("Location: ../views/buscarCotizaciones.php?encontrados=false&criterio=" . $criterio . "&busqueda=" . $busqueda . "&comobuscar=" . $comobuscar);
    } else {