From dc6bfed9fc260f3379ab8723ea25bebfd4c2132f Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Wed, 12 Dec 2012 12:54:18 +0000 Subject: [PATCH] Added download of balance sheet, security on switch orgs, loc of new features to sv-SE --- .../Enums/OrganizationFinancialAccountType.cs | 20 +- .../OrganizationFinancialAccounts.cs | 11 +- Logic/Financial/YearlyReport.cs | 62 ++++++ Logic/Structure/Organization.cs | 33 ++-- Site5/App_GlobalResources/Global.resx | 3 + Site5/App_GlobalResources/Pages.Ledgers.resx | 12 ++ .../sv-SE/Controls.Pirates.sv-SE.resx | 122 ++++++++++++ .../sv-SE/Global.sv-SE.resx | 153 +++++++++++++++ .../{ => sv-SE}/Menu5.sv-SE.resx | 50 ++--- .../sv-SE/Pages.Finance.sv-SE.resx | 178 ++++++++++++++++++ .../Pages.Global.sv-SE.resx} | 107 ++++++++--- .../{ => sv-SE}/Pages.Governance.sv-SE.resx | 169 ++--------------- .../sv-SE/Pages.Init.sv-SE.resx | 125 ++++++++++++ .../{ => sv-SE}/Pages.Ledgers.sv-SE.resx | 123 ++++++++++-- .../sv-SE/Pages.Security.sv-SE.resx | 124 ++++++++++++ Site5/Master-v5.master | 2 +- Site5/Master-v5.master.cs | 27 ++- Site5/Pages/v5/Ledgers/BalanceSheet.aspx | 4 +- Site5/Pages/v5/Ledgers/CloseLedgers.aspx.cs | 2 +- Site5/Pages/v5/Ledgers/Csv-BalanceData.aspx | 1 + .../Pages/v5/Ledgers/Csv-BalanceData.aspx.cs | 96 ++++++++++ .../v5/Ledgers/Json-BalanceSheetData.aspx.cs | 22 +++ .../v5/Ledgers/Json-ProfitLossData.aspx.cs | 20 ++ Site5/Tests/TestBookkeepingIntegrity.aspx.cs | 2 +- 24 files changed, 1216 insertions(+), 252 deletions(-) create mode 100644 Site5/App_GlobalResources/sv-SE/Controls.Pirates.sv-SE.resx create mode 100644 Site5/App_GlobalResources/sv-SE/Global.sv-SE.resx rename Site5/App_GlobalResources/{ => sv-SE}/Menu5.sv-SE.resx (90%) create mode 100644 Site5/App_GlobalResources/sv-SE/Pages.Finance.sv-SE.resx rename Site5/App_GlobalResources/{Global.sv-SE.resx => sv-SE/Pages.Global.sv-SE.resx} (66%) rename Site5/App_GlobalResources/{ => sv-SE}/Pages.Governance.sv-SE.resx (60%) create mode 100644 Site5/App_GlobalResources/sv-SE/Pages.Init.sv-SE.resx rename Site5/App_GlobalResources/{ => sv-SE}/Pages.Ledgers.sv-SE.resx (68%) create mode 100644 Site5/App_GlobalResources/sv-SE/Pages.Security.sv-SE.resx create mode 100644 Site5/Pages/v5/Ledgers/Csv-BalanceData.aspx create mode 100644 Site5/Pages/v5/Ledgers/Csv-BalanceData.aspx.cs diff --git a/Basic/Enums/OrganizationFinancialAccountType.cs b/Basic/Enums/OrganizationFinancialAccountType.cs index b0907720..42eac7ca 100644 --- a/Basic/Enums/OrganizationFinancialAccountType.cs +++ b/Basic/Enums/OrganizationFinancialAccountType.cs @@ -32,6 +32,10 @@ namespace Activizr.Basic.Enums /// AssetsVat, /// + /// If virtual banking is enabled, this is where the virtual assets go + /// + AssetsVirtualBanking, + /// /// Any expense claims on the organization that have not been paid back /// DebtsExpenseClaims, @@ -48,23 +52,23 @@ namespace Activizr.Basic.Enums /// DebtsTax, /// - /// Own capital - asset balancing yearly result, accumulating year after year + /// Equity - the difference between debt and assets /// - DebtsCapital, + DebtsEquity, /// /// Undeclared Value Added Tax (outbound) before putting it on tax balance /// DebtsVat, /// + /// If virtual banking is enabled, this is the central debt to local assets + /// + DebtsVirtualBanking, + /// /// Other debts in general /// DebtsOther, /// - /// Main income account - /// - IncomeGeneral, - /// - /// Income specifically from sales - default outbound invoices to this acct + /// Income from sales - default outbound invoices to this acct /// IncomeSales, /// @@ -88,7 +92,7 @@ namespace Activizr.Basic.Enums /// CostsAllocatedFunds, /// - /// When closing books, this is the yearly result (balanced against DebtsCapital) + /// When closing books, this is the yearly result (balanced against DebtsEquity) /// CostsYearlyResult // multi-account type }; diff --git a/Logic/Financial/OrganizationFinancialAccounts.cs b/Logic/Financial/OrganizationFinancialAccounts.cs index bdd169ad..6e8f5b0b 100644 --- a/Logic/Financial/OrganizationFinancialAccounts.cs +++ b/Logic/Financial/OrganizationFinancialAccounts.cs @@ -43,7 +43,7 @@ namespace Activizr.Logic.Financial organizationAccounts[OrganizationFinancialAccountType.DebtsInboundInvoices] = FinancialAccount.FromIdentity(25); // organizationAccounts[OrganizationFinancialAccountType.DebtsOther] = FinancialAccount.FromIdentity(25); // organizationAccounts[OrganizationFinancialAccountType.AssetsOutboundInvoices] = FinancialAccount.FromIdentity(28); // - organizationAccounts[OrganizationFinancialAccountType.DebtsCapital] = FinancialAccount.FromIdentity(96); // + organizationAccounts[OrganizationFinancialAccountType.DebtsEquity] = FinancialAccount.FromIdentity(96); // organizationAccounts[OrganizationFinancialAccountType.AssetsPaypal] = FinancialAccount.FromIdentity(2); // organizationAccounts[OrganizationFinancialAccountType.CostsYearlyResult] = FinancialAccount.FromIdentity(97); // organizationAccounts[OrganizationFinancialAccountType.AssetsOutstandingCashAdvances] = FinancialAccount.FromIdentity(156); // @@ -137,9 +137,9 @@ namespace Activizr.Logic.Financial get { return this[OrganizationFinancialAccountType.CostsYearlyResult]; } } - public FinancialAccount DebtsCapital + public FinancialAccount DebtsEquity { - get { return this[OrganizationFinancialAccountType.DebtsCapital]; } + get { return this[OrganizationFinancialAccountType.DebtsEquity]; } } public FinancialAccount DebtsExpenseClaims @@ -172,11 +172,6 @@ namespace Activizr.Logic.Financial get { return this[OrganizationFinancialAccountType.DebtsSalary]; } } - public FinancialAccount IncomeGeneral - { - get { return this[OrganizationFinancialAccountType.IncomeGeneral]; } - } - public FinancialAccount IncomeDonations { get { return this[OrganizationFinancialAccountType.IncomeDonations]; } diff --git a/Logic/Financial/YearlyReport.cs b/Logic/Financial/YearlyReport.cs index ddc4d2c9..6f13b4a7 100644 --- a/Logic/Financial/YearlyReport.cs +++ b/Logic/Financial/YearlyReport.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Activizr.Basic.Enums; +using Activizr.Basic.Types; using Activizr.Logic.Structure; namespace Activizr.Logic.Financial @@ -51,6 +52,13 @@ 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 @@ -67,6 +75,60 @@ namespace Activizr.Logic.Financial private FinancialAccountType _accountType; + private void AggregateAccounts() + { + const int assetIdentity = 1000000001; + const int debtIdentity = 1000000002; + const int incomeIdentity = 1000000003; + const int costIdentity = 1000000004; + + Dictionary remapLookup = new Dictionary(); + + remapLookup[FinancialAccountType.Asset] = assetIdentity; + remapLookup[FinancialAccountType.Debt] = debtIdentity; + remapLookup[FinancialAccountType.Income] = incomeIdentity; + remapLookup[FinancialAccountType.Cost] = costIdentity; + + List newRootLevel = new List(); + + int equityIdentity = _treeMap[0][0].Organization.FinancialAccounts.DebtsEquity.Identity; + + if (_accountType == FinancialAccountType.Balance) + { + newRootLevel.Add(FinancialAccount.FromBasic(new BasicFinancialAccount(assetIdentity, "%ASSET_ACCOUNTGROUP%", FinancialAccountType.Asset, 0, 0, 0))); + newRootLevel.Add(FinancialAccount.FromBasic(new BasicFinancialAccount(debtIdentity, "%DEBT_ACCOUNTGROUP%", FinancialAccountType.Debt, 0, 0, 0))); + } + else if (_accountType == FinancialAccountType.Result) + { + newRootLevel.Add(FinancialAccount.FromBasic(new BasicFinancialAccount(incomeIdentity, "%INCOME_ACCOUNTGROUP%", FinancialAccountType.Income, 0, 0, 0))); + newRootLevel.Add(FinancialAccount.FromBasic(new BasicFinancialAccount(costIdentity, "%COST_ACCOUNTGROUP%", FinancialAccountType.Cost, 0, 0, 0))); + } + else + { + throw new InvalidOperationException("AccountType other than Balance or Result passed to YearlyReport.AggregateAccounts()"); + } + + foreach (FinancialAccount account in _treeMap[0]) + { + if (account.Identity == equityIdentity) + { + newRootLevel.Add(account); + } + else + { + if (!_treeMap.ContainsKey(remapLookup[account.AccountType])) + { + _treeMap[remapLookup[account.AccountType]] = new List(); + } + + _treeMap[remapLookup[account.AccountType]].Add(account); + } + } + + _treeMap[0] = newRootLevel; + } + + private void PopulateTotals() { this.Totals = new YearlyReportNode(); diff --git a/Logic/Structure/Organization.cs b/Logic/Structure/Organization.cs index 65884439..40d6f790 100644 --- a/Logic/Structure/Organization.cs +++ b/Logic/Structure/Organization.cs @@ -245,8 +245,8 @@ namespace Activizr.Logic.Structure FinancialAccount.Create(this.Identity, "ICT and Infrastructure", FinancialAccountType.Cost, 0); FinancialAccounts[OrganizationFinancialAccountType.CostsYearlyResult] = FinancialAccount.Create(this.Identity, "Yearly result", FinancialAccountType.Cost, 0); - FinancialAccounts[OrganizationFinancialAccountType.DebtsCapital] = - FinancialAccount.Create(this.Identity, "Own Capital", FinancialAccountType.Debt, 0); + FinancialAccounts[OrganizationFinancialAccountType.DebtsEquity] = + FinancialAccount.Create(this.Identity, "Equity", FinancialAccountType.Debt, 0); FinancialAccounts[OrganizationFinancialAccountType.DebtsExpenseClaims] = FinancialAccount.Create(this.Identity, "Expense Claims", FinancialAccountType.Debt, 0); FinancialAccounts[OrganizationFinancialAccountType.DebtsInboundInvoices] = @@ -260,17 +260,10 @@ namespace Activizr.Logic.Structure FinancialAccounts[OrganizationFinancialAccountType.DebtsVat] = FinancialAccount.Create(this.Identity, "Outbound Value Added Tax", FinancialAccountType.Debt, 0); - FinancialAccount incomeGeneral = - FinancialAccount.Create(this.Identity, "Income", FinancialAccountType.Income, 0); - - // We need to store this in code because of database lag replication issues when creating children - - // we can't use assume that it's available for reading yet. - - FinancialAccounts[OrganizationFinancialAccountType.IncomeGeneral] = incomeGeneral; FinancialAccounts[OrganizationFinancialAccountType.IncomeDonations] = - FinancialAccount.Create(this.Identity, "Donations", FinancialAccountType.Income, incomeGeneral.Identity); + FinancialAccount.Create(this.Identity, "Donations", FinancialAccountType.Income, 0); FinancialAccounts[OrganizationFinancialAccountType.IncomeSales] = - FinancialAccount.Create(this.Identity, "Sales", FinancialAccountType.Income, incomeGeneral.Identity); + FinancialAccount.Create(this.Identity, "Sales", FinancialAccountType.Income, 0); // Then, create various cost accounts that are probably needed, or that could be used as a starting point @@ -632,7 +625,6 @@ namespace Activizr.Logic.Structure #region class globals - public static readonly int SandboxIdentity = 3; public static readonly int RootIdentity = 5; public static readonly int PPSEid = 1; public static readonly int UPSEid = 2; @@ -647,6 +639,23 @@ namespace Activizr.Logic.Structure get { return FromIdentity(SandboxIdentity); } } + public static int SandboxIdentity + { + get + { + if (Organization.FromIdentity(1).Name.StartsWith("Sandbox")) + { + return 1; + } + else if (Organization.FromIdentity(3).Name.StartsWith("Sandbox")) + { + return 3; + } + + throw new InvalidOperationException("Cannot locate Sandbox organization's identity"); + } + } + public static Organization Root { get { return FromIdentity(RootIdentity); } diff --git a/Site5/App_GlobalResources/Global.resx b/Site5/App_GlobalResources/Global.resx index 1e37841a..81c9c2e1 100644 --- a/Site5/App_GlobalResources/Global.resx +++ b/Site5/App_GlobalResources/Global.resx @@ -213,6 +213,9 @@ Please select a file to upload. Error message. Displayed when the used has clicked "Upload" without selecting a file to upload. + + You are currently logged into <strong>{0}</strong>. Would you like to switch to another organization? + Actions List of shortcuts to likely actions diff --git a/Site5/App_GlobalResources/Pages.Ledgers.resx b/Site5/App_GlobalResources/Pages.Ledgers.resx index d9199c09..c00e4828 100644 --- a/Site5/App_GlobalResources/Pages.Ledgers.resx +++ b/Site5/App_GlobalResources/Pages.Ledgers.resx @@ -120,6 +120,9 @@ Account + + Assets + Balance Sheet for {0}, {0} is the organization name. The year follows immediately. @@ -127,6 +130,9 @@ Current + + Debt + BalanceSheet Must ONLY contain A-Z, a-z characters - nothing accented! @@ -164,10 +170,16 @@ P&L for {0} for The {0} is the organization name. The year number follows this string. + + Costs + ProfitLoss Must ONLY contain A-Z, a-z characters - nothing accented! + + Revenue + The P&L is an overview of income and expenditures, which are grouped by budgets or cost/income type. The sum of all income and expenditure is the yearly result. You may also want to look at the <a href="BalanceSheet.aspx">balance sheet</a> which is the overview of assets and debts. diff --git a/Site5/App_GlobalResources/sv-SE/Controls.Pirates.sv-SE.resx b/Site5/App_GlobalResources/sv-SE/Controls.Pirates.sv-SE.resx new file mode 100644 index 00000000..546a23d2 --- /dev/null +++ b/Site5/App_GlobalResources/sv-SE/Controls.Pirates.sv-SE.resx @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + diff --git a/Site5/App_GlobalResources/sv-SE/Global.sv-SE.resx b/Site5/App_GlobalResources/sv-SE/Global.sv-SE.resx new file mode 100644 index 00000000..8622a3aa --- /dev/null +++ b/Site5/App_GlobalResources/sv-SE/Global.sv-SE.resx @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Site5/App_GlobalResources/Menu5.sv-SE.resx b/Site5/App_GlobalResources/sv-SE/Menu5.sv-SE.resx similarity index 90% rename from Site5/App_GlobalResources/Menu5.sv-SE.resx rename to Site5/App_GlobalResources/sv-SE/Menu5.sv-SE.resx index 6dc11c6b..f2e6e01f 100644 --- a/Site5/App_GlobalResources/Menu5.sv-SE.resx +++ b/Site5/App_GlobalResources/sv-SE/Menu5.sv-SE.resx @@ -1,4 +1,4 @@ - + - - + + - + - - - - + + + + - - + + - - + + - - - - + + + + - + - + @@ -241,13 +241,19 @@ Kontoplan - Granska Huvudbok + Granska Räkenskaper Balansräkning + + Kan inte stänga böcker för {0} + + + Stäng Bokföring För {0} + - Felsök Bokföring/Reskontra + Felsök Bokföring, Konton Importera Bankdata @@ -256,7 +262,7 @@ Lönelista - Resulträkning + Resultaträkning Ange Budgetbelopp @@ -333,4 +339,4 @@ Självregistreringssidan - \ No newline at end of file + diff --git a/Site5/App_GlobalResources/sv-SE/Pages.Finance.sv-SE.resx b/Site5/App_GlobalResources/sv-SE/Pages.Finance.sv-SE.resx new file mode 100644 index 00000000..22e3f64e --- /dev/null +++ b/Site5/App_GlobalResources/sv-SE/Pages.Finance.sv-SE.resx @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Förskottsbelopp (i {0}) + {0} is the currency. + + + Kontonummer + + + Clearingnummer + + + Bankens namn + + + Budget + + + Dina bankuppgifter + + + Om du skall göra ett inköp för organisationen, men behöver pengar i förväg i stället för att hävda dem tillbaka i efteråt, kan du begära ett förskott för specifika ändamål. + + + Begär förskott + + + Syfte + + + Ett förskott har begärts för <strong>{0}</strong> i {1}. Det begärda beloppet är {2} {3:N2}. Observera att detta är ett <strong>lån</strong> från organisationen till dess kvitton har presenterats som matchar förskottet. + {0} is the person receiving the advance, {1} is the entered description. {2} is the currency (in caps) and {3:N2} is the amount, with two decimals, displayed in culture. + + + Detta måste attesteras av budgetägaren, och går sedan till utbetalning. + + + Eftersom detta är din egen budget, så har detta attesterats automatiskt och har gått till utbetalning. + This is displayed if either the person creating the cash advance OR the person receiving it is the budget owner. + + + Skriv in beloppet (i {0}) som du skulle vilja ha i förskott. + {0} is the currency. + + + Ange ditt bankkontonummer. + + + Vänligen ange din banks clearingnummer. + + + Ange bankens namn. + + + Välj en budget att belasta. + + + Vänligen ange syftet med förskottet. + + diff --git a/Site5/App_GlobalResources/Global.sv-SE.resx b/Site5/App_GlobalResources/sv-SE/Pages.Global.sv-SE.resx similarity index 66% rename from Site5/App_GlobalResources/Global.sv-SE.resx rename to Site5/App_GlobalResources/sv-SE/Pages.Global.sv-SE.resx index 5aa2037d..fb7d4f62 100644 --- a/Site5/App_GlobalResources/Global.sv-SE.resx +++ b/Site5/App_GlobalResources/sv-SE/Pages.Global.sv-SE.resx @@ -59,46 +59,46 @@ : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> - - + + - + - - - - + + + + - - + + - - + + - - - - + + + + - + - + @@ -141,24 +141,87 @@ Startsida Title of default page + + Utfall + + + Utfall (prel) + + + Utfall hittills + + + Bokföringskonto + + + Konto + + + Budget + + + Årligt resultat + + + Avbryt + Displayed as cancellation link on changing something + Byta? Link after describing what the user is looking at, allowing a change. - Klicka på bilden för att förstora. + Klicka bilden för att förstora. Displayed where thumbnails can be enlarged modally. + + Bekräfta + Displayed as confirmation link on changing something + + + -- Välj budget/konto -- + Initializer in dropdown box. + + + -- Välj organisation -- + Initializer in dropdown box. + Ta mig dit... Link after describing something. + + Ingen + Displayed when an account/position etc is vacant + + + Ägare + + + Bearbetar fil... + Displayed while processing an uploaded file (along with a progress bar). + + + Ladda Upp Fil + Displayed on "Submit" button next to file upload controls. + + + Ladda Upp Fil Till Activizr + Used as header above upload sections. + + + Välj fil att ladda upp. + Error message. Displayed when the used has clicked "Upload" without selecting a file to upload. + + + Du är inloggad i <strong>{0}</strong>. Vill du växla till en annan organisation? + Genvägar List of shortcuts to likely actions - Inga förslag på åtgärder för stunden. + Inga föreslagna åtgärder just nu. No shortcuts from this page right now. @@ -170,11 +233,11 @@ List of todo items - Inget behöver omedelbar uppmärksamhet. + Inget brådskar just nu. Indicator that nothing needs immediate attention - Här kommer saker som behöver uppmärksamhet. + Saker att göra kommer att finnas här. Placeholder for future action items. Temporary. - \ No newline at end of file + diff --git a/Site5/App_GlobalResources/Pages.Governance.sv-SE.resx b/Site5/App_GlobalResources/sv-SE/Pages.Governance.sv-SE.resx similarity index 60% rename from Site5/App_GlobalResources/Pages.Governance.sv-SE.resx rename to Site5/App_GlobalResources/sv-SE/Pages.Governance.sv-SE.resx index eb8d9e43..27fcca83 100644 --- a/Site5/App_GlobalResources/Pages.Governance.sv-SE.resx +++ b/Site5/App_GlobalResources/sv-SE/Pages.Governance.sv-SE.resx @@ -59,46 +59,46 @@ : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> - - + + - + - - - - + + + + - - + + - - + + - - - - + + + + - + - + @@ -253,137 +253,4 @@ Du läser en motion till mötet In sidebar info box. Meeting name follows in bold. - - Styrelsens rekommendation - First item in dropdown box - - - Avst. - - - Styrelsen - Row header - - - Ändring - Row header - - - Att-satser - Row header - - - # - - - Nej - - - Motivering - Row header - - - Rek. - - - Text - - - Text / Titel - - - Ja - - - Ändringsförslag för {0} - In content box header. The meeting name goes in {0}. - - - Rösta på föreslagna ändringar till motioner. I nästa steg röstar vi om de resulterande motionerna, med de ändringar införda som röstats igenom. Alla ändringsförslag är listade under respektive motion, och alla detaljer finns infällda under motionernas och ändringsförslagens rubriker. Du kan välja en röstningsrekommendation om du vill. - - - Rösta på Ändringsförslag - - - --- - - - NEJ - - - JA - - - Välj rekommendation... - Default in dropdown box - - - Skapa voteringslista? - This becomes a link which folds out to a popup asking "for motions or amendments". - - - Skapa voteringslista för ändringsförslag - In pop-up after clicking "create voting list" - - - Skapa röstlista för personval - In pop-up after clicking "create voting list" - - - Skapa voteringslista för motioner - In pop-up after clicking "create voting list" - - - Ibland håller den här organisationen, {0}, möten. Under dessa möten sker omröstningar. Här listas allt som du kan rösta i. Du kan också skapa röstlistor som andra kan följa när de röstar. - The {0} is the organization name. - - - Personval - - - Sakfrågor - - - Ändringsförslag - - - Motioner - - - Ej öppnad - Keep very short. - - - Öppnar {0:yyyy-MMM-dd}. - Note the embedded date format. Localize to national standard. - - - Rösta - - - Ordningsfrågor - - - Inga ordningsfrågor just nu. - - - Rösta här - Link to voting page - - - Rösta om {0:N0} ändringsförslag: - The {0} is the amendment count. - - - Rösta om {0:N0} motioner: - The {0} is the motion count. - - - Klar, jag röstar så här - Button at end of page - - - Kan Inte Rösta - Testmöte - For Tests Only - - \ No newline at end of file + diff --git a/Site5/App_GlobalResources/sv-SE/Pages.Init.sv-SE.resx b/Site5/App_GlobalResources/sv-SE/Pages.Init.sv-SE.resx new file mode 100644 index 00000000..35bf96b8 --- /dev/null +++ b/Site5/App_GlobalResources/sv-SE/Pages.Init.sv-SE.resx @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + + + diff --git a/Site5/App_GlobalResources/Pages.Ledgers.sv-SE.resx b/Site5/App_GlobalResources/sv-SE/Pages.Ledgers.sv-SE.resx similarity index 68% rename from Site5/App_GlobalResources/Pages.Ledgers.sv-SE.resx rename to Site5/App_GlobalResources/sv-SE/Pages.Ledgers.sv-SE.resx index 2e1311b8..e97944cc 100644 --- a/Site5/App_GlobalResources/Pages.Ledgers.sv-SE.resx +++ b/Site5/App_GlobalResources/sv-SE/Pages.Ledgers.sv-SE.resx @@ -59,46 +59,46 @@ : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> - - + + - + - - - - + + + + - - + + - - + + - - - - + + + + - + - + @@ -117,6 +117,52 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Konto + + + Tillgångar + + + Balansräkning för {0}, + {0} is the organization name. The year follows immediately. + + + Just nu + + + Skulder + + + Balans + Must ONLY contain A-Z, a-z characters - nothing accented! + + + Slut-XXXX + The XXXX is replaced with year number. + + + Balansräkningen är en översikt över tillgångar och skulder vid ett ögonblick i tiden, och används för att se hur resultaten påverkar organisationens övergripande finansiella hälsa. Du kan också titta på <a href="ProfitLossStatement.aspx"> resultaträkningen</a> som är en översikt över inkomster och utgifter. + + + Balansräkning + + + Ändr Q1 + + + Ändr Q2 + + + Ändr Q3 + + + Ändr Q4 + + + Start-XXXX + The XXXX is replaced with year number. + Konto @@ -124,6 +170,16 @@ Resultaträkning för {0} år The {0} is the organization name. The year number follows this string. + + Kostnader + + + Resultat + Must ONLY contain A-Z, a-z characters - nothing accented! + + + Inkomster + Resultaträkningen är en översikt av inkomster och utgifter, och grupperas per budget eller kostnadstyp. Summan av alla inkomster och utgifter är det årliga reulstatet. Du kan också titta på <a href="BalanceSheet.aspx">balansräkningen</a> som är översikten över tillgångar och skulder. @@ -147,9 +203,10 @@ Resultat + Footer on P&L statement - Idag + Hittills i år Year To Date @@ -171,4 +228,32 @@ Spara budgetar Text on submit button - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Site5/App_GlobalResources/sv-SE/Pages.Security.sv-SE.resx b/Site5/App_GlobalResources/sv-SE/Pages.Security.sv-SE.resx new file mode 100644 index 00000000..c2818659 --- /dev/null +++ b/Site5/App_GlobalResources/sv-SE/Pages.Security.sv-SE.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + + diff --git a/Site5/Master-v5.master b/Site5/Master-v5.master index f58060a8..a3f02c38 100644 --- a/Site5/Master-v5.master +++ b/Site5/Master-v5.master @@ -307,7 +307,7 @@ diff --git a/Site5/Pages/v5/Ledgers/CloseLedgers.aspx.cs b/Site5/Pages/v5/Ledgers/CloseLedgers.aspx.cs index 5ceca6c5..c7b6cf3f 100644 --- a/Site5/Pages/v5/Ledgers/CloseLedgers.aspx.cs +++ b/Site5/Pages/v5/Ledgers/CloseLedgers.aspx.cs @@ -108,7 +108,7 @@ public partial class Pages_v5_Ledgers_CloseLedgers : PageV5Base { FinancialTransaction resultTransaction = FinancialTransaction.Create(this.CurrentOrganization.Identity, new DateTime(closingYear, 12, 31, 23, 59, 00), "Årets resultat " + closingYear.ToString()); // TODO: Localize string resultTransaction.AddRow(this.CurrentOrganization.FinancialAccounts.CostsYearlyResult, -resultsDeltaCents, null); - resultTransaction.AddRow(this.CurrentOrganization.FinancialAccounts.DebtsCapital, -balanceDeltaCents, null); + resultTransaction.AddRow(this.CurrentOrganization.FinancialAccounts.DebtsEquity, -balanceDeltaCents, null); // 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. diff --git a/Site5/Pages/v5/Ledgers/Csv-BalanceData.aspx b/Site5/Pages/v5/Ledgers/Csv-BalanceData.aspx new file mode 100644 index 00000000..810eb821 --- /dev/null +++ b/Site5/Pages/v5/Ledgers/Csv-BalanceData.aspx @@ -0,0 +1 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Csv-BalanceData.aspx.cs" Inherits="Pages_v5_Ledgers_Csv_BalanceData" %> diff --git a/Site5/Pages/v5/Ledgers/Csv-BalanceData.aspx.cs b/Site5/Pages/v5/Ledgers/Csv-BalanceData.aspx.cs new file mode 100644 index 00000000..bd991558 --- /dev/null +++ b/Site5/Pages/v5/Ledgers/Csv-BalanceData.aspx.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Activizr.Basic.Enums; +using Activizr.Logic.Financial; +using Activizr.Logic.Pirates; +using Activizr.Logic.Security; +using Activizr.Logic.Structure; + +public partial class Pages_v5_Ledgers_Csv_BalanceData : System.Web.UI.Page +{ + protected void Page_Load(object sender, EventArgs e) + { + // Current authentication + + string identity = HttpContext.Current.User.Identity.Name; + string[] identityTokens = identity.Split(','); + + string userIdentityString = identityTokens[0]; + string organizationIdentityString = identityTokens[1]; + + int currentUserId = Convert.ToInt32(userIdentityString); + int currentOrganizationId = Convert.ToInt32(organizationIdentityString); + + Person currentUser = Person.FromIdentity(currentUserId); + Authority authority = currentUser.GetAuthority(); + Organization currentOrganization = Organization.FromIdentity(currentOrganizationId); + + // Get culture + + string cultureString = "en-US"; + HttpCookie cookie = Request.Cookies["PreferredCulture"]; + + if (cookie != null) + { + cultureString = cookie.Value; + } + + _renderCulture = new CultureInfo(cultureString); + + // Get current year + + _year = DateTime.Today.Year; + + string yearParameter = Request.QueryString["Year"]; + + if (!string.IsNullOrEmpty(yearParameter)) + { + _year = Int32.Parse(yearParameter); // will throw if non-numeric - don't matter for app + } + + YearlyReport report = YearlyReport.Create(currentOrganization, _year, FinancialAccountType.Result); + + Response.ClearContent(); + Response.ClearHeaders(); + Response.ContentType = "text/plain"; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + Resources.Pages.Ledgers.BalanceSheet_DownloadFileName + _year.ToString(CultureInfo.InvariantCulture) + "-" + DateTime.Today.ToString("yyyyMMdd") + ".csv"); + + Response.Output.WriteLine("\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\",\"{6}\"", Resources.Pages.Ledgers.ProfitLossStatement_AccountName, Resources.Pages.Ledgers.BalanceSheet_StartYear.Replace("XXXX", _year.ToString(CultureInfo.InvariantCulture)), + Resources.Pages.Ledgers.BalanceSheet_Q1, Resources.Pages.Ledgers.BalanceSheet_Q2, Resources.Pages.Ledgers.BalanceSheet_Q3, Resources.Pages.Ledgers.BalanceSheet_Q4, + (_year == DateTime.Today.Year? Resources.Pages.Ledgers.BalanceSheet_Current : Resources.Pages.Ledgers.BalanceSheet_EndYear.Replace("XXXX", _year.ToString(CultureInfo.InvariantCulture)))); + + RecurseCsvReport(report.ReportLines, string.Empty); + + Response.End(); + } + + private int _year = 2012; + private CultureInfo _renderCulture; + + private void RecurseCsvReport(List reportLines, string accountPrefix) + { + foreach (YearlyReportLine line in reportLines) + { + Response.Output.WriteLine("\"{0}{1}\",{2},{3},{4},{5},{6},{7}", + accountPrefix, line.AccountName, + line.AccountValues.PreviousYear / 100.0, + line.AccountValues.Quarters[0] / 100.0, + line.AccountValues.Quarters[1] / 100.0, + line.AccountValues.Quarters[2] / 100.0, + line.AccountValues.Quarters[3] / 100.0, + line.AccountValues.ThisYear / 100.0); + + + if (line.Children.Count > 0) + { + RecurseCsvReport(line.Children, "-" + accountPrefix); + } + } + + } +} \ No newline at end of file diff --git a/Site5/Pages/v5/Ledgers/Json-BalanceSheetData.aspx.cs b/Site5/Pages/v5/Ledgers/Json-BalanceSheetData.aspx.cs index 9cb8b135..b059012a 100644 --- a/Site5/Pages/v5/Ledgers/Json-BalanceSheetData.aspx.cs +++ b/Site5/Pages/v5/Ledgers/Json-BalanceSheetData.aspx.cs @@ -54,6 +54,7 @@ public partial class Pages_v5_Ledgers_Json_BalanceSheetData : System.Web.UI.Page } YearlyReport report = YearlyReport.Create(currentOrganization, _year, FinancialAccountType.Balance); + LocalizeRoot(report.ReportLines); Response.ContentType = "application/json"; @@ -63,6 +64,27 @@ public partial class Pages_v5_Ledgers_Json_BalanceSheetData : System.Web.UI.Page } + + private void LocalizeRoot(List lines) + { + Dictionary localizeMap = new Dictionary(); + + localizeMap["%ASSET_ACCOUNTGROUP%"] = Resources.Pages.Ledgers.BalanceSheet_Assets; + localizeMap["%DEBT_ACCOUNTGROUP%"] = Resources.Pages.Ledgers.BalanceSheet_Debt; + localizeMap["%INCOME_ACCOUNTGROUP%"] = Resources.Pages.Ledgers.ProfitLossStatement_Income; + localizeMap["%COST_ACCOUNTGROUP%"] = Resources.Pages.Ledgers.ProfitLossStatement_Costs; + + foreach (YearlyReportLine line in lines) + { + if (localizeMap.ContainsKey(line.AccountName)) + { + line.AccountName = localizeMap[line.AccountName]; + } + } + } + + + private int _year = 2012; private CultureInfo _renderCulture; diff --git a/Site5/Pages/v5/Ledgers/Json-ProfitLossData.aspx.cs b/Site5/Pages/v5/Ledgers/Json-ProfitLossData.aspx.cs index 78db837f..c51bc67c 100644 --- a/Site5/Pages/v5/Ledgers/Json-ProfitLossData.aspx.cs +++ b/Site5/Pages/v5/Ledgers/Json-ProfitLossData.aspx.cs @@ -54,6 +54,7 @@ public partial class Pages_v5_Ledgers_Json_ProfitLossData : System.Web.UI.Page } YearlyReport report = YearlyReport.Create(currentOrganization, _year, FinancialAccountType.Result); + LocalizeRoot(report.ReportLines); Response.ContentType = "application/json"; @@ -63,6 +64,25 @@ public partial class Pages_v5_Ledgers_Json_ProfitLossData : System.Web.UI.Page } + private void LocalizeRoot(List lines) + { + Dictionary localizeMap = new Dictionary(); + + localizeMap["%ASSET_ACCOUNTGROUP%"] = Resources.Pages.Ledgers.BalanceSheet_Assets; + localizeMap["%DEBT_ACCOUNTGROUP%"] = Resources.Pages.Ledgers.BalanceSheet_Debt; + localizeMap["%INCOME_ACCOUNTGROUP%"] = Resources.Pages.Ledgers.ProfitLossStatement_Income; + localizeMap["%COST_ACCOUNTGROUP%"] = Resources.Pages.Ledgers.ProfitLossStatement_Costs; + + foreach (YearlyReportLine line in lines) + { + if (localizeMap.ContainsKey(line.AccountName)) + { + line.AccountName = localizeMap[line.AccountName]; + } + } + } + + private string WriteFooter (YearlyReportNode totals) { string result = string.Format("\"name\":\"{0}\"", Resources.Pages.Ledgers.ProfitLossStatement_Results); diff --git a/Site5/Tests/TestBookkeepingIntegrity.aspx.cs b/Site5/Tests/TestBookkeepingIntegrity.aspx.cs index 25952620..6befe2ac 100644 --- a/Site5/Tests/TestBookkeepingIntegrity.aspx.cs +++ b/Site5/Tests/TestBookkeepingIntegrity.aspx.cs @@ -37,7 +37,7 @@ public partial class Tests_TestBookkeepingIntegrity : PageV5Base FinancialAccounts resultAccounts = FinancialAccounts.ForOrganization(this.CurrentOrganization, FinancialAccountType.Result); - FinancialAccount ownCapital = this.CurrentOrganization.FinancialAccounts.DebtsCapital; + FinancialAccount ownCapital = this.CurrentOrganization.FinancialAccounts.DebtsEquity; FinancialAccount resultAsNoted = this.CurrentOrganization.FinancialAccounts.CostsYearlyResult; FinancialAccounts balancesWithoutCapital =