X-Git-Url: http://git.hcoop.net/hcoop/portal.git/blobdiff_plain/b6dd1aafb4c9cddf89b06c2eeac1b5277046ad9f..44a63d224a81da3c5d2c9e50a46b6af956c47c5f:/money.mlt
diff --git a/money.mlt b/money.mlt
index 2293821..e846c3f 100644
--- a/money.mlt
+++ b/money.mlt
@@ -1,5 +1,7 @@
<% @header [("title", ["MoneyMatters"])];
+val root = Group.inGroupNum 0;
+
ref showNormal = true;
if $"hist" <> "" then
@@ -27,7 +29,29 @@ if $"hist" <> "" then
| _ => %>
multi | <%
end;
if admin then
- %>[Hosting] [Payment] [Other] |
+ %>[Bill] [Payment] [Other] |
+ [Delete] | <%
+end
+%><%
+end %>
+
+
+<% elseif $"cmd" = "primary" then
+ val admin = Group.inGroupName "money";
+ showNormal := false %>
+
+Primary Transactions
+
+
+ Date | Description | Amount | Last modified | Participants |
+<% foreach (amt, trn) in Money.listUserTransactions (valOf (Init.userNameToId "hcoop")) do %>
+ <% #d trn %> | <% Web.html (#descr trn) %> | <% #amount trn %> | <% #stamp trn %> |
+<% switch Money.listChargesWithNames (#id trn) of
+ [(name, cha)] => %><% name %> | <%
+ | _ => %>multi | <%
+end;
+if admin then
+ %>[Bill] [Payment] [Other] |
[Delete] | <%
end
%>
<%
@@ -37,7 +61,7 @@ end %>
<% elseif $"cmd" = "bals" then
showNormal := false %>
-Balances
+Active Balances
+<% elseif $"cmd" = "deadbals" then
+ showNormal := false %>
+
+Retired Balances
+
+
+
+<% elseif $"cmd" = "nbals" then
+ showNormal := false;
+ val bals = Balance.listNegativeOwnedBalances () %>
+
+Negative Active Balances (<% length bals %>)
+
+
+
<% elseif $"cmd" = "hosting" then
Group.requireGroupName "money";
showNormal := false %>
@@ -112,6 +175,58 @@ end %>
%>Hosting transaction modified.
+<% elseif $"cmd" = "bill" then
+ Group.requireGroupName "money";
+ showNormal := false %>
+
+New bill for the co-op
+
+
+<% elseif $"cmd" = "dues" then
+ Group.requireGroupName "money";
+ showNormal := false %>
+
+Monthly dues
+
+
+<% elseif $"cmd" = "paypal" then
+ showNormal := false;
+ val apps = App.searchPaypal ($"email");
+ val users = Init.searchPaypal ($"email");
+
+ switch apps of
+ _ :: _ =>
+ %>Approved applications
+
+ <% foreach appl in apps do %>
+
+
+ Received: | <% #applied appl %> |
+ Approved by: | <%
+ ref first = true;
+ ref found = false;
+ foreach (id, name) in App.votes (#id appl) do
+ if first then
+ first := false
+ else
+ %>, <%
+ end
+ %><% name %><%
+ end %> |
+ Username: | <% #name appl %> |
+ Real name: | <% Web.html (#rname appl) %> |
+ E-mail address: | <% #email appl %> |
+ <% switch #paypal appl of
+ SOME s => %> PayPal: | <% s %> |
+ <% end;
+ switch #checkout appl of
+ SOME s => %> Google Checkout: | <% s %> |
+ <% end %>
+ Forward e-mail? | <% if #forward appl then %>yes<% else %>no<% end %> |
+ Proposed uses: | <% Web.htmlNl (#uses appl) %> |
+ Other information: | <% Web.htmlNl (#other appl) %> |
+
+
+ <% if root then %>
+ Add this member.
+ <% end
+ end
+ end;
+
+ switch users of
+ _ :: _ =>
+ %>Members
+
+ <% foreach user in users do %>
+ <% #name user %> [add payment]
+ <% end
+ end;
+
+ switch (apps, users) of
+ (nil, nil) => %>No matches.<%
+ end
+
+elseif $"cmd" = "realname" then
+ showNormal := false;
+ val users = Init.searchRealName ($"rname");
+
+ switch users of
+ _ :: _ =>
+ %>Members
+
+ <% foreach user in users do %>
+ <% #name user %> [add payment]
+ <% end
+ end;
+
+ switch users of
+ nil => %>No matches.<%
+ end
+
+elseif $"cmd" = "checkout" then
+ showNormal := false;
+ val apps = App.searchCheckout ($"email");
+ val users = Init.searchCheckout ($"email");
+
+ switch apps of
+ _ :: _ =>
+ %>Approved applications
+
+ <% foreach appl in apps do %>
+
+
+ Received: | <% #applied appl %> |
+ Approved by: | <%
+ ref first = true;
+ ref found = false;
+ foreach (id, name) in App.votes (#id appl) do
+ if first then
+ first := false
+ else
+ %>, <%
+ end
+ %><% name %><%
+ end %> |
+ Username: | <% #name appl %> |
+ Real name: | <% Web.html (#rname appl) %> |
+ E-mail address: | <% #email appl %> |
+ <% switch #paypal appl of
+ SOME s => %> PayPal: | <% s %> |
+ <% end;
+ switch #checkout appl of
+ SOME s => %> Google Checkout: | <% s %> |
+ <% end %>
+ Forward e-mail? | <% if #forward appl then %>yes<% else %>no<% end %> |
+ Proposed uses: | <% Web.htmlNl (#uses appl) %> |
+ Other information: | <% Web.htmlNl (#other appl) %> |
+
+
+ <% if root then %>
+ Add this member.
+ <% end
+ end
+ end;
+
+ switch users of
+ _ :: _ =>
+ %>Members
+
+ <% foreach user in users do %>
+ <% #name user %> [add payment]
+ <% end
+ end;
+
+ switch (apps, users) of
+ (nil, nil) => %>No matches.<%
+ end
+
+elseif $"cmd" = "delinq" then
+ showNormal := false;
+ val dqs = Money.delinquentPledgers () %>
+
+ Member | Pledge | Balance |
+<% foreach dq in dqs do %>
+ <% #name dq %> | <% #shares dq %> | $<% #balance dq %> |
+<% end %>
+
+
+ Int.toString (#id dq)) dqs) %>">Lower these pledges to 1
+
+<% elseif $"lower" <> "" then
+ Money.resetPledges (List.map Web.stoi (String.tokens (fn ch => ch = #",") ($"lower")))
+
+ %>Pledges reset.
<%
+
+elseif $"cmd" = "freezeworthy" then
+ showNormal := false;
+ val dqs = Money.freezeworthyPledgers () %>
+
+ Member | Balance |
+<% foreach dq in dqs do %>
+ <% #name dq %> | $<% #balance dq %> |
+<% if #joinedThisMonth dq then %>(joined this month) | <% end %>
<% end %>
+
-<% if showNormal then %>
+<% elseif $"cmd" = "bootworthy" then
+ showNormal := false;
+ val dqs = Money.bootworthyPledgers () %>
+
+ Member | Balance |
+<% foreach dq in dqs do %>
+ <% #name dq %> | $<% #balance dq %> |
+<% if #joinedThisMonth dq then %>(joined this month) | <% end %>
+<% end %>
+
-Your balance: $<% #amount (Balance.lookupBalance (#bal (Init.getUser ()))) %>
+<% end %>
+
+<% if showNormal then
+ val you = Init.getUser();
+ val bal = Balance.lookupBalance (#bal you);
+ val deposit = Balance.depositAmount (#id bal);
+ val showBal = Util.sub (#amount bal, deposit) %>
+
+Your balance: $<% showBal %>
+Deposit: $<% deposit %> (3 months of dues at the minimal pledge level)
+Co-op balance: $<% #amount (Balance.lookupBalance (valOf (Balance.balanceNameToId "hcoop"))) %>
+
+
+
+<% if (iff Group.inGroupName "money" then $"lookback" = "" else $"audit" <> "") then %>Sum of all active balances: $<% Balance.sumOwnedBalances () %>
<% end %>
List all transactions
-List all balances
+List primary transactions
+List active balances
+List negative active balances
+List members who deserve account freezing
+List members who deserve to be kicked out
+List retired balances
-<% if Group.inGroupName "money" then %>
+<% if (Group.inGroupName "money" and $"lookback" = "") or $"audit" <> "" then %>
+
+Drop pledges of delinquent members
+Switch to regular member view
New transaction:
-Hosting bill
+Bill for the co-op
Payment from member
+Monthly dues
+New hosting bill (old style)
Generic/even
Equalize balances
+
+
+Look up a PayPal e-mail address
+
+
+
+Look up a Real Name
+
+
+
+Apply Stripe Payments
+
+
+Date | Member |
+ Name on Card |
+ Amount (After Fees) | | |
+
+<% foreach stripePmt in Money.listAllPendingStripePayments () do %>
+
+
+ <% #name (Init.lookupUser (#webuser_id stripePmt)) %> |
+ <% #paid_on stripePmt %> |
+ <% #card_name stripePmt %>
+ | $<% #net stripePmt %> |
+
+ |
+
+<% end %>
+
Most recent transactions
+
+
<% else %>
+Switch to audit view
+<% val lookback = case $"lookback" of "" => 20 | "inf" => 0 | lb => Web.stoi lb;
+ @payment [] %>
Your recent account activity
+
+
+<% ref running = showBal;
+val trans = iff lookback = 0 then
+ Money.listUserTransactions (Init.getUserId ())
+ else
+ Money.listUserTransactionsLimit (Init.getUserId (), lookback) %>
- Date | Description | Amount |
-<% foreach (amount, trn) in Money.listUserTransactionsLimit (Init.getUserId (), 20) do %>
- <% #d trn %> | <% Web.html (#descr trn) %> | <% amount %>/<% #amount trn %> |
-<% end %>
+ Date | Description | Debit | Credit | Balance |
+<% foreach (amount, trn) in trans do %>
+ <% #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 %> |
+<% running := Util.sub (running, amount)
+end %>
+<% if lookback <> 0 then %>
+Show all transactions
+<% end %>
<% end
end %>