how to create Stock Table form Sell Table & Purchase Table
Sell_Table
Date
|
Bill No
|
Product Name
|
Unit
|
Qty
|
Rate
|
Total Amount
|
25/11/2017
|
13
|
Notebook
|
Pic
|
100
|
10
|
1000
|
25/11/2017
|
12
|
Keyboard
|
Pic
|
10
|
300
|
3000
|
25/10/2017
|
11
|
Mobile
|
Pic
|
5
|
5000
|
25000
|
10/10/20 17
|
10
|
Keyboard
|
Pic
|
20
|
300
|
6000
|
5/8/2017
|
9
|
Mobile
|
Pic
|
10
|
500
|
5000
|
Purchase_Table
Date
|
Product Name
|
Unit
|
Qty
|
Rate
|
Total Amount
|
5/11/2017
|
Notebook
|
Pic
|
500
|
10
|
5000
|
25/10/2017
|
Keyboard
|
Pic
|
100
|
300
|
30000
|
25/10/2017
|
Mobile
|
Pic
|
10
|
5000
|
50000
|
10/10/2017
|
Keyboard
|
Pic
|
20
|
300
|
6000
|
5/8/2017
|
Mobile
|
Pic
|
100
|
500
|
50000
|
Stock_Table
Month
|
Product Name
|
Unit
|
Opening_Balance
|
TotalSold
|
Closing_Balance
|
Nov. 2017
|
Notebook
|
Pic
|
500
|
100
|
400
|
Nov. 2017
|
Keyboard
|
Pic
|
100
|
10
|
90
|
Oct 2017
|
Keyboard
|
Pic
|
20+100=120
|
20
|
100
|
Oct 2017
|
Mobile
|
Pic
|
90+10 = 100
|
5
|
95
|
Aug 2017
|
Mobile
|
Pic
|
100
|
10
|
90
|