Solved

ACCOUNTING - CALCULATING BALANCE

Posted on 2006-07-06
3
389 Views
Last Modified: 2012-05-05
Hello,

assuming the table below as instance:

DESCRIPTION               DEBIT        CREDIT        BALANCE
________________________________________________
check cashed                    0               500              12050
rent                               1000             0                11050
check cashed                    0               120              11170

After insert all those values, let's say I need to change the first credit, from 500 to 600. Once I do that, all the next records must be recalculated. I don't need just to get the total balance, but it should be calculated row by row, to update all the next rows.

I thought I could do getting all the values in a gridview and than calculate. But it's a too slow way. I thought in T-SQL or even do without bind a grid to calculate.

What's the best way to do that?

Thanks.
0
Comment
Question by:starusa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 250 total points
ID: 17053447
I'm going to go out on a limb here and state that that would violate one of the primary rules of Accounting, never change a posted transaction.
If you need to make a correction, say from 500 to 600, then I believe you will have to create a new record with a credit of 100, and a description that explains it.

Hope this helps.
-Jim
0
 

Author Comment

by:starusa
ID: 17054027
Thanks, that's an excellent point.

I'm developing a system using asp.net. The current system is written in classic asp, I'm just writing it again and trying to do some changes to optimize it. Today, all the credits and debits are recorded and then, the balance is updated when a button, "calculate" is clicked.

The best way is update the balance when the new record is inserted, right?

Thanks!
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 17054052
>The best way is update the balance when the new record is inserted, right?
Since the balance is calculated every time a record is inserted, pretty much everywhere, then yes this would be the case.

Thanks for the grade.  Good luck with your project.  -Jim
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question