17. Bank Balance Example
Checking account and Visa credit card transactions are combined into one spreadsheet:% cat bank.ssVisa charges are marked with a 1 in column C. Transactions which have been processed by the bank and Visa charges which have been paid are marked by a 1 in column D. The balances in columns G to J use the values from columns C and D in logical expressions such as !C2&&D2 meaning the item was not a credit card transaction and was processed by the bank.#if HTML #define X "<font color=red>0</font>" #else #define X "X" #endif g2:j14 = {g1+(!c2&&d2)*(f2-e2), h1+!(c2&&d2)*(f2-e2), i1+(c2&&!d2)*e2, h2+i2}; format c:d "%g"; g1:j1 = { 1438.62, g1, 0.00, h1+i1 }; a0:j0 = {"2012","Desc","V","x","-","+","Bank","Real","Visa","TrueBal" }; fill a2:f3 { "12/26", "Kelly's", 1, 1, 19.97, , "12/25", "Sfly", 1, 1, 25.00, , "12/25", "Netflix", 1, 1, 8.47, , "01/03", "Verizon", , 1, 100.98, , "01/04", "Mtg", , 1, 436.58, , "01/06", "AMC", 1, , 58.63, , "01/06", "Amazon", 1, , 152.64, , "01/11", "BMSS #2841", , X, 10, , "01/27", "PECO", , X, 223.02, , "01/22", "BSB", , 1, , 300, "01/23", "ATT", , X, 195.92, , }; eval; headers off; print;% SS -c 10 --Table bank.ss
The result shows the bank balance, real balance (including credit card charges and other transactions which have not yet been processed, i.e. how much money you really have left), Visa balance, and true balance (what the bank balance would be if all transactions were processed, not including credit card charges):
2012 | Desc | V | x | - | + | Bank | Real | Visa | TrueBal |
1438.62 | 1438.62 | 0.00 | 1438.62 | ||||||
12/26 | Kelly's | 1 | 1 | 19.97 | 1438.62 | 1438.62 | 0.00 | 1438.62 | |
12/25 | Sfly | 1 | 1 | 25.00 | 1438.62 | 1438.62 | 0.00 | 1438.62 | |
12/25 | Netflix | 1 | 1 | 8.47 | 1438.62 | 1438.62 | 0.00 | 1438.62 | |
01/03 | Verizon | 1 | 100.98 | 1337.64 | 1337.64 | 0.00 | 1337.64 | ||
01/04 | Mtg | 1 | 436.58 | 901.06 | 901.06 | 0.00 | 901.06 | ||
01/06 | AMC | 1 | 58.63 | 901.06 | 842.43 | 58.63 | 901.06 | ||
01/06 | Amazon | 1 | 152.64 | 901.06 | 689.79 | 211.27 | 901.06 | ||
01/11 | BMSS #2841 | 0 | 10.00 | 901.06 | 679.79 | 211.27 | 891.06 | ||
01/27 | PECO | 0 | 223.02 | 901.06 | 456.77 | 211.27 | 668.04 | ||
01/22 | BSB | 1 | 300.00 | 1201.06 | 756.77 | 211.27 | 968.04 | ||
01/23 | ATT | 0 | 195.92 | 1201.06 | 560.85 | 211.27 | 772.12 | ||
1201.06 | 560.85 | 211.27 | 772.12 | ||||||
1201.06 | 560.85 | 211.27 | 772.12 |