Click here to Skip to main content
15,902,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
AOA!
I want to ask that i am making finance sytem project in C#. I want to update my balance column in databse with respect to entities, for example
I have four columns in my database like this:
account_no        acount_desc        debit    credit      balance
101               furniture           56         0         null
102               furniture            0        46         null


I want to update the balance column first time when debit is 56 then balance will be 56 in second entry when credit is 46 then balance will be (56-46=10) but i want this value in all the balance column of same account desc. How is it possible?
Actually i am making trial balance report. In crystal report i am showing balance with the help of formula but how can i save this balance in database table column?
I want to save the total balance with respect to some entity like furniture in database?
Posted
Updated 26-Mar-14 11:39am
v3

1 solution

SQL
you should maintain two table

One is main acc and another one is debit and credit table like this tables

 Create table Mainacc(AccNo int identity,AccDesc nvarchar(max),balance float)
 Create table accinvoice(accno int,AccDesc nvarchar(max), debit float,credit float)

 Insert into Mainacc values(1,'furniture',100)

First balance is 100
then
you debit 56 from accno 1

that entry insert to accinvoice table

insert into accinvoice values(1,furniture,56,0)

Update acc set balance=balance-56 where accNo=1

 Second credit 46 from accno 1

that next entry insert to accinvoice table

insert into accinvoice values(1,furniture,0,46)
Update acc set balance=balance+46 where accNo=1
 
Share this answer
 
Comments
Member 10690757 26-Mar-14 12:55pm    
murugesan22 is it work for each column of entity means if furniture is debited twice a month then balance is updated twice times in each column of furniture?

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