account_balance

Current balance (sum of all past invoices, payments, credit/debit notes, bonds, commissions, etc.) for a Smile account.

Column name Description Data type
account Primary key.

The account uid.

Reference to account.

integer
balance The amount owing. Negative amounts indicate account is in credit; positive amounts if account has an outstanding debt. Will be NULL if the account has yet to raise any invoices or make any payments. numeric *

The account_balance table lists all accounts and their balances, even if the balance is zero.

SELECT usn(account), cf(account, 'contactNameFamily') AS "family name", cf(account, 'contactNameGiven') AS "given name", balance FROM account_balance;


   usn     |  family name  |  given name   |   balance   
-----------+---------------+---------------+-------------
2142420815 | Keating       | Paul          |     1428.00
2142421037 | Bush          | George W      |      900.00
2142421607 | Ausburn       | Royce         |     1526.50
2142420799 | Howard        | John          |     1510.50