Case $1$: $g(x)=q(x)=0$
Then $\dfrac{\partial V(t,x)}{\partial t}+h(x)=0$
$\dfrac{\partial V(t,x)}{\partial t}=-h(x)$
$V(t,x)=C(x)-h(x)t$
$V(T,x)=\Phi(x)$ :
$C(x)-h(x)T=\Phi(x)$
$C(x)=\Phi(x)+h(x)T$
$\therefore V(t,x)=\Phi(x)+h(x)T-h(x)t=\Phi(x)+h(x)(T-t)$
Case $2$: $g(x)\neq0$ and $q(x)=0$
Then $\dfrac{\partial V(t,x)}{\partial t}+g(x)\dfrac{\partial V(t,x)}{\partial x}+h(x)=0$
$\dfrac{\partial V(t,x)}{\partial t}+g(x)\dfrac{\partial V(t,x)}{\partial x}=-h(x)$
This belongs to a PDE of the form http://eqworld.ipmnet.ru/en/solutions/fpde/fpde1212.pdf
The general solution is $V(t,x)=C\biggl(\int^x\dfrac{1}{g(x)}dx-t\biggr)-\int^x\dfrac{h(x)}{g(x)}dx$
$V(T,x)=\Phi(x)$ :
$C\biggl(\int^x\dfrac{1}{g(x)}dx-T\biggr)-\int^x\dfrac{h(x)}{g(x)}dx=\Phi(x)$
$C\biggl(\int^x\dfrac{1}{g(x)}dx-T\biggr)=\Phi(x)+\int^x\dfrac{h(x)}{g(x)}dx$
$C(x)=\Phi\biggl(\biggl(\int^x\dfrac{1}{g(x)}dx-T\biggr)^{-1}(x)\biggr)+\int^{\left(\int^x\frac{1}{g(x)}dx-T\right)^{-1}(x)}\dfrac{h(x)}{g(x)}dx$
$\therefore V(t,x)=\Phi\biggl(\biggl(\int^x\dfrac{1}{g(x)}dx-T\biggr)^{-1}\biggl(\int^x\dfrac{1}{g(x)}dx-t\biggr)\biggr)+\int^{\left(\int^x\frac{1}{g(x)}dx-T\right)^{-1}\left(\int^x\frac{1}{g(x)}dx-t\right)}\dfrac{h(x)}{g(x)}dx-\int^x\dfrac{h(x)}{g(x)}dx$
Case $3$: $q(x)\neq0$
Then $\dfrac{\partial V(t,x)}{\partial t}+g(x)\dfrac{\partial V(t,x)}{\partial x}+q(x)\dfrac{\partial^2V(t,x)}{\partial x^2}+h(x)=0$
It is possible that the subsititution $V(t,x)=V_c(t,x)+V_p(t,x)$ can make the inhomogeneous linear PDE becomes homogeneous linear PDE if $V_p(t,x)$ can be found.
For this question, the form of $V_p(t,x)$ is not difficult to guess, just the particular solution of the ODE $g(x)\dfrac{dV(x)}{dx}+q(x)\dfrac{d^2V(x)}{dx^2}+h(x)=0$ , i.e. $V_p(t,x)=-\int^xe^{-\int^x\frac{g(x)}{q(x)}dx}\int^x\dfrac{h(x)}{q(x)}e^{\int^x\frac{g(x)}{q(x)}dx}~dx~dx$
So let $V(t,x)=V_c(t,x)-\int^xe^{-\int^x\frac{g(x)}{q(x)}dx}\int^x\dfrac{h(x)}{q(x)}e^{\int^x\frac{g(x)}{q(x)}dx}~dx~dx$ ,
Then $\dfrac{\partial V_c(t,x)}{\partial t}+g(x)\dfrac{\partial V_c(t,x)}{\partial x}+q(x)\dfrac{\partial^2V_c(t,x)}{\partial x^2}=0$
Of course we use separation of variables:
Let $V_c(t,x)=T(t)X(x)$ ,
Then $T'(t)X(x)+g(x)T(t)X'(x)+q(x)T(t)X''(x)=0$
$T'(t)X(x)=-(q(x)X''(x)+g(x)X'(x))T(t)$
$\dfrac{T'(t)}{T(t)}=-\dfrac{q(x)X''(x)+g(x)X'(x)}{X(x)}=f(s)$
$\begin{cases}\dfrac{T'(t)}{T(t)}=f(s)\\q(x)X''(x)+g(x)X'(x)+f(s)X(x)=0\end{cases}$
$\therefore V(t,x)=\sum_sC_1(s)e^{tf_s(s)}X_{s,1}(x,s)+\sum_sC_2(s)e^{tf_s(s)}X_{s,2}(x,s)+\int_sC_3(s)e^{tf_g(s)}X_{g,1}(x,s)~ds+\int_sC_4(s)e^{tf_g(s)}X_{g,2}(x,s)~ds-\int^xe^{-\int^x\frac{g(x)}{q(x)}dx}\int^x\dfrac{h(x)}{q(x)}e^{\int^x\frac{g(x)}{q(x)}dx}~dx~dx$
or $V(t,x)=\sum_sC_1(s)e^{tf_s(s)}X_{s,1}(x,s)+\sum_sC_2(s)e^{tf_s(s)}X_{s,2}(x,s)+\sum_sC_3(s)e^{tf_g(s)}X_{g,1}(x,s)+\sum_sC_4(s)e^{tf_g(s)}X_{g,2}(x,s)-\int^xe^{-\int^x\frac{g(x)}{q(x)}dx}\int^x\dfrac{h(x)}{q(x)}e^{\int^x\frac{g(x)}{q(x)}dx}~dx~dx$
Then subsititute $V(T,x)=\Phi(x)$ into the above general solutions to eliminate part of the arbitrary parts to get the final answer.
The suffix $s$ stand for special cases while suffix $g$ stand for general cases. The special cases means that the values of $s$ that lead $q(x)X''(x)+g(x)X'(x)+f(s)X(x)=0$ will have the forms of their general solution differ from the current form of the general solution of most values of $s$ in $q(x)X''(x)+g(x)X'(x)+f(s)X(x)=0$ .
Note that different $q(x)$ , $g(x)$ and $f(s)$ may result the special cases appearing in the different values of $s$ . Like the previous question Indication on how to solve the heat equations with nonconstant coefficients $(q(x)=-x^2 , g(x)=-2x)$ , choose $f(s)=-\dfrac{4\pi^2s^2+1}{4}$ will result the only special case appearing in $s=0$ . We should choose the form of $f(s)$ wisely so that the special cases appear in the nice values of $s$ .