Topic: [SOLVED] Trying but can't find solution.
Hi all,
Last few days I was trying (without success) to find solution for my problem. For easier understanding of problem, I created and attached example. Example is Bakery with list of products (Meat Pie, Cherry Pie, Chesse Pie...) and list of Row Materials. Every product has his own recepie, for example, Meat Pie includes 0,3 kg of flour + 0,2 kg of meat; making Cherry Pie includes 0,2 kg of Flour + 0,4 kg of Cherrys, etc...) My main problem is how to calculate current stock quantities for raw materials (It should be something like this: (every raw material total received) - [(every product total produced * quantity of raw material from recepie for every product)]. Take look at attached example, it will be more clear what I mean (key field is in table raw_materials - cf_qty_In_Stocks).
I think I need to use SQLite JOIN function but I don't know how to do that or maybe my database is not designed as it should. It would be great if someone can solve this problem in this example for me.
Any help is appreciated, thanks in advance.
Vladimir