From: Adam Chlipala Date: Tue, 15 Jul 2008 16:32:51 +0000 (+0000) Subject: Links to list all transactions; debit/credit columns X-Git-Url: http://git.hcoop.net/hcoop/portal.git/commitdiff_plain/60465e67fb55c6fddb458407d5b10adafd6e214f Links to list all transactions; debit/credit columns --- diff --git a/money.mlt b/money.mlt index 5977d09..dbad9a9 100644 --- a/money.mlt +++ b/money.mlt @@ -663,25 +663,34 @@ end %> <% else %> Switch to audit view
-<% val lookback = case $"lookback" of "" => 20 | lb => Web.stoi lb; +<% val lookback = case $"lookback" of "" => 20 | "inf" => 0 | lb => Web.stoi lb; @payment [] %>

Your recent account activity

- Show most recent transactions. + Show most recent transactions.
-<% ref running = showBal %> +<% ref running = showBal; +val trans = iff lookback = 0 then + Money.listUserTransactions (Init.getUserId ()) + else + Money.listUserTransactionsLimit (Init.getUserId (), lookback) %> - -<% foreach (amount, trn) in Money.listUserTransactionsLimit (Init.getUserId (), lookback) do %> - + +<% foreach (amount, trn) in trans do %> + + + <% running := Util.sub (running, amount) end %>
Date Description Amount Balance
<% #d trn %> <% Web.html (#descr trn) %> <% amount %>/<% #amount trn %>
Date Description Debit Credit Balance
<% #d trn %> <% Web.html (#descr trn) %><% if Util.lt (amount, 0.0) then %><% amount %><% end %><% if Util.ge (amount, 0.0) then %><% amount %><% end %> <% running %>
+<% if lookback <> 0 then %> +Show all transactions
+<% end %> <% end end %> diff --git a/portal.mlt b/portal.mlt index a673d77..e9d82fe 100644 --- a/portal.mlt +++ b/portal.mlt @@ -17,6 +17,7 @@ val showBal = Util.sub (#amount bal, deposit); <% running := Util.sub (running, amount) end %> +Show all transactions
Balance: $<% showBal %>
Deposit: $<% deposit %> (3 months of dues at the minimal pledge level) diff --git a/util.sig b/util.sig index d6f9d5c..f8c38d4 100644 --- a/util.sig +++ b/util.sig @@ -18,6 +18,9 @@ sig val sub : real * real -> real val mult : int * real -> real + val lt : real * real -> bool + val ge : real * real -> bool + val validHost : string -> bool val validDomain : string -> bool val validEmail : string -> bool diff --git a/util.sml b/util.sml index 07793bb..9c269c1 100644 --- a/util.sml +++ b/util.sml @@ -32,6 +32,9 @@ fun add (r1 : real, r2) = r1 + r2 fun sub (r1 : real, r2) = r1 - r2 fun mult (r1, r2) = real r1 * r2 +fun lt (r1 : real, r2) = r1 < r2 +fun ge (r1 : real, r2) = r1 >= r2 + fun isIdent ch = Char.isLower ch orelse Char.isDigit ch orelse ch = #"-" fun validHost s =