X-Git-Url: http://git.hcoop.net/bpt/portal.git/blobdiff_plain/9bda1e7f56f54ad5f5fa2782a8b746c4b77ae70b..64ec9551fc56c42188e195cbbe24c79ad18b293f:/money.mlt diff --git a/money.mlt b/money.mlt index a0994f0..8e6f24c 100644 --- a/money.mlt +++ b/money.mlt @@ -1,12 +1,24 @@ <% @header [("title", ["MoneyMatters"])]; +val root = Group.inGroupNum 0; + ref showNormal = true; -if $"cmd" = "list" then +if $"hist" <> "" then + showNormal := false; + val id = Web.stoi ($"hist") %> + + +<% foreach (amount, trn) in Money.listUserTransactions id do %> + +<% end %> +
Date Description Amount
<% #d trn %> <% Web.html (#descr trn) %> <% amount %>/<% #amount trn %>
+ +<% elseif $"cmd" = "list" then val admin = Group.inGroupName "money"; showNormal := false %> -

Transactions

+

Transactions

@@ -27,17 +39,56 @@ end %> <% elseif $"cmd" = "bals" then showNormal := false %> -

Balances

+

Active Balances

+ +
Date Description Amount Last modified Participants
+<% foreach bal in Balance.listOwnedBalances () do %> + +<% end %> +
<% #name bal %> <% #amount bal %> +<% switch Balance.listBalanceUsers (#id bal) of + [] => + | (user :: users) => + %><% Web.html (#name user) %><% + foreach user in users do + %>, <% Web.html (#name user) %><% + 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 Balance.listBalances () do %> +<% foreach bal in bals do %> <% end %> @@ -47,17 +98,17 @@ end %> Group.requireGroupName "money"; showNormal := false %> -

New hosting bill

+

New hosting bill

- + -
<% #name bal %> <% #amount bal %> <% switch Balance.listBalanceUsers (#id bal) of [] => | (user :: users) => - %><% Web.html (#name user) %><% + %><% Web.html (#name user) %> [History]<% foreach user in users do - %>, <% Web.html (#name user) %><% + %>, <% Web.html (#name user) %> [History]<% end end %>
- - - - - - +
Description:
Date:
Amount:
Free bandwidth cutoff (MB):
Cost/GB:
Member usage:
+ + + + + +
Description:
Date:
Amount:
Free bandwidth cutoff (MB):
Cost/GB:
Member usage:
@@ -66,7 +117,7 @@ end %> val id = Money.addTransaction ($"descr", Util.neg (Web.stor ($"amount")), $"d"); Money.addHostingCharges {trn = id, cutoff = 1000 * Web.stoi ($"cutoff"), cost = Web.stor ($"cost"), usage = $"usage"}; - %>

Hosting transaction added.

+ %>

Hosting transaction added.

<% elseif $"modHosting" <> "" then Group.requireGroupName "money"; @@ -74,17 +125,20 @@ end %> val id = Web.stoi ($"modHosting"); val trn = Money.lookupTransaction id %> -

Modify hosting bill

+

Modify hosting bill

- + - - - - - - - +
Description:
Date:
Amount:
Free bandwidth cutoff (MB):
Cost/GB:
Member usage:
+ + + + + +
Description:
Date:
Amount:
Free bandwidth cutoff (MB):
Cost/GB:
Member usage:
@@ -97,19 +151,19 @@ end %> Money.modTransaction {trn with descr = $"descr", d = $"d", amount = Util.neg (Web.stor ($"amount"))}; Money.addHostingCharges {trn = id, cutoff = 1000 * Web.stoi ($"cutoff"), cost = Web.stor ($"cost"), usage = $"usage"}; - %>

Hosting transaction modified.

+ %>

Hosting transaction modified.

<% elseif $"cmd" = "evenForm" then Group.requireGroupName "money"; showNormal := false %> -

New generic/even transaction

- +

New generic/even transaction

+ - - - - -
Description:
Date:
Amount:
Members: + + + + <% elseif $"cmd" = "pay" then Group.requireGroupName "money"; + val uid = (case $"user" of "" => ~1 | s => Web.stoi s); showNormal := false %> -

New member payment

+

New member payment

- + -
Description:
Date:
Amount:
Members:
- - - -
Description:
Date:
Amount:
Member: + + + + @@ -142,11 +203,13 @@ 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; - %>

Payment transaction added.

+ %>

Payment transaction added.

<% elseif $"modPay" <> "" then Group.requireGroupName "money"; @@ -154,15 +217,15 @@ end %> val id = Web.stoi ($"modPay"); val trn = Money.lookupTransaction id %> -

Modify member payment

+

Modify member payment

- + -
Description:
Date: ">
Amount:
Member:
- - - -
Description:
Date:
Amount:
Member: + + + + Money.addCharge {trn = id, usr = Web.stoi ($"usr"), amount = amount}; Money.applyCharges id; - %>

Member payment modified.

+ %>

Member payment modified.

<% elseif $"cmd" = "evenForm" then Group.requireGroupName "money"; showNormal := false %> -

New generic/even transaction

- +

New generic/even transaction

+ -
Description:
Date:
Amount:
Member:
- - - -
Description:
Date:
Amount:
Members: + + + + val id = Money.addTransaction ($"descr", Web.stor ($"amount"), $"d"); Money.addEvenCharges (id, map Web.stoi (Web.getMultiParam "usrs")) - %>

Even transaction added.

+ %>

Even transaction added.

<% elseif $"modEven" <> "" then Group.requireGroupName "money"; showNormal := false; val trn = Money.lookupTransaction (Web.stoi ($"modEven")) %> -

Modify even transaction

+

Modify even transaction

- +"> -
Description:
Date:
Amount:
Members:
- - - -
Description:
Date:
Amount:
Members: + + + + Money.modTransaction {trn with descr = $"descr", d = $"d", amount = Web.stor ($"amount")}; Money.addEvenCharges (id, map Web.stoi (Web.getMultiParam "usrs")) - %>

Even transaction modified

+ %>

Even transaction modified

<% elseif $"del" <> "" then Group.requireGroupName "money"; showNormal := false; val trn = Money.lookupTransaction (Web.stoi ($"del")) %> -

Are you sure you want to delete transaction <% Web.html (#descr trn) %>?

+

Are you sure you want to delete transaction <% Web.html (#descr trn) %>?

">Yes, delete <% Web.html (#descr trn) %>! <% elseif $"del2" <> "" then @@ -253,18 +316,23 @@ end %> val trn = Money.lookupTransaction id; Money.clearCharges id; Money.deleteTransaction id %> -

<% Web.html (#descr trn) %> deleted!

+

<% Web.html (#descr trn) %> deleted!

+ +<% elseif $"cmd" = "equalize" then + Group.requireGroupName "money"; + Money.equalizeBalances (); + %>

Balances equalized

<% elseif $"trn" <> "" then showNormal := false; val id = Web.stoi ($"trn"); val trn = Money.lookupTransaction id %> -
Description:
Date:
Amount:
Members:
- - - - - +
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 @@ -277,21 +345,184 @@ foreach (name, cha) in Money.listChargesWithNames id do end %>
TRN#: <% id %>
Description: <% Web.html (#descr trn) %>
Date: <% #d trn %>
Amount: $<% #amount trn %>
Distribution:
+<% 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 + +elseif $"cmd" = "delinq" then + showNormal := false; + val dqs = Money.delinquentPledgers () %> + + +<% foreach dq in dqs do %> + <% end %> +
    Member Pledge Balance
    <% #name dq %> <% #shares dq %> $<% #balance dq %>
    + + 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.

    <% + +end %> + +<% if showNormal then + val you = Init.getUser(); + val bal = Balance.lookupBalance (#bal you); + val deposit = Balance.depositAmount (#id bal) %> + +

    Your balance: $<% Util.sub (#amount bal, deposit) %>
    +Deposit: $<% deposit %> (3 months of dues at the minimal pledge level)

    + + -<% if showNormal then %> +<% 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" then %> +<% if (Group.inGroupName "money" and $"lookback" = "") or $"audit" <> "" then %> + +Drop pledges of delinquent members
    +Switch to regular member view

    New transaction:
    Hosting bill
    Payment from member
    Generic/even
    +
    +Equalize balances
    +
    + +

    Look up a PayPal e-mail address

    -

    Most recent transactions

    + + + + + +

    Look up a Google Checkout e-mail address

    + +
    + + +
    + +

    Most recent transactions

    @@ -307,12 +538,20 @@ end %>
    Date Description Amount Participants Replace Delete
    <% else %> +Switch to audit view
    +<% val lookback = case $"lookback" of "" => 20 | lb => Web.stoi lb; + @payment [] %> -

    Your recent account activity

    +

    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 %>