Solved

ACCOUNTING - CALCULATING BALANCE

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

777 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