public TransactionPerCategoryReportDto(DateTime initialDate, DateTime finalDate, IEnumerable<Category> categories) { InitialDate = initialDate; FinalDate = finalDate; FillCategories(categories); Credits = new List<TransactionPerCategoryItemData>(); Debits = new List<TransactionPerCategoryItemData>(); CreditsSum = new TransactionPerCategoryItemData("Créditos", 0); DebitsSum = new TransactionPerCategoryItemData("Débitos", 0); Balance = new TransactionPerCategoryItemData("Saldo", 0); }
private TransactionPerCategoryItemData CreateTransactionPerCategoryData(Category category) { var categoryData = new TransactionPerCategoryItemData(category.Name, category.Id); for (var date = _report.InitialDate; date <= _report.FinalDate; date = date.AddMonths(1)) { var sumOfTheMonth = SumTransactionsForCategoryAndDate(category.Name, date); categoryData.AddValue(sumOfTheMonth); AddToSumOfTheMonth(sumOfTheMonth.Copy(), category.TransactionType == TransactionType.Credit); } return categoryData; }
public void AddDebit(TransactionPerCategoryItemData item) { Debits.Add(item); }
public void AddCredit(TransactionPerCategoryItemData item) { Credits.Add(item); }