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); }
public MonthlyBudgetReport(YearMonth when, IMoneyCalculator calculator, IEnumerable <Category> categories, MonthLog incomeLog, MonthLog expenseLog) { if (incomeLog.Log != BudgetLogType.Incomes) { throw new ArgumentException(nameof(incomeLog)); } if (expenseLog.Log != BudgetLogType.Expenses) { throw new ArgumentException(nameof(expenseLog)); } When = when; Income = incomeLog.Total; Expense = expenseLog.Total; Balance = FinancialStats.GetBalance(calculator, Income, Expense); Expenses = GetExpensesReport(calculator, categories, expenseLog); }