X-Git-Url: https://git.hcoop.net/hcoop/zz_old/portal.git/blobdiff_plain/1fe415e08e00c6d35d0561f8213914d3c15532a4..0d9a3a9d9f3f41cfbea6c7d793d44e7cbc22b838:/money.mlt diff --git a/money.mlt b/money.mlt index 2293821..34002dd 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 @@ -37,7 +39,7 @@ end %> <% elseif $"cmd" = "bals" then showNormal := false %> -

Balances

+

Active Balances

<% foreach bal in Balance.listOwnedBalances () do %> @@ -53,6 +55,45 @@ end %> <% end %>
+<% elseif $"cmd" = "deadbals" then + showNormal := false %> + +

Retired Balances

+ + +<% foreach bal in Balance.listUnownedBalances () do %> + +<% end %> +
<% #name bal %> <% #amount bal %> +<% switch Balance.listBalanceUsers (#id bal) of + [] => + | (user :: users) => + %><% Web.html (#name user) %> [History]<% + foreach user in users do + %>, <% Web.html (#name user) %> [History]<% + end +end %>
+ +<% elseif $"cmd" = "nbals" then + showNormal := false; + val bals = Balance.listNegativeOwnedBalances () %> + +

Negative Active Balances (<% length bals %>)

+ + +<% foreach bal in bals do %> + +<% end %> +
<% #name bal %> <% #amount bal %> +<% switch Balance.listBalanceUsers (#id bal) of + [] => + | (user :: users) => + %><% Web.html (#name user) %> [History]<% + foreach user in users do + %>, <% Web.html (#name user) %> [History]<% + end +end %>
+ <% elseif $"cmd" = "hosting" then Group.requireGroupName "money"; showNormal := false %> @@ -133,6 +174,7 @@ end %> <% elseif $"cmd" = "pay" then Group.requireGroupName "money"; + val uid = (case $"user" of "" => ~1 | s => Web.stoi s); showNormal := false %>

New member payment

@@ -140,12 +182,18 @@ end %>
- - + + @@ -155,6 +203,8 @@ end %> <% 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; @@ -283,7 +333,7 @@ end %> -x + <% ref first = true; foreach (name, cha) in Money.listChargesWithNames id do if first then @@ -295,16 +345,135 @@ foreach (name, cha) in Money.listChargesWithNames id do end %>
Description:
Date:
Description:
Date: ">
Amount:
Member:
Date: <% #d trn %>
Amount: $<% #amount trn %>
Distribution:
-<% end %> +<% 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 %> +


+ + + + + + + <% switch #paypal appl of + SOME s => %> + <% end; + switch #checkout appl of + SOME s => %> + <% end %> + + + +
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 %>
PayPal: <% s %>
Google Checkout: <% s %>
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" = "checkout" then + showNormal := false; + val apps = App.searchCheckout ($"email"); + val users = Init.searchCheckout ($"email"); + + switch apps of + _ :: _ => + %>

    Approved applications

    + + <% foreach appl in apps do %> +


    + + + + + + + <% switch #paypal appl of + SOME s => %> + <% end; + switch #checkout appl of + SOME s => %> + <% end %> + + + +
    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 %>
    PayPal: <% s %>
    Google Checkout: <% s %>
    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 + +end %> <% if showNormal then %> -

    Your balance: $<% #amount (Balance.lookupBalance (#bal (Init.getUser ()))) %>

    +

    Your balance: $<% #amount (Balance.lookupBalance (#bal (Init.getUser ()))) %>

    +<% 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 active balances
    +List negative active balances
    +List retired balances
    + +<% if (Group.inGroupName "money" and $"lookback" = "") or $"audit" <> "" then %> -<% if Group.inGroupName "money" then %> +Switch to regular member view

    New transaction:
    Hosting bill
    @@ -312,6 +481,21 @@ end %> Generic/even

    Equalize balances
    +
    + +

    Look up a PayPal e-mail address

    + + + + +
    + +

    Look up a Google Checkout e-mail address

    + +
    + + +

    Most recent transactions

    @@ -329,12 +513,20 @@ end %> <% else %> +Switch to audit view
    +<% val lookback = case $"lookback" of "" => 20 | lb => Web.stoi lb; + @payment [] %>

    Your recent account activity

    +
    + Show most recent transactions. + +
    + -<% foreach (amount, trn) in Money.listUserTransactionsLimit (Init.getUserId (), 20) do %> +<% foreach (amount, trn) in Money.listUserTransactionsLimit (Init.getUserId (), lookback) do %> <% end %>
    Date Description Amount
    <% #d trn %> <% Web.html (#descr trn) %> <% amount %>/<% #amount trn %>