Add back in link to old style bill
[bpt/portal.git] / money.mlt
1 <% @header [("title", ["MoneyMatters"])];
2
3 val root = Group.inGroupNum 0;
4
5 ref showNormal = true;
6
7 if $"hist" <> "" then
8 showNormal := false;
9 val id = Web.stoi ($"hist") %>
10 <table>
11 <tr> <td><b>Date</b></td> <td><b>Description</b></td> <td><b>Amount</b></td> </tr>
12 <% foreach (amount, trn) in Money.listUserTransactions id do %>
13 <tr> <td><% #d trn %></td> <td><a href="money?trn=<% #id trn %>"><% Web.html (#descr trn) %></a></td> <td><% amount %>/<% #amount trn %></td> </tr>
14 <% end %>
15 </table>
16
17 <% elseif $"cmd" = "list" then
18 val admin = Group.inGroupName "money";
19 showNormal := false %>
20
21 <h3>Transactions</h3>
22
23 <table>
24 <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>
25 <% foreach trn in Money.listTransactions () do %>
26 <tr> <td><% #d trn %></td> <td><a href="money?trn=<% #id trn %>"><% Web.html (#descr trn) %></a></td> <td><% #amount trn %></td> <td><% #stamp trn %></td>
27 <% switch Money.listChargesWithNames (#id trn) of
28 [(name, cha)] => %><td><a href="user?id=<% #usr cha %>"><% name %></a></td><%
29 | _ => %><td><i>multi</i></td><%
30 end;
31 if admin then
32 %><td><a href="money?modBill=<% #id trn %>">[Bill]</a> <a href="money?modPay=<% #id trn %>">[Payment]</a> <a href="money?modEven=<% #id trn %>">[Other]</a></td>
33 <td><a href="money?del=<% #id trn %>">[Delete]</a></td><%
34 end
35 %></tr><%
36 end %>
37 </table>
38
39 <% elseif $"cmd" = "primary" then
40 val admin = Group.inGroupName "money";
41 showNormal := false %>
42
43 <h3>Primary Transactions</h3>
44
45 <table>
46 <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>
47 <% foreach (amt, trn) in Money.listUserTransactions (valOf (Init.userNameToId "hcoop")) do %>
48 <tr> <td><% #d trn %></td> <td><a href="money?trn=<% #id trn %>"><% Web.html (#descr trn) %></a></td> <td><% #amount trn %></td> <td><% #stamp trn %></td>
49 <% switch Money.listChargesWithNames (#id trn) of
50 [(name, cha)] => %><td><a href="user?id=<% #usr cha %>"><% name %></a></td><%
51 | _ => %><td><i>multi</i></td><%
52 end;
53 if admin then
54 %><td><a href="money?modBill=<% #id trn %>">[Bill]</a> <a href="money?modPay=<% #id trn %>">[Payment]</a> <a href="money?modEven=<% #id trn %>">[Other]</a></td>
55 <td><a href="money?del=<% #id trn %>">[Delete]</a></td><%
56 end
57 %></tr><%
58 end %>
59 </table>
60
61 <% elseif $"cmd" = "bals" then
62 showNormal := false %>
63
64 <h3>Active Balances</h3>
65
66 <table>
67 <% foreach bal in Balance.listOwnedBalances () do %>
68 <tr><td><% #name bal %></td> <td><% #amount bal %></td> <td>
69 <% switch Balance.listBalanceUsers (#id bal) of
70 [] =>
71 | (user :: users) =>
72 %><a href="money?hist=<% #id user %>"><% Web.html (#name user) %></a> <a href="money?hist=<% #id user %>">[History]</a><%
73 foreach user in users do
74 %>, <a href="money?hist=<% # id user %>"><% Web.html (#name user) %></a><%
75 end
76 end %></td> </tr>
77 <% end %>
78 </table>
79
80 <% elseif $"cmd" = "deadbals" then
81 showNormal := false %>
82
83 <h3>Retired Balances</h3>
84
85 <table>
86 <% foreach bal in Balance.listUnownedBalances () do %>
87 <tr><td><% #name bal %></td> <td><% #amount bal %></td> <td>
88 <% switch Balance.listBalanceUsers (#id bal) of
89 [] =>
90 | (user :: users) =>
91 %><a href="user?id=<% #id user %>"><% Web.html (#name user) %></a> <a href="money?hist=<% #id user %>">[History]</a><%
92 foreach user in users do
93 %>, <a href="user?id=<% #id user %>"><% Web.html (#name user) %></a> <a href="money?hist=<% #id user %>">[History]</a><%
94 end
95 end %></td> </tr>
96 <% end %>
97 </table>
98
99 <% elseif $"cmd" = "nbals" then
100 showNormal := false;
101 val bals = Balance.listNegativeOwnedBalances () %>
102
103 <h3>Negative Active Balances (<% length bals %>)</h3>
104
105 <table>
106 <% foreach bal in bals do %>
107 <tr><td><% #name bal %></td> <td><% #amount bal %></td> <td>
108 <% switch Balance.listBalanceUsers (#id bal) of
109 [] =>
110 | (user :: users) =>
111 %><a href="user?id=<% #id user %>"><% Web.html (#name user) %></a> <a href="money?hist=<% #id user %>">[History]</a><%
112 foreach user in users do
113 %>, <a href="user?id=<% #id user %>"><% Web.html (#name user) %></a> <a href="money?hist=<% #id user %>">[History]</a><%
114 end
115 end %></td> </tr>
116 <% end %>
117 </table>
118
119 <% elseif $"cmd" = "hosting" then
120 Group.requireGroupName "money";
121 showNormal := false %>
122
123 <h3>New hosting bill</h3>
124
125 <form action="money" method="post">
126 <input type="hidden" name="cmd" value="hosting2">
127 <table class="blanks">
128 <tr> <td>Description:</td> <td><input name="descr"></td> </tr>
129 <tr> <td>Date:</td> <td><input name="d"></td> </tr>
130 <tr> <td>Amount:</td> <td><input name="amount"></td> </tr>
131 <tr> <td>Free bandwidth cutoff (MB):</td> <td><input name="cutoff" value="200"></td> </tr>
132 <tr> <td>Cost/GB:</td> <td><input name="cost" value="4"></td> </tr>
133 <tr> <td>Member usage:</td> <td><textarea wrap="soft" name="usage" rows="24" cols="80"></textarea></td> </tr>
134 <tr> <td><input type="submit" value="Add"></td> </tr>
135 </table>
136
137 <% elseif $"cmd" = "hosting2" then
138 Group.requireGroupName "money";
139 val id = Money.addTransaction ($"descr", Util.neg (Web.stor ($"amount")), $"d");
140 Money.addHostingCharges {trn = id, cutoff = 1000 * Web.stoi ($"cutoff"), cost = Web.stor ($"cost"), usage = $"usage"};
141
142 %><h3>Hosting transaction added.</h3>
143
144 <% elseif $"modHosting" <> "" then
145 Group.requireGroupName "money";
146 showNormal := false;
147 val id = Web.stoi ($"modHosting");
148 val trn = Money.lookupTransaction id %>
149
150 <h3>Modify hosting bill</h3>
151
152 <form action="money" method="post">
153 <input type="hidden" name="saveHosting" value="<% id %>">
154 <table class="blanks">
155 <tr> <td>Description:</td> <td><input name="descr" value="<% Web.html (#descr trn) %>"></td> </tr>
156 <tr> <td>Date:</td> <td><input name="d" value="<% Web.html (#d trn) %>"></td> </tr>
157 <tr> <td>Amount:</td> <td><input name="amount" value="<% Util.neg (#amount trn) %>"></td> </tr>
158 <tr> <td>Free bandwidth cutoff (MB):</td> <td><input name="cutoff" value="200"></td> </tr>
159 <tr> <td>Cost/GB:</td> <td><input name="cost" value="4"></td> </tr>
160 <tr> <td>Member usage:</td> <td><textarea wrap="soft" name="usage" rows="24" cols="80"><%
161 switch Money.lookupHostingUsage id of
162 SOME s => s
163 end %></textarea></td> </tr>
164 <tr> <td><input type="submit" value="Save"></td> </tr>
165 </table>
166
167 <% elseif $"saveHosting" <> "" then
168 Group.requireGroupName "money";
169 val id = Web.stoi ($"saveHosting");
170 val trn = Money.lookupTransaction id;
171
172 Money.clearCharges id;
173 Money.modTransaction {trn with descr = $"descr", d = $"d", amount = Util.neg (Web.stor ($"amount"))};
174 Money.addHostingCharges {trn = id, cutoff = 1000 * Web.stoi ($"cutoff"), cost = Web.stor ($"cost"), usage = $"usage"};
175
176 %><h3>Hosting transaction modified.</h3>
177
178 <% elseif $"cmd" = "bill" then
179 Group.requireGroupName "money";
180 showNormal := false %>
181
182 <h3>New bill for the co-op</h3>
183
184 <form action="money" method="post">
185 <input type="hidden" name="cmd" value="bill2">
186 <table class="blanks">
187 <tr> <td>Description:</td> <td><input name="descr"></td> </tr>
188 <tr> <td>Date:</td> <td><input name="d"></td> </tr>
189 <tr> <td>Amount:</td> <td><input name="amount"></td> </tr>
190 <tr> <td><input type="submit" value="Add"></td> </tr>
191 </table>
192
193 <% elseif $"cmd" = "bill2" then
194 Group.requireGroupName "money";
195 val id = Money.addTransaction ($"descr", Util.neg (Web.stor ($"amount")), $"d");
196 Money.addCharge {trn = id, usr = valOf (Init.userNameToId "hcoop"), amount = Util.neg (Web.stor ($"amount"))};
197 Money.applyCharges id;
198
199 %><h3>Bill added.</h3>
200
201 <% elseif $"modBill" <> "" then
202 Group.requireGroupName "money";
203 showNormal := false;
204 val id = Web.stoi ($"modBill");
205 val trn = Money.lookupTransaction id %>
206
207 <h3>Modify bill</h3>
208
209 <form action="money" method="post">
210 <input type="hidden" name="saveBill" value="<% id %>">
211 <table class="blanks">
212 <tr> <td>Description:</td> <td><input name="descr" value="<% Web.html (#descr trn) %>"></td> </tr>
213 <tr> <td>Date:</td> <td><input name="d" value="<% Web.html (#d trn) %>"></td> </tr>
214 <tr> <td>Amount:</td> <td><input name="amount" value="<% Util.neg (#amount trn) %>"></td> </tr>
215 <tr> <td><input type="submit" value="Save"></td> </tr>
216 </table>
217
218 <% elseif $"saveBill" <> "" then
219 Group.requireGroupName "money";
220 val id = Web.stoi ($"saveBill");
221 val trn = Money.lookupTransaction id;
222
223 Money.clearCharges id;
224 Money.modTransaction {trn with descr = $"descr", d = $"d", amount = Util.neg (Web.stor ($"amount"))};
225 Money.addCharge {trn = id, usr = valOf (Init.userNameToId "hcoop"), amount = Util.neg (Web.stor ($"amount"))};
226 Money.applyCharges id;
227
228 %><h3>Bill modified.</h3>
229
230 <% elseif $"cmd" = "evenForm" then
231 Group.requireGroupName "money";
232 showNormal := false %>
233 <h3>New generic/even transaction</h3>
234 <form action="money" method="post">
235 <input type="hidden" name="cmd" value="even">
236 <table class="blanks">
237 <tr> <td>Description:</td> <td><input name="descr"></td> </tr>
238 <tr> <td>Date:</td> <td><input name="d"></td> </tr>
239 <tr> <td>Amount:</td> <td><input name="amount"></td> </tr>
240 <tr> <td>Members:</td> <td><select name="usrs" size="5" multiple>
241 <% foreach usr in Init.listUsers () do %>
242 <option value="<% #id usr %>"><% #name usr %></option>
243 <% end %>
244 </select></td> </tr>
245 <tr> <td><input type="submit" value="Add"></td> </tr>
246 </table>
247 </form>
248
249 <% elseif $"cmd" = "pay" then
250 Group.requireGroupName "money";
251 val uid = (case $"user" of "" => ~1 | s => Web.stoi s);
252 showNormal := false %>
253
254 <h3>New member payment</h3>
255
256 <form action="money" method="post">
257 <input type="hidden" name="cmd" value="pay2">
258 <table class="blanks">
259 <tr> <td>Description:</td> <td><select name="descr">
260 <option<% if $"checkout" = "" then %> selected<% end %>>PayPal</option>
261 <option<% if $"checkout" <> "" then %> selected<% end %>>Google Checkout</option>
262 <option>Check</option>
263 <option>Direct transfer</option>
264 <option value="">Other:</option>
265 </select> <input name="descr2"></td> </tr>
266 <tr> <td>Date:</td> <td><input name="d" value="<% Web.html (Date.fmt "%B %d, %Y" (Date.fromTimeLocal (Time.now ()))) %>"></td> </tr>
267 <tr> <td>Amount:</td> <td><input name="amount"></td> </tr>
268 <tr> <td>Member:</td> <td><select name="usr">
269 <% foreach usr in Init.listUsers () do %>
270 <option value="<% #id usr %>"<% if #id usr = uid then %> selected<% end %>><% #name usr %></option>
271 <% end %>
272 </select></td> </tr>
273 <tr> <td><input type="submit" value="Add"></td> </tr>
274 </table>
275 </form>
276
277 <% elseif $"cmd" = "pay2" then
278 Group.requireGroupName "money";
279 val amount = Web.stor ($"amount");
280 val descr = $"descr";
281 val descr = iff descr = "" then $"descr2" else descr;
282 val id = Money.addTransaction (descr, amount, $"d");
283 Money.addCharge {trn = id, usr = Web.stoi ($"usr"), amount = amount};
284 Money.applyCharges id;
285
286 %><h3>Payment transaction added.</h3>
287
288 <% elseif $"modPay" <> "" then
289 Group.requireGroupName "money";
290 showNormal := false;
291 val id = Web.stoi ($"modPay");
292 val trn = Money.lookupTransaction id %>
293
294 <h3>Modify member payment</h3>
295
296 <form action="money" method="post">
297 <input type="hidden" name="savePay" value="<% id %>">
298 <table class="blanks">
299 <tr> <td>Description:</td> <td><input name="descr" value="<% Web.html (#descr trn) %>"></td> </tr>
300 <tr> <td>Date:</td> <td><input name="d" value="<% Web.html (#d trn) %>"></td> </tr>
301 <tr> <td>Amount:</td> <td><input name="amount" value="<% #amount trn %>"></td> </tr>
302 <tr> <td>Member:</td> <td><select name="usr">
303 <% foreach (sel, usr) in Money.listUsers (#id trn) do %>
304 <option value="<% #id usr %>"<% if sel then %> selected<% end %>><% #name usr %></option>
305 <% end %>
306 </td></tr>
307 <tr> <td><input type="submit" value="Save"></td> </tr>
308 </table>
309
310 <% elseif $"savePay" <> "" then
311 Group.requireGroupName "money";
312 val id = Web.stoi ($"savePay");
313 val trn = Money.lookupTransaction id;
314
315 val amount = Web.stor ($"amount");
316 Money.clearCharges id;
317 Money.modTransaction {trn with descr = $"descr", d = $"d", amount = amount};
318 Money.addCharge {trn = id, usr = Web.stoi ($"usr"), amount = amount};
319 Money.applyCharges id;
320
321 %><h3>Member payment modified.</h3>
322
323 <% elseif $"cmd" = "evenForm" then
324 Group.requireGroupName "money";
325 showNormal := false %>
326 <h3>New generic/even transaction</h3>
327 <form action="money" method="post">
328 <input type="hidden" name="cmd" value="even">
329 <table class="blanks">
330 <tr> <td>Description:</td> <td><input name="descr"></td> </tr>
331 <tr> <td>Date:</td> <td><input name="d"></td> </tr>
332 <tr> <td>Amount:</td> <td><input name="amount"></td> </tr>
333 <tr> <td>Members:</td> <td><select name="usrs" size="5" multiple>
334 <% foreach usr in Init.listUsers () do %>
335 <option value="<% #id usr %>"><% #name usr %></option>
336 <% end %>
337 </select></td> </tr>
338 <tr> <td><input type="submit" value="Add"></td> </tr>
339 </table>
340 </form>
341
342 <% elseif $"cmd" = "even" then
343 Group.requireGroupName "money";
344 val id = Money.addTransaction ($"descr", Web.stor ($"amount"), $"d");
345 Money.addEvenCharges (id, map Web.stoi (Web.getMultiParam "usrs"))
346
347 %><h3>Even transaction added.</h3>
348
349 <% elseif $"modEven" <> "" then
350 Group.requireGroupName "money";
351 showNormal := false;
352 val trn = Money.lookupTransaction (Web.stoi ($"modEven")) %>
353 <h3>Modify even transaction</h3>
354
355 <form action="money" method="post">
356 <input type="hidden" name="saveEven" value="<% $"modEven" %>">
357 <table class="blanks">
358 <tr> <td>Description:</td> <td><input name="descr" value="<% Web.html (#descr trn) %>"></td> </tr>
359 <tr> <td>Date:</td> <td><input name="d" value="<% Web.html (#d trn) %>"></td> </tr>
360 <tr> <td>Amount:</td> <td><input name="amount" value="<% #amount trn %>"></td> </tr>
361 <tr> <td>Members:</td> <td><select name="usrs" size="5" multiple>
362 <% foreach (sel, usr) in Money.listUsers (#id trn) do %>
363 <option value="<% #id usr %>"<% if sel then %> selected<% end %>><% #name usr %></option>
364 <% end %>
365 </select></td> </tr>
366 <tr> <td><input type="submit" value="Save"></td> </tr>
367 </table>
368 </form>
369
370 <% elseif $"saveEven" <> "" then
371 Group.requireGroupName "money";
372 val id = Web.stoi ($"saveEven");
373 val trn = Money.lookupTransaction id;
374 Money.clearCharges id;
375 Money.modTransaction {trn with descr = $"descr", d = $"d", amount = Web.stor ($"amount")};
376 Money.addEvenCharges (id, map Web.stoi (Web.getMultiParam "usrs"))
377
378 %><h3>Even transaction modified</h3>
379
380 <% elseif $"del" <> "" then
381 Group.requireGroupName "money";
382 showNormal := false;
383 val trn = Money.lookupTransaction (Web.stoi ($"del")) %>
384 <h3>Are you sure you want to delete transaction <a href="money?trn=<% #id trn %>"><% Web.html (#descr trn) %></a>?</h3>
385 <a href="money?del2=<% $"del" %>">Yes, delete <% Web.html (#descr trn) %>!</a>
386
387 <% elseif $"del2" <> "" then
388 Group.requireGroupName "money";
389 val id = Web.stoi ($"del2");
390 val trn = Money.lookupTransaction id;
391 Money.clearCharges id;
392 Money.deleteTransaction id %>
393 <h3><% Web.html (#descr trn) %> deleted!</h3>
394
395 <% elseif $"cmd" = "equalize" then
396 Group.requireGroupName "money";
397 Money.equalizeBalances ();
398 %><h3>Balances equalized</h3>
399
400 <% elseif $"trn" <> "" then
401 showNormal := false;
402 val id = Web.stoi ($"trn");
403 val trn = Money.lookupTransaction id %>
404 <table class="blanks">
405 <tr> <td>TRN#:</td> <td><% id %></td> </tr>
406 <tr> <td>Description:</td> <td><% Web.html (#descr trn) %></td> </tr>
407 <tr> <td>Date:</td> <td><% #d trn %></td> </tr>
408 <tr> <td>Amount:</td> <td>$<% #amount trn %></td> </tr>
409 <tr> <td>Distribution:</td>
410
411 <% ref first = true;
412 foreach (name, cha) in Money.listChargesWithNames id do
413 if first then
414 first := false
415 else
416 %><tr> <td></td> <%
417 end
418 %><td><a href="user?id=<% #usr cha %>"><% name %></a></td> <td>$<% #amount cha %></td> </tr><%
419 end %>
420 </table>
421
422 <% elseif $"cmd" = "paypal" then
423 showNormal := false;
424 val apps = App.searchPaypal ($"email");
425 val users = Init.searchPaypal ($"email");
426
427 switch apps of
428 _ :: _ =>
429 %><h3>Approved applications</h3>
430
431 <% foreach appl in apps do %>
432 <br><hr><br>
433 <table class="blanks">
434 <tr> <td>Received:</td> <td><% #applied appl %></td> </tr>
435 <tr> <td>Approved by:</td> <td><%
436 ref first = true;
437 ref found = false;
438 foreach (id, name) in App.votes (#id appl) do
439 if first then
440 first := false
441 else
442 %>, <%
443 end
444 %><a href="user?id=<% id %>"><% name %></a><%
445 end %> </td> </tr>
446 <tr> <td>Username:</td> <td><% #name appl %></td> </tr>
447 <tr> <td>Real name:</td> <td><% Web.html (#rname appl) %></td> </tr>
448 <tr> <td>E-mail address:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr>
449 <% switch #paypal appl of
450 SOME s => %><tr> <td>PayPal:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr>
451 <% end;
452 switch #checkout appl of
453 SOME s => %><tr> <td>Google Checkout:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr>
454 <% end %>
455 <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr>
456 <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr>
457 <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr>
458 </table>
459
460 <% if root then %>
461 <a href="apps?add=<% #id appl %>">Add this member.</a><br>
462 <% end
463 end
464 end;
465
466 switch users of
467 _ :: _ =>
468 %><h3>Members</h3>
469
470 <% foreach user in users do %>
471 <li> <a href="user?id=<% #id user %>"><% #name user %></a> <a href="?cmd=pay&user=<% #id user %>">[add payment]</a></li>
472 <% end
473 end;
474
475 switch (apps, users) of
476 (nil, nil) => %>No matches.<%
477 end
478
479 elseif $"cmd" = "checkout" then
480 showNormal := false;
481 val apps = App.searchCheckout ($"email");
482 val users = Init.searchCheckout ($"email");
483
484 switch apps of
485 _ :: _ =>
486 %><h3>Approved applications</h3>
487
488 <% foreach appl in apps do %>
489 <br><hr><br>
490 <table class="blanks">
491 <tr> <td>Received:</td> <td><% #applied appl %></td> </tr>
492 <tr> <td>Approved by:</td> <td><%
493 ref first = true;
494 ref found = false;
495 foreach (id, name) in App.votes (#id appl) do
496 if first then
497 first := false
498 else
499 %>, <%
500 end
501 %><a href="user?id=<% id %>"><% name %></a><%
502 end %> </td> </tr>
503 <tr> <td>Username:</td> <td><% #name appl %></td> </tr>
504 <tr> <td>Real name:</td> <td><% Web.html (#rname appl) %></td> </tr>
505 <tr> <td>E-mail address:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr>
506 <% switch #paypal appl of
507 SOME s => %><tr> <td>PayPal:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr>
508 <% end;
509 switch #checkout appl of
510 SOME s => %><tr> <td>Google Checkout:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr>
511 <% end %>
512 <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr>
513 <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr>
514 <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr>
515 </table>
516
517 <% if root then %>
518 <a href="apps?add=<% #id appl %>">Add this member.</a><br>
519 <% end
520 end
521 end;
522
523 switch users of
524 _ :: _ =>
525 %><h3>Members</h3>
526
527 <% foreach user in users do %>
528 <li> <a href="user?id=<% #id user %>"><% #name user %></a> <a href="?cmd=pay&user=<% #id user %>&checkout=1">[add payment]</a></li>
529 <% end
530 end;
531
532 switch (apps, users) of
533 (nil, nil) => %>No matches.<%
534 end
535
536 elseif $"cmd" = "delinq" then
537 showNormal := false;
538 val dqs = Money.delinquentPledgers () %>
539 <table>
540 <tr> <th>Member</th> <th>Pledge</th> <th>Balance</th> </tr>
541 <% foreach dq in dqs do %>
542 <tr> <td><a href="user?id=<% #id dq %>"><% #name dq %></a></td> <td><% #shares dq %></td> <td>$<% #balance dq %></td> </tr>
543 <% end %>
544 </table>
545
546 <a href="?lower=<% String.concatWith "," (List.map (fn dq => Int.toString (#id dq)) dqs) %>">Lower these pledges to 1</a>
547
548 <% elseif $"lower" <> "" then
549 Money.resetPledges (List.map Web.stoi (String.tokens (fn ch => ch = #",") ($"lower")))
550
551 %><h3>Pledges reset.</h3><%
552
553 elseif $"cmd" = "freezeworthy" then
554 showNormal := false;
555 val dqs = Money.freezeworthyPledgers () %>
556 <table>
557 <tr> <th>Member</th> <th>Balance</th> </tr>
558 <% foreach dq in dqs do %>
559 <tr> <td><a href="user?id=<% #id dq %>"><% #name dq %></a></td> <td>$<% #balance dq %></td> </tr>
560 <% end %>
561 </table>
562
563 <% elseif $"cmd" = "bootworthy" then
564 showNormal := false;
565 val dqs = Money.bootworthyPledgers () %>
566 <table>
567 <tr> <th>Member</th> <th>Balance</th> </tr>
568 <% foreach dq in dqs do %>
569 <tr> <td><a href="user?id=<% #id dq %>"><% #name dq %></a></td> <td>$<% #balance dq %></td> </tr>
570 <% end %>
571 </table>
572
573 <% end %>
574
575 <% if showNormal then
576 val you = Init.getUser();
577 val bal = Balance.lookupBalance (#bal you);
578 val deposit = Balance.depositAmount (#id bal) %>
579
580 <h3>Your balance: $<% Util.sub (#amount bal, deposit) %><br>
581 Deposit: $<% deposit %></b> (3 months of dues at the minimal <a href="pledge">pledge level</a>)<br>
582 Co-op balance: $<% #amount (Balance.lookupBalance (valOf (Balance.balanceNameToId "hcoop"))) %></h3>
583
584 <!--h3>Your balance: $<% #amount bal %></h3-->
585
586 <% if (iff Group.inGroupName "money" then $"lookback" = "" else $"audit" <> "") then %><h3>Sum of all active balances: $<% Balance.sumOwnedBalances () %></h3><% end %>
587
588 <a href="money?cmd=list">List all transactions</a><br>
589 <a href="money?cmd=primary">List primary transactions</a><br>
590 <a href="money?cmd=bals">List active balances</a><br>
591 <a href="money?cmd=nbals">List negative active balances</a><br>
592 <a href="money?cmd=freezeworthy">List members who deserve account freezing</a><br>
593 <a href="money?cmd=bootworthy">List members who deserve to be kicked out</a><br>
594 <a href="money?cmd=deadbals">List retired balances</a><br>
595
596 <% if (Group.inGroupName "money" and $"lookback" = "") or $"audit" <> "" then %>
597
598 <a href="?cmd=delinq">Drop pledges of delinquent members</a><br>
599 <a href="?lookback=20">Switch to regular member view</a><br>
600
601 <br><b><u>New transaction:</u></b><br>
602 <a href="money?cmd=bill">Bill for the co-op</a><br>
603 <a href="money?cmd=hosting">New hosting bill (old style)</a><br>
604 <a href="money?cmd=pay">Payment from member</a><br>
605 <a href="money?cmd=evenForm">Generic/even</a><br>
606 <br>
607 <a href="money?cmd=equalize">Equalize balances</a><br>
608 <br>
609
610 <h3>Look up a PayPal e-mail address</h3>
611
612 <form method="post">
613 <input type="hidden" name="cmd" value="paypal">
614 <input name="email"> <input type="submit" value="Look up">
615 </form>
616
617 <h3>Look up a Google Checkout e-mail address</h3>
618
619 <form method="post">
620 <input type="hidden" name="cmd" value="checkout">
621 <input name="email"> <input type="submit" value="Look up">
622 </form>
623
624 <h3>Most recent transactions</h3>
625
626 <table>
627 <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>
628 <% foreach trn in Money.listTransactionsLimit 20 do %>
629 <tr> <td><% #d trn %></td> <td><a href="money?trn=<% #id trn %>"><% Web.html (#descr trn) %></a></td> <td><% #amount trn %></td>
630 <% switch Money.listChargesWithNames (#id trn) of
631 [(name, cha)] => %><td><a href="user?id=<% #usr cha %>"><% name %></a></td><%
632 | _ => %><td><i>multi</i></td><%
633 end %>
634 <td><a href="money?modBill=<% #id trn %>">[Bill]</a> <a href="money?modPay=<% #id trn %>">[Payment]</a> <a href="money?modEven=<% #id trn %>">[Other]</a></td>
635 <td><a href="money?del=<% #id trn %>">[Delete]</a></td> </tr>
636 <% end %>
637 </table>
638
639 <% else %>
640 <a href="?audit=1">Switch to audit view</a><br>
641 <% val lookback = case $"lookback" of "" => 20 | lb => Web.stoi lb;
642 @payment [] %>
643
644 <h3>Your recent account activity</h3>
645
646 <form>
647 Show <input name="lookback" size="5" value="<% lookback %>"> most recent transactions.
648 <input type="submit" value="Show">
649 </form>
650
651 <table>
652 <tr> <td><b>Date</b></td> <td><b>Description</b></td> <td><b>Amount</b></td> </tr>
653 <% foreach (amount, trn) in Money.listUserTransactionsLimit (Init.getUserId (), lookback) do %>
654 <tr> <td><% #d trn %></td> <td><a href="money?trn=<% #id trn %>"><% Web.html (#descr trn) %></a></td> <td><% amount %>/<% #amount trn %></td> </tr>
655 <% end %>
656 </table>
657
658 <% end
659 end %>
660
661 <% @footer [] %>