Fix for account aggregation in financial reports

This commit is contained in:
Rick Falkvinge
2012-12-12 22:04:08 +00:00
parent 8ee8d3e6d2
commit eb809b2262
+11 -7
View File
@@ -37,6 +37,17 @@ namespace Activizr.Logic.Financial
}
}
// Aggregate accounts, if appropriate
int rootLevelAccounts = accounts.Count(account => account.ParentFinancialAccountId == 0);
if (rootLevelAccounts > 3)
{
// regroup list
report.AggregateAccounts();
}
// Build tree (there should be a template for this)
report._treeMap = new Dictionary<int, List<FinancialAccount>>();
@@ -52,13 +63,6 @@ namespace Activizr.Logic.Financial
}
if (report._treeMap[0].Count > 3)
{
// regroup list
report.AggregateAccounts();
}
FinancialAccounts orderedList = new FinancialAccounts(); // This list is guaranteed to have parents before children
report.PopulateOrderedList(orderedList, 0); // recursively add nodes parents-first