I am working on an inventory management application. Here is the scenario:
- the user enters items purchased with the following information (product identifier, quantity purchased, purchase price, minimum wind price, purchase date)
each operation, the user enters items sold with the following information (Product identifier, quantity sold, final wind price, transaction date), and each operation I warned the user if the final wind price is less than the minimum wind price
every operation, wind, I recorded the benefits of the transaction (the final price wind is the purchase price)
The problem is this: you can buy the same product at a different time at a different price, then we can calculate the total benefit,
for example, if I have the following case
purchased items (t-shirt), 10, £ 20, £ 23, 08/10/2012 purchased items (t-shirt), 10, £ 22, £ 25, 08/19/2012
In this case, the wind operation, what should I do to restore the article with the correct purchase price and calculate the profit and record good information in the sales table?