Committing more work on P&L
This commit is contained in:
@@ -196,7 +196,7 @@ namespace Activizr.Basic.Enums
|
||||
/// <summary>
|
||||
/// First bookkeeping year of org in Activizr (can set inbound balances for this year only)
|
||||
/// </summary>
|
||||
OrgFirstBookkeepingYear
|
||||
OrgFirstFiscalYear
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -33,6 +33,16 @@ namespace Activizr.Logic.Structure
|
||||
}
|
||||
|
||||
|
||||
public int FirstFiscalYear
|
||||
{
|
||||
get
|
||||
{
|
||||
int year = data.GetOptionalDataInt(ObjectOptionalDataType.OrgFirstFiscalYear);
|
||||
return year;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int FiscalBooksClosedUntilYear
|
||||
{
|
||||
get
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
@@ -0,0 +1,13 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="EconomyNotEnabled.aspx.cs" Inherits="Pages_v5_Finance_EconomyNotEnabled" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
|
||||
<h2>Economy isn't enabled for this organization</h2>
|
||||
|
||||
<img alt="Fail symbol" src="/Images/Icons/iconshock-cross-96px.png" align="left" />Economy has not been enabled for this organization. Therefore, financial functions are not available. Contact an organization administrator to enable financial functions.
|
||||
<div style="clear:both"></div>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderSide" Runat="Server">
|
||||
</asp:Content>
|
||||
|
||||
@@ -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.";
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<int, List<FinancialAccount>> treeMap = new Dictionary<int, List<FinancialAccount>>();
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
|
||||
<div style="float:right"><asp:DropDownList runat="server" ID="DropYears"/></div>
|
||||
<h2>P&L for Piratpartiet For Year</h2>
|
||||
<h2>P&L for Piratpartiet For Year <asp:DropDownList runat="server" ID="DropYears"/></h2>
|
||||
<table id="tableProfitLoss" title="" class="easyui-treegrid" style="width:680px;height:600px"
|
||||
url="Json-ProfitLossData.aspx"
|
||||
rownumbers="false"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
@@ -9,8 +10,27 @@ public partial class Pages_v5_Ledgers_ProfitLossStatement : PageV5Base
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!this.CurrentOrganization.IsEconomyEnabled)
|
||||
{
|
||||
Response.Redirect("/Pages/v5/Finance/EconomyNotEnabled.aspx", true);
|
||||
return;
|
||||
}
|
||||
|
||||
this.PageIcon = "iconshock-abacus";
|
||||
this.PageTitle = Resources.Pages.Ledgers.ProfitLossStatement_PageTitle;
|
||||
this.InfoBoxLiteral = Resources.Pages.Ledgers.ProfitLossStatement_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--;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user