Financial Transaction History / Available Balance Calc

Options

Hi all

I'm trying to figure out the best way to model a financial transaction history on a per-customer basis. Right now I have a user table and a transactions table. All transactions for all customers are currently in the transactions table.

I want to have a running available balance calculated for each customer as each transactions posts. What's the best way to achieve this? A single column in the user table called 'available balance' that is updated as each transaction is added to the transactions table?

Thanks.

Answers

  • dorian
    dorian Member
    edited June 2023
    Options

    Actually no I don't think that will won't work as I want to keep track of the available balance as each transaction posts so I can show that to the customer in the front-end, sort of like the right-hand column below.

    Based on some reading, I might need to add an available balance column to my transactions table AND a current available balance column to my user table. As each transaction posts the available balance as-of that transaction is calculated and stored with the transaction in the transactions table AND the current available balance is updated for the user. Would this work?

  • dorian
    dorian Member
    Options

    Anyone have any input please?