예제 #1
0
        public static FinancialAccounts ForOrganization(Organization organization, FinancialAccountType accountType)
        {
            FinancialAccounts allAccounts = ForOrganization(organization);
            FinancialAccounts result      = new FinancialAccounts();

            Dictionary <FinancialAccountType, bool> lookup = new Dictionary <FinancialAccountType, bool>();

            lookup[accountType] = true;

            if (accountType == FinancialAccountType.Balance || accountType == FinancialAccountType.Unknown)
            {
                lookup[FinancialAccountType.Asset] = true;
                lookup[FinancialAccountType.Debt]  = true;
            }

            if (accountType == FinancialAccountType.Result || accountType == FinancialAccountType.Unknown)
            {
                lookup[FinancialAccountType.Income] = true;
                lookup[FinancialAccountType.Cost]   = true;
            }

            foreach (FinancialAccount account in allAccounts)
            {
                if (lookup.ContainsKey(account.AccountType))
                {
                    result.Add(account);
                }
            }

            return(result);
        }
        private string GetAccountGroup(FinancialAccountType type, string localizedGroupName)
        {
            string childrenString = GetAccountsRecurse(type, 0);

            Int64 projectedResults = _treeBudgetLookup.ContainsKey(_resultAccountId) ? _treeBudgetLookup[_resultAccountId] : 0;

            if (type == FinancialAccountType.Income && projectedResults <= 0) // expected profit or zero
            {
                childrenString += "," + GetProfitLossNode("ProjectedProfit", -projectedResults);
            }
            else if (type == FinancialAccountType.Cost && projectedResults >= 0) // expected loss or zero
            {
                childrenString += "," + GetProfitLossNode("ProjectedLoss", -projectedResults);
            }

            string addString =
                String.Format(
                    "<img class=\\\"IconAdd\\\" accountType=\\\"{0}\\\" src=\\\"/Images/Icons/iconshock-add-16px.png\\\" />",
                    type);

            return("{\"id\":\"" + -((int)type) + "\",\"accountName\":\"<span class=\\\"SpanGroupName\\\">" +
                   JsonSanitize(localizedGroupName) + "</span> (<a class=\\\"LinkAdd\\\" accountType=\\\"" + type +
                   "\\\" href=\\\"#\\\">" + JsonSanitize(Resources.Pages.Ledgers.AccountPlan_AddAccount) +
                   "</a>)\",\"state\":\"open\",\"children\":[" + childrenString + "],\"action\":\"" + addString + "\"}");
        }
예제 #3
0
        private string GetAccountGroup(FinancialAccountType type, string localizedGroupName)
        {
            string childrenString = GetAccountsRecurse(type, 0);

            return("{\"id\":\"" + -((int)type) + "\",\"accountName\":\"" + JsonSanitize(localizedGroupName) +
                   "\",\"state\":\"open\",\"children\":[" + childrenString + "]}");
        }
예제 #4
0
        public IActionResult DeleteConfirmed(int id)
        {
            FinancialAccountType financialAccountType = _context.FinancialAccountType.Single(m => m.ID == id);

            _context.FinancialAccountType.Remove(financialAccountType);
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #5
0
        protected static FinancialAccount Create(int organizationId, string name, FinancialAccountType accountType,
                                                 int parentFinancialAccountId)
        {
            int accountId = SwarmDb.GetDatabaseForWriting()
                            .CreateFinancialAccount(organizationId, name, accountType, parentFinancialAccountId);

            return(FromIdentityAggressive(accountId));
        }
        public ICollection <ContaFinanceira> GetByType(FinancialAccountType type)
        {
            var item = _session
                       .CreateCriteria(typeof(ContaFinanceira))
                       .Add(Restrictions.Eq("Tipo", type))
                       .List <ContaFinanceira>();

            return(item);
        }
예제 #7
0
 private void PopulateAccountTypes()
 {
     this.DropAccountType.Items.Clear();
     for (int i = 1; i < 5; ++i)
     {
         FinancialAccountType t = ((FinancialAccountType[])Enum.GetValues(typeof(FinancialAccountType)))[i];
         this.DropAccountType.Items.Add(new ListItem(t.ToString(), t.ToString()));
     }
 }
예제 #8
0
 public IActionResult Edit(FinancialAccountType financialAccountType)
 {
     if (ModelState.IsValid)
     {
         _context.Update(financialAccountType);
         _context.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(financialAccountType));
 }
        public ContaFinanceira GetByRegister(Cadastro value, FinancialAccountType type)
        {
            ContaFinanceira item = _session
                                   .CreateCriteria(typeof(ContaFinanceira))
                                   .Add(Restrictions.Eq("Cadastro", value))
                                   .Add(Restrictions.Eq("Tipo", type))
                                   .UniqueResult <ContaFinanceira>();

            return(item);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.ContentType = "application/json";
            FinancialAccountType accountType =
                (FinancialAccountType)(Enum.Parse(typeof(FinancialAccountType), Request.QueryString["AccountType"]));

            string accountsJson = string.Empty;

            int excludeId = -1;

            string excludeIdString = Request.QueryString["ExcludeId"];

            if (!String.IsNullOrEmpty(excludeIdString))
            {
                excludeId = Int32.Parse(excludeIdString);
            }

            // Get accounts

            FinancialAccounts accounts = FinancialAccounts.ForOrganization(this.CurrentOrganization, accountType);

            // Build tree (there should be a template for this)

            Dictionary <int, List <FinancialAccount> > treeMap = new Dictionary <int, List <FinancialAccount> >();

            foreach (FinancialAccount account in accounts)
            {
                if (account.Identity == excludeId)
                {
                    continue;
                }

                if (!treeMap.ContainsKey(account.ParentIdentity))
                {
                    treeMap[account.ParentIdentity] = new List <FinancialAccount>();
                }

                treeMap[account.ParentIdentity].Add(account);
            }

            if (treeMap.ContainsKey(0))
            {
                accountsJson = RecurseTreeMap(treeMap, 0);
            }

            accountsJson = "[{\"id\":\"0\",\"text\":\"" +
                           JsonSanitize(Resources.Global.ResourceManager.GetString("Financial_" + accountType.ToString())) +
                           "\",\"state\":\"open\",\"children\":" +
                           accountsJson +
                           "}]";

            Response.Output.WriteLine(accountsJson);

            Response.End();
        }
예제 #11
0
        public static int CreateAccount(string accountType)
        {
            AuthenticationData   authData        = GetAuthenticationDataAndCulture();
            FinancialAccountType accountTypeEnum =
                (FinancialAccountType)Enum.Parse(typeof(FinancialAccountType), accountType);

            FinancialAccount account = FinancialAccount.Create(authData.CurrentOrganization,
                                                               Resources.Pages.Ledgers.AccountPlan_NewAccount, accountTypeEnum, null);

            return(account.Identity);
        }
예제 #12
0
        // GET: FinancialAccountTypes/Edit/5
        public IActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }

            FinancialAccountType financialAccountType = _context.FinancialAccountType.Single(m => m.ID == id);

            if (financialAccountType == null)
            {
                return(HttpNotFound());
            }
            return(View(financialAccountType));
        }
예제 #13
0
    protected void ButtonAdd_Click(object sender, EventArgs e)
    {
        if (!_authority.HasPermission(Permission.CanDoEconomyTransactions, _organizationId, -1, Authorization.Flag.ExactOrganization))
        {
            ScriptManager.RegisterStartupScript(this, Page.GetType(), "getlost",
                                                "alert ('You do not have access to change financial records.');", true);
            return;
        }
        FinancialAccountType pAccountType = (FinancialAccountType)Enum.Parse(typeof(FinancialAccountType), this.DropAccountType.SelectedValue);
        int pParentFinancialAccountId     = Int32.Parse(this.DropAccounts.SelectedValue);

        FinancialAccount.Create(_organizationId, TextAccountName.Text, pAccountType, pParentFinancialAccountId);

        ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind();", true);
    }
예제 #14
0
 public BasicFinancialAccount (int financialAccountId, string name, FinancialAccountType accountType,
                               int organizationId, int parentFinancialAccountId, int ownerPersonId,
                               bool open, int openedYear, int closedYear, bool expensable, bool administrative)
 {
     this.FinancialAccountId = financialAccountId;
     this.Name = name;
     this.AccountType = accountType;
     this.OrganizationId = organizationId;
     this.OwnerPersonId = ownerPersonId;
     this.ParentFinancialAccountId = parentFinancialAccountId;
     this.Open = open;
     this.OpenedYear = openedYear;
     this.ClosedYear = closedYear;
     this.Expensable = expensable;
     this.Administrative = administrative;
 }
예제 #15
0
        public int CreateFinancialAccount(int pOrganizationId, string pName, FinancialAccountType pAccountType, int pParentFinancialAccountId)
        {
            using (DbConnection connection = GetMySqlDbConnection())
            {
                connection.Open();

                DbCommand command = GetDbCommand("CreateFinancialAccount", connection);
                command.CommandType = CommandType.StoredProcedure;

                AddParameterWithName(command, "pOrganizationId", pOrganizationId);
                AddParameterWithName(command, "pName", pName);
                AddParameterWithName(command, "pAccountType", (int)pAccountType);
                AddParameterWithName(command, "pParentFinancialAccountId", pParentFinancialAccountId);

                return Convert.ToInt32(command.ExecuteScalar());
            }
        }
예제 #16
0
 public BasicFinancialAccount(int financialAccountId, string name, FinancialAccountType accountType,
                              int organizationId, int parentFinancialAccountId, int ownerPersonId,
                              bool open, int openedYear, int closedYear, bool active, bool expensable,
                              bool administrative, int linkBackward, int linkForward)
 {
     this.FinancialAccountId = financialAccountId;
     this.Name                     = name;
     this.AccountType              = accountType;
     this.OrganizationId           = organizationId;
     this.OwnerPersonId            = ownerPersonId;
     this.ParentFinancialAccountId = parentFinancialAccountId;
     this.Open                     = open;
     this.OpenedYear               = openedYear;
     this.ClosedYear               = closedYear;
     this.Active                   = active;
     this.Expensable               = expensable;
     this.Administrative           = administrative;
     this.LinkBackward             = linkBackward;
     this.LinkForward              = linkForward;
 }
        private string GetAccountsRecurse(FinancialAccountType accountType, int rootNodeId)
        {
            List <string> childStrings = new List <string>();

            if (!this._hashedAccounts.ContainsKey(rootNodeId))
            {
                return(string.Empty);
            }

            if (this._hashedAccounts[rootNodeId].Count == 1)
            {
                // No children

                return(string.Empty);
            }

            foreach (FinancialAccount account in this._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}\",\"text\":\"{1}\"",
                                     account.Identity,
                                     Server.HtmlEncode(JsonSanitize(account.Name))
                                     ) + grandChildren + '}');
            }

            return(String.Join(",", childStrings.ToArray()));
        }
    public void Populate(Organization organization, FinancialAccountType accountType)
    {
        Controls_v4_FinancialAccountTree tree = (Controls_v4_FinancialAccountTree)this.DropFinancialAccounts.Items[0].FindControl("FinancialAccountTree");

        tree.Populate(organization, accountType);
    }
예제 #19
0
 public static FinancialAccount Create (int organizationId, string name, FinancialAccountType accountType, int parentFinancialAccountId)
 {
     int accountId = SwarmDb.GetDatabaseForWriting().CreateFinancialAccount(organizationId, name, accountType, parentFinancialAccountId);
     return FromIdentityAggressive(accountId);
 }
예제 #20
0
        public static AnnualReport Create(Organization organization, int year, FinancialAccountType accountType)
        {
            AnnualReport report = new AnnualReport();

            report.Organization = organization;
            report.Year         = year;
            report._accountType = accountType;

            // Get accounts

            FinancialAccounts accounts = FinancialAccounts.ForOrganization(organization, accountType);

            // Remove unwanted accounts

            FinancialAccount resultsAccount = organization.FinancialAccounts.CostsYearlyResult;

            foreach (FinancialAccount account in accounts)
            {
                // For now, just remove the "results" account. TODO: Remove inactive accounts, too.

                if (account.Identity == resultsAccount.Identity)
                {
                    accounts.Remove(account);
                    break;
                }
            }

            // Build tree (there should be a template for this)

            report._treeMap = new Dictionary <int, List <FinancialAccount> >();

            foreach (FinancialAccount account in accounts)
            {
                if (!report._treeMap.ContainsKey(account.ParentIdentity))
                {
                    report._treeMap[account.ParentIdentity] = new List <FinancialAccount>();
                }

                report._treeMap[account.ParentIdentity].Add(account);
            }


            FinancialAccounts orderedList = new FinancialAccounts();

            // This list is guaranteed to have parents before children

            report.PopulateOrderedList(orderedList, 0); // recursively add nodes parents-first
            report.PopulateLookups(orderedList);        // populate the lookup tables for results per account
            report.PopulateTotals();

            report.ReportLines = new List <AnnualReportLine>();
            report.RecurseAddLines(report.ReportLines, 0);

            // Aggregate accounts, if appropriate

            if (report._treeMap[0].Count > 3)
            {
                // regroup list

                report.AggregateAccounts();
            }

            return(report);
        }
예제 #21
0
    public void Populate(Organization organization, FinancialAccountType accountType)
    {
        FinancialAccounts accounts = FinancialAccounts.ForOrganization(organization, accountType);

        Populate(accounts);
    }
        private string GetAccountsRecurse(FinancialAccountType accountType, int rootNodeId)
        {
            List <string> childStrings = new List <string>();

            if (!this._hashedAccounts.ContainsKey(rootNodeId))
            {
                return(string.Empty);
            }

            if (this._hashedAccounts[rootNodeId].Count == 1)
            {
                // No children

                return(string.Empty);
            }

            IOrderedEnumerable <FinancialAccount> childAccountsSorted = this._hashedAccounts[rootNodeId].OrderBy(account => account.Name);;

            foreach (FinancialAccount account in childAccountsSorted)
            {
                if (account.Identity == rootNodeId || account.AccountType != accountType || account.Identity == _resultAccountId)
                {
                    continue;
                }

                string ownerString = "&nbsp;";
                if (account.AccountType == FinancialAccountType.Income ||
                    account.AccountType == FinancialAccountType.Cost)
                {
                    if (account.OwnerPersonId != 0)
                    {
                        // TODO: add zoom, write capability

                        ownerString =
                            "<span style=\\\"padding-" + _nearEdge + ":20px;background-repeat:no-repeat;background-position:center " + _nearEdge + ";background-image:url('" +
                            account.Owner.GetSecureAvatarLink(16) + "')\\\">" +
                            JsonSanitize(Server.HtmlEncode(account.Owner.Canonical)) + "</span>";
                    }
                    else
                    {
                        // TODO: add write capability

                        ownerString =
                            "<span style=\\\"padding-" + _nearEdge + ":20px;background-repeat:no-repeat;background-position:center " + _nearEdge + ";background-image:url('/Images/Icons/iconshock-warning-16x12px.png')\\\">" +
                            JsonSanitize(Server.HtmlEncode(Global.Global_NoOwner)) + "</span>";
                    }
                }

                string grandChildren = GetAccountsRecurse(accountType, account.Identity);
                if (!string.IsNullOrEmpty(grandChildren))
                {
                    grandChildren = ",\"state\":\"closed\",\"children\":[" + grandChildren + "]";
                }

                string editString =
                    String.Format(
                        "<img class='IconEdit' accountId='{0}{1}' height='16' width='24' src='/Images/Icons/iconshock-wrench-128x96px-centered.png' />",
                        accountType.ToString().Substring(0, 1), account.Identity);


                childStrings.Add('{' +
                                 String.Format(
                                     "\"id\":\"{0}\",\"accountName\":\"{1}\",\"owner\":\"{2}\",\"balance\":\"{3}\",\"budget\":\"{4}\",\"action\":\"{5}\",\"inactive\":\"{6}\"",
                                     account.Identity,
                                     JsonSanitize(account.Name),
                                     ownerString,
                                     this._hashedAccounts[account.Identity].Count > 1
                                          ? JsonDualString(account.Identity, this._treeBalanceLookup[account.Identity],
                                                           this._singleBalanceLookup[account.Identity])
                                          : (this._singleBalanceLookup[account.Identity] / 100.0).ToString("N0",
                                                                                                           CultureInfo.CurrentCulture),
                                     account.AccountType == FinancialAccountType.Income ||
                                     account.AccountType == FinancialAccountType.Cost
                                          ? this._hashedAccounts[account.Identity].Count > 1
                                              ? (JsonDualString(account.Identity,
                                                                this._treeBudgetLookup[account.Identity],
                                                                this._singleBudgetLookup[account.Identity]))
                                              : (this._singleBudgetLookup[account.Identity] / 100.0).ToString("N0",
                                                                                                              CultureInfo.CurrentCulture)
                                          : string.Empty,
                                     editString,
                                     account.Active? "false":"true"  // reverses condition on purpose
                                     ) + grandChildren + '}');
            }

            return(String.Join(",", childStrings.ToArray()));
        }
예제 #23
0
        private string GetAccountsRecurse(FinancialAccountType accountType, int rootNodeId)
        {
            List <string> childStrings = new List <string>();

            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 ownerString = "&nbsp;";
                if (account.AccountType == FinancialAccountType.Income || account.AccountType == FinancialAccountType.Cost)
                {
                    if (account.OwnerPersonId != 0)
                    {
                        // TODO: add zoom, write capability

                        ownerString =
                            "<span style=\\\"padding-left:20px;background-repeat:no-repeat;background-image:url('" +
                            account.Owner.GetSecureAvatarLink(16) + "')\\\">" +
                            JsonSanitize(Server.HtmlEncode(account.Owner.Canonical)) + "</span>";
                    }
                    else
                    {
                        // TODO: add write capability

                        ownerString =
                            "<span style=\\\"padding-left:20px;background-repeat:no-repeat;background-position:center left;background-image:url('/Images/Icons/iconshock-warning-16x12px.png')\\\">" +
                            JsonSanitize(Server.HtmlEncode(Resources.Global.Global_NoOwner)) + "</span>";
                    }
                }

                string grandChildren = GetAccountsRecurse(accountType, account.Identity);
                if (!string.IsNullOrEmpty(grandChildren))
                {
                    grandChildren = ",\"state\":\"closed\",\"children\":[" + grandChildren + "]";
                }

                string editString = String.Format("<img class=\\\"IconEdit\\\" accountId=\\\"{0}{1}\\\" src=\\\"/Images/Icons/iconshock-wrench-16px.png\\\" />", accountType.ToString().Substring(0, 1), account.Identity);


                childStrings.Add('{' + String.Format("\"id\":\"{0}\",\"accountName\":\"{1}\",\"owner\":\"{2}\",\"balance\":\"{3}\",\"budget\":\"{4}\",\"action\":\"{5}\"",
                                                     account.Identity,
                                                     Server.HtmlEncode(JsonSanitize(account.Name)),
                                                     ownerString,
                                                     _hashedAccounts[account.Identity].Count > 1 ? JsonDualString(account.Identity, _treeBalanceLookup[account.Identity], _singleBalanceLookup[account.Identity]) : (_singleBalanceLookup [account.Identity] / 100.0).ToString("N0"),
                                                     account.AccountType == FinancialAccountType.Income || account.AccountType == FinancialAccountType.Cost?
                                                     _hashedAccounts[account.Identity].Count > 1 ? (JsonDualString(account.Identity, _treeBudgetLookup[account.Identity], _singleBudgetLookup[account.Identity])) :
                                                     (_singleBudgetLookup[account.Identity] / 100.0).ToString("N0") :
                                                     string.Empty,
                                                     editString
                                                     ) + grandChildren + '}');
            }

            return(String.Join(",", childStrings.ToArray()));
        }
예제 #24
0
        public static YearlyReport Create (Organization organization, int year, FinancialAccountType accountType)
        {
            YearlyReport report = new YearlyReport();
            report.Organization = organization;
            report.Year = year;
            report._accountType = accountType;

            // Get accounts

            FinancialAccounts accounts = FinancialAccounts.ForOrganization(organization, accountType);

            // Remove unwanted accounts

            FinancialAccount resultsAccount = organization.FinancialAccounts.CostsYearlyResult;

            foreach (FinancialAccount account in accounts)
            {
                // For now, just remove the "results" account. TODO: Remove inactive accounts, too.

                if (account.Identity == resultsAccount.Identity)
                {
                    accounts.Remove(account);
                    break;
                }
            }

            // Build tree (there should be a template for this)

            report._treeMap = new Dictionary<int, List<FinancialAccount>>();

            foreach (FinancialAccount account in accounts)
            {
                if (!report._treeMap.ContainsKey(account.ParentIdentity))
                {
                    report._treeMap[account.ParentIdentity] = new List<FinancialAccount>();
                }

                report._treeMap[account.ParentIdentity].Add(account);
            }


            FinancialAccounts orderedList = new FinancialAccounts(); // This list is guaranteed to have parents before children

            report.PopulateOrderedList(orderedList, 0);  // recursively add nodes parents-first
            report.PopulateLookups(orderedList);         // populate the lookup tables for results per account
            report.PopulateTotals();

            report.ReportLines = new List<YearlyReportLine>();
            report.RecurseAddLines(report.ReportLines, 0);

            // Aggregate accounts, if appropriate

            if (report._treeMap[0].Count > 3)
            {
                // regroup list

                report.AggregateAccounts();
            }

            return report;
        }
    public void Populate(Organization organization, FinancialAccountType accountType)
    {
        FinancialAccounts accounts = FinancialAccounts.ForOrganization(organization, accountType);

        Populate(accounts);
    }
예제 #26
0
 public static FinancialAccount Create(Organization organization, string newAccountName,
                                       FinancialAccountType accountType, FinancialAccount parentAccount)
 {
     return(Create(organization.Identity, newAccountName, accountType,
                   parentAccount == null ? 0 : parentAccount.Identity));
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.ContentType = "application/json";
            FinancialAccountType accountType =
                (FinancialAccountType)(Enum.Parse(typeof(FinancialAccountType), Request.QueryString["AccountType"]));

            string response = string.Empty;

            int excludeId = -1;

            string excludeIdString = Request.QueryString["ExcludeId"];

            if (!String.IsNullOrEmpty(excludeIdString))
            {
                excludeId = Int32.Parse(excludeIdString);
            }

            int resultsAccountId = CurrentOrganization.FinancialAccounts.CostsYearlyResult.Identity;

            // Get accounts

            FinancialAccounts accounts = FinancialAccounts.ForOrganization(CurrentOrganization, accountType);

            // Build tree (there should be a template for this)

            Dictionary <int, List <FinancialAccount> > treeMap = new Dictionary <int, List <FinancialAccount> >();

            foreach (FinancialAccount account in accounts)
            {
                if (account.Identity == excludeId || account.Identity == resultsAccountId)
                {
                    continue;
                }

                if (!treeMap.ContainsKey(account.ParentIdentity))
                {
                    treeMap[account.ParentIdentity] = new List <FinancialAccount>();
                }

                treeMap[account.ParentIdentity].Add(account);
            }

            this._hashedAccounts = treeMap;

            if (accountType == FinancialAccountType.Asset || accountType == FinancialAccountType.Balance ||
                accountType == FinancialAccountType.All)
            {
                response += GetAccountGroup(FinancialAccountType.Asset, Resources.Global.Financial_Asset) +
                            ",";
            }

            if (accountType == FinancialAccountType.Debt || accountType == FinancialAccountType.Balance ||
                accountType == FinancialAccountType.All)
            {
                response += GetAccountGroup(FinancialAccountType.Debt, Resources.Global.Financial_Debt) + ",";
            }

            if (accountType == FinancialAccountType.Income || accountType == FinancialAccountType.Result ||
                accountType == FinancialAccountType.All)
            {
                response +=
                    GetAccountGroup(FinancialAccountType.Income, Resources.Global.Financial_Income) +
                    ",";
            }

            if (accountType == FinancialAccountType.Cost || accountType == FinancialAccountType.Result ||
                accountType == FinancialAccountType.All)
            {
                response += GetAccountGroup(FinancialAccountType.Cost, Resources.Global.Financial_Cost);
            }

            response = response.TrimEnd(',');
            // removes last comma regardless of where it came from or if it's even there

            Response.Output.WriteLine("[" + response + "]");
            Response.End();
        }
    public void Populate(Organization organization, FinancialAccountType accountType)
    {
        Controls_v4_FinancialAccountTree tree = (Controls_v4_FinancialAccountTree)this.DropFinancialAccounts.Items[0].FindControl("FinancialAccountTree");

        tree.Populate(organization, accountType);
    }