Consider a stand of trees that grows according to $$\frac{dV}{dt}=\frac{r}{1+at}V\bigg(1-\frac{V}{K}\bigg)$$ Determine the effort $E(t)$ that will yield $$\max_{0\leq E(t)\leq E_{\text{max}}}\int_0^T e^{-\delta t}pE(t)V(t)dt+pe^{-\delta t}V(T)$$ subject to $$\frac{dV}{dt}=\frac{r}{1+at}V\bigg(1-\frac{V}{K}\bigg)-EV \ \ \text{and} \ \ V(0)=V_0$$
This is a Bolza problem, as the functional to be maximized above consists a part where the state variable $V(t)$ and control variable $E(t)$ varies over time in the integral, and at $t=T$ another terminal function is also given. So we need to use Pontryagin maximum principle to solve the maximum effort $E_{\max}$. I am able to find the Hamilton canonical equations $$\frac{dV}{dt}=\frac{\partial H}{\partial \lambda} \\ \frac{d\lambda}{dt}=-\frac{\partial H}{\partial V}$$ where $\lambda(t)$ is an adjoint variable, $H$ is the hamiltonian of the above problem. Now, since this is a mixed type functional, I cannot simply write that $$H=e^{-\delta t}pEV+\lambda\bigg[\frac{r}{1+at}V\bigg(1-\frac{V}{K}\bigg)-EV\bigg]$$ as it will lose the term $pe^{-\delta t}V(T)$ explicitly. So what is the possible approach to correctly use Pontryagin maximum principle in this problem and find that Hamiltonian? Any help is appreciated.
P.S. - It will be better if someone explains clearly how to apply the general Pontryagin maximum principle for this type of problems, along the lines of the above problem.