Hi there and
to Talk Budgies!
I'm sorry to hear that your budgie is ill. If he has been throwing up seeds and white foam, it is imperative you get him to an avian vet right away. From the moment he began vomiting seeds and green liquid, you should have taken him in. Most likely he has a long-term illness like megabacteria or AGY (avian gastric yeast), so please be sure to tell the vet to test for all possible illnesses.
Since he's stopped moving much, the likelihood is that the illness has progressed so far that he is no longer able to hide it; budgies tend to hide things as long as possible when they are ill as this would help them stay safe from predators in the wild.
Again, please, please take him in to the avian vet as soon as possible. This is not an illness you can cure at home, unfortunately.
Also, you should remove the gravel/gravel paper from his cage. Budgies do not need grit or gravel, and sandpaper can hurt their feet as will as seriously cause harm if ingested. You can line his cage with newspaper instead
Meanwhile, be sure to look through the forum's many Budgie Articles and "stickies" (threads "stuck" to the top of each subform for easy reference) to stay up to date on all the best practices for caring for budgies. If you have any questions after reading through anything, be sure to ask as we'd love to help.
I truly hope that your budgie is able to recover; please keep us posted in this thread on his condition.