Click here to Skip to main content
Sign Up to vote bad
good
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 1 Jun '12 - 1:46
Namit KB1.3K

Comments
Jαved - 1 Jun '12 - 7:56
What have you done so far?
SASS_Shooter - 1 Jun '12 - 11:57
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!!!!
Sunnykumar08 - 2 Jun '12 - 16:19
what do you need ?? A logic or Code ??
Mayur2258 - 3 Jun '12 - 22:43
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
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 315
1 Sergey Alexandrovich Kryukov 259
2 Aarti Meswania 250
3 Slacker007 240
4 Ron Beyer 190
0 Sergey Alexandrovich Kryukov 8,743
1 OriginalGriff 7,124
2 CPallini 3,678
3 Rohan Leuva 3,011
4 Maciej Los 2,403


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 3 Jun 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid