$dto->setSubtotal($sinIva + $iva);
    if (!isset($_SESSION['productoDatos'])) {
        $_SESSION['productoDatos'] = array();
        array_push($_SESSION['productoDatos'], $dto);
    } else {
        array_push($_SESSION['productoDatos'], $dto);
    }
    header('location: ../views/crearCotizacion2.php?idcliente=' . $cliente);
}
if (isset($_GET['finalizar'])) {
    $dto->setObservaciones($_POST['observaciones']);
    $dto->setEstado("Vigente");
    $dto->setIdCliente($_GET['idcliente']);
    $dto->setIdUsuario($_SESSION['datosLogin']['id']);
    $dto->setDescuentoIvaxCliente("Si");
    $idCotizacion = $facade->registrarCotizaciones($dto)['idc'];
    foreach ($_SESSION['productoDatos'] as $productos) {
        $detalles->setIdCotizacion($idCotizacion);
        $detalles->setCantidad($productos->getCantidad());
        $detalles->setIdProducto($productos->getId());
        $detalles->setTotal($productos->getSubtotal());
        $detalles->setIva($productos->getIva());
        $mensaje = $facade->agregarProducto($detalles);
    }
    unset($_SESSION['productoDatos']);
    header("Location: ../views/buscarCotizaciones.php?mensaje=" . $mensaje);
}
if (isset($_GET['cancelar'])) {
    $id = $_GET['id'];
    $mensaje = $facade->cancelarCoti($id);
    header("Location: ../views/buscarCotizaciones.php?mensaje=" . $mensaje);