You've written that the electric flux is given by,
[itex]\varphi = \int\vec{E}\cdot d\vec{S}[/itex]
which is correct, but then you've written that
[itex]\vec{E} = -\vec{\nabla} \varphi[/itex] which is wrong! The electric field can be written as the gradient of the electric potential, not the the flux.