Mostly wing it based on my memory. But in some occasions, there's a list of important stuffs. It's mostly just 2,3 items like "we're out of potatoes/onions/salt", then wing the rest.
I think except for important and constant stuffs like spices, it's better to just buy what's available cheap and make your food from that. But that could be just me
How much do you pay? Maybe you can pay someone to write you a custom program to do those things. Maybe in libre office, or python, or some other language with gui and plots.