% @header [("title", ["MoneyMatters"])];
ref showNormal = true;
if $"cmd" = "list" then
showNormal := false %>
Transactions
Date | Description | Amount | Last modified | Participants |
<% foreach trn in Money.listTransactions () do %>
<% #d trn %> | <% Web.html (#descr trn) %> | <% #amount trn %> | <% #stamp trn %> |
<% switch Money.listChargesWithNames (#id trn) of
[(name, cha)] => %><% name %> |
<%
| _ => %>multi | <%
end
end %>
<% elseif $"cmd" = "bals" then
showNormal := false %>
Balances
<% elseif $"cmd" = "hosting" then
Group.requireGroupName "money";
showNormal := false %>
New hosting bill
<% elseif $"cmd" = "even" then
val id = Money.addTransaction ($"descr", Web.stor ($"amount"), $"d");
Money.addEvenCharges (id, map Web.stoi (Web.getMultiParam "usrs"))
%>Even transaction added.
<% elseif $"modEven" <> "" then
showNormal := false;
val trn = Money.lookupTransaction (Web.stoi ($"modEven")) %>
Modify even transaction
<% elseif $"saveEven" <> "" then
val id = Web.stoi ($"saveEven");
val trn = Money.lookupTransaction id;
Money.clearCharges id;
Money.modTransaction {trn with descr = $"descr", d = $"d", amount = Web.stor ($"amount")};
Money.addEvenCharges (id, map Web.stoi (Web.getMultiParam "usrs"))
%>Even transaction modified
<% elseif $"del" <> "" then
showNormal := false;
val trn = Money.lookupTransaction (Web.stoi ($"del")) %>
">Yes, delete <% Web.html (#descr trn) %>!
<% elseif $"del2" <> "" then
val id = Web.stoi ($"del2");
val trn = Money.lookupTransaction id;
Money.clearCharges id;
Money.deleteTransaction id %>
<% Web.html (#descr trn) %> deleted!
<% elseif $"trn" <> "" then
showNormal := false;
val id = Web.stoi ($"trn");
val trn = Money.lookupTransaction id %>
TRN#: | <% id %> |
Description: | <% Web.html (#descr trn) %> |
Date: | <% #d trn %> |
Amount: | $<% #amount trn %> |
Distribution: |
<% ref first = true;
foreach (name, cha) in Money.listChargesWithNames id do
if first then
first := false
else
%>
| <%
end
%><% name %> | $<% #amount cha %> |
<%
end %>
<% end %>
<% if showNormal then %>
List all transactions
List all balances
<% if Group.inGroupName "money" then %>
New transaction:
Hosting bill
Generic/even
Most recent transactions
Date | Description | Amount | Participants | Replace | Delete |
<% foreach trn in Money.listTransactionsLimit 20 do %>
<% #d trn %> | <% Web.html (#descr trn) %> | <% #amount trn %> |
<% switch Money.listChargesWithNames (#id trn) of
[(name, cha)] => %><% name %> | <%
| _ => %>multi | <%
end %>
[Even] | [Delete] |
<% end %>
<% else %>
Your recent account activity
Date | Description | Amount |
<% foreach (amount, trn) in Money.listUserTransactionsLimit (Init.getUserId (), 20) do %>
<% #d trn %> | <% Web.html (#descr trn) %> | <% amount %>/<% #amount trn %> |
<% end %>
<% end
end %>
<% @footer [] %>