I am currently developping an app for a brewery in which we are managing an inventory. In the app we currently have the possibility to create brewing recipes and then to planify a brew to a future date.
Here you can see, I can add brewing steps either in a recipe or in a brew, in this exemple we have two different steps belonging to the same brews. You can see that it is divided in 3 batch because the brewery can make up to 3 batch to fill one fermenter.
When a step is created it also creates a Stock Variation, which is virtual if the beer hasn’t been brewed and real if the beer has been brewed. Virtuality of the variation serves the purpose of stock planification.
On this screenshot you can see how : if a variation is real it updates the real stock, which represent what the brewery has in its inventory. If it’s virtual it updates the virtual stock. The stocks values you see are the result of 2 operations :
- For the real stock it is the sum of each real stock variation.
- For the virtual stock it is the sum of each stock variation no matter if they are real or virtual.
Now, I want to go further, each stock variation has a date and a value, and each Ingredient has a critical value, if the stocks goes under this value the brewery has to order some.
I would want a way to find the exact Stock Variation where the sum of the values of each anterior Stock Variation is inferior or equal to the critical value of the corresponding ingredient. If I find this Stock Variation I can find to what Value the stock will be at and what date it corresponds.
Thank you to anyone reading this, if you need more details I would be happy to give them. Sorry if everything is not very understandable that’s because I’m french