else
Real.fmt (StringCvt.FIX (SOME 2)) n
+val basePerMonth = 5.0
+val deposit = basePerMonth * 3.0
+
fun main _ =
let
val db = C.conn dbstring
val shares = C.intFromSql shares
val amount = C.realFromSql amount
- val perMonth = 900.0 * real shares / real totalShares
- val deposit = perMonth * 3.0
- val headsUp = perMonth * 5.0
+ val perMonth = basePerMonth * real shares
+ val headsUp = deposit + perMonth * 2.0
in
if amount >= headsUp then
()
write "\nMinimum amount to pay to not see this message again for two months: US$";
write (printReal (headsUp - amount));
- write "\n\nYour deposit requirement was calculated by dividing our total monthly expenses\n";
- write "($900) by the sum of all members' pledge amounts, multiplying by your pledge amount,\n";
- write "and then multiplying by 3. That is, the amount covers your share of three months'\n";
- write "expenses.\n\n";
+ write "\n\nThe deposit requirement was calculated as three months of dues at $5/mo..\n\n";
write "To make a payment, visit:\n";
write " https://members.hcoop.net/\n";
write "\nIf for whatever reason you don't plan to pay the amount suggested in this e-mail,\n";
write "_please_ don't stay silent. Reply to this message explaining your circumstances.\n";
- write "We are doing limited-time monetary grants on request, due to the extra costs\n";
- write "associated with setting up our new servers.\n";
ignore (Mail.mclose m)
end
end
| doOne _ = raise Fail "Bad SQL row"
in
- C.app db doOne "SELECT Balance.name, COUNT(*), SUM(WebUserPaying.shares) AS shrs, Balance.amount FROM WebUserPaying JOIN Balance ON WebUserPaying.bal = Balance.id GROUP BY Balance.name, Balance.amount HAVING amount < 10";
+ C.app db doOne ("SELECT Balance.name, COUNT(*), SUM(WebUserPaying.shares) AS shrs, Balance.amount FROM WebUserPaying JOIN Balance ON WebUserPaying.bal = Balance.id GROUP BY Balance.name, Balance.amount HAVING amount < " ^ C.realToSql deposit ^ " + " ^ C.realToSql (basePerMonth * 2.0) ^ " * SUM(WebUserPaying.shares)");
C.close db;
OS.Process.success
end handle C.Sql s => (print ("SQL failure: " ^ s ^ "\n");