Dear Friends,
I have two tables with the follwing data:
1) Purchase Table:
VoucherNo Date ItemCode Qty Rate Value
1 01/01/2009 A 2500 10 25000
2 01/01/2009 A 1200 9 10800
3 02/01/2009 A 1500 11 16500
4 05/01/2009 A 500 10 5000
5 10/01/2009 A 4000 8 32000
TOTAL 9700 9.6 89300
2) Issue Table:
VoucherNo Date ItemCode Qty Rate Value
1 01/01/2009 A 3000
2 02/01/2009 A 500
3 03/01/2009 A 2000
4 06/01/2009 A 1000
5 10/01/2009 A 2000
6 11/01/2009 A 3000
Total 11500
Now pls advise how to "Create a View in SQL-2000" so that the following union view automatically gets polulated by appropriate "Rate and Value" against each Issue By FIFO Inventory Method as per follow:
3. Fifo View:
Date ItemCode InQty InRate InValue OutQty OutRate OutValue
01/01/2009 A 2500 10 25000 0 0 0
01/01/2009 A 1200 9 10800 0 0 0
01/01/2009 A 0 0 0 3000 0
02/01/2009 A 1500 11 16500 0 0 0
02/01/2009 A 0 0 0 500 0
03/01/2009 A 0 0 0 2000 0
05/01/2009 A 500 10 5000 0 0 0
06/01/2009 A 0 0 0 1000 0
10/01/2009 A 4000 8 32000 0 0 0
10/01/2009 A 0 0 0 2000 0
11/01/2009 A 0 0 0 3000 0
Pls advise asap.
Rgds-
Sanjeeb
Post new comment