- unless u.flash.blank? = u.flash ~ "\n------" ~ "\n" - if u.surplus > 0 - if u.spending_goal_today == 0 = "You have spent your budget for today." - elsif u.spending_goal_today > 0 = "You can spend #{money(u.spending_goal_today)} today." - elsif u.spending_goal_today < 0 = "You have spent your budget for today, plus an additional #{money(u.spending_goal_today * -1)}." - if u.days_left > 1 ~ "\n" = "If you #{u.spent_today <= 0 ? "don't spend anything" : "only spend #{money(u.spent_today)}"} today, you will have" = " #{money(u.surplus / u.days_left)} to spend each day." = " #{money((u.surplus / u.days_left) * 7)} to spend each week." = " #{money(u.surplus)} to spend over the next #{days(u.days_left)}." - elsif u.total_left > 0 = "You should not spend any money #{"for the next #{days(u.days_left)} " if u.days_left > 0}if you want to continue to save #{money(u.total_left)}." - if u.days_left > 1 ~ "\n" = "If you wish to spend into your savings this month, you can afford to spend" = " #{money(u.total_left / u.days_left)} each day." = " #{money((u.total_left / u.days_left) * 7)} each week." = " #{money(u.total_left)} over the next #{days(u.days_left)}." - elsif u.total_left == 0 = "You should not spend any money #{"for the next #{days(u.days_left)} " if u.days_left > 0}if you want to avoid going into debt." - else = "You need to earn #{money(u.total_left / u.days_left_including_today * -1)} today." - if u.days_left > 0 ~ "\n" = "Continue to do so for the next #{days(u.days_left)} to avoid going into debt." ~ "\n" If you do not, Sum will temporarily decrease your spending money for next month to account for the debt. - if u.surplus_for_period > 0 ~ "\n" = "You have saved #{money(u.surplus_for_period)} more than expected for a #{u.days_passed_including_today} day period." - elsif u.surplus_for_period < 0 ~ "\n" = "You have spent #{money(u.surplus_for_period * -1)} more than expected for a #{u.days_passed_including_today} day period." - else ~ "\n" = "You have spent exactly as expected for a #{u.days_passed_including_today} day period." ~ "\n------" ~ "\n" = "Fiscal month: #{u.beginning_of_month.strftime("%m/%d/%y")} to #{u.reset_at.strftime("%m/%d/%y")} (#{u.days_in_month} days)" - if u.recent_transactions ~ "\n" = "Last #{u.recent_transactions.length == 1 ? "transaction" : "#{u.recent_transactions.length} transactions"}:" - u.recent_transactions.compact.each do |amount| = " #{money(amount * -1)}" ~ "\n------" ~ "\n" Reply to this email with the word "stop" to stop receiving emails, or "start" to begin receiving them again. ~ "\n" Every time you spend money or use the ATM, don't forget to email the dollar amount to sum@sumapp.com. ~ "\n" Use the form at http://sumapp.com to update the values used to calculate this budget.