public function registrarCotizaciones(CotizacionesDTO $cotizacionesDTO, PDO $conexion)
 {
     try {
         $query = $conexion->prepare("INSERT INTO Cotizaciones  VALUES (DEFAULT,?,now(),2,?,?,?,?)");
         $query->bindParam(1, $cotizacionesDTO->getEstado());
         $query->bindParam(2, $cotizacionesDTO->getObservaciones());
         $query->bindParam(3, $cotizacionesDTO->getDescuentoIvaxCliente());
         $query->bindParam(4, $cotizacionesDTO->getIdUsuario());
         $query->bindParam(5, $cotizacionesDTO->getIdCliente());
         $query->execute();
         $query2 = $conexion->prepare('SELECT MAX(IdCotizacion) AS "idc" FROM cotizaciones');
         $query2->execute();
         return $query2->fetch();
     } catch (Exception $ex) {
         $this->mensaje = $ex->getMessage();
     }
     $conexion = null;
     return $this->mensaje;
 }
 public function ConvertirCotizacionAOrdenCompra(CotizacionesDTO $cotizacionesDTO, DetallesCotizacionDTO $detallesCotizacionDTO, OrdenesDeCompraDTO $ordenesDeCompraDTO, PDO $cnn)
 {
     try {
         $query = $cnn->prepare("UPDATE Cotizaciones SET Estado=?, FechaCreacion=?, ValorTotal=?, Observaciones=?, DescuentoIvaXCliente=?, IdUsuario=?, IdCliente=? WHERE IdCotizacion=?)");
         $query->bindParam(1, $cotizacionesDTO->getEstado());
         $query->bindParam(2, $cotizacionesDTO->getFechaCreacion());
         $query->bindParam(3, $cotizacionesDTO->getValorTotal());
         $query->bindParam(4, $cotizacionesDTO->getObservaciones());
         $query->bindParam(5, $cotizacionesDTO->getDescuentoIvaXcliente());
         $query->bindParam(6, $cotizacionesDTO->getIdUsuario());
         $query->bindParam(7, $cotizacionesDTO->getIdCliente());
         $query->bindParam(8, $cotizacionesDTO->getIdCotizacion());
         $query->execute();
         $this->ConvertirAOrden($detallesCotizacionDTO, $cnn);
         $mensaje = "OK ConvertirCotizacionAOrdenCompra";
     } catch (Exception $ex) {
         $mensaje = $ex->getMessage();
     }
     $cnn = null;
     return $mensaje;
 }