diff --git a/Basic/Types/Financial/BasicFinancialAccount.cs b/Basic/Types/Financial/BasicFinancialAccount.cs index ef2b356e..528ce32c 100644 --- a/Basic/Types/Financial/BasicFinancialAccount.cs +++ b/Basic/Types/Financial/BasicFinancialAccount.cs @@ -7,7 +7,7 @@ namespace Swarmops.Basic.Types.Financial { public BasicFinancialAccount (int financialAccountId, string name, FinancialAccountType accountType, int organizationId, int parentFinancialAccountId, int ownerPersonId, - bool open, int openedYear, int closedYear, bool expensable) + bool open, int openedYear, int closedYear, bool expensable, bool administrative) { this.FinancialAccountId = financialAccountId; this.Name = name; @@ -19,10 +19,11 @@ namespace Swarmops.Basic.Types.Financial this.OpenedYear = openedYear; this.ClosedYear = closedYear; this.Expensable = expensable; + this.Administrative = administrative; } public BasicFinancialAccount (BasicFinancialAccount original) : - this(original.Identity, original.Name, original.AccountType, original.OrganizationId, original.ParentFinancialAccountId, original.OwnerPersonId, original.Open, original.OpenedYear, original.ClosedYear, original.Expensable) + this(original.Identity, original.Name, original.AccountType, original.OrganizationId, original.ParentFinancialAccountId, original.OwnerPersonId, original.Open, original.OpenedYear, original.ClosedYear, original.Expensable, original.Administrative) { // Empty copy constructor } @@ -38,6 +39,7 @@ namespace Swarmops.Basic.Types.Financial public int OpenedYear { get; protected set; } public int ClosedYear { get; protected set; } public bool Expensable { get; protected set; } + public bool Administrative { get; protected set; } #region IHasIdentity Members diff --git a/Database/Database-Financials.cs b/Database/Database-Financials.cs index 94d1fb80..5c8e85c5 100644 --- a/Database/Database-Financials.cs +++ b/Database/Database-Financials.cs @@ -15,7 +15,8 @@ namespace Swarmops.Database { private const string financialAccountFieldSequence = " FinancialAccountId,Name,OrganizationId,AccountType,ParentFinancialAccountId," + // 0-4 - " OwnerPersonId,Open,OpenedYear,ClosedYear,Expensable " + // 5-9 + " OwnerPersonId,Open,OpenedYear,ClosedYear,Expensable," + // 5-9 + " Administrative " + // 10 " FROM FinancialAccounts "; public int CreateFinancialAccount(int pOrganizationId, string pName, FinancialAccountType pAccountType, int pParentFinancialAccountId) @@ -690,8 +691,9 @@ namespace Swarmops.Database int openedYear = reader.GetInt32(7); int closedYear = reader.GetInt32(8); bool expensable = reader.GetBoolean(9); + bool administrative = reader.GetBoolean(10); - return new BasicFinancialAccount(accountId, name, accountType, organizationId, parentFinancialAccountId, ownerPersonId, open, openedYear, closedYear, expensable); + return new BasicFinancialAccount(accountId, name, accountType, organizationId, parentFinancialAccountId, ownerPersonId, open, openedYear, closedYear, expensable, administrative); } private BasicFinancialAccountRow ReadFinancialAccountRowFromDataReader (DbDataReader reader) diff --git a/Site5/App_GlobalResources/Global.resx b/Site5/App_GlobalResources/Global.resx index ce62923e..d2105b7d 100644 --- a/Site5/App_GlobalResources/Global.resx +++ b/Site5/App_GlobalResources/Global.resx @@ -379,4 +379,16 @@ Yes For yes/no options + + Assets + + + Expenses + + + Liabilities + + + Revenue + \ No newline at end of file diff --git a/Site5/App_GlobalResources/Pages.Ledgers.resx b/Site5/App_GlobalResources/Pages.Ledgers.resx index e4977e29..d6d1f032 100644 --- a/Site5/App_GlobalResources/Pages.Ledgers.resx +++ b/Site5/App_GlobalResources/Pages.Ledgers.resx @@ -140,7 +140,7 @@ Current - Debt + Liabilities BalanceSheet @@ -180,7 +180,7 @@ The {0} is the organization name. The year number follows this string. - Costs + Expenses ProfitLoss diff --git a/Site5/Automation/Json-FinancialAccountsTree.aspx b/Site5/Automation/Json-FinancialAccountsTree.aspx new file mode 100644 index 00000000..284bfe9e --- /dev/null +++ b/Site5/Automation/Json-FinancialAccountsTree.aspx @@ -0,0 +1 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Json-FinancialAccountsTree.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Financial.Json_FinancialAccountsTree" %> \ No newline at end of file diff --git a/Site5/Automation/Json-FinancialAccountsTree.aspx.cs b/Site5/Automation/Json-FinancialAccountsTree.aspx.cs new file mode 100644 index 00000000..5d9161ab --- /dev/null +++ b/Site5/Automation/Json-FinancialAccountsTree.aspx.cs @@ -0,0 +1,92 @@ +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.Swarm; +using Swarmops.Logic.Security; +using Swarmops.Logic.Structure; + +namespace Swarmops.Frontend.Pages.v5.Financial +{ + public partial class Json_FinancialAccountsTree : DataV5Base + { + 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> treeMap = new Dictionary>(); + + foreach (FinancialAccount account in accounts) + { + if (account.Identity == excludeId) + { + continue; + } + + if (!treeMap.ContainsKey(account.ParentIdentity)) + { + treeMap[account.ParentIdentity] = new List(); + } + + treeMap[account.ParentIdentity].Add(account); + } + + 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(); + } + + private string RecurseTreeMap(Dictionary> treeMap, int node) + { + List elements = new List(); + + foreach (FinancialAccount account in treeMap[node]) + { + string element = string.Format("\"id\":{0},\"text\":\"{1}\"", account.Identity, + JsonSanitize(account.Name)); + + if (treeMap.ContainsKey(account.Identity)) + { + element += ",\"state\":\"closed\",\"children\":" + RecurseTreeMap(treeMap, account.Identity); + } + + elements.Add("{" + element + "}"); + } + + return "[" + String.Join(",", elements.ToArray()) + "]"; + + } + } +} \ No newline at end of file diff --git a/Site5/Controls/v5/Financial/ComboBudgets.ascx b/Site5/Controls/v5/Financial/ComboBudgets.ascx index 0b1f15e7..b2bea6d9 100644 --- a/Site5/Controls/v5/Financial/ComboBudgets.ascx +++ b/Site5/Controls/v5/Financial/ComboBudgets.ascx @@ -1,4 +1,4 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ComboBudgets.ascx.cs" Inherits="Swarmops.Controls.Financial.BudgetCombo" %> +<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ComboBudgets.ascx.cs" Inherits="Swarmops.Controls.Financial.ComboBudgets" %> + + \ No newline at end of file diff --git a/Site5/Controls/v5/Swarm/ComboPeople.ascx.cs b/Site5/Controls/v5/Swarm/ComboPeople.ascx.cs new file mode 100644 index 00000000..b8c36857 --- /dev/null +++ b/Site5/Controls/v5/Swarm/ComboPeople.ascx.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Swarmops.Logic.Swarm; + +namespace Swarmops.Controls.Financial +{ + public partial class ComboPeople : ControlV5Base + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + public Person Selected { set; protected get; } + + public bool NobodySelected { set; protected get; } + } +} \ No newline at end of file diff --git a/Site5/Controls/v5/Swarm/ComboPerson.ascx b/Site5/Controls/v5/Swarm/ComboPersonObsolete.ascx similarity index 81% rename from Site5/Controls/v5/Swarm/ComboPerson.ascx rename to Site5/Controls/v5/Swarm/ComboPersonObsolete.ascx index bfffeeff..cbc79aa8 100644 --- a/Site5/Controls/v5/Swarm/ComboPerson.ascx +++ b/Site5/Controls/v5/Swarm/ComboPersonObsolete.ascx @@ -1,4 +1,4 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ComboPerson.ascx.cs" Inherits="Swarmops.Controls.Swarm.ComboPerson" %> +<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ComboPersonObsolete.ascx.cs" Inherits="Swarmops.Controls.Swarm.ComboPersonObsolete" %> -<%@ Register Src="~/Controls/v5/Swarm/ComboPerson.ascx" TagName="ComboPerson" TagPrefix="act5" %> +<%@ Register Src="~/Controls/v5/Swarm/ComboPersonObsolete.ascx" TagName="ComboPerson" TagPrefix="act5" %> diff --git a/Site5/Images/Icons/iconshock-warning-24px.png b/Site5/Images/Icons/iconshock-warning-24px.png new file mode 100644 index 00000000..0f4f3c2e Binary files /dev/null and b/Site5/Images/Icons/iconshock-warning-24px.png differ diff --git a/Site5/Pages/v5/Governance/AddMotion.aspx b/Site5/Pages/v5/Governance/AddMotion.aspx index 42874955..76840ae3 100644 --- a/Site5/Pages/v5/Governance/AddMotion.aspx +++ b/Site5/Pages/v5/Governance/AddMotion.aspx @@ -1,6 +1,6 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="AddMotion.aspx.cs" Inherits="Swarmops.Pages.Governance.AddMotion" %> -<%@ Register src="~/Controls/v5/Swarm/ComboPerson.ascx" tagname="ComboPerson" tagprefix="act5" %> +<%@ Register src="~/Controls/v5/Swarm/ComboPersonObsolete.ascx" tagname="ComboPerson" tagprefix="act5" %>