Click here to Skip to main content
15,125,104 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,
i am currently facing an issue and hope that someone will help me.
here is the scenario.
I have a simple table.
Member Table
================

Member_id Name Opening_Balance Balance_Type
1 David 5000 Debit


Transaction Table
=================
Transaction_id Transaction_date Member_id Description Debit Credit
1 10/01/2011 1 Cash 500 0
2 10/02/2011 1 Cash 0 1000
3 10/03/2011 1 Cash 500 0
4 10/04/2011 1 Cash 0 8000

Now what i need to show the Balance after each entry and its Type. The final result will be look like this.

Transaction Details View
========================
Transaction_id Transaction_date Member_id Description Debit Credit Balance Balance_Type
1 10/01/2011 1 Cash 500 0 5500 Debit
2 10/02/2011 1 Cash 0 1000 4500 Debit
3 10/03/2011 1 Cash 500 0 5000 Debit
4 10/04/2011 1 Cash 0 8000 3000 Credit

How can i create this view? the final balance is prepared by using the opening balance from the members table and then each calculation is made by the balance of previous record to the next and balance type is changed accordingly.
I hope that some expert will help.
Posted

1 solution

Have a look at this article Calculating Running Totals[^] and see if you can use it to get your running total working.
   

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