WHAT I ALREADY HAVE:
In my application, I have Credit and Debit columns. I am using the column type as Decimal 8.2 with a default value of 0.00 for both columns in the table. When a user receives a loan of, say, $ 50, the credit column receives a value of 50.00, and the debit is filled as 0.00.
WHAT IAM TRIES TO ACCEPT:
Now I also want to show the balance for the transaction in the third column, next to the Debit column in the interface. So, I am creating a new “Balance” column with the column type as Decimal 8.2, and the default value is 0.00 and just fills the balance as (credit debit) in my code? Or can I dynamically calculate balance values every time a user visits this page? Which method would be best and why?
The latest transactions are displayed first. Here is an example of how I want my interface to work / look:
PK Credit Debit Balance
3 0.00 20.00 35.00
2 10.00 5.00 55.00
1 50.00 0.00 50.00
Totals: 60.00 25.00 35.00
PK is an automatic key, a primary key. What will be the code to output the output as above?
Thanks in advance.
source
share