We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,439 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Sum values from 3 datatables based on ID

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.

2
Contributors
2
Replies
4 Days
Discussion Span
6 Months Ago
Last Updated
4
Views
vijaycare
Newbie Poster
23 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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

M.Waqas Aslam
Master Poster
761 posts since Aug 2011
Reputation Points: 58
Solved Threads: 126
Skill Endorsements: 2

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.

vijaycare
Newbie Poster
23 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.0612 seconds using 2.69MB