I have a table goods movement. This has the attributes item number, storage bin, quantity change and type of quantity change, which are 1(putaway),2(stock removal) and 3(inventory).To calculate the total quantity of an item I make a query for the table, which adds up the quantity change. However, there is still the process of inventory that applies to one item at a time with a bin. So if one takes the stock of a storage bin physically, the stock of the article in a storage bin should be adjusted in the database. To do this, the difference between the actual stock and the target stock is simply formed. This is then included in the goods movement table. This seems to me however rather complicated in the conversion, because always the stock quantity of an article for a storage bin must be computed, in order to form then the difference and this must take place at the correct place. By this I mean that the inventory takes place on a certain date and thus only then the stock should be adjusted. Would someone perhaps have an idea for the implementation?