我有下表,但我不知道如何根据借方和贷方列计算余额和状态列,如下所示?
| ID | AR_DATE |ACC_CODE | ACC_NAME | DETAILS | DEBIT | CREDIT | BALANCE ?| STATUS?|
----------------------------------------------------------------------------------------
| 1 | 2013-04-10 | 101 | A/R | Kofi | 500 | 0 | 500 | Debit |
| 2 | 2013-04-10 | 101 | A/R | AMA | 0 | 250 | 250 | Debit |
| 3 | 2013-04-11 | 101 | A/R | Boss | 0 | 50 | 200 | Debit |
| 4 | 2013-04-12 | 101 | A/R | Jhon | 0 | 300 | 100 | Credit |