diff --git a/Basic/Enums/ObjectOptionalDataType.cs b/Basic/Enums/ObjectOptionalDataType.cs
index 98c2df46..9c6f3c23 100644
--- a/Basic/Enums/ObjectOptionalDataType.cs
+++ b/Basic/Enums/ObjectOptionalDataType.cs
@@ -196,7 +196,7 @@ namespace Activizr.Basic.Enums
///
/// First bookkeeping year of org in Activizr (can set inbound balances for this year only)
///
- OrgFirstBookkeepingYear
+ OrgFirstFiscalYear
}
diff --git a/Logic/Structure/Organization.cs b/Logic/Structure/Organization.cs
index dff16a60..65884439 100644
--- a/Logic/Structure/Organization.cs
+++ b/Logic/Structure/Organization.cs
@@ -151,6 +151,40 @@ namespace Activizr.Logic.Structure
get { return OptionalData.GetOptionalDataBool(ObjectOptionalDataType.OrgEconomyEnabled); }
}
+ public int FirstFiscalYear
+ {
+ get
+ {
+ if (!IsEconomyEnabled)
+ {
+ throw new InvalidOperationException("Cannot request first fiscal year; organization is not economy-enabled");
+ }
+
+ int year = Parameters.FirstFiscalYear;
+
+ if (year < 2000)
+ {
+ if (this.Identity == 1 && this.Name.StartsWith("Piratpartiet"))
+ {
+ OptionalData.SetOptionalDataInt(ObjectOptionalDataType.OrgFirstFiscalYear, 2009);
+ year = 2009;
+ }
+ else if (this.Identity == 2 && this.Name.StartsWith("Europirate Acad"))
+ {
+ OptionalData.SetOptionalDataInt(ObjectOptionalDataType.OrgFirstFiscalYear, 2012);
+ year = 2012;
+ }
+ else if (this.Identity == 1 && this.Name.StartsWith("Sandbox"))
+ {
+ OptionalData.SetOptionalDataInt(ObjectOptionalDataType.OrgFirstFiscalYear, 2012);
+ year = 2012;
+ }
+ }
+
+ return year;
+ }
+ }
+
public Currency Currency
{
get
@@ -209,8 +243,6 @@ namespace Activizr.Logic.Structure
FinancialAccount.Create(this.Identity, "Bank Fees", FinancialAccountType.Cost, 0);
FinancialAccounts[OrganizationFinancialAccountType.CostsInfrastructure] =
FinancialAccount.Create(this.Identity, "ICT and Infrastructure", FinancialAccountType.Cost, 0);
- FinancialAccounts[OrganizationFinancialAccountType.CostsLocalDonationTransfers] =
- FinancialAccount.Create(this.Identity, "Local donations (virtual balancing)", FinancialAccountType.Cost, 0);
FinancialAccounts[OrganizationFinancialAccountType.CostsYearlyResult] =
FinancialAccount.Create(this.Identity, "Yearly result", FinancialAccountType.Cost, 0);
FinancialAccounts[OrganizationFinancialAccountType.DebtsCapital] =
@@ -258,6 +290,10 @@ namespace Activizr.Logic.Structure
OptionalData.SetOptionalDataString(ObjectOptionalDataType.OrgCurrency, currency.Code);
+ // Set current year to first fiscal year
+
+ this.OptionalData.SetOptionalDataInt(ObjectOptionalDataType.OrgFirstFiscalYear, DateTime.Today.Year);
+
// Finally, flag the org as enabled
this.OptionalData.SetOptionalDataBool(ObjectOptionalDataType.OrgEconomyEnabled, true);
diff --git a/Logic/Structure/OrganizationParameters.cs b/Logic/Structure/OrganizationParameters.cs
index ff495626..a58359a0 100644
--- a/Logic/Structure/OrganizationParameters.cs
+++ b/Logic/Structure/OrganizationParameters.cs
@@ -33,6 +33,16 @@ namespace Activizr.Logic.Structure
}
+ public int FirstFiscalYear
+ {
+ get
+ {
+ int year = data.GetOptionalDataInt(ObjectOptionalDataType.OrgFirstFiscalYear);
+ return year;
+ }
+ }
+
+
public int FiscalBooksClosedUntilYear
{
get
diff --git a/Site5/Images/PageIcons/iconshock-coins-cross-40px.png b/Site5/Images/PageIcons/iconshock-coins-cross-40px.png
new file mode 100644
index 00000000..a2d19f3a
Binary files /dev/null and b/Site5/Images/PageIcons/iconshock-coins-cross-40px.png differ
diff --git a/Site5/Pages/v5/Finance/EconomyNotEnabled.aspx b/Site5/Pages/v5/Finance/EconomyNotEnabled.aspx
new file mode 100644
index 00000000..6484f34b
--- /dev/null
+++ b/Site5/Pages/v5/Finance/EconomyNotEnabled.aspx
@@ -0,0 +1,13 @@
+<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="EconomyNotEnabled.aspx.cs" Inherits="Pages_v5_Finance_EconomyNotEnabled" %>
+
+
+
+
+ Economy isn't enabled for this organization
+
+
Economy has not been enabled for this organization. Therefore, financial functions are not available. Contact an organization administrator to enable financial functions.
+
+
+
+
+
diff --git a/Site5/Pages/v5/Finance/EconomyNotEnabled.aspx.cs b/Site5/Pages/v5/Finance/EconomyNotEnabled.aspx.cs
new file mode 100644
index 00000000..0aa10150
--- /dev/null
+++ b/Site5/Pages/v5/Finance/EconomyNotEnabled.aspx.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+public partial class Pages_v5_Finance_EconomyNotEnabled : PageV5Base
+{
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ this.PageTitle = "Economy Not Enabled";
+ this.PageIcon = "iconshock-coins-cross";
+ this.InfoBoxLiteral = "Please contact an organization administrator for assistance.";
+ }
+}
\ No newline at end of file
diff --git a/Site5/Pages/v5/Finance/RequestCashAdvance.aspx.cs b/Site5/Pages/v5/Finance/RequestCashAdvance.aspx.cs
index 092ea4d5..d048d79d 100644
--- a/Site5/Pages/v5/Finance/RequestCashAdvance.aspx.cs
+++ b/Site5/Pages/v5/Finance/RequestCashAdvance.aspx.cs
@@ -11,6 +11,12 @@ public partial class Pages_v5_Finance_RequestCashAdvance : PageV5Base
{
protected void Page_Load(object sender, EventArgs e)
{
+ if (!this.CurrentOrganization.IsEconomyEnabled)
+ {
+ Response.Redirect("/Pages/v5/Finance/EconomyNotEnabled.aspx", true);
+ return;
+ }
+
this.PageTitle = Resources.Pages.Finance.RequestCashAdvance_PageTitle;
this.PageIcon = "iconshock-walletmoney";
this.InfoBoxLiteral = Resources.Pages.Finance.RequestCashAdvance_Info;
diff --git a/Site5/Pages/v5/Ledgers/CloseLedgers.aspx.cs b/Site5/Pages/v5/Ledgers/CloseLedgers.aspx.cs
index f9813164..5ceca6c5 100644
--- a/Site5/Pages/v5/Ledgers/CloseLedgers.aspx.cs
+++ b/Site5/Pages/v5/Ledgers/CloseLedgers.aspx.cs
@@ -44,7 +44,7 @@ public partial class Pages_v5_Ledgers_CloseLedgers : PageV5Base
// First, roll over virtual balances.
- if (true) // if this.CurrentOrganization.Parameters.VirtualBankingEnabled
+ if (false) // if this.CurrentOrganization.Parameters.VirtualBankingEnabled
{
FinancialAccount rootAccount = FinancialAccount.FromIdentity(29); // HACK: Hardcoded account; should be _organization.FinancialAccount.CostsVirtualBankingRoot
FinancialAccount tempAccount = FinancialAccount.FromIdentity(98); // HACK: Hardcoded account; should be _organization.FinancialAccount.AssetsVirtualRollover
diff --git a/Site5/Pages/v5/Ledgers/Json-ProfitLossData.aspx.cs b/Site5/Pages/v5/Ledgers/Json-ProfitLossData.aspx.cs
index d3253ebc..bf029f7e 100644
--- a/Site5/Pages/v5/Ledgers/Json-ProfitLossData.aspx.cs
+++ b/Site5/Pages/v5/Ledgers/Json-ProfitLossData.aspx.cs
@@ -57,6 +57,21 @@ public partial class Pages_v5_Ledgers_Json_ProfitLossData : System.Web.UI.Page
FinancialAccounts accounts = FinancialAccounts.ForOrganization(currentOrganization, FinancialAccountType.Result);
+ // Remove unwanted accounts
+
+ FinancialAccount resultsAccount = currentOrganization.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)
Dictionary> treeMap = new Dictionary>();
diff --git a/Site5/Pages/v5/Ledgers/ProfitLossStatement.aspx b/Site5/Pages/v5/Ledgers/ProfitLossStatement.aspx
index 2e179f5d..e228d9d7 100644
--- a/Site5/Pages/v5/Ledgers/ProfitLossStatement.aspx
+++ b/Site5/Pages/v5/Ledgers/ProfitLossStatement.aspx
@@ -10,27 +10,32 @@
$(document).ready(function () {
$('#tableProfitLoss').treegrid(
- {
- onBeforeExpand: function (foo) {
- $('span.profitlossdata-collapsed-' + foo.id).fadeOut('fast', function () {
- $('span.profitlossdata-expanded-' + foo.id).fadeIn('slow');
- });
- },
-
- onBeforeCollapse: function (foo) {
- $('span.profitlossdata-expanded-' + foo.id).fadeOut('fast', function() {
- $('span.profitlossdata-collapsed-' + foo.id).fadeIn('slow');
- });
- }
- });
+ {
+ onBeforeExpand: function (foo) {
+ $('span.profitlossdata-collapsed-' + foo.id).fadeOut('fast', function () {
+ $('span.profitlossdata-expanded-' + foo.id).fadeIn('slow');
+ });
+ },
+
+ onBeforeCollapse: function (foo) {
+ $('span.profitlossdata-expanded-' + foo.id).fadeOut('fast', function () {
+ $('span.profitlossdata-collapsed-' + foo.id).fadeIn('slow');
+ });
+ }
+ });
+
+ $('#<%=DropYears.ClientID %>').change(function() {
+ var selectedYear = $('#<%=DropYears.ClientID %>').val();
+
+ alert (selectedYear);
+ });
});
-
- P&L for Piratpartiet For Year
+ P&L for Piratpartiet For Year
= firstFiscalYear)
+ {
+ this.DropYears.Items.Add(year.ToString(CultureInfo.InvariantCulture));
+ year--;
+ }
+
+ }
}
}
\ No newline at end of file