public void RefreshView(Goal_ModelCollection modelCollection) { Remaining.text = modelCollection.Strings[15]; decimal RemainingAmount = modelCollection.GoalModel.Amount - DataReformatter.GetExpensesTotal(modelCollection.ExpenseModels); Amount.text = "$" + RemainingAmount.ToString(); }
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(Goal_V2_ModelCollection modelCollection) { decimal ExpensesTotal = DataReformatter.GetExpensesTotal(modelCollection.ExpenseModels); SpentAmount.text = "$" + ExpensesTotal.ToString(); PlannedAmount.text = "$" + modelCollection.GoalModel.Amount.ToString(); decimal RemainingDecimal = modelCollection.GoalModel.Amount - ExpensesTotal; RemainingAmount.text = "$" + RemainingDecimal.ToString(); }
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 Refresh(ColorBar_ModelCollection modelCollection) { Dictionary <int, decimal> ExpenseTotals = DataReformatter.GetExpenseTotalsDict(modelCollection.CatagoryModels, modelCollection.ExpenseModels); Dictionary <int, CatagoryModel> CatagoryModelDict = DataReformatter.GetCatagoryModelsDict(modelCollection.CatagoryModels); float fullWidth = 0.00f; foreach (ColorBarElement colorBarElement in ColorBarElements) { colorBarElement.transform.localPosition = new Vector3(fullWidth, 0, 0); float currentWidth = ((float)ExpenseTotals[colorBarElement.CatagoryID] / (float)modelCollection.GoalModel.Amount) * ScreenWidth; // Fixes a float inaccuracy bug where a sliver of color for catagories that have no expenses was showing. currentWidth = currentWidth >= 1 ? currentWidth : 0; colorBarElement.UpdateView(CatagoryModelDict[colorBarElement.CatagoryID], currentWidth); fullWidth += currentWidth; } }