Added sales tree to VAT reports

This commit is contained in:
Rick Falkvinge
2018-04-15 16:21:06 +02:00
parent fd7fa680ad
commit 4e5ab9dfd9
+13 -1
View File
@@ -69,10 +69,11 @@ namespace Swarmops.Logic.Financial
FinancialAccount vatInbound = organization.FinancialAccounts.AssetsVatInboundUnreported;
FinancialAccount vatOutbound = organization.FinancialAccounts.DebtsVatOutboundUnreported;
FinancialAccount sales = organization.FinancialAccounts.IncomeSales;
FinancialAccounts salesTree = sales.ThisAndBelow();
FinancialAccountRows inboundRows = RowsNotInVatReport(vatInbound, endDate);
FinancialAccountRows outboundRows = RowsNotInVatReport(vatOutbound, endDate);
FinancialAccountRows turnoverRows = RowsNotInVatReport(sales, endDate);
FinancialAccountRows turnoverRows = RowsNotInVatReport(salesTree, endDate);
Dictionary<int, bool> transactionsIncludedLookup = new Dictionary<int, bool>();
@@ -228,6 +229,17 @@ namespace Swarmops.Logic.Financial
get { return VatReportItems.ForReport(this); }
}
private static FinancialAccountRows RowsNotInVatReport(FinancialAccounts accounts, DateTime endTime)
{
FinancialAccountRows result = new FinancialAccountRows();
result.AddRange(accounts.SelectMany(account => RowsNotInVatReport(account, endTime)));
return result;
}
private static FinancialAccountRows RowsNotInVatReport(FinancialAccount account, DateTime endDateTime)
{
Organization organization = account.Organization;