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; }