Exemple #1
0
        /// -------------------------------------------------------------
        ///
        public override void renderContent()
        {
            int lineWidth = 30;

            currentBudget.sortBudgetItems();

            List <string> financeData = new List <string>();

            financeData.Add("~~~~~~  Monthly Budget  ~~~~~~");
            financeData.Add("");

            foreach (FinanceItem budgetItem in currentBudget.monthlyBudgetItems)
            {
                financeData.Add(Formatter.formatAmountLine(budgetItem.title, budgetItem.amount, lineWidth));
            }
            financeData.Add("");
            foreach (FinanceItem budgetItem in currentBudget.monthlyIntrPrinc)
            {
                financeData.Add(Formatter.formatAmountLine(budgetItem.title, budgetItem.amount, lineWidth));
            }

            financeData.Add("______________________________");
            financeData.Add("");
            financeData.Add(Formatter.formatAmountLine("Saving/Net Amount", currentBudget.getMonthlyNetSum(), lineWidth));

            financeData.Add("");
            financeData.Add("");
            financeData.Add("");
            financeData.Add("");
            financeData.Add("~~~~~~~~~~~  Debt  ~~~~~~~~~~~");
            financeData.Add("");

            foreach (Loan loan in currentBudget.loans)
            {
                financeData.Add(Formatter.formatAmountLine(loan.title + " (" + loan.shortName + ")", loan.amount, lineWidth));
                financeData.Add(Formatter.formatAmountLine(" - Monthly payment", loan.monthlyPayment, lineWidth));
                financeData.Add(Formatter.formatAmountLine(" - Interest %", loan.interestPercentage, lineWidth, 2));
                financeData.Add(Formatter.formatAmountLine(" - Annual principal", loan.calculatePrincipal(12), lineWidth));
                financeData.Add("");
            }

            financeData.Add("");
            financeData.Add("");
            financeData.Add("");
            financeData.Add("~~~~~~~~~  Savings  ~~~~~~~~~~");
            financeData.Add("");
            financeData.Add(Formatter.formatAmountLine("Current savings", currentBudget.currentSavings, lineWidth));
            financeData.Add(Formatter.formatAmountLine("Savings growth %", currentBudget.savingsGrowthRate, lineWidth, 2));
            financeData.Add(Formatter.formatAmountLine("Annual growth", currentBudget.calculateSavings(12), lineWidth));

            financeData.Add("");
            financeData.Add("");
            financeData.Add("");
            financeData.Add("~~~~~~~~~~  Goals  ~~~~~~~~~~~");
            financeData.Add("");
            if (currentBudget.savingsGoals.Count > 0)
            {
                financeData.Add("Savings Goals");
            }
            foreach (FinanceItem savingsGoal in currentBudget.savingsGoals)
            {
                financeData.Add(Formatter.formatAmountLine(" - " + savingsGoal.title, savingsGoal.amount, lineWidth));
            }
            financeData.Add("");
            if (currentBudget.debtGoals.Count > 0)
            {
                financeData.Add("Debt Goals");
            }
            foreach (FinanceItem debtGoal in currentBudget.debtGoals)
            {
                financeData.Add(Formatter.formatAmountLine(" - " + debtGoal.title, debtGoal.amount, lineWidth));
            }

            List <FinanceItem> chartItems = currentBudget.monthlyBudgetItems.ToList().Concat(currentBudget.monthlyIntrPrinc).ToList();

            chartItems.Add(new FinanceItem(
                               "Savings",
                               -currentBudget.getMonthlyNetSum()
                               ));
            PieChart simpleChart = new PieChart(10, chartItems);

            Render.renderChart(simpleChart.chart, chartItems);

            Render.renderColumnContent(financeData);
        }