X-Git-Url: https://git.hcoop.net/hcoop/portal.git/blobdiff_plain/1b566e48ec4228ebf60088e7040b9d92a8c1fb01..ac5cb613b0f0a143eaeed801979bfc56e7c88e40:/money.mlt diff --git a/money.mlt b/money.mlt index 9c50d10..fd3cc86 100644 --- a/money.mlt +++ b/money.mlt @@ -29,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

+ + + +<% foreach (amt, trn) in Money.listUserTransactions (valOf (Init.userNameToId "hcoop")) do %> + +<% switch Money.listChargesWithNames (#id trn) of + [(name, cha)] => %><% + | _ => %><% +end; +if admin then + %><% end %><% @@ -47,7 +69,7 @@ end %> <% 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) %><% end @@ -153,6 +175,58 @@ end %> %>

Hosting transaction modified.

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

New bill for the co-op

+ + + +
Date Description Amount Last modified Participants
<% #d trn %> <% Web.html (#descr trn) %> <% #amount trn %> <% #stamp trn %><% name %>multi[Bill] [Payment] [Other] [Delete]
+ + + + +
Description:
Date:
Amount:
+ +<% elseif $"cmd" = "bill2" then + Group.requireGroupName "money"; + val id = Money.addTransaction ($"descr", Util.neg (Web.stor ($"amount")), $"d"); + Money.addCharge {trn = id, usr = valOf (Init.userNameToId "hcoop"), amount = Util.neg (Web.stor ($"amount"))}; + Money.applyCharges id; + + %>

Bill added.

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

Modify bill

+ + + + + + + + +
Description:
Date:
Amount:
+ +<% elseif $"saveBill" <> "" then + Group.requireGroupName "money"; + val id = Web.stoi ($"saveBill"); + val trn = Money.lookupTransaction id; + + Money.clearCharges id; + Money.modTransaction {trn with descr = $"descr", d = $"d", amount = Util.neg (Web.stor ($"amount"))}; + Money.addCharge {trn = id, usr = valOf (Init.userNameToId "hcoop"), amount = Util.neg (Web.stor ($"amount"))}; + Money.applyCharges id; + + %>

Bill modified.

+ <% elseif $"cmd" = "evenForm" then Group.requireGroupName "money"; showNormal := false %> @@ -205,7 +279,7 @@ end %> val amount = Web.stor ($"amount"); val descr = $"descr"; val descr = iff descr = "" then $"descr2" else descr; - val id = Money.addTransaction ($"descr", amount, $"d"); + val id = Money.addTransaction (descr, amount, $"d"); Money.addCharge {trn = id, usr = Web.stoi ($"usr"), amount = amount}; Money.applyCharges id; @@ -265,6 +339,27 @@ end %> +<% elseif $"cmd" = "dues" then + Group.requireGroupName "money"; + showNormal := false %> + +

Monthly dues

+ +
+ + + + + + +
Description:
Date:
Amount/pledge:
+ +<% elseif $"cmd" = "dues2" then + Group.requireGroupName "money"; + Money.billDues {descr = $"descr", base = Web.stor ($"base"), date = $"d"}; + + %>

Dues debits added.

+ <% elseif $"cmd" = "even" then Group.requireGroupName "money"; val id = Money.addTransaction ($"descr", Web.stor ($"amount"), $"d"); @@ -402,6 +497,23 @@ end %> (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"); @@ -476,23 +588,50 @@ elseif $"cmd" = "delinq" then %>

    Pledges reset.

    <% -end %> +elseif $"cmd" = "freezeworthy" then + showNormal := false; + val dqs = Money.freezeworthyPledgers () %> + + +<% foreach dq in dqs do %> + +<% if #joinedThisMonth dq then %><% end %> +<% end %> +
    Member Balance
    <% #name dq %> $<% #balance dq %>(joined this month)
    + +<% elseif $"cmd" = "bootworthy" then + showNormal := false; + val dqs = Money.bootworthyPledgers () %> + + +<% foreach dq in dqs do %> + +<% if #joinedThisMonth dq then %><% end %> +<% end %> +
    Member Balance
    <% #name dq %> $<% #balance dq %>(joined this month)
    + +<% end %> <% if showNormal then val you = Init.getUser(); val bal = Balance.lookupBalance (#bal you); - val deposit = Balance.depositAmount (#id bal) %> + 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"))) %>

    -

    Your balance: $<% #amount bal %>

    + <% if (iff Group.inGroupName "money" then $"lookback" = "" else $"audit" <> "") then %>

    Sum of all active balances: $<% Balance.sumOwnedBalances () %>

    <% end %> List all transactions
    +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" and $"lookback" = "") or $"audit" <> "" then %> @@ -501,8 +640,10 @@ Deposit: $<% deposit %> (3 months of dues at your current p 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
    @@ -522,6 +663,13 @@ Deposit: $<% deposit %> (3 months of dues at your current p +

    Look up a Real Name

    + +
    + + +
    +

    Most recent transactions

    @@ -532,29 +680,41 @@ Deposit: $<% deposit %> (3 months of dues at your current p [(name, cha)] => %><% | _ => %><% end %> - + <% end %>
    <% name %>multi[Hosting] [Payment] [Other][Bill] [Payment] [Other] [Delete]
    <% else %> Switch to audit view
    -<% val lookback = case $"lookback" of "" => 20 | lb => Web.stoi lb; +<% val lookback = case $"lookback" of "" => 20 | "inf" => 0 | lb => Web.stoi lb; @payment [] %>

    Your recent account activity

    - Show most recent transactions. + Show most recent transactions.
    +<% ref running = showBal; +val trans = iff lookback = 0 then + Money.listUserTransactions (Init.getUserId ()) + else + Money.listUserTransactionsLimit (Init.getUserId (), lookback) %> - -<% foreach (amount, trn) in Money.listUserTransactionsLimit (Init.getUserId (), lookback) do %> - -<% end %> + +<% foreach (amount, trn) in trans do %> + + + + +<% running := Util.sub (running, amount) +end %>
    Date Description Amount
    <% #d trn %> <% Web.html (#descr trn) %> <% amount %>/<% #amount trn %>
    Date Description Debit Credit Balance
    <% #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 %>
    +<% if lookback <> 0 then %> +Show all transactions
    +<% end %> <% end end %>