In this you could use 2 tables(Transaction & Stock).
Store the Qty & Price in Transaction table.
-------------------------------------------------------------------------------------
Tbl_Transaction
-------------------------------------------------------------------------------------
Order_ID Order_Date ItemCode Qty Price
-------------------------------------------------------------------------------------
100 02-Jan-2014 Item001 1 2
101 05-Jan-2014 Item001 1 5
-------------------------------------------------------------------------------------
Update the Qty in Stock table.
-------------------------------------------------------------------------------------
Tbl_Stock
-------------------------------------------------------------------------------------
ItemCode Qty
-------------------------------------------------------------------------------------
Item001 2
-------------------------------------------------------------------------------------
Using
JOIN
query(
GROUP BY
needed to be there for some conditions) you could get the available stock, stock price, other aggregate things like MAX, MIN, AVG, etc.,
This is just a sample & you could customize this based on your requirement.
EDIT
---------------------------------------------
It's up to your need. Show this data in a popup using following methods(As already said choose any one based on your requirement). Here few methods popular.
-------------------------------------------------------------------------------------
Actual Prices based on Transaction table -- JOIN
-------------------------------------------------------------------------------------
ItemCode Qty Price
-------------------------------------------------------------------------------------
Item001 1 2
Item001 1 5
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
Based on Average price ( 2+5 = 7. 7/2 = 3.5 ) -- JOIN & AVG
-------------------------------------------------------------------------------------
ItemCode Qty Price
-------------------------------------------------------------------------------------
Item001 2 3.5
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
Based on Latest price (2 vs 5 = 5) -- JOIN & MAX
-------------------------------------------------------------------------------------
ItemCode Qty Price
-------------------------------------------------------------------------------------
Item001 2 5
-------------------------------------------------------------------------------------
All you need to do is write SQL query using
JOIN
&/
GROUP BY
to fetch records like this. That's it.