public static decimal After(DAS_ModelCollection modelCollection) { decimal totalSpentInMonth = DataReformatter.GetExpensesTotal(modelCollection.ExpenseModels); decimal amountLeftToSpend = modelCollection.GoalModel.Amount - totalSpentInMonth; DateTime firstOfNextMonth = new DateTime(modelCollection.CurrentlySetTime.Year, modelCollection.CurrentlySetTime.Month, 1).AddMonths(1); int daysLeftInMonth = (firstOfNextMonth - modelCollection.CurrentlySetTime).Days; return(amountLeftToSpend / (daysLeftInMonth + 1)); }
public void RefreshView(DAS_ModelCollection modelCollection) { BDAS.text = "$" + DailyAverageSpendCalculator.Before(modelCollection).ToString("0.00"); if (modelCollection.CurrentlySetTime.Month < DateTime.Now.Month && modelCollection.CurrentlySetTime.Year <= DateTime.Now.Year) { ADAS.text = "N/A"; } else { ADAS.text = "$" + DailyAverageSpendCalculator.After(modelCollection).ToString("0.00"); } }
public static decimal Before(DAS_ModelCollection modelCollection) { decimal totalSpentInMonth = DataReformatter.GetExpensesTotal(modelCollection.ExpenseModels); if (modelCollection.CurrentlySetTime.Month < DateTime.Now.Month && modelCollection.CurrentlySetTime.Year <= DateTime.Now.Year) { return(totalSpentInMonth / DateTime.DaysInMonth(modelCollection.CurrentlySetTime.Year, modelCollection.CurrentlySetTime.Month)); } else { return(totalSpentInMonth / modelCollection.CurrentlySetTime.Day); } }
public void ConstructView(DAS_ModelCollection modelCollection) { RefreshView(modelCollection); }