When do I need to use virtual work in writing the equations of motion?

I'm studying for our comprehensive exam . I just need to clarify something. So the equation of motion for lagrangian dynamics is [itex]\frac{d}{dt}\frac{\partial L}{\partial\dot{q}_{i}}[/itex] = [itex]\frac{\partial L}{\partial {q}_{i}}[/itex]

However, in my notes there are example which uses the principle of virtual work wherein [itex]\frac{d}{dt}\frac{\partial L}{\partial\dot{q}_{i}}[/itex] - [itex]\frac{\partial L}{\partial {q}_{i}}[/itex] = [itex]F_{q}[/itex]