Hi all!
I'm stuck somewhere. I have a table for Inventory (which contains the available amount of each food component)
What I want to do: If I select a certain food (say salad) I want to be able to deduct the components (amount) of 'salad' from the inventory table.
Consider this:
Salad is made up of 20mil of water, 50 of oil and 100gm of onion (just an example)
When I give someone a Salad, I want to be able to deduct 20mil of water, 50 of oil and 100gm of onion from the inventory table. (So that I know how much of each item in my inventory is left)
The code is to allow these recipes of Salad to be changed/deleted/some others added into it. (Flexibility). I've found this difficult since in order to allow this flexibility, I can't just write that deduction in code as something that won't change forever.(More recipes can be added in the future)
Does anyone has an idea on how to do this?
I use MySQL with VB.NET
Thanks in advance!
P.S: What I have so far:
My tables are:
1.Inventory (item,amount)
2. Menu (menu_name)
3. Salad (recipe, amount)
Other tables will be added for each menu, just like I did for salad.
Now, when I click Salad, since it has two values (recipe for it and amount), how then can I subtract these (recipe & amount) from the (amount) in the inventory table?
I find it challenging.