From 91fb2bc3fc1a037fc6c23242a405722735ea3828 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Tue, 3 Mar 2015 20:48:18 +0100 Subject: [PATCH] Closing Ledgers --- Site5/App_GlobalResources/Pages.Ledgers.resx | 6 ++++++ Site5/Pages/v5/Ledgers/CloseLedgers.aspx.cs | 19 +++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Site5/App_GlobalResources/Pages.Ledgers.resx b/Site5/App_GlobalResources/Pages.Ledgers.resx index 444b42a1..3e545708 100644 --- a/Site5/App_GlobalResources/Pages.Ledgers.resx +++ b/Site5/App_GlobalResources/Pages.Ledgers.resx @@ -664,4 +664,10 @@ Please select an account in order to add a row to this transaction. + + Annual Loss + + + Annual Profit + \ No newline at end of file diff --git a/Site5/Pages/v5/Ledgers/CloseLedgers.aspx.cs b/Site5/Pages/v5/Ledgers/CloseLedgers.aspx.cs index db4c1823..2a556b19 100644 --- a/Site5/Pages/v5/Ledgers/CloseLedgers.aspx.cs +++ b/Site5/Pages/v5/Ledgers/CloseLedgers.aspx.cs @@ -29,6 +29,11 @@ public partial class Pages_v5_Ledgers_CloseLedgers : PageV5Base // TODO: this fn should move to Organization int closingYear = CurrentOrganization.Parameters.FiscalBooksClosedUntilYear + 1; + if (closingYear < 1000) + { + closingYear = CurrentOrganization.FirstFiscalYear; + } + bool hasOpenTxForClosingYear = false; @@ -116,11 +121,17 @@ public partial class Pages_v5_Ledgers_CloseLedgers : PageV5Base if (balanceDeltaCents == -resultsDeltaCents && closingYear < DateTime.Today.Year) { + string transactionLabel = Resources.Pages.Ledgers.CloseLedgers_AnnualProfit; + + if (balanceDeltaCents < 0) + { + transactionLabel = Resources.Pages.Ledgers.CloseLedgers_AnnualLoss; + } + FinancialTransaction resultTransaction = FinancialTransaction.Create (CurrentOrganization.Identity, - new DateTime (closingYear, 12, 31, 23, 59, 00), "Ã…rets resultat " + closingYear); - // TODO: Localize string - resultTransaction.AddRow (CurrentOrganization.FinancialAccounts.CostsYearlyResult, -resultsDeltaCents, null); - resultTransaction.AddRow (CurrentOrganization.FinancialAccounts.DebtsEquity, -balanceDeltaCents, null); + new DateTime (closingYear, 12, 31, 23, 59, 00), transactionLabel + " " + closingYear); + resultTransaction.AddRow (CurrentOrganization.FinancialAccounts.CostsYearlyResult, -resultsDeltaCents, CurrentUser); + resultTransaction.AddRow (CurrentOrganization.FinancialAccounts.DebtsEquity, -balanceDeltaCents, CurrentUser); // Ledgers are now at zero-sum for the year's result accounts and from the start up until end-of-closing-year for the balance accounts.