Ejemplo n.º 1
0
        private void CalculateWeekOutcomes()
        {
            foreach (var week in budget.Weeks)
            {
                var calculatedRemainder =
                    PriorWeekRemainder(week) -
                    EnvelopeSize +
                    CashMovements[week].Sum(i => i.Amount) +
                    MonthlyCashMovements[week].Sum(p => p.Amount);

                var remainder = Remainders.SingleOrDefault(r => r.Date == week.LastDay);

                if (remainder != null)
                {
                    budget.AddFreeMoney(week.LastDay, remainder.Amount - calculatedRemainder);
                }
            }
        }
Ejemplo n.º 2
0
        public int GetRemainder(DateTime date)
        {
            var remainder = Remainders.SingleOrDefault(r => r.Date == date);

            return(remainder != null ? remainder.Amount : calculatedRemainders[date]);
        }