My book says:
Let us derive an expression for the potential energy associated with an object at a given location above the surface of earth. Consider an external agent lifting an object of mass $m$ from an initial height $yi$ above the ground to a final height $yf$. We assume the lifting is done slowly with no acceleration so the applied force from the agent can be modelled as being equal to in magnitude to the gravitational force on the object. The work done by the external agent on the earth-object system as the object undergoes this upward displacement is given by : $Wnet = \vec{Fapp}\cdot \Delta \vec{r} = mg\hat{j}\cdot[(yf - yi)\hat{j}] = mgyf - mgyi$
Where this result is the net work done on the system because the applied force is only force by the environment. The equation represents a transfer of energy into the system and the energy appears in a different form called potential energy. Therefore we call the quantity $mgy$ as the gravitational potential energy $Ug$. $Ug \equiv mgy$.
Therefore $Wnet = \Delta Ug$
What I don't understand is , why is the net work done only by the external force? Why didn't the author include the work done due to gravity? Isn't the net work done on a system the sum of all the works done by both external and internal forces?