X-Git-Url: http://git.hcoop.net/hcoop/zz_old/portal.git/blobdiff_plain/8d347a3306ce7cc6e744183f0d4229f09d3f7101..f9d08b8c04c4174dac4f9c9e4750d39c3e6c5423:/money.mlt diff --git a/money.mlt b/money.mlt index e2bf406..1e1f692 100644 --- a/money.mlt +++ b/money.mlt @@ -3,6 +3,7 @@ ref showNormal = true; if $"cmd" = "list" then + val admin = Group.inGroupName "money"; showNormal := false %>

Transactions

@@ -12,9 +13,14 @@ if $"cmd" = "list" then <% foreach trn in Money.listTransactions () do %> <% #d trn %> <% Web.html (#descr trn) %> <% #amount trn %> <% #stamp trn %> <% switch Money.listChargesWithNames (#id trn) of - [(name, cha)] => %><% name %> <% - | _ => %>multi <% + [(name, cha)] => %><% name %><% + | _ => %>multi<% +end; +if admin then + %>[Hosting] [Payment] [Other] + [Delete]<% end +%><% end %> @@ -56,11 +62,127 @@ end %> <% elseif $"cmd" = "hosting2" then - val id = Money.addTransaction ($"descr", Web.stor ($"amount"), $"d"); + Group.requireGroupName "money"; + 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.

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

Modify hosting bill

+ +
+ + + + + + + + + +
Description:
Date:
Amount:
Free bandwidth cutoff (MB):
Cost/GB:
Member usage:
+ +<% elseif $"saveHosting" <> "" then + Group.requireGroupName "money"; + val id = Web.stoi ($"saveHosting"); + val trn = Money.lookupTransaction id; + + Money.clearCharges id; + 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.

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

New generic/even transaction

+ + + + + + + + +
Description:
Date:
Amount:
Members:
+
+ +<% elseif $"cmd" = "pay" then + Group.requireGroupName "money"; + showNormal := false %> + +

New member payment

+ +
+ + + + + + + +
Description:
Date:
Amount:
Member:
+
+ +<% elseif $"cmd" = "pay2" then + Group.requireGroupName "money"; + val amount = Web.stor ($"amount"); + val id = Money.addTransaction ($"descr", amount, $"d"); + Money.addCharge {trn = id, usr = Web.stoi ($"usr"), amount = amount}; + Money.applyCharges id; + + %>

Payment transaction added.

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

Modify member payment

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

Member payment modified.

+ <% elseif $"cmd" = "evenForm" then Group.requireGroupName "money"; showNormal := false %> @@ -81,12 +203,14 @@ end %>
<% elseif $"cmd" = "even" then + Group.requireGroupName "money"; val id = Money.addTransaction ($"descr", Web.stor ($"amount"), $"d"); Money.addEvenCharges (id, map Web.stoi (Web.getMultiParam "usrs")) %>

Even transaction added.

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

Modify even transaction

@@ -107,6 +231,7 @@ end %> <% elseif $"saveEven" <> "" then + Group.requireGroupName "money"; val id = Web.stoi ($"saveEven"); val trn = Money.lookupTransaction id; Money.clearCharges id; @@ -116,18 +241,25 @@ end %> %>

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

">Yes, delete <% Web.html (#descr trn) %>! <% elseif $"del2" <> "" then + Group.requireGroupName "money"; val id = Web.stoi ($"del2"); val trn = Money.lookupTransaction id; Money.clearCharges id; Money.deleteTransaction id %>

<% 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"); @@ -161,7 +293,10 @@ end %>
New transaction:
Hosting bill
+Payment from member
Generic/even
+
+Equalize balances

Most recent transactions

@@ -173,7 +308,8 @@ end %> [(name, cha)] => %><% name %><% | _ => %>multi<% end %> -[Even] [Delete] +[Hosting] [Payment] [Other] +[Delete] <% end %>