public AnnualBudgetReport(IMoneyCalculator calculator, IEnumerable <MonthlyBudgetReport> months)
        {
            Months = months.ToList();

            Income  = FinancialStats.GetTotal(calculator, Months.Select(n => n.Income));
            Expense = FinancialStats.GetTotal(calculator, Months.Select(n => n.Expense));

            Balance = FinancialStats.GetBalance(calculator, Income, Expense);
        }
Exemplo n.º 2
0
        public MonthLog(BudgetLogType log,
                        YearMonth when,
                        IMoneyCalculator calculator,
                        IEnumerable <Transaction> actual = null,
                        IEnumerable <Forecast> forecast  = null)
        {
            When         = when;
            Transactions = actual?.Where(n => n.Log == log).ToList() ?? new List <Transaction>();
            Forecasts    = forecast?.Where(n => n.Log == log).ToList() ?? new List <Forecast>();

            Total = FinancialStats.GetTotal(calculator,
                                            Transactions.Select(n => n.Amount),
                                            Forecasts.Select(n => n.Amount));
        }
Exemplo n.º 3
0
        public ExpenseCategoryReport(Category category,
                                     IMoneyCalculator calculator,
                                     MonthLog expenseLog)
        {
            CategoryKey = category.Key;
            Title       = category.Title;
            Description = category.Description;

            Total = FinancialStats.GetTotal(calculator,
                                            expenseLog.Transactions
                                            .Where(n => category.IsSameOrParentOf(n.CategoryKey))
                                            .Select(n => n.Amount),
                                            expenseLog.Forecasts
                                            .Where(n => category.IsSameOrParentOf(n.CategoryKey))
                                            .Select(n => n.Amount)
                                            );
        }