cvsimport
[hcoop/zz_old/portal.git] / money.mlt
index 02e7233..cbc7a6f 100644 (file)
--- a/money.mlt
+++ b/money.mlt
@@ -1,5 +1,7 @@
 <% @header [("title", ["MoneyMatters"])];
 
+val root = Group.inGroupNum 0;
+
 ref showNormal = true;
 
 if $"hist" <> "" then
@@ -16,7 +18,7 @@ if $"hist" <> "" then
        val admin = Group.inGroupName "money";
        showNormal := false %>
 
-<h3><b>Transactions</b></h3>
+<h3>Transactions</h3>
 
 <table>
 <tr> <td><b>Date</b></td> <td><b>Description</b></td> <td><b>Amount</b></td> <td><b>Last modified</b></td> <td><b>Participants</b></td> </tr>
@@ -37,10 +39,10 @@ end %>
 <% elseif $"cmd" = "bals" then
        showNormal := false %>
 
-<h3><b>Balances</b></h3>
+<h3>Active Balances</h3>
 
 <table>
-<% foreach bal in Balance.listBalances () do %>
+<% foreach bal in Balance.listOwnedBalances () do %>
 <tr><td><% #name bal %></td> <td><% #amount bal %></td> <td>
 <% switch Balance.listBalanceUsers (#id bal) of
          [] =>
@@ -53,21 +55,60 @@ end %></td> </tr>
 <% end %>
 </table>
 
+<% elseif $"cmd" = "deadbals" then
+       showNormal := false %>
+
+<h3>Retired Balances</h3>
+
+<table>
+<% foreach bal in Balance.listUnownedBalances () do %>
+<tr><td><% #name bal %></td> <td><% #amount bal %></td> <td>
+<% switch Balance.listBalanceUsers (#id bal) of
+         [] =>
+       | (user :: users) =>
+               %><a href="user?id=<% #id user %>"><% Web.html (#name user) %></a> <a href="money?hist=<% #id user %>">[History]</a><%
+               foreach user in users do
+                       %>, <a href="user?id=<% #id user %>"><% Web.html (#name user) %></a> <a href="money?hist=<% #id user %>">[History]</a><%
+               end
+end %></td> </tr>
+<% end %>
+</table>
+
+<% elseif $"cmd" = "nbals" then
+       showNormal := false;
+       val bals =  Balance.listNegativeOwnedBalances () %>
+
+<h3>Negative Active Balances (<% length bals %>)</h3>
+
+<table>
+<% foreach bal in bals do %>
+<tr><td><% #name bal %></td> <td><% #amount bal %></td> <td>
+<% switch Balance.listBalanceUsers (#id bal) of
+         [] =>
+       | (user :: users) =>
+               %><a href="user?id=<% #id user %>"><% Web.html (#name user) %></a> <a href="money?hist=<% #id user %>">[History]</a><%
+               foreach user in users do
+                       %>, <a href="user?id=<% #id user %>"><% Web.html (#name user) %></a> <a href="money?hist=<% #id user %>">[History]</a><%
+               end
+end %></td> </tr>
+<% end %>
+</table>
+
 <% elseif $"cmd" = "hosting" then
        Group.requireGroupName "money";
        showNormal := false %>
 
-<h3><b>New hosting bill</b></h3>
+<h3>New hosting bill</h3>
 
-<form action="money">
+<form action="money" method="post">
 <input type="hidden" name="cmd" value="hosting2">
-<table>
-<tr> <td align="right"><b>Description</b>:</td> <td><input name="descr"></td> </tr>
-<tr> <td align="right"><b>Date</b>:</td> <td><input name="d"></td> </tr>
-<tr> <td align="right"><b>Amount</b>:</td> <td><input name="amount"></td> </tr>
-<tr> <td align="right"><b>Free bandwidth cutoff (MB)</b>:</td> <td><input name="cutoff" value="200"></td> </tr>
-<tr> <td align="right"><b>Cost/GB</b>:</td> <td><input name="cost" value="4"></td> </tr>
-<tr> <td align="right" valign="top"><b>Member usage</b>:</td> <td><textarea wrap="soft" name="usage" rows="24" cols="80"></textarea></td> </tr>
+<table class="blanks">
+<tr> <td>Description:</td> <td><input name="descr"></td> </tr>
+<tr> <td>Date:</td> <td><input name="d"></td> </tr>
+<tr> <td>Amount:</td> <td><input name="amount"></td> </tr>
+<tr> <td>Free bandwidth cutoff (MB):</td> <td><input name="cutoff" value="200"></td> </tr>
+<tr> <td>Cost/GB:</td> <td><input name="cost" value="4"></td> </tr>
+<tr> <td>Member usage:</td> <td><textarea wrap="soft" name="usage" rows="24" cols="80"></textarea></td> </tr>
 <tr> <td><input type="submit" value="Add"></td> </tr>
 </table>
 
@@ -76,7 +117,7 @@ end %></td> </tr>
        val id = Money.addTransaction ($"descr", Util.neg (Web.stor ($"amount")), $"d");
        Money.addHostingCharges {trn = id, cutoff = 1000 * Web.stoi ($"cutoff"), cost = Web.stor ($"cost"), usage = $"usage"};
 
-       %><h3><b>Hosting transaction added.</b></h3>
+       %><h3>Hosting transaction added.</h3>
 
 <% elseif $"modHosting" <> "" then
        Group.requireGroupName "money";
@@ -84,17 +125,17 @@ end %></td> </tr>
        val id = Web.stoi ($"modHosting");
        val trn = Money.lookupTransaction id %>
 
-<h3><b>Modify hosting bill</b></h3>
+<h3>Modify hosting bill</h3>
 
-<form action="money">
+<form action="money" method="post">
 <input type="hidden" name="saveHosting" value="<% id %>">
-<table>
-<tr> <td align="right"><b>Description</b>:</td> <td><input name="descr" value="<% Web.html (#descr trn) %>"></td> </tr>
-<tr> <td align="right"><b>Date</b>:</td> <td><input name="d" value="<% Web.html (#d trn) %>"></td> </tr>
-<tr> <td align="right"><b>Amount</b>:</td> <td><input name="amount" value="<% Util.neg (#amount trn) %>"></td> </tr>
-<tr> <td align="right"><b>Free bandwidth cutoff (MB)</b>:</td> <td><input name="cutoff" value="200"></td> </tr>
-<tr> <td align="right"><b>Cost/GB</b>:</td> <td><input name="cost" value="4"></td> </tr>
-<tr> <td align="right" valign="top"><b>Member usage</b>:</td> <td><textarea wrap="soft" name="usage" rows="24" cols="80"><%
+<table class="blanks">
+<tr> <td>Description:</td> <td><input name="descr" value="<% Web.html (#descr trn) %>"></td> </tr>
+<tr> <td>Date:</td> <td><input name="d" value="<% Web.html (#d trn) %>"></td> </tr>
+<tr> <td>Amount:</td> <td><input name="amount" value="<% Util.neg (#amount trn) %>"></td> </tr>
+<tr> <td>Free bandwidth cutoff (MB):</td> <td><input name="cutoff" value="200"></td> </tr>
+<tr> <td>Cost/GB:</td> <td><input name="cost" value="4"></td> </tr>
+<tr> <td>Member usage:</td> <td><textarea wrap="soft" name="usage" rows="24" cols="80"><%
 switch Money.lookupHostingUsage id of
          SOME s => s
 end %></textarea></td> </tr>
@@ -110,19 +151,19 @@ end %></textarea></td> </tr>
        Money.modTransaction {trn with descr = $"descr", d = $"d", amount = Util.neg (Web.stor ($"amount"))};
        Money.addHostingCharges {trn = id, cutoff = 1000 * Web.stoi ($"cutoff"), cost = Web.stor ($"cost"), usage = $"usage"};
 
-       %><h3><b>Hosting transaction modified.</b></h3>
+       %><h3>Hosting transaction modified.</h3>
 
 <% elseif $"cmd" = "evenForm" then
        Group.requireGroupName "money";
        showNormal := false %>
-<h3><b>New generic/even transaction</b></h3>
-<form action="money">
+<h3>New generic/even transaction</h3>
+<form action="money" method="post">
 <input type="hidden" name="cmd" value="even">
-<table>
-<tr> <td align="right"><b>Description</b>:</td> <td><input name="descr"></td> </tr>
-<tr> <td align="right"><b>Date</b>:</td> <td><input name="d"></td> </tr>
-<tr> <td align="right"><b>Amount</b>:</td> <td><input name="amount"></td> </tr>
-<tr> <td align="right" valign="top"><b>Members</b>:</td> <td><select name="usrs" size="5" multiple>
+<table class="blanks">
+<tr> <td>Description:</td> <td><input name="descr"></td> </tr>
+<tr> <td>Date:</td> <td><input name="d"></td> </tr>
+<tr> <td>Amount:</td> <td><input name="amount"></td> </tr>
+<tr> <td>Members:</td> <td><select name="usrs" size="5" multiple>
 <% foreach usr in Init.listUsers () do %>
        <option value="<% #id usr %>"><% #name usr %></option>
 <% end %>
@@ -133,19 +174,26 @@ end %></textarea></td> </tr>
 
 <% elseif $"cmd" = "pay" then
        Group.requireGroupName "money";
+       val uid = (case $"user" of "" => ~1 | s => Web.stoi s);
        showNormal := false %>
 
-<h3><b>New member payment</b></h3>
+<h3>New member payment</h3>
 
-<form action="money">
+<form action="money" method="post">
 <input type="hidden" name="cmd" value="pay2">
-<table>
-<tr> <td align="right"><b>Description</b>:</td> <td><input name="descr"></td> </tr>
-<tr> <td align="right"><b>Date</b>:</td> <td><input name="d"></td> </tr>
-<tr> <td align="right"><b>Amount</b>:</td> <td><input name="amount"></td> </tr>
-<tr> <td align="right" valign="top"><b>Member</b>:</td> <td><select name="usr">
+<table class="blanks">
+<tr> <td>Description:</td> <td><select name="descr">
+       <option<% if $"checkout" = "" then %> selected<% end %>>PayPal</option>
+       <option<% if $"checkout" <> "" then %> selected<% end %>>Google Checkout</option>
+       <option>Check</option>
+       <option>Direct transfer</option>
+       <option value="">Other:</option>
+</select> <input name="descr2"></td> </tr>
+<tr> <td>Date:</td> <td><input name="d" value="<% Web.html (Date.fmt "%B %d, %Y" (Date.fromTimeLocal (Time.now ()))) %>"></td> </tr>
+<tr> <td>Amount:</td> <td><input name="amount"></td> </tr>
+<tr> <td>Member:</td> <td><select name="usr">
 <% foreach usr in Init.listUsers () do %>
-       <option value="<% #id usr %>"><% #name usr %></option>
+       <option value="<% #id usr %>"<% if #id usr = uid then %> selected<% end %>><% #name usr %></option>
 <% end %>
 </select></td> </tr>
 <tr> <td><input type="submit" value="Add"></td> </tr>
@@ -155,11 +203,13 @@ end %></textarea></td> </tr>
 <% elseif $"cmd" = "pay2" then
        Group.requireGroupName "money";
        val amount = Web.stor ($"amount");
+       val descr = $"descr";
+       val descr = iff descr = "" then $"descr2" else descr;
        val id = Money.addTransaction ($"descr", amount, $"d");
        Money.addCharge {trn = id, usr = Web.stoi ($"usr"), amount = amount};
        Money.applyCharges id;
 
-       %><h3><b>Payment transaction added.</b></h3>
+       %><h3>Payment transaction added.</h3>
 
 <% elseif $"modPay" <> "" then
        Group.requireGroupName "money";
@@ -167,15 +217,15 @@ end %></textarea></td> </tr>
        val id = Web.stoi ($"modPay");
        val trn = Money.lookupTransaction id %>
 
-<h3><b>Modify member payment</b></h3>
+<h3>Modify member payment</h3>
 
-<form action="money">
+<form action="money" method="post">
 <input type="hidden" name="savePay" value="<% id %>">
-<table>
-<tr> <td align="right"><b>Description</b>:</td> <td><input name="descr" value="<% Web.html (#descr trn) %>"></td> </tr>
-<tr> <td align="right"><b>Date</b>:</td> <td><input name="d" value="<% Web.html (#d trn) %>"></td> </tr>
-<tr> <td align="right"><b>Amount</b>:</td> <td><input name="amount" value="<% Util.neg (#amount trn) %>"></td> </tr>
-<tr> <td align="right" valign="top"><b>Member</b>:</td> <td><select name="usr">
+<table class="blanks">
+<tr> <td>Description:</td> <td><input name="descr" value="<% Web.html (#descr trn) %>"></td> </tr>
+<tr> <td>Date:</td> <td><input name="d" value="<% Web.html (#d trn) %>"></td> </tr>
+<tr> <td>Amount:</td> <td><input name="amount" value="<% #amount trn %>"></td> </tr>
+<tr> <td>Member:</td> <td><select name="usr">
 <% foreach (sel, usr) in Money.listUsers (#id trn) do %>
        <option value="<% #id usr %>"<% if sel then %> selected<% end %>><% #name usr %></option>
 <% end %>
@@ -194,19 +244,19 @@ end %></textarea></td> </tr>
        Money.addCharge {trn = id, usr = Web.stoi ($"usr"), amount = amount};
        Money.applyCharges id;
 
-       %><h3><b>Member payment modified.</b></h3>
+       %><h3>Member payment modified.</h3>
 
 <% elseif $"cmd" = "evenForm" then
        Group.requireGroupName "money";
        showNormal := false %>
-<h3><b>New generic/even transaction</b></h3>
-<form action="money">
+<h3>New generic/even transaction</h3>
+<form action="money" method="post">
 <input type="hidden" name="cmd" value="even">
-<table>
-<tr> <td align="right"><b>Description</b>:</td> <td><input name="descr"></td> </tr>
-<tr> <td align="right"><b>Date</b>:</td> <td><input name="d"></td> </tr>
-<tr> <td align="right"><b>Amount</b>:</td> <td><input name="amount"></td> </tr>
-<tr> <td align="right" valign="top"><b>Members</b>:</td> <td><select name="usrs" size="5" multiple>
+<table class="blanks">
+<tr> <td>Description:</td> <td><input name="descr"></td> </tr>
+<tr> <td>Date:</td> <td><input name="d"></td> </tr>
+<tr> <td>Amount:</td> <td><input name="amount"></td> </tr>
+<tr> <td>Members:</td> <td><select name="usrs" size="5" multiple>
 <% foreach usr in Init.listUsers () do %>
        <option value="<% #id usr %>"><% #name usr %></option>
 <% end %>
@@ -220,21 +270,21 @@ end %></textarea></td> </tr>
        val id = Money.addTransaction ($"descr", Web.stor ($"amount"), $"d");
        Money.addEvenCharges (id, map Web.stoi (Web.getMultiParam "usrs"))
 
-       %><h3><b>Even transaction added.</b></h3>
+       %><h3>Even transaction added.</h3>
 
 <% elseif $"modEven" <> "" then
        Group.requireGroupName "money";
        showNormal := false;
        val trn = Money.lookupTransaction (Web.stoi ($"modEven")) %>
-<h3><b>Modify even transaction</b></h3>
+<h3>Modify even transaction</h3>
 
-<form action="money">
+<form action="money" method="post">
 <input type="hidden" name="saveEven" value="<% $"modEven" %>">
-<table>
-<tr> <td align="right"><b>Description</b>:</td> <td><input name="descr" value="<% Web.html (#descr trn) %>"></td> </tr>
-<tr> <td align="right"><b>Date</b>:</td> <td><input name="d" value="<% Web.html (#d trn) %>"></td> </tr>
-<tr> <td align="right"><b>Amount</b>:</td> <td><input name="amount" value="<% #amount trn %>"></td> </tr>
-<tr> <td align="right" valign="top"><b>Members</b>:</td> <td><select name="usrs" size="5" multiple>
+<table class="blanks">
+<tr> <td>Description:</td> <td><input name="descr" value="<% Web.html (#descr trn) %>"></td> </tr>
+<tr> <td>Date:</td> <td><input name="d" value="<% Web.html (#d trn) %>"></td> </tr>
+<tr> <td>Amount:</td> <td><input name="amount" value="<% #amount trn %>"></td> </tr>
+<tr> <td>Members:</td> <td><select name="usrs" size="5" multiple>
 <% foreach (sel, usr) in Money.listUsers (#id trn) do %>
        <option value="<% #id usr %>"<% if sel then %> selected<% end %>><% #name usr %></option>
 <% end %>
@@ -251,13 +301,13 @@ end %></textarea></td> </tr>
        Money.modTransaction {trn with descr = $"descr", d = $"d", amount = Web.stor ($"amount")};
        Money.addEvenCharges (id, map Web.stoi (Web.getMultiParam "usrs"))
 
-       %><h3><b>Even transaction modified</b></h3>
+       %><h3>Even transaction modified</h3>
 
 <% elseif $"del" <> "" then
        Group.requireGroupName "money";
        showNormal := false;
        val trn = Money.lookupTransaction (Web.stoi ($"del")) %>
-       <h3><b>Are you sure you want to delete transaction <a href="money?trn=<% #id trn %>"><% Web.html (#descr trn) %></a>?</b></h3>
+       <h3>Are you sure you want to delete transaction <a href="money?trn=<% #id trn %>"><% Web.html (#descr trn) %></a>?</h3>
        <a href="money?del2=<% $"del" %>">Yes, delete <% Web.html (#descr trn) %>!</a>
 
 <% elseif $"del2" <> "" then
@@ -266,23 +316,23 @@ end %></textarea></td> </tr>
        val trn = Money.lookupTransaction id;
        Money.clearCharges id;
        Money.deleteTransaction id %>
-       <h3><b><% Web.html (#descr trn) %> deleted!</b></h3>
+       <h3><% Web.html (#descr trn) %> deleted!</h3>
 
 <% elseif $"cmd" = "equalize" then
        Group.requireGroupName "money";
        Money.equalizeBalances ();
-       %><h3><b>Balances equalized</b></h3>
+       %><h3>Balances equalized</h3>
 
 <% elseif $"trn" <> "" then
        showNormal := false;
        val id = Web.stoi ($"trn");
        val trn = Money.lookupTransaction id %>
-<table>
-<tr> <td align="right"><b>TRN#</b>:</td> <td><% id %></td> </tr>
-<tr> <td align="right"><b>Description</b>:</td> <td><% Web.html (#descr trn) %></td> </tr>
-<tr> <td align="right"><b>Date</b>:</td> <td><% #d trn %></td> </tr>
-<tr> <td align="right"><b>Amount</b>:</td> <td>$<% #amount trn %></td> </tr>
-<tr> <td align="right" valign="top"><b>Distribution</b>:</td>
+<table class="blanks">
+<tr> <td>TRN#:</td> <td><% id %></td> </tr>
+<tr> <td>Description:</td> <td><% Web.html (#descr trn) %></td> </tr>
+<tr> <td>Date:</td> <td><% #d trn %></td> </tr>
+<tr> <td>Amount:</td> <td>$<% #amount trn %></td> </tr>
+<tr> <td>Distribution:</td>
 
 <% ref first = true;
 foreach (name, cha) in Money.listChargesWithNames id do
@@ -295,16 +345,135 @@ foreach (name, cha) in Money.listChargesWithNames id do
 end %>
 </table>
 
-<% end %>
+<% elseif $"cmd" = "paypal" then
+   showNormal := false;
+   val apps = App.searchPaypal ($"email");
+   val users = Init.searchPaypal ($"email");
+
+   switch apps of
+     _ :: _ =>
+     %><h3>Approved applications</h3>
+
+     <% foreach appl in apps do %>
+               <br><hr><br>
+               <table class="blanks">
+               <tr> <td>Received:</td> <td><% #applied appl %></td> </tr>
+               <tr> <td>Approved by:</td> <td><%
+                       ref first = true;
+                       ref found = false;
+                       foreach (id, name) in App.votes (#id appl) do
+                               if first then
+                                       first := false
+                               else
+                                       %>, <%
+                               end
+                               %><a href="user?id=<% id %>"><% name %></a><%
+                       end %> </td> </tr>
+       <tr> <td>Username:</td> <td><% #name appl %></td> </tr>
+       <tr> <td>Real name:</td> <td><% Web.html (#rname appl) %></td> </tr>
+       <tr> <td>E-mail address:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr>
+       <% switch #paypal appl of
+         SOME s => %><tr> <td>PayPal:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr>
+       <% end;
+       switch #checkout appl of
+         SOME s => %><tr> <td>Google Checkout:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr>
+       <% end %>
+       <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr>
+       <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr>
+       <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr>
+       </table>
+
+       <% if root then %>
+               <a href="apps?add=<% #id appl %>">Add this member.</a><br>
+       <% end
+       end
+   end;
+
+   switch users of
+     _ :: _ =>
+     %><h3>Members</h3>
+
+     <% foreach user in users do %>
+       <li> <a href="user?id=<% #id user %>"><% #name user %></a> <a href="?cmd=pay&user=<% #id user %>">[add payment]</a></li>
+     <% end
+   end;
+
+   switch (apps, users) of
+     (nil, nil) => %>No matches.<%
+   end
+
+elseif $"cmd" = "checkout" then
+   showNormal := false;
+   val apps = App.searchCheckout ($"email");
+   val users = Init.searchCheckout ($"email");
+
+   switch apps of
+     _ :: _ =>
+     %><h3>Approved applications</h3>
+
+     <% foreach appl in apps do %>
+               <br><hr><br>
+               <table class="blanks">
+               <tr> <td>Received:</td> <td><% #applied appl %></td> </tr>
+               <tr> <td>Approved by:</td> <td><%
+                       ref first = true;
+                       ref found = false;
+                       foreach (id, name) in App.votes (#id appl) do
+                               if first then
+                                       first := false
+                               else
+                                       %>, <%
+                               end
+                               %><a href="user?id=<% id %>"><% name %></a><%
+                       end %> </td> </tr>
+       <tr> <td>Username:</td> <td><% #name appl %></td> </tr>
+       <tr> <td>Real name:</td> <td><% Web.html (#rname appl) %></td> </tr>
+       <tr> <td>E-mail address:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr>
+       <% switch #paypal appl of
+         SOME s => %><tr> <td>PayPal:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr>
+       <% end;
+       switch #checkout appl of
+         SOME s => %><tr> <td>Google Checkout:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr>
+       <% end %>
+       <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr>
+       <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr>
+       <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr>
+       </table>
+
+       <% if root then %>
+               <a href="apps?add=<% #id appl %>">Add this member.</a><br>
+       <% end
+       end
+   end;
+
+   switch users of
+     _ :: _ =>
+     %><h3>Members</h3>
+
+     <% foreach user in users do %>
+       <li> <a href="user?id=<% #id user %>"><% #name user %></a> <a href="?cmd=pay&user=<% #id user %>&checkout=1">[add payment]</a></li>
+     <% end
+   end;
+
+   switch (apps, users) of
+     (nil, nil) => %>No matches.<%
+   end
+
+end %>
 
 <% if showNormal then %>
 
-<h3><b>Your balance:</b> $<% #amount (Balance.lookupBalance (#bal (Init.getUser ()))) %></h3>
+<h3>Your balance: $<% #amount (Balance.lookupBalance (#bal (Init.getUser ()))) %></h3>
+<% if (iff Group.inGroupName "money" then $"lookback" = "" else $"audit" <> "") then %><h3>Sum of all active balances: $<% Balance.sumOwnedBalances () %></h3><% end %>
 
 <a href="money?cmd=list">List all transactions</a><br>
-<a href="money?cmd=bals">List all balances</a><br>
+<a href="money?cmd=bals">List active balances</a><br>
+<a href="money?cmd=nbals">List negative active balances</a><br>
+<a href="money?cmd=deadbals">List retired balances</a><br>
 
-<% if Group.inGroupName "money" then %>
+<% if (Group.inGroupName "money" and $"lookback" = "") or $"audit" <> "" then %>
+
+<a href="?lookback=20">Switch to regular member view</a><br>
 
 <br><b><u>New transaction:</u></b><br>
 <a href="money?cmd=hosting">Hosting bill</a><br>
@@ -312,8 +481,23 @@ end %>
 <a href="money?cmd=evenForm">Generic/even</a><br>
 <br>
 <a href="money?cmd=equalize">Equalize balances</a><br>
+<br>
+
+<h3>Look up a PayPal e-mail address</h3>
 
-<h3><b>Most recent transactions</b></h3>
+<form method="post">
+<input type="hidden" name="cmd" value="paypal">
+<input name="email"> <input type="submit" value="Look up">
+</form>
+
+<h3>Look up a Google Checkout e-mail address</h3>
+
+<form method="post">
+<input type="hidden" name="cmd" value="checkout">
+<input name="email"> <input type="submit" value="Look up">
+</form>
+
+<h3>Most recent transactions</h3>
 
 <table>
 <tr> <td><b>Date</b></td> <td><b>Description</b></td> <td><b>Amount</b></td> <td><b>Participants</b></td> <td><b>Replace</b></td> <td><b>Delete</b></td> </tr>
@@ -329,12 +513,20 @@ end %>
 </table>
 
 <% else %>
+<a href="?audit=1">Switch to audit view</a><br>
+<% val lookback = case $"lookback" of "" => 20 | lb => Web.stoi lb;
+   @payment [] %>
+
+<h3>Your recent account activity</h3>
 
-<h3><b>Your recent account activity</b></h3>
+<form>
+      Show <input name="lookback" size="5" value="<% lookback %>"> most recent transactions.
+      <input type="submit" value="Show">
+</form>
 
 <table>
 <tr> <td><b>Date</b></td> <td><b>Description</b></td> <td><b>Amount</b></td> </tr>
-<% foreach (amount, trn) in Money.listUserTransactionsLimit (Init.getUserId (), 20) do %>
+<% 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 %>
 </table>