Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a comboBox while selecting CustomerName from ComboBox, Sum of
All the BillAmount purchased by Same Customer in diff dates from one table
should display in datagridview Column Name "TotalBillAmount"
and Sum of total payment done by that same customer should show in same datagridview column Name "Payment".
and finally two more column in datagridview "AdvanceDeposit" and "Credit".

If sum of Payment is more than sum of BillAmount, rest amount should display in "AdvanceDeposit" and "Credit" amount is zero and vice-versa.
So for that what kind of query should i used, how to achieve solution of this problem.
Thanks in Advance....
Posted
Comments
Jαved 1-Jun-12 7:56am    
What have you done so far?
SASS_Shooter 1-Jun-12 11:57am    
Are you kidding me???? Are you fracking serious???? How the heck can ANYONE on this board tell you what type of query to do when YOU have the fracking database schema and YOU have the tables. Jeez man, engage your brain before asking questions!!!!
Sunny_Kumar_ 2-Jun-12 16:19pm    
what do you need ?? A logic or Code ??
Mayur2258 3-Jun-12 22:43pm    
I think you need logic. you have created program up to this so you can code. better but ask someone logic for it better. ask the logic who requires this application. Ten you can solve it.

1 solution

Hi,
Get the TotalBillAmount,Payment from db using a stored procedure. You can use aggregate function "SUM" to calculate the amount and use "gropupby" function to group it by using Customer Name. And the AdvanceDeposit and Credit logiic can be written on row databound of the grid. Please let me know if you need more idea on this.

Thanks,
Lijo
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900