Update of /cvsroot/hcoop/portal In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv7172
Modified Files: balance.sig balance.sml init.sml money.mlt portal.mlt util.sig util.sml Log Message: Subtract deposit amounts from displayed balances Index: util.sml =================================================================== RCS file: /cvsroot/hcoop/portal/util.sml,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** util.sml 19 Jan 2008 20:57:32 -0000 1.16 --- util.sml 18 Feb 2008 17:46:05 -0000 1.17 *************** *** 30,33 **** --- 30,34 ---- fun neg (r : real) = ~r fun add (r1 : real, r2) = r1 + r2 + fun sub (r1 : real, r2) = r1 - r2 fun mult (r1, r2) = real r1 * r2 Index: balance.sml =================================================================== RCS file: /cvsroot/hcoop/portal/balance.sml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** balance.sml 22 Nov 2007 19:24:00 -0000 1.10 --- balance.sml 18 Feb 2008 17:46:05 -0000 1.11 *************** *** 106,108 **** --- 106,123 ---- fun isNegative (bal : balance) = #amount bal < 0.0 + fun depositAmount bal = + let + val db = getDb () + + val totalShares = case C.oneRow db "SELECT SUM(shares) FROM WebUserPaying" of + [n] => C.intFromSql n + | row => Init.rowError ("Bad depositAmount share count result", row) + in + case C.oneRow db ($`SELECT 3.0 * 900.0 * SUM(shares) / ^(C.intToSql totalShares) + FROM WebUserPaying + WHERE bal = ^(C.intToSql bal)`) of + [amount] => C.realFromSql amount + | row => Init.rowError ("Bad depositAmount result", row) + end + end Index: money.mlt =================================================================== RCS file: /cvsroot/hcoop/portal/money.mlt,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** money.mlt 11 Dec 2007 13:27:17 -0000 1.20 --- money.mlt 18 Feb 2008 17:46:05 -0000 1.21 *************** *** 462,468 **** end %> ! <% if showNormal then %> ! <h3>Your balance: $<% #amount (Balance.lookupBalance (#bal (Init.getUser ()))) %></h3> <% if (iff Group.inGroupName "money" then $"lookback" = "" else $"audit" <> "") then %><h3>Sum of all active balances: $<% Balance.sumOwnedBalances () %></h3><% end %> --- 462,472 ---- end %> ! <% if showNormal then ! val you = Init.getUser(); ! val bal = Balance.lookupBalance (#bal you); ! val deposit = Balance.depositAmount (#id bal) %> ! <h3>Your balance: $<% Util.sub (#amount bal, deposit) %><br> ! Deposit: $<% deposit %></b> (3 months of dues at your current <a href="pledge">pledge level</a>)</h3> <% if (iff Group.inGroupName "money" then $"lookback" = "" else $"audit" <> "") then %><h3>Sum of all active balances: $<% Balance.sumOwnedBalances () %></h3><% end %> Index: balance.sig =================================================================== RCS file: /cvsroot/hcoop/portal/balance.sig,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** balance.sig 24 Oct 2007 11:48:39 -0000 1.5 --- balance.sig 18 Feb 2008 17:46:05 -0000 1.6 *************** *** 1,5 **** signature BALANCE = sig ! type balance = {id :int, name : string, amount : real} val addBalance : string -> int --- 1,5 ---- signature BALANCE = sig ! type balance = {id : int, name : string, amount : real} val addBalance : string -> int *************** *** 18,20 **** --- 18,22 ---- val sumOwnedBalances : unit -> real val isNegative : balance -> bool + + val depositAmount : int -> real end Index: portal.mlt =================================================================== RCS file: /cvsroot/hcoop/portal/portal.mlt,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** portal.mlt 22 Nov 2007 19:24:00 -0000 1.16 --- portal.mlt 18 Feb 2008 17:46:05 -0000 1.17 *************** *** 1,4 **** --- 1,5 ---- <% val you = Init.getUser(); val bal = Balance.lookupBalance (#bal you); + val deposit = Balance.depositAmount (#id bal); @header [] %> *************** *** 13,17 **** <% end %> </table> ! <b>Balance: $<% #amount bal %></b> <% val polls = Poll.listCurrentPolls (); --- 14,19 ---- <% end %> </table> ! <b>Balance: $<% Util.sub (#amount bal, deposit) %></b><br> ! <b>Deposit: $<% deposit %></b> (3 months of dues at your current <a href="pledge">pledge level</a>) <% val polls = Poll.listCurrentPolls (); Index: init.sml =================================================================== RCS file: /cvsroot/hcoop/portal/init.sml,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** init.sml 8 Dec 2007 21:00:07 -0000 1.24 --- init.sml 18 Feb 2008 17:46:05 -0000 1.25 *************** *** 152,156 **** fun byPledge () = C.map (getDb ()) mkUserRow ($`SELECT id, name, rname, bal, joined, app, shares, paypal, checkout ! FROM WebUser WHERE shares > 1 ORDER BY shares DESC, name`) --- 152,156 ---- fun byPledge () = C.map (getDb ()) mkUserRow ($`SELECT id, name, rname, bal, joined, app, shares, paypal, checkout ! FROM WebUserPaying WHERE shares > 1 ORDER BY shares DESC, name`) Index: util.sig =================================================================== RCS file: /cvsroot/hcoop/portal/util.sig,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** util.sig 19 Jan 2008 20:57:32 -0000 1.13 --- util.sig 18 Feb 2008 17:46:05 -0000 1.14 *************** *** 16,19 **** --- 16,20 ---- val neg : real -> real val add : real * real -> real + val sub : real * real -> real val mult : int * real -> real ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ hcoop-cvs mailing list hcoop-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hcoop-cvs