diff --git a/Basic/Enums/OrganizationFinancialAccountType.cs b/Basic/Enums/OrganizationFinancialAccountType.cs index 684c9400..69bf97de 100644 --- a/Basic/Enums/OrganizationFinancialAccountType.cs +++ b/Basic/Enums/OrganizationFinancialAccountType.cs @@ -24,6 +24,14 @@ namespace Swarmops.Basic.Enums /// AssetsPaypal, /// + /// Assets held in bitcoin (if any), immediately accessible. + /// + AssetsBitcoinHot, + /// + /// Assets held in bitcoin cold storage (if any). + /// + AssetsBitcoinCold, + /// /// Any outstanding cash advances that have been paid out and not cleared against receipts or paid back /// AssetsOutstandingCashAdvances, @@ -80,6 +88,10 @@ namespace Swarmops.Basic.Enums /// CostsBankFees, /// + /// Gains from currency fluctuation (typically bitcoin or altcoins). + /// + IncomeCurrencyFluctuations, + /// /// IT and such - default SMS charges, etc, here /// CostsInfrastructure, @@ -92,6 +104,10 @@ namespace Swarmops.Basic.Enums /// CostsAllocatedFunds, /// + /// Losses from currency fluctuation (typically bitcoin or altcoins). + /// + CostsCurrencyFluctuations, + /// /// When closing books, this is the yearly result (balanced against DebtsEquity) /// CostsYearlyResult, // multi-account type diff --git a/Logic/Financial/FinancialAccounts.cs b/Logic/Financial/FinancialAccounts.cs index a167e351..a7078587 100644 --- a/Logic/Financial/FinancialAccounts.cs +++ b/Logic/Financial/FinancialAccounts.cs @@ -103,7 +103,7 @@ namespace Swarmops.Logic.Financial public static FinancialAccounts GetTree(FinancialAccount rootAccount) { - Dictionary nodes = GetHashedAccounts(); + Dictionary nodes = GetHashedAccounts(rootAccount.Organization); return GetTree(nodes, rootAccount.Identity, 0); } @@ -161,7 +161,7 @@ namespace Swarmops.Logic.Financial return result; } - protected static Dictionary GetHashedAccounts() + public static Dictionary GetHashedAccounts(Organization organization) { // This generates a Dictionary >. // @@ -173,7 +173,7 @@ namespace Swarmops.Logic.Financial Dictionary result = new Dictionary(); - FinancialAccounts allAccounts = FromArray(SwarmDb.GetDatabaseForReading().GetFinancialAccountsForOrganization(Organization.PPSEid)); // HACK HACK HACK + FinancialAccounts allAccounts = FromArray(SwarmDb.GetDatabaseForReading().GetFinancialAccountsForOrganization(organization.Identity)); // Add the nodes. @@ -187,12 +187,11 @@ namespace Swarmops.Logic.Financial // Add the children. + result[0] = new FinancialAccounts(); // for the root-level accounts + foreach (FinancialAccount account in allAccounts) { - if (account.ParentIdentity != 0) - { - result[account.ParentIdentity].Add(account); - } + result[account.ParentIdentity].Add(account); } return result; diff --git a/Logic/Structure/Organization.cs b/Logic/Structure/Organization.cs index 1f92a807..f1900f10 100644 --- a/Logic/Structure/Organization.cs +++ b/Logic/Structure/Organization.cs @@ -233,8 +233,12 @@ namespace Swarmops.Logic.Structure FinancialAccount.Create(this.Identity, "Outbound Invoices", FinancialAccountType.Asset, 0); FinancialAccounts[OrganizationFinancialAccountType.AssetsOutstandingCashAdvances] = FinancialAccount.Create(this.Identity, "Cash Advances", FinancialAccountType.Asset, 0); - FinancialAccounts[OrganizationFinancialAccountType.AssetsPaypal] = - FinancialAccount.Create(this.Identity, "Paypal Account", FinancialAccountType.Asset, 0); + //FinancialAccounts[OrganizationFinancialAccountType.AssetsPaypal] = + // FinancialAccount.Create(this.Identity, "Paypal Account", FinancialAccountType.Asset, 0); + //FinancialAccounts[OrganizationFinancialAccountType.AssetsBitcoinHot] = + // FinancialAccount.Create(this.Identity, "Bitcoin Holdings (Hot)", FinancialAccountType.Asset, 0); + //FinancialAccounts[OrganizationFinancialAccountType.AssetsBitcoinCold] = + // FinancialAccount.Create(this.Identity, "Bitcoin Cold Storage", FinancialAccountType.Asset, 0); FinancialAccounts[OrganizationFinancialAccountType.AssetsVat] = FinancialAccount.Create(this.Identity, "Inbound Value Added Tax", FinancialAccountType.Asset, 0); FinancialAccounts[OrganizationFinancialAccountType.CostsAllocatedFunds] = diff --git a/Site5/App_GlobalResources/Pages.Ledgers.resx b/Site5/App_GlobalResources/Pages.Ledgers.resx index c1c00288..e4977e29 100644 --- a/Site5/App_GlobalResources/Pages.Ledgers.resx +++ b/Site5/App_GlobalResources/Pages.Ledgers.resx @@ -117,6 +117,15 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Create new root account + + + This is the overview of the financial accounts in your bookkeeping ledger. You can do some maintenance from here, even if most of the daily operations should be delegated to the budget owners. + + + Account Plan + Account diff --git a/Site5/Images/PageIcons/iconshock-openbook-16px.png b/Site5/Images/PageIcons/iconshock-openbook-16px.png new file mode 100644 index 00000000..da1aa51e Binary files /dev/null and b/Site5/Images/PageIcons/iconshock-openbook-16px.png differ diff --git a/Site5/Images/PageIcons/iconshock-openbook-40px.png b/Site5/Images/PageIcons/iconshock-openbook-40px.png new file mode 100644 index 00000000..1d5a670b Binary files /dev/null and b/Site5/Images/PageIcons/iconshock-openbook-40px.png differ diff --git a/Site5/Master-v5.master b/Site5/Master-v5.master index 96553fb8..015642a7 100644 --- a/Site5/Master-v5.master +++ b/Site5/Master-v5.master @@ -186,7 +186,7 @@ - + diff --git a/Site5/Pages/v5/Ledgers/AccountPlan.aspx b/Site5/Pages/v5/Ledgers/AccountPlan.aspx new file mode 100644 index 00000000..6e9f7b21 --- /dev/null +++ b/Site5/Pages/v5/Ledgers/AccountPlan.aspx @@ -0,0 +1,51 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="AccountPlan.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Ledgers.AccountPlan" %> +<%@ Register TagPrefix="Swarmops5" TagName="ExternalScripts" Src="~/Controls/v5/UI/ExternalScripts.ascx" %> + + + + + + + + +

+ + + + + + + + + + + +
Account NameOwnerBalanceBudgetFlagsEdit
+ +
+ + + + + diff --git a/Site5/Pages/v5/Ledgers/AccountPlan.aspx.cs b/Site5/Pages/v5/Ledgers/AccountPlan.aspx.cs new file mode 100644 index 00000000..ce6c1b0c --- /dev/null +++ b/Site5/Pages/v5/Ledgers/AccountPlan.aspx.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace Swarmops.Frontend.Pages.v5.Ledgers +{ + public partial class AccountPlan : PageV5Base + { + protected void Page_Load(object sender, EventArgs e) + { + if (!this.CurrentOrganization.IsEconomyEnabled) + { + Response.Redirect("/Pages/v5/Financial/EconomyNotEnabled.aspx", true); + return; + } + + this.PageIcon = "iconshock-openbook"; + this.PageTitle = Resources.Pages.Ledgers.AccountPlan_PageTitle; + this.InfoBoxLiteral = Resources.Pages.Ledgers.AccountPlan_Info; + } + } + +} \ No newline at end of file diff --git a/Site5/Pages/v5/Ledgers/BalanceSheet.aspx b/Site5/Pages/v5/Ledgers/BalanceSheet.aspx index cdbc199b..ff20bba5 100644 --- a/Site5/Pages/v5/Ledgers/BalanceSheet.aspx +++ b/Site5/Pages/v5/Ledgers/BalanceSheet.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="BalanceSheet.aspx.cs" Inherits="Pages_v5_Ledgers_BalanceSheet" %> +<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="BalanceSheet.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Ledgers.BalanceSheet" %> <%@ Register src="~/Controls/v5/UI/ExternalScripts.ascx" tagname="ExternalScripts" tagprefix="Swarmops5" %> @@ -86,20 +86,20 @@ animate="true" fitColumns="true" idField="id" treeField="name"> - - - - — - — - — - — - — - — - - - - + + + + — + — + — + — + — + — + + + +

diff --git a/Site5/Pages/v5/Ledgers/BalanceSheet.aspx.cs b/Site5/Pages/v5/Ledgers/BalanceSheet.aspx.cs index fbf5642b..b1808763 100644 --- a/Site5/Pages/v5/Ledgers/BalanceSheet.aspx.cs +++ b/Site5/Pages/v5/Ledgers/BalanceSheet.aspx.cs @@ -6,45 +6,49 @@ using System.Web.UI; using System.Web.UI.WebControls; using System.Globalization; -public partial class Pages_v5_Ledgers_BalanceSheet : PageV5Base +namespace Swarmops.Frontend.Pages.v5.Ledgers { - protected void Page_Load(object sender, EventArgs e) + public partial class BalanceSheet : PageV5Base { - if (!this.CurrentOrganization.IsEconomyEnabled) + protected void Page_Load(object sender, EventArgs e) { - Response.Redirect("/Pages/v5/Financial/EconomyNotEnabled.aspx", true); - return; - } - - this.PageIcon = "iconshock-treasure"; - this.PageTitle = Resources.Pages.Ledgers.BalanceSheet_PageTitle; - this.InfoBoxLiteral = Resources.Pages.Ledgers.BalanceSheet_Info; - - if (!Page.IsPostBack) - { - int year = DateTime.Today.Year; - int firstFiscalYear = CurrentOrganization.FirstFiscalYear; - - while (year >= firstFiscalYear) + if (!this.CurrentOrganization.IsEconomyEnabled) { - this.DropYears.Items.Add(year.ToString(CultureInfo.InvariantCulture)); - year--; + Response.Redirect("/Pages/v5/Financial/EconomyNotEnabled.aspx", true); + return; } - Localize(); + this.PageIcon = "iconshock-treasure"; + this.PageTitle = Resources.Pages.Ledgers.BalanceSheet_PageTitle; + this.InfoBoxLiteral = Resources.Pages.Ledgers.BalanceSheet_Info; + + if (!Page.IsPostBack) + { + int year = DateTime.Today.Year; + int firstFiscalYear = CurrentOrganization.FirstFiscalYear; + + while (year >= firstFiscalYear) + { + this.DropYears.Items.Add(year.ToString(CultureInfo.InvariantCulture)); + year--; + } + + Localize(); + } } + + + private void Localize() + { + this.LabelContentHeader.Text = string.Format(Resources.Pages.Ledgers.BalanceSheet_ContentHeader, + CurrentOrganization.Name); + this.LiteralHeaderQ1.Text = Resources.Pages.Ledgers.BalanceSheet_Q1; + this.LiteralHeaderQ2.Text = Resources.Pages.Ledgers.BalanceSheet_Q2; + this.LiteralHeaderQ3.Text = Resources.Pages.Ledgers.BalanceSheet_Q3; + this.LiteralHeaderQ4.Text = Resources.Pages.Ledgers.BalanceSheet_Q4; + this.LiteralHeaderYtd.Text = Resources.Pages.Ledgers.BalanceSheet_Current; + this.LiteralHeaderAccountName.Text = Resources.Pages.Ledgers.BalanceSheet_AccountName; + } + } - - - private void Localize() - { - this.LabelContentHeader.Text = string.Format(Resources.Pages.Ledgers.BalanceSheet_ContentHeader, CurrentOrganization.Name); - this.LiteralHeaderQ1.Text = Resources.Pages.Ledgers.BalanceSheet_Q1; - this.LiteralHeaderQ2.Text = Resources.Pages.Ledgers.BalanceSheet_Q2; - this.LiteralHeaderQ3.Text = Resources.Pages.Ledgers.BalanceSheet_Q3; - this.LiteralHeaderQ4.Text = Resources.Pages.Ledgers.BalanceSheet_Q4; - this.LiteralHeaderYtd.Text = Resources.Pages.Ledgers.BalanceSheet_Current; - this.LiteralHeaderAccountName.Text = Resources.Pages.Ledgers.BalanceSheet_AccountName; - } - } \ No newline at end of file diff --git a/Site5/Pages/v5/Ledgers/Json-AccountPlanData.aspx b/Site5/Pages/v5/Ledgers/Json-AccountPlanData.aspx new file mode 100644 index 00000000..b05b5a4b --- /dev/null +++ b/Site5/Pages/v5/Ledgers/Json-AccountPlanData.aspx @@ -0,0 +1 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Json-AccountPlanData.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Ledgers.AccountPlanData" %> diff --git a/Site5/Pages/v5/Ledgers/Json-AccountPlanData.aspx.cs b/Site5/Pages/v5/Ledgers/Json-AccountPlanData.aspx.cs new file mode 100644 index 00000000..93ee2327 --- /dev/null +++ b/Site5/Pages/v5/Ledgers/Json-AccountPlanData.aspx.cs @@ -0,0 +1,104 @@ +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 Swarmops.Basic.Enums; +using Swarmops.Logic.Financial; +using Swarmops.Logic.Security; + +namespace Swarmops.Frontend.Pages.v5.Ledgers +{ + public partial class AccountPlanData : DataV5Base + { + protected void Page_Load(object sender, EventArgs e) + { + _authenticationData = GetAuthenticationDataAndCulture(); + _year = DateTime.Today.Year; + + if (!_authenticationData.CurrentUser.HasAccess(new Access(_authenticationData.CurrentOrganization, AccessAspect.Bookkeeping, AccessType.Read))) + { + throw new UnauthorizedAccessException(); + } + + // TODO: Get and cache account tree and account balances + + Response.ContentType = "application/json"; + + string response = string.Empty; + + _hashedAccounts = FinancialAccounts.GetHashedAccounts(_authenticationData.CurrentOrganization); + + response += GetAccountGroup(FinancialAccountType.Asset, Resources.Pages.Ledgers.BalanceSheet_Assets) + ","; + response += GetAccountGroup(FinancialAccountType.Debt, Resources.Pages.Ledgers.BalanceSheet_Debt) + ","; + response += GetAccountGroup(FinancialAccountType.Income, Resources.Pages.Ledgers.ProfitLossStatement_Income) + ","; + response += GetAccountGroup(FinancialAccountType.Cost, Resources.Pages.Ledgers.ProfitLossStatement_Costs); + + Response.Output.WriteLine("[" + response + "]"); + Response.End(); + } + + private int _year = 2012; + private CultureInfo _renderCulture; + private AuthenticationData _authenticationData; + private Dictionary _hashedAccounts; + + + private string GetAccountGroup (FinancialAccountType type, string localizedGroupName) + { + string childrenString = GetAccountsRecurse(type, 0); + + return "{\"id\":\"" + -((int) type) + "\",\"accountName\":\"" + JsonSanitize(localizedGroupName) + + "\",\"state\":\"open\",\"children\":[" + childrenString + "]}"; + } + + private string GetAccountsRecurse (FinancialAccountType accountType, int rootNodeId) + { + List childStrings = new List(); + + if (!_hashedAccounts.ContainsKey(rootNodeId)) + { + return string.Empty; + } + + if (_hashedAccounts [rootNodeId].Count == 1) + { + // No children + + return string.Empty; + } + + foreach (FinancialAccount account in _hashedAccounts[rootNodeId]) + { + if (account.Identity == rootNodeId || account.AccountType != accountType) + { + continue; + } + + string grandChildren = GetAccountsRecurse(accountType, account.Identity); + if (!string.IsNullOrEmpty(grandChildren)) + { + grandChildren = ",\"state\":\"closed\",\"children\":[" + grandChildren + "]"; + } + + + childStrings.Add('{' + String.Format("\"id\":\"{0}\",\"accountName\":\"{1}\"", account.Identity, JsonSanitize(account.Name)) + grandChildren + '}'); + } + + return String.Join(",", childStrings.ToArray()); + } + + private class DisplayedAccount + { + public string Name; + public int Identity; + }; + + private class DisplayedAccounts : List + { + // typedef + }; + } +} \ No newline at end of file diff --git a/Site5/Pages/v5/Ledgers/Json-BalanceSheetData.aspx b/Site5/Pages/v5/Ledgers/Json-BalanceSheetData.aspx index 9c18dd96..30ef0fd0 100644 --- a/Site5/Pages/v5/Ledgers/Json-BalanceSheetData.aspx +++ b/Site5/Pages/v5/Ledgers/Json-BalanceSheetData.aspx @@ -1 +1 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Json-BalanceSheetData.aspx.cs" Inherits="Pages_v5_Ledgers_Json_BalanceSheetData" %> +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Json-BalanceSheetData.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Ledgers.BalanceSheetData" %> diff --git a/Site5/Pages/v5/Ledgers/Json-BalanceSheetData.aspx.cs b/Site5/Pages/v5/Ledgers/Json-BalanceSheetData.aspx.cs index e036a7b1..3c4a0827 100644 --- a/Site5/Pages/v5/Ledgers/Json-BalanceSheetData.aspx.cs +++ b/Site5/Pages/v5/Ledgers/Json-BalanceSheetData.aspx.cs @@ -12,117 +12,131 @@ using Swarmops.Logic.Swarm; using Swarmops.Logic.Security; using Swarmops.Logic.Structure; -public partial class Pages_v5_Ledgers_Json_BalanceSheetData : DataV5Base +namespace Swarmops.Frontend.Pages.v5.Ledgers { - protected void Page_Load(object sender, EventArgs e) + public partial class BalanceSheetData : DataV5Base { - // Get auth data - - _authenticationData = GetAuthenticationDataAndCulture(); - - // Get current year - - _year = DateTime.Today.Year; - - string yearParameter = Request.QueryString["Year"]; - - if (!string.IsNullOrEmpty(yearParameter)) + protected void Page_Load(object sender, EventArgs e) { - _year = Int32.Parse(yearParameter); // will throw if non-numeric - don't matter for app + // Get auth data + + _authenticationData = GetAuthenticationDataAndCulture(); + + // 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(_authenticationData.CurrentOrganization, _year, + FinancialAccountType.Balance); + LocalizeRoot(report.ReportLines); + + Response.ContentType = "application/json"; + + Response.Output.WriteLine(RecurseReport(report.ReportLines)); + + Response.End(); } - YearlyReport report = YearlyReport.Create(_authenticationData.CurrentOrganization, _year, FinancialAccountType.Balance); - LocalizeRoot(report.ReportLines); - - Response.ContentType = "application/json"; - - Response.Output.WriteLine(RecurseReport(report.ReportLines)); - - Response.End(); - } - - private AuthenticationData _authenticationData; + private AuthenticationData _authenticationData; - 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) + private void LocalizeRoot(List lines) { - if (localizeMap.ContainsKey(line.AccountName)) + 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) { - line.AccountName = localizeMap[line.AccountName]; + if (localizeMap.ContainsKey(line.AccountName)) + { + line.AccountName = localizeMap[line.AccountName]; + } } } - } - private int _year = 2012; - private CultureInfo _renderCulture; + private int _year = 2012; + private CultureInfo _renderCulture; - private string RecurseReport(List reportLines) - { - List elements = new List(); - - foreach (YearlyReportLine line in reportLines) + private string RecurseReport(List reportLines) { - string element = string.Format("\"id\":{0},\"name\":\"{1}\"", line.AccountId, - JsonSanitize(line.AccountName)); + List elements = new List(); - if (line.Children.Count > 0) + foreach (YearlyReportLine line in reportLines) { + string element = string.Format("\"id\":{0},\"name\":\"{1}\"", line.AccountId, + JsonSanitize(line.AccountName)); - element += ",\"lastYear\":" + - JsonDualString(line.AccountId, line.AccountTreeValues.PreviousYear, line.AccountValues.PreviousYear); - - for (int quarter = 1; quarter <= 4; quarter++) + if (line.Children.Count > 0) { - element += string.Format(",\"q{0}\":", quarter) + - JsonDualString(line.AccountId, line.AccountTreeValues.Quarters[quarter - 1], line.AccountValues.Quarters[quarter - 1]); + + element += ",\"lastYear\":" + + JsonDualString(line.AccountId, line.AccountTreeValues.PreviousYear, + line.AccountValues.PreviousYear); + + for (int quarter = 1; quarter <= 4; quarter++) + { + element += string.Format(",\"q{0}\":", quarter) + + JsonDualString(line.AccountId, line.AccountTreeValues.Quarters[quarter - 1], + line.AccountValues.Quarters[quarter - 1]); + } + + element += ",\"ytd\":" + + JsonDualString(line.AccountId, line.AccountTreeValues.ThisYear, + line.AccountValues.ThisYear); + + + element += ",\"state\":\"closed\",\"children\":" + RecurseReport(line.Children); + } + else + { + element += string.Format(_renderCulture, ",\"lastYear\":\"{0:N0}\"", + (double) line.AccountValues.PreviousYear/100.0); + + for (int quarter = 1; quarter <= 4; quarter++) + { + element += string.Format(_renderCulture, ",\"q{0}\":\"{1:N0}\"", quarter, + line.AccountValues.Quarters[quarter - 1]/100.0); + } + + element += string.Format(_renderCulture, ",\"ytd\":\"{0:N0}\"", + (double) line.AccountValues.ThisYear/100.0); } - element += ",\"ytd\":" + - JsonDualString(line.AccountId, line.AccountTreeValues.ThisYear, line.AccountValues.ThisYear); - - - element += ",\"state\":\"closed\",\"children\":" + RecurseReport(line.Children); - } - else - { - element += string.Format(_renderCulture, ",\"lastYear\":\"{0:N0}\"", (double)line.AccountValues.PreviousYear / 100.0); - - for (int quarter = 1; quarter <= 4; quarter++) - { - element += string.Format(_renderCulture, ",\"q{0}\":\"{1:N0}\"", quarter, line.AccountValues.Quarters[quarter - 1] / 100.0); - } - - element += string.Format(_renderCulture, ",\"ytd\":\"{0:N0}\"", (double)line.AccountValues.ThisYear / 100.0); + elements.Add("{" + element + "}"); } - elements.Add("{" + element + "}"); + return "[" + String.Join(",", elements.ToArray()) + "]"; } - return "[" + String.Join(",", elements.ToArray()) + "]"; - } - - private string JsonDualString(int accountId, Int64 treeValue, Int64 singleValue) - { - if (treeValue != 0 && singleValue == 0) + private string JsonDualString(int accountId, Int64 treeValue, Int64 singleValue) { - return string.Format(_renderCulture, "\"Σ {1:N0} \"", accountId, treeValue / 100.00); + if (treeValue != 0 && singleValue == 0) + { + return string.Format(_renderCulture, + "\"Σ {1:N0} \"", + accountId, treeValue/100.00); + } + return string.Format(_renderCulture, + "\"Σ {1:N0}{2:N0}\"", + accountId, treeValue/100.0, singleValue/100.0); } - return string.Format(_renderCulture, "\"Σ {1:N0}{2:N0}\"", accountId, treeValue / 100.0, singleValue / 100.0); + + } - - } \ No newline at end of file diff --git a/Site5/Pages/v5/Security/ChangeOrganizations.aspx b/Site5/Pages/v5/Security/ChangeOrganizations.aspx index a69c0967..49330ac2 100644 --- a/Site5/Pages/v5/Security/ChangeOrganizations.aspx +++ b/Site5/Pages/v5/Security/ChangeOrganizations.aspx @@ -7,7 +7,7 @@