Show running balances on transaction summaries
[bpt/portal.git] / money.mlt
index 90f87b3..5977d09 100644 (file)
--- a/money.mlt
+++ b/money.mlt
@@ -598,9 +598,10 @@ elseif $"cmd" = "freezeworthy" then
 <% if showNormal then
    val you = Init.getUser();
    val bal = Balance.lookupBalance (#bal you);
-   val deposit = Balance.depositAmount (#id bal) %>
+   val deposit = Balance.depositAmount (#id bal);
+   val showBal = Util.sub (#amount bal, deposit) %>
 
-<h3>Your balance: $<% Util.sub (#amount bal, deposit) %><br>
+<h3>Your balance: $<% showBal %><br>
 Deposit: $<% deposit %></b> (3 months of dues at the minimal <a href="pledge">pledge level</a>)<br>
 Co-op balance: $<% #amount (Balance.lookupBalance (valOf (Balance.balanceNameToId "hcoop"))) %></h3>
 
@@ -672,11 +673,14 @@ end %>
       <input type="submit" value="Show">
 </form>
 
+<% ref running = showBal %>
 <table>
-<tr> <td><b>Date</b></td> <td><b>Description</b></td> <td><b>Amount</b></td> </tr>
+<tr> <td><b>Date</b></td> <td><b>Description</b></td> <td><b>Amount</b></td> <td><b>Balance</b></td></tr>
 <% foreach (amount, trn) in Money.listUserTransactionsLimit (Init.getUserId (), lookback) do %>
-<tr> <td><% #d trn %></td> <td><a href="money?trn=<% #id trn %>"><% Web.html (#descr trn) %></a></td> <td><% amount %>/<% #amount trn %></td> </tr>
-<% end %>
+<tr> <td><% #d trn %></td> <td><a href="money?trn=<% #id trn %>"><% Web.html (#descr trn) %></a></td> <td><% amount %>/<% #amount trn %></td>
+<td><% running %></tr>
+<% running := Util.sub (running, amount)
+end %>
 </table>
 
 <% end