Solved

ACCOUNTING - CALCULATING BALANCE

Posted on 2006-07-06
3
388 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
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…

679 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