cvsimport
[hcoop/zz_old/portal.git] / pledge.mlt
CommitLineData
d58382bd 1<% @header [("title", ["Sliding scale pledges"])];
2
3if $"cmd" = "set" then
4 val user = Init.getUser ();
5 val shares = Web.stoi ($"pledge");
6 if shares <= 0 then
7 %><h3>You can't make a non-positive pledge!</h3><%
8 else
9 Init.modUser {user with shares = shares}
10 %><h3>Thank you for your pledge!</h3><%
11 end
12elseif $"cmd" = "calc" then
13 val user = Init.getUser ();
14 val amt = Web.stor ($"amt");
15 val base = Money.costBase amt
16 %><h3>Out of $<% amt %>, you would pay $<% Util.mult (#shares user, base) %> and the lowest share of the cost would be $<% base %>.</h3><%
17end
18
19val user = Init.getUser () %>
20
d58382bd 21<p>HCoop divides expenses among members based on a "sliding scale"-style scheme. We charge you only for our concrete expenses, not adding any expenses beyond what we pay to service providers and vendors. Whenever a concrete expense needs to be paid for, we divide it among the members based on how much each of you has pledged on this web page. Your pledge is a whole number 1 or higher which you can think of as indicating how many times the amount paid by the lowest-contributing members you are willing to pay. Concretely, every expense is divided by the sum of all members' pledges, and each member is charged an amount equal to the result of that division times his pledge number. This way <i>everyone's</i> monthly costs go down automatically as we gain new members.</p>
22
23<h2>Set your pledge number</h2>
24<form method="post">
25<input type="hidden" name="cmd" value="set">
26<input name="pledge" size="3" value="<% #shares user %>">
27<input type="submit" value="Set">
28</form>
29
30<h2>Calculate your share of an expense</h2>
31<form method="post">
32<input type="hidden" name="cmd" value="calc">
33$<input name="amt" size="7" value="750">
34<input type="submit" value="Calculate">
35</form>
36
37<h2>Members with pledges above 1</h2>
38
39<table>
40<% foreach usr in Init.byPledge () do %>
41 <tr> <td align="right"><% #shares usr %></td> <td><a href="user?id=<% #id usr %>"><% Web.html (#name usr) %></a></td> </tr>
42<% end %>
43</table>
44
45<% @footer [] %>
46
47