Usually, an MPC consists of discretizing the optimal control problem in time using some numerical quadrature scheme. So the infinite-dimensional OCP reads $$\begin{aligned}J(\vec{u}) &= \varphi\left(\vec{x}(t_i+t_{hor})\right) + \int_{t_i}^{t_i+t_ {hor}}l(\vec{x},\vec{u})\text{d}t \\ \text{s.t.}\\ \dot{\vec{x}}&=\vec{f}(\vec{x},\vec{u}), \quad \vec{x}(t_i)=\hat{\vec{x}}_i\end{aligned}$$ which can be transcribed to a static nonlinear program using, e.g., the trapezoidal rule for the integral and some other (or does it have to be the same?) integration scheme, e.g., the explicit Euler for the ODE, i.e. $$\begin{aligned} c(\vec w) &= \varphi\left(\vec{x}_N\right)+\frac{t_{hor}}{N}\sum_{k=0}^{N-1}\frac{l(\vec{x}_k,\vec{u}_k)+l(\vec{x}_{k+1},\vec{u}_{k+1})}{2}\\ \text{s.t.}\\ \vec{x}_{k+1}&=\vec{x}_{k}+\frac{t_{hor}}{N}\vec{f}(\vec{x}_k,\vec{u}_k), \qquad k=0,...,N-1\\ \vec{x}_0&=\vec{\hat{x}}_i \end{aligned}$$ where $\vec{w}=[\vec{x}_0^T\ ... \ \vec{x}_N^T \ \vec{u}_0^T\ ... \ \vec{u}_N^T ]^T$ are the decision variables, $t_{hor}$ is the MPC horizon, and $N$ is the number of discretization steps. But often it can be observed that instead of the above sum, the cost function simply reads $$c(\vec w) = \varphi\left(\vec{x}_N\right)+ \sum_{k=0}^{N}l(\vec{x}_k,\vec{u}_k).$$ My question is, under what conditions is this possible? Can I always do this? I guess that it depends on whether the actual value of the integral matters or not but this implies that the integration does not change the optimal decision variables $\vec w^\ast$ since it involves just a scaling of the cost function? I could also imagine that it has to do with the function $l(\cdot)$ itself. Maybe this only works if $l(\cdot)$ is at most quadratic in the decision variables? Although I have seen this notation in nonlinear MPC.
EDIT 1: added ODE equality constraint and final costs
EDIT 2: Adding the final cost, I can see that one might need to have both discretizations to be the same or non at all for the continuous integral? Since in the discretized version, $\varphi\left(\vec{x}_N\right)$ depends on the final state which is the result of the ODE integration which, in this example, was done using the explicit Euler while the continuous integral has been approximated using the trapezoidal rule leading to different accuracies in the solution when they should probably be of the same order of accuracy? Therefore, just using the second sum leads to just adding up the values of the running cost term evaluated at the discretized steps which, in turn, depend on the ODE discretization. So this seems to make more sense to me than having two different integration schemes.