From b5dc79cabf7afd0adc34746aa0a050714cfe0eb4 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Tue, 15 Jul 2008 16:19:04 +0000 Subject: [PATCH] Show running balances on transaction summaries --- money.mlt | 14 +++++++++----- portal.mlt | 12 ++++++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/money.mlt b/money.mlt index 90f87b3..5977d09 100644 --- 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) %> -

Your balance: $<% Util.sub (#amount bal, deposit) %>
+

Your balance: $<% showBal %>
Deposit: $<% deposit %> (3 months of dues at the minimal pledge level)
Co-op balance: $<% #amount (Balance.lookupBalance (valOf (Balance.balanceNameToId "hcoop"))) %>

@@ -672,11 +673,14 @@ end %> +<% ref running = showBal %> - + <% foreach (amount, trn) in Money.listUserTransactionsLimit (Init.getUserId (), lookback) do %> - -<% end %> + + +<% running := Util.sub (running, amount) +end %>
Date Description Amount
Date Description Amount Balance
<% #d trn %> <% Web.html (#descr trn) %> <% amount %>/<% #amount trn %>
<% #d trn %> <% Web.html (#descr trn) %> <% amount %>/<% #amount trn %><% running %>
<% end diff --git a/portal.mlt b/portal.mlt index 7fb59ee..a673d77 100644 --- a/portal.mlt +++ b/portal.mlt @@ -1,19 +1,23 @@ <% val you = Init.getUser(); val bal = Balance.lookupBalance (#bal you); val deposit = Balance.depositAmount (#id bal); +val showBal = Util.sub (#amount bal, deposit); @header [] %> <% @payment [] %>

Your recent account activity

+<% ref running = showBal %> - + <% foreach (amount, trn) in Money.listUserTransactionsLimit (Init.getUserId (), 5) do %> - -<% end %> + + +<% running := Util.sub (running, amount) +end %>
Date Description Amount
Date Description Amount Balance
<% #d trn %> <% Web.html (#descr trn) %> <% amount %>/<% #amount trn %>
<% #d trn %> <% Web.html (#descr trn) %> <% amount %>/<% #amount trn %><% running %>
-Balance: $<% Util.sub (#amount bal, deposit) %>
+Balance: $<% showBal %>
Deposit: $<% deposit %> (3 months of dues at the minimal pledge level) -- 2.20.1