Account Plan enhancements 3

This commit is contained in:
Rick Falkvinge
2015-01-23 19:20:25 +01:00
parent b6319750ab
commit 71aa07e60f
+4 -2
View File
@@ -390,13 +390,15 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
account.SetBudgetCents (DateTime.Today.Year, newSingleBudget);
// Once we've set the budget, also update the "yearly result" budget
// Once we've set the budget, also update the "yearly result" budget.
// This will be the WRONG SIGN for a P&L budget, but much better for display purposes (positive result is a profit, negative a loss).
// Will need to compensate for this in a future budget vs. actuals display.
int thisYear = DateTime.UtcNow.Year;
FinancialAccounts allProfitLossAccounts = FinancialAccounts.ForOrganization(authData.CurrentOrganization);
Int64 newProfitLossProjection = allProfitLossAccounts.Where(queryAccount => queryAccount.Identity != authData.CurrentOrganization.FinancialAccounts.CostsYearlyResult.Identity).Sum(queryAccount => queryAccount.GetBudgetCents(thisYear));
authData.CurrentOrganization.FinancialAccounts.CostsYearlyResult.SetBudgetCents(thisYear, -newProfitLossProjection);
authData.CurrentOrganization.FinancialAccounts.CostsYearlyResult.SetBudgetCents(thisYear, newProfitLossProjection);
return new ChangeAccountDataResult
{