1.11M Members

Sum values from 3 datatables based on ID

 
0
 

Hi All,

I am having a stock report in my application. It has 4 Datagridview each one for OpeningStock, Purchase, Sales and ClosingStock. I am using vs2005 and access 2003 database. The report is based on from and to date basis. (i.e: if the user selects 2 dates, The opeining stock should be inclusive of opening stock+purchases-Sales made upto the startdate) likewise the purchase, sales and closing stock details.

I have 3 datatables one for the opening stock (Which is keyed in the beginning of the application), the another one contains purchasedetails upto the startdate and another one for salesdetails upto startdate.

What i want to show is datagrid1 for showing the opening balance
(i.e:InitialStock + Purchase - Sales) up to startdate,
datagrid2 is for showing the purchase (i.e: Purchases made from and to between dates)
datagrid3 is for showing the Sales (i.e: Sales made from and to between dates)
and datagrid4 is for showing the closingstock (i.e: InitialStock + Purchases - sales) upto the enddate.

Thanks in advance.
Any suggestion would be appreciated.

 
0
 

you can use three datatables for this , get required records for each datatable and then assign them to your grids.

 
0
 

Hi Aslam,

Thanks for your reply.
I know it requires 3 datatables and I am already written query for the 3 datatables.
What my issue is, How to combine these 3 datatables based on ID column and add and subtract the Qty column.

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article