Budgets appear to work - committing

This commit is contained in:
Rick Falkvinge
2012-01-17 00:34:11 +00:00
parent 09a2ba8a9e
commit 9a094ed6aa
21 changed files with 356 additions and 107 deletions
+15 -1
View File
@@ -9,7 +9,7 @@ using Activizr.Basic.Enums;
namespace Activizr.Logic.Financial
{
public class FinancialAccount : BasicFinancialAccount, ITreeNode
public class FinancialAccount : BasicFinancialAccount, ITreeNode, IOwnerSettable
{
private FinancialAccount (BasicFinancialAccount basic)
: base(basic)
@@ -82,6 +82,11 @@ namespace Activizr.Logic.Financial
PirateDb.GetDatabase().SetFinancialAccountBudget(this.Identity, year, amount);
}
public void SetBudgetCents (int year, Int64 amount)
{
PirateDb.GetDatabase().SetFinancialAccountBudget(this.Identity, year, amount / 100.0); // TODO: Change db structure to use cents
}
public void SetBudgetMontly (int year, int month, Int64 amountCents)
{
PirateDb.GetDatabase().SetFinancialAccountBudgetMonthly(this.Identity, year, month, amountCents);
@@ -203,5 +208,14 @@ namespace Activizr.Logic.Financial
private ObjectOptionalData _optionalData;
#endregion
#region IOwnerSettable members
public void SetOwner(Person newOwner)
{
this.Owner = newOwner;
}
#endregion
}
}
+1
View File
@@ -65,6 +65,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Financial\ImportedBankData.cs" />
<Compile Include="Pirates\Interfaces.cs" />
<Compile Include="Security\Accesses.cs" />
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Cache\MailTemplateCache.cs" />
+12
View File
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Activizr.Logic.Pirates
{
public interface IOwnerSettable
{
void SetOwner(Person newOwner);
}
}
@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="PersonDetailPopup_ChangePerson" xml:space="preserve">
<value>Change Person...</value>
<comment>Displayed in popup that shows an individual as owner of something</comment>
</data>
<data name="PersonDetailPopup_ChangeTo" xml:space="preserve">
<value>Change to:</value>
<comment>Displayed as header above the person selector when changing person</comment>
</data>
</root>
@@ -141,6 +141,10 @@
<value>Dashboard</value>
<comment>Title of default page</comment>
</data>
<data name="Global_Cancel" xml:space="preserve">
<value>Cancel</value>
<comment>Displayed as cancellation link on changing something</comment>
</data>
<data name="Global_Change" xml:space="preserve">
<value>Change?</value>
<comment>Link after describing what the user is looking at, allowing a change.</comment>
@@ -149,6 +153,10 @@
<value>Click image to enlarge.</value>
<comment>Displayed where thumbnails can be enlarged modally.</comment>
</data>
<data name="Global_Confirm" xml:space="preserve">
<value>Confirm</value>
<comment>Displayed as confirmation link on changing something</comment>
</data>
<data name="Global_DropInits_SelectFinancialAccount" xml:space="preserve">
<value>-- Select bookkeeping account --</value>
<comment>Initializer in dropdown box.</comment>
@@ -13,7 +13,7 @@ namespace Activizr.Controls.Base
{
// Localize
this.LabelSelectLanguage.Text = Resources.Pages.Global.CurrentUserInfo_SelectLanguage.ToUpperInvariant();
this.LabelSelectLanguage.Text = Resources.Global.CurrentUserInfo_SelectLanguage.ToUpperInvariant();
}
protected void LinkDanish_Click(object sender, EventArgs e)
@@ -7,20 +7,20 @@
<div style="padding:10px;overflow:hidden">
<asp:Panel ID="PanelRead" runat="server" Visible="true">
<span style="line-height:150%"><asp:Label ID="LabelPersonName" runat="server" /><br /><asp:Label ID="LabelPersonIdentity" runat="server" /></span><br /><br /><asp:LinkButton runat="server" Text="Set new owner..." ID="ButtonSetNewOwner" Onclick="ButtonSetNewOwner_Click" />
<span style="line-height:150%"><asp:Label ID="LabelPersonName" runat="server" /><br /><asp:Label ID="LabelPersonIdentity" runat="server" /></span><br /><br /><asp:LinkButton runat="server" Text="Change Person LOC..." ID="ButtonSetNew" Onclick="ButtonSetNew_Click" />
</asp:Panel>
<asp:Panel ID="PanelWrite" runat="server" Visible="false">
<span style="line-height:150%"><asp:Label ID="LabelWriteLabel" runat="server" Text="Set new owner:" /><br /><act5:ComboPerson ID="PersonNewOwner" runat="server" OnSelectedPersonChanged="PersonNewOwner_SelectedPersonChanged" /></span><br />
<div style="float:right"><asp:LinkButton ID="ButtonConfirmPerson" runat="server" Text="Confirm" OnClick="ButtonConfirmPerson_Click" Visible="false" /></div>
<asp:LinkButton ID="ButtonCancel" runat="server" Text="Cancel" OnClick="ButtonCancel_Click" />
<span style="line-height:150%"><asp:Label ID="LabelWriteLabel" runat="server" Text="Change to:" /><br /><act5:ComboPerson ID="PersonNew" runat="server" OnSelectedPersonChanged="PersonNew_SelectedPersonChanged" /></span><br />
<div style="float:right"><asp:LinkButton ID="ButtonConfirmPerson" runat="server" Text="Confirm LOC" OnClick="ButtonConfirmPerson_Click" Visible="false" /></div>
<asp:LinkButton ID="ButtonCancel" runat="server" Text="Cancel LOC" OnClick="ButtonCancel_Click" />
</asp:Panel>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ButtonSetNewOwner" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="PersonNewOwner" EventName="SelectedPersonChanged" />
<asp:AsyncPostBackTrigger ControlID="ButtonSetNew" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="PersonNew" EventName="SelectedPersonChanged" />
<asp:AsyncPostBackTrigger ControlID="ButtonCancel" EventName="Click" />
<asp:PostBackTrigger ControlID="ButtonConfirmPerson" />
</Triggers>
@@ -13,6 +13,10 @@ using Activizr.Logic.Pirates;
using Activizr.Logic.Security;
using Telerik.Web.UI;
public delegate void PersonChangedEventHandler(object sender, PersonChangedEventArgs e);
public partial class Controls_v5_PersonDetailPopup : ControlV5Base
{
protected void Page_Load(object sender, EventArgs e)
@@ -25,12 +29,22 @@ public partial class Controls_v5_PersonDetailPopup : ControlV5Base
}
this.LabelPersonName.Style[HtmlTextWriterStyle.FontSize] = "20px";
this.PersonNewOwner.Width = 167;
this.PersonNew.Width = 157;
this.ButtonSetNew.Visible = this.Changeable;
// Localize
this.ButtonSetNew.Text = Resources.Controls.Pirates.PersonDetailPopup_ChangePerson;
this.LabelWriteLabel.Text = Resources.Controls.Pirates.PersonDetailPopup_ChangeTo;
this.ButtonConfirmPerson.Text = Resources.Global.Global_Confirm;
this.ButtonCancel.Text = Resources.Global.Global_Cancel;
}
private Person _person;
public object Cookie { get; set; }
public Person Person
{
@@ -38,7 +52,7 @@ public partial class Controls_v5_PersonDetailPopup : ControlV5Base
{
if (_person == null)
{
return this.PersonNewOwner.SelectedPerson;
return this.PersonNew.SelectedPerson;
}
return _person;
@@ -68,23 +82,14 @@ public partial class Controls_v5_PersonDetailPopup : ControlV5Base
}
public FinancialAccount Account
{
set
{
_account = value;
}
}
public bool Changeable { get; set; }
private FinancialAccount _account;
protected void ButtonSetNewOwner_Click(object sender, EventArgs e)
protected void ButtonSetNew_Click(object sender, EventArgs e)
{
this.PanelRead.Visible = false;
this.PanelWrite.Visible = true;
this.PersonNewOwner.Focus();
this.PersonNew.Focus();
}
public void Reset()
@@ -92,7 +97,7 @@ public partial class Controls_v5_PersonDetailPopup : ControlV5Base
this.PanelWrite.Visible = false;
this.PanelRead.Visible = true;
this.ButtonConfirmPerson.Visible = false;
this.PersonNewOwner.SelectedPerson = null;
this.PersonNew.SelectedPerson = null;
if (ViewState[this.ClientID + "_PersonId"] == null)
{
@@ -105,25 +110,26 @@ public partial class Controls_v5_PersonDetailPopup : ControlV5Base
}
protected void PersonNewOwner_SelectedPersonChanged(object sender, EventArgs e)
protected void PersonNew_SelectedPersonChanged(object sender, EventArgs e)
{
this.ImageAvatar.ImageUrl = this.PersonNewOwner.SelectedPerson.GetSecureAvatarLink(96);
this.ImageAvatar.ImageUrl = this.PersonNew.SelectedPerson.GetSecureAvatarLink(96);
this.ButtonConfirmPerson.Visible = true;
}
protected void ButtonConfirmPerson_Click(object sender, EventArgs e)
{
if (this._account == null)
{
throw new InvalidOperationException("Can't set owner for null account");
}
this._person = this.PersonNew.SelectedPerson;
this._account.Owner = this.PersonNewOwner.SelectedPerson;
this._person = this.PersonNewOwner.SelectedPerson;
IOwnerSettable settableInterface = this.Cookie as IOwnerSettable;
if (settableInterface != null)
{
settableInterface.SetOwner(this._person);
}
if (PersonChanged != null)
{
PersonChanged(this, new EventArgs());
PersonChanged(this, new PersonChangedEventArgs(this.PersonNew.SelectedPerson, this.Cookie));
}
this.LabelPersonName.Text = _person.Name;
@@ -136,6 +142,21 @@ public partial class Controls_v5_PersonDetailPopup : ControlV5Base
Reset();
}
public event EventHandler PersonChanged;
public event PersonChangedEventHandler PersonChanged;
}
public class PersonChangedEventArgs: EventArgs
{
public PersonChangedEventArgs(Person newPerson, object cookie)
{
this.NewPerson = newPerson;
this.Cookie = cookie;
}
public readonly Person NewPerson;
public readonly object Cookie;
}
+9 -9
View File
@@ -12,20 +12,20 @@ public partial class Default : PageV5Base
protected void Page_Load(object sender, EventArgs e)
{
this.PageTitle = Resources.Pages.Global.Dashboard_PageTitle;
this.PageTitle = Resources.Global.Dashboard_PageTitle;
this.PageIcon = "iconshock-steering-wheel";
this.LabelActionListMotions.Text = Resources.Pages.Governance.ListMotions_PageTitle;
this.LabelActionVote.Text = Resources.Pages.Governance.Vote_PageTitle;
this.LabelSidebarInfo.Text = Resources.Pages.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Pages.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Pages.Global.Sidebar_Todo;
this.LabelSidebarInfo.Text = Resources.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Global.Sidebar_Todo;
this.LabelActionItemsHere.Text = Resources.Pages.Global.Sidebar_Todo_Placeholder;
this.LabelGoThere.Text = Resources.Pages.Global.Global_GoThere;
this.LabelDashboardTemporaryContent.Text = Resources.Pages.Global.Dashboard_Main_Temporary;
this.LabelDashboardInfo.Text = Resources.Pages.Global.Dashboard_Info_Temporary;
this.LabelGoThere2.Text = Resources.Pages.Global.Global_GoThere;
this.LabelActionItemsHere.Text = Resources.Global.Sidebar_Todo_Placeholder;
this.LabelGoThere.Text = Resources.Global.Global_GoThere;
this.LabelDashboardTemporaryContent.Text = Resources.Global.Dashboard_Main_Temporary;
this.LabelDashboardInfo.Text = Resources.Global.Dashboard_Info_Temporary;
this.LabelGoThere2.Text = Resources.Global.Global_GoThere;
}
}
+2 -2
View File
@@ -118,8 +118,8 @@ namespace Activizr
this.ImageCultureIndicator.ImageUrl = "~/Images/Flags/" + flagName + ".png";
this.LinkLogout.Text = Resources.Pages.Global.CurrentUserInfo_Logout;
this.LabelPreferences.Text = Resources.Pages.Global.CurrentUserInfo_Preferences;
this.LinkLogout.Text = Resources.Global.CurrentUserInfo_Logout;
this.LabelPreferences.Text = Resources.Global.CurrentUserInfo_Preferences;
if (cultureStringLower != "en-gb" && cultureStringLower != "sv-se" && cultureString.Trim().Length > 0)
{
+4 -4
View File
@@ -36,10 +36,10 @@ namespace Activizr.Pages.Governance
this.LabelText.Text = Resources.Pages.Governance.AddMotion_Text;
this.LabelDecisions.Text = Resources.Pages.Governance.AddMotion_Decisions;
this.LabelSidebarInfo.Text = Resources.Pages.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Pages.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Pages.Global.Sidebar_Todo;
this.LabelActionItemsHere.Text = Resources.Pages.Global.Sidebar_Todo_Placeholder;
this.LabelSidebarInfo.Text = Resources.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Global.Sidebar_Todo;
this.LabelActionItemsHere.Text = Resources.Global.Sidebar_Todo_Placeholder;
this.ButtonAddMotion.Text = Resources.Pages.Governance.AddMotion_SubmitMotion;
@@ -37,10 +37,10 @@ namespace Activizr.Pages.Governance
this.LabelText.Text = Resources.Pages.Governance.AddMotionAmendment_Text;
this.LabelDecision.Text = Resources.Pages.Governance.AddMotionAmendment_Decision;
this.LabelSidebarInfo.Text = Resources.Pages.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Pages.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Pages.Global.Sidebar_Todo;
this.LabelActionItemsHere.Text = Resources.Pages.Global.Sidebar_Todo_Placeholder;
this.LabelSidebarInfo.Text = Resources.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Global.Sidebar_Todo;
this.LabelActionItemsHere.Text = Resources.Global.Sidebar_Todo_Placeholder;
this.ButtonAddMotionAmendment.Text = Resources.Pages.Governance.AddMotionAmendment_SubmitAmendment;
@@ -49,14 +49,14 @@ namespace Activizr.Pages.Governance
private void Localize()
{
this.LabelSidebarInfo.Text = Resources.Pages.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Pages.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Pages.Global.Sidebar_Todo;
this.LabelActionItemsHere.Text = Resources.Pages.Global.Sidebar_Todo_Placeholder;
this.LabelSidebarInfo.Text = Resources.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Global.Sidebar_Todo;
this.LabelActionItemsHere.Text = Resources.Global.Sidebar_Todo_Placeholder;
this.LabelSidebarLookingAt.Text = Resources.Pages.Governance.ListMotions_Sidebar_Info;
this.LabelMeetingName.Text = _meeting.Name;
this.LabelChangeMeeting.Text = Resources.Pages.Global.Global_Change;
this.LabelChangeMeeting.Text = Resources.Global.Global_Change;
LocalizeGrid();
}
+4 -4
View File
@@ -38,10 +38,10 @@ namespace Activizr.Pages.Governance
this.LabelMotionTextLabel.Text = Resources.Pages.Governance.ViewMotion_Text;
this.LabelViewingMotionInfo.Text = Resources.Pages.Governance.ViewMotion_ViewingMotionInfo;
this.LabelSidebarInfo.Text = Resources.Pages.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Pages.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Pages.Global.Sidebar_Todo;
this.LabelActionItemsHere.Text = Resources.Pages.Global.Sidebar_Todo_Placeholder;
this.LabelSidebarInfo.Text = Resources.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Global.Sidebar_Todo;
this.LabelActionItemsHere.Text = Resources.Global.Sidebar_Todo_Placeholder;
// Fill in fields
+4 -4
View File
@@ -18,10 +18,10 @@ namespace Activizr.Pages.Governance
this.PageTitle = Resources.Pages.Governance.Vote_PageTitle;
this.PageIcon = "iconshock-vote";
this.LabelSidebarInfo.Text = Resources.Pages.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Pages.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Pages.Global.Sidebar_Todo;
this.LabelActionItemsHere.Text = Resources.Pages.Global.Sidebar_Todo_Placeholder;
this.LabelSidebarInfo.Text = Resources.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Global.Sidebar_Todo;
this.LabelActionItemsHere.Text = Resources.Global.Sidebar_Todo_Placeholder;
this.LabelActionListMotions.Text = Resources.Pages.Governance.ListMotions_PageTitle;
this.LabelVotingInfo.Text = String.Format(Resources.Pages.Governance.Vote_Info, _currentOrganization.Name);
@@ -70,11 +70,11 @@ namespace Activizr.Pages.Governance
private void Localize()
{
this.LabelActionListMotions.Text = Resources.Pages.Governance.ListMotions_PageTitle;
this.LabelActionItemsHere.Text = Resources.Pages.Global.Sidebar_Todo_Placeholder;
this.LabelActionItemsHere.Text = Resources.Global.Sidebar_Todo_Placeholder;
this.LabelAmendmentsForMeeting.Text = _meeting.Name;
this.LabelSidebarInfo.Text = Resources.Pages.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Pages.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Pages.Global.Sidebar_Todo;
this.LabelSidebarInfo.Text = Resources.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Global.Sidebar_Todo;
this.ButtonSaveVote.Text = Resources.Pages.Governance.VoteAmendments_SaveVote_Temp;
this.LabelInfo.Text = Resources.Pages.Governance.VoteAmendments_Info;
+5 -3
View File
@@ -3,7 +3,9 @@
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
<asp:Content ID="BodyContent" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
<asp:HiddenField ID="HiddenInitOrganizationId" Value="" runat="server" />
<h2><asp:Label ID="LabelRootBudgetHeader" Text="Root Budgets For Org [LOC]" runat="server" /><div style="float:right"><asp:DropDownList ID="DropYears" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropYears_SelectedIndexChanged" /></div></h2>
@@ -15,10 +17,10 @@
<div class="entryfields">
<strong>Budget, Owner [LOC]</strong><br/>
<asp:Repeater ID="RepeaterAccountBudgets" OnItemDataBound="RepeaterAccountBudgets_ItemDataBound" runat="server"><ItemTemplate><asp:HiddenField runat="server" ID="HiddenAccountId" /><asp:TextBox ID="TextBudget" runat="server" Text="Not set" />&nbsp;&nbsp;<span style="border-bottom: dashed 1px #808080;cursor:pointer"><asp:Label ID="LabelBudgetOwner" runat="server" /></span><telerik:RadToolTip ID="ToolTip" runat="server" AnimationDuration="150" AutoCloseDelay="200000" ShowDelay="0"
<asp:Repeater ID="RepeaterAccountBudgets" OnItemDataBound="RepeaterAccountBudgets_ItemDataBound" runat="server"><ItemTemplate><asp:HiddenField runat="server" ID="HiddenAccountId" /><asp:HiddenField runat="server" ID="HiddenCurrentBudget" /><asp:TextBox ID="TextBudget" runat="server" Text="Not set" />&nbsp;&nbsp;<span style="border-bottom: dashed 1px #808080;cursor:pointer"><asp:Label ID="LabelBudgetOwner" runat="server" /></span><telerik:RadToolTip ID="ToolTip" runat="server" AnimationDuration="150" AutoCloseDelay="200000" ShowDelay="0"
EnableShadow="true" HideDelay="1" Width="288px" Height="96px" HideEvent="ManualClose" OffsetX="30" OffsetY="0"
RelativeTo="Element" Animation="Slide" Position="TopCenter" ShowCallout="true" TargetControlID="LabelBudgetOwner" RenderInPageRoot="true" ShowEvent="OnClick"
Skin="Telerik"><act5:PersonDetailPopup runat="server" ID="PersonDetail" /></telerik:RadToolTip><br/></ItemTemplate></asp:Repeater>
Skin="Telerik"><act5:PersonDetailPopup Changeable="true" runat="server" ID="PersonDetail" /></telerik:RadToolTip><br/></ItemTemplate></asp:Repeater>
<asp:TextBox ID="TextYearlyResult" Text="Yearly Result (fill in programmatically)" runat="server" ReadOnly="true" Enabled="false" />&nbsp;<br/>
<asp:Button ID="ButtonSetBudgets" Text="Set New Budgets [LOC]" OnClick="ButtonSetBudgets_Click" runat="server" />&nbsp;
</div>
+87 -24
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
@@ -7,14 +8,31 @@ using Activizr.Basic.Enums;
using Activizr.Logic.Financial;
using Activizr.Logic.Pirates;
using Activizr.Logic.Security;
using Activizr.Logic.Structure;
using Telerik.Web.UI;
public partial class Pages_v5_Ledgers_SetRootBudgets : PageV5Base
{
protected void Page_Init (object sender, EventArgs e)
{
if (Page.IsPostBack)
{
// Create controls, for amounts to be set in Page_Load. This is necessary for events to fire.
// We don't know the year setting here yet.
FinancialAccounts accounts = GetRootLevelResultAccounts();
this.RepeaterAccountBudgets.DataSource = accounts;
this.RepeaterAccountBudgets.DataBind();
}
}
protected void Page_Load(object sender, EventArgs e)
{
this.PageAccessRequired = new Access(_currentOrganization, AccessAspect.Bookkeeping, AccessType.Write);
this.HiddenInitOrganizationId.Value = _currentOrganization.Identity.ToString();
this.PageIcon = "iconshock-moneybag";
this.PageTitle = Resources.Pages.Ledgers.SetRootBudgets_PageTitle;
@@ -29,7 +47,7 @@ public partial class Pages_v5_Ledgers_SetRootBudgets : PageV5Base
{
this.DropYears.Items.Add(new ListItem(currentYear.ToString()));
currentYear--;
} while (accounts[0].GetBudgetCents(currentYear) > 0);
} while (accounts[0].GetTree().GetBudgetSumCents(currentYear) > 0);
this.DropYears.SelectedIndex = 0;
@@ -52,6 +70,9 @@ public partial class Pages_v5_Ledgers_SetRootBudgets : PageV5Base
this.DropYears.Style[HtmlTextWriterStyle.FontWeight] = "bold";
this.ButtonSetBudgets.Style[HtmlTextWriterStyle.MarginTop] = "4px";
this.ButtonSetBudgets.Style[HtmlTextWriterStyle.MarginBottom] = "5px";
this.ButtonSetBudgets.Style[HtmlTextWriterStyle.Padding] = "1px";
RebindTooltips();
}
protected void UpdateYearlyResult(FinancialAccounts rootAccounts)
@@ -62,7 +83,7 @@ public partial class Pages_v5_Ledgers_SetRootBudgets : PageV5Base
foreach (FinancialAccount account in rootAccounts)
{
budgetSum += account.GetTree().GetBudgetSumCents(_year)/100;
actualSum -= account.GetTree().GetDeltaCents(new DateTime(_year,1,1), new DateTime(_year+1, 1, 1))/100; // negative: results accounts are sign reversed
actualSum -= (account.GetTree().GetDeltaCents(new DateTime(_year,1,1), new DateTime(_year+1, 1, 1))+50)/100; // negative: results accounts are sign reversed
}
this.TextYearlyResult.Text = String.Format("{0:N0}", budgetSum);
@@ -106,11 +127,14 @@ public partial class Pages_v5_Ledgers_SetRootBudgets : PageV5Base
FinancialAccount account = (FinancialAccount)item.DataItem;
TextBox textBudget = (TextBox) e.Item.FindControl("TextBudget");
TextBox textBudget = (TextBox) e.Item.FindControl("TextBudget");
textBudget.Text = String.Format("{0:N0}", account.GetTree().GetBudgetSumCents(_year)/100);
textBudget.Style[HtmlTextWriterStyle.TextAlign] = "right";
textBudget.Style[HtmlTextWriterStyle.Width] = "80px";
if (_year > 0) // called from after viewstate parsed
{
textBudget.Text = String.Format("{0:N0}", account.GetTree().GetBudgetSumCents(_year)/100);
textBudget.Style[HtmlTextWriterStyle.TextAlign] = "right";
textBudget.Style[HtmlTextWriterStyle.Width] = "80px";
}
Label labelOwnerName = (Label) e.Item.FindControl("LabelBudgetOwner");
Person accountOwner = account.Owner;
@@ -126,12 +150,12 @@ public partial class Pages_v5_Ledgers_SetRootBudgets : PageV5Base
RadToolTip toolTip = (RadToolTip)e.Item.FindControl("ToolTip");
Controls_v5_PersonDetailPopup personDetail = (Controls_v5_PersonDetailPopup)toolTip.FindControl("PersonDetail");
personDetail.PersonChanged += new EventHandler(PersonDetail_PersonChanged);
personDetail.PersonChanged += new PersonChangedEventHandler(PersonDetail_PersonChanged);
if (!Page.IsPostBack && _authority != null)
{
personDetail.Person = accountOwner;
personDetail.Account = account;
personDetail.Cookie = account;
}
HiddenField hiddenAccountId = (HiddenField) e.Item.FindControl("HiddenAccountId");
@@ -140,23 +164,22 @@ public partial class Pages_v5_Ledgers_SetRootBudgets : PageV5Base
// this.TooltipManager.TargetControls.Add(labelBudgetOwner.ClientID, line.AccountIdentity.ToString(), true);
}
void PersonDetail_PersonChanged(object sender, EventArgs e)
void PersonDetail_PersonChanged(object sender, PersonChangedEventArgs e)
{
// Here, an owner has changed. We need to re-bind the owners column.
/*
FinancialAccounts accounts = _account.Children;
AccountBudgetLines childData = new AccountBudgetLines();
// TODO: This resets the budget amounts to the values in the database, which is not really what we want.
foreach (FinancialAccount account in accounts)
{
childData.Add(new AccountBudgetLine(account, _year));
}
FinancialAccount account = (FinancialAccount) e.Cookie;
account.Owner = e.NewPerson;
this.RepeaterBudgetOwners.DataSource = childData;
this.RepeaterBudgetOwners.DataBind();
FinancialAccounts accounts = GetRootLevelResultAccounts();
RebindTooltips();*/
this.RepeaterAccountBudgets.DataSource = accounts;
this.RepeaterAccountBudgets.DataBind();
RebindTooltips();
}
protected void DropYears_SelectedIndexChanged(object sender, EventArgs e)
@@ -176,8 +199,18 @@ public partial class Pages_v5_Ledgers_SetRootBudgets : PageV5Base
private FinancialAccounts GetRootLevelResultAccounts()
{
FinancialAccount yearlyResult = _currentOrganization.FinancialAccounts.CostsYearlyResult;
FinancialAccounts allAccounts = FinancialAccounts.ForOrganization(_currentOrganization, FinancialAccountType.Result);
Organization org = _currentOrganization;
if (org == null && Page.IsPostBack)
{
// If we're being called from Page_Init to create controls just to catch events, then _currentOrganization won't be set.
// We need to create it temporarily from a hidden field:
org = Organization.FromIdentity(Int32.Parse(Request["ctl00$PlaceHolderMain$HiddenInitOrganizationId"]));
}
FinancialAccount yearlyResult = org.FinancialAccounts.CostsYearlyResult;
FinancialAccounts allAccounts = FinancialAccounts.ForOrganization(org, FinancialAccountType.Result);
// Select root accounts
@@ -207,7 +240,7 @@ public partial class Pages_v5_Ledgers_SetRootBudgets : PageV5Base
FinancialAccount account = FinancialAccount.FromIdentity(Int32.Parse(hiddenAccountId.Value));
personDetail.Person = account.Owner;
personDetail.Account = account;
personDetail.Cookie = child;
}
}
@@ -224,14 +257,44 @@ public partial class Pages_v5_Ledgers_SetRootBudgets : PageV5Base
Label labelActuals = (Label) e.Item.FindControl("LabelAccountActuals");
Int64 actuals = account.GetTree().GetDeltaCents(new DateTime(_year, 1, 1), new DateTime(_year + 1, 1, 1))/
Int64 actuals = (account.GetTree().GetDeltaCents(new DateTime(_year, 1, 1), new DateTime(_year + 1, 1, 1))+50)/
100;
labelActuals.Text = String.Format("{0:N0}", -actuals); // negative as results accounts are sign reversed
}
protected void ButtonSetBudgets_Click(object sender, EventArgs e)
{
throw new NotImplementedException();
foreach (RepeaterItem repeaterItem in this.RepeaterAccountBudgets.Items)
{
HiddenField hiddenAccountId = (HiddenField) repeaterItem.FindControl("HiddenAccountId");
TextBox textBudget = (TextBox) repeaterItem.FindControl("TextBudget");
FinancialAccount account = FinancialAccount.FromIdentity(Int32.Parse(hiddenAccountId.Value));
// TODO: Possible race condition here, fix with HiddenField
Int64 newBudgetAmount = Int64.Parse(textBudget.Text.Replace(",","").Replace(" ",""), Thread.CurrentThread.CurrentCulture); // TODO: May throw -- catch and send error message
Int64 currentBudgetAmount = account.GetTree().GetBudgetSumCents(_year)/100;
// Set the new amount to the difference between the single budget of this account and the intended amount
if (newBudgetAmount != currentBudgetAmount)
{
account.SetBudgetCents(_year,
account.GetBudgetCents(_year) + (newBudgetAmount - currentBudgetAmount)*100);
}
}
// After updating budgets, rebind repeater
FinancialAccounts accounts = GetRootLevelResultAccounts();
UpdateYearlyResult(accounts);
this.RepeaterAccountBudgets.DataSource = accounts;
this.RepeaterAccountBudgets.DataBind();
}
}
+10 -10
View File
@@ -33,22 +33,22 @@ namespace Activizr.Site.Pages.Ledgers
{
// Localize
this.LabelSidebarInfo.Text = Resources.Pages.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Pages.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Pages.Global.Sidebar_Todo;
this.LabelSidebarInfo.Text = Resources.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Global.Sidebar_Todo;
this.LabelDownloadInstructions.Text = Resources.Pages.Ledgers.UploadBankFiles_DownloadInstructions;
this.LabelClickImage.Text = Resources.Pages.Global.Global_ClickImageToEnlarge;
this.LabelClickImage.Text = Resources.Global.Global_ClickImageToEnlarge;
this.LabelUploadBankFilesInfo.Text = Resources.Pages.Ledgers.UploadBankFiles_Info;
this.LabelActionItemsHere.Text = Resources.Pages.Global.Sidebar_Todo_Placeholder;
this.LabelActionItemsHere.Text = Resources.Global.Sidebar_Todo_Placeholder;
this.LabelSelectBankAndAccount.Text = Resources.Pages.Ledgers.UploadBankFiles_SelectBankAndAccount;
this.LabelSelectFileType.Text = Resources.Pages.Ledgers.UploadBankFiles_SelectBankFileType;
this.LabelSelectAccount.Text = Resources.Pages.Ledgers.UploadBankFiles_SelectAccount;
this.LabelUploadH2Header.Text = Resources.Pages.Ledgers.UploadBankFiles_UploadBankFile;
this.LabelUploadH3Header.Text = Resources.Pages.Global.Global_UploadFileToActivizr;
this.Upload.Text = Resources.Pages.Global.Global_UploadFile;
this.LabelProcessing.Text = Resources.Pages.Global.Global_ProcessingFile;
this.LabelUploadH3Header.Text = Resources.Global.Global_UploadFileToActivizr;
this.Upload.Text = Resources.Global.Global_UploadFile;
this.LabelProcessing.Text = Resources.Global.Global_ProcessingFile;
this.LinkUploadAnother.Text = Resources.Pages.Ledgers.UploadBankFiles_UploadAnother;
this.LabelModalInstructionHeader.Text = Resources.Pages.Ledgers.UploadBankFiles_BankScreenshot;
@@ -176,7 +176,7 @@ namespace Activizr.Site.Pages.Ledgers
FinancialAccountType.Asset);
this.DropAccounts.Items.Clear();
this.DropAccounts.Items.Add(Resources.Pages.Global.Global_DropInits_SelectFinancialAccount);
this.DropAccounts.Items.Add(Resources.Global.Global_DropInits_SelectFinancialAccount);
foreach (FinancialAccount account in accounts)
{
@@ -300,7 +300,7 @@ namespace Activizr.Site.Pages.Ledgers
{
// If no file was uploaded, re-show the instructions div
this.LabelNoFileUploaded.Text = Resources.Pages.Global.Global_Upload_ErrorSelectFile;
this.LabelNoFileUploaded.Text = Resources.Global.Global_Upload_ErrorSelectFile;
this.LiteralDivInstructionsStyle.Text = @"style='display:inline'";
}
else
+1 -1
View File
@@ -12,7 +12,7 @@ public partial class Security_AccessDenied : PageV5Base
this.PageIcon = "iconshock-disconnect";
this.LabelAccessDeniedHeader.Text = Resources.Pages.Security.AccessDenied_Header;
this.LabelSidebarInfo.Text = Resources.Pages.Global.Sidebar_Information;
this.LabelSidebarInfo.Text = Resources.Global.Sidebar_Information;
this.LabelAccessDeniedInfo.Text = Resources.Pages.Security.AccessDenied_Info;
this.LiteralAccessDeniedRant.Text = String.Format(Resources.Pages.Security.AccessDenied_Rant, _currentOrganization.Name);
}