Added localizability to Account Plan

This commit is contained in:
Rick Falkvinge
2014-09-27 16:44:45 +02:00
parent 120522d817
commit 127dd37a9d
5 changed files with 170 additions and 31 deletions
+2 -2
View File
@@ -160,7 +160,7 @@ namespace Swarmops.Logic.Financial
try
{
int yearClosed = this.Organization.Parameters.FiscalBooksClosedUntilYear;
if (this.OpenedYear >= yearClosed)
if (yearClosed > 0 && this.OpenedYear <= yearClosed)
{
throw new InvalidOperationException("Can't reparent an account with transactions in closedledger space");
}
@@ -223,7 +223,7 @@ namespace Swarmops.Logic.Financial
try
{
int yearClosed = this.Organization.Parameters.FiscalBooksClosedUntilYear;
if (this.OpenedYear >= yearClosed)
if (yearClosed > 0 && this.OpenedYear <= yearClosed)
{
throw new InvalidOperationException("Can't rename an account with transactions in closedledger space");
}
+17
View File
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for CommonV5Base
/// </summary>
public class CommonV5Base
{
public CommonV5Base()
{
//
// TODO: Add constructor logic here
//
}
}
+75 -2
View File
@@ -112,10 +112,10 @@
<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>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.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>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="AccountPlan_CreateRootAccount" xml:space="preserve">
<value>Create new root account</value>
@@ -428,4 +428,77 @@
<data name="ViewOutstandingAccounts_PageTitle" xml:space="preserve">
<value>List Unsettled Accounts</value>
</data>
<data name="AccountPlan_Edit_AccountName" xml:space="preserve">
<value>Account name</value>
</data>
<data name="AccountPlan_Edit_ActiveLong" xml:space="preserve">
<value>Is this account open for transactions?</value>
</data>
<data name="AccountPlan_Edit_ActiveShort" xml:space="preserve">
<value>Active</value>
</data>
<data name="AccountPlan_Edit_AdministrativeLong" xml:space="preserve">
<value>Are transactions here excluded from 2-D reports?</value>
</data>
<data name="AccountPlan_Edit_AdministrativeShort" xml:space="preserve">
<value>Admin</value>
</data>
<data name="AccountPlan_Edit_BudgetBalance" xml:space="preserve">
<value>Budget (balance is &lt;span id="SpanTextCurrency"&gt;foo&lt;/span&gt; &lt;span id="SpanEditBalance"&gt;bar&lt;/span&gt;)</value>
<comment>foo, bar replaced on load with actual values</comment>
</data>
<data name="AccountPlan_Edit_ExpensableLong" xml:space="preserve">
<value>Can people use this account for expense reports?</value>
</data>
<data name="AccountPlan_Edit_ExpensableShort" xml:space="preserve">
<value>Expensable</value>
</data>
<data name="AccountPlan_Edit_FileUploadProfile" xml:space="preserve">
<value>File upload profile</value>
</data>
<data name="AccountPlan_Edit_Header" xml:space="preserve">
<value>Editing Account</value>
</data>
<data name="AccountPlan_Edit_HeaderAutomation" xml:space="preserve">
<value>Automation</value>
<comment>Automatic connections to bank, blockchain etc.</comment>
</data>
<data name="AccountPlan_Edit_HeaderConfiguration" xml:space="preserve">
<value>Configuration</value>
</data>
<data name="AccountPlan_Edit_HeaderDailyOperations" xml:space="preserve">
<value>Daily Operations</value>
</data>
<data name="AccountPlan_Edit_InitialValue" xml:space="preserve">
<value>Initial Value</value>
<comment>For asset and liability accounts - the value going into Swarmops first ledger year</comment>
</data>
<data name="AccountPlan_Edit_Owner" xml:space="preserve">
<value>Owner</value>
</data>
<data name="AccountPlan_Edit_Parent" xml:space="preserve">
<value>Parent account or group</value>
</data>
<data name="AccountPlan_ExpensesBudgetsAreNegaive" xml:space="preserve">
<value>This is an Expenses account. Such accounts normally have a budget in the negative, since they drain assets from the organization. Your proposed budget was changed to negative.</value>
<comment>Displayed as a message box</comment>
</data>
<data name="AccountPlan_Header_AccountName" xml:space="preserve">
<value>Account</value>
</data>
<data name="AccountPlan_Header_Balance" xml:space="preserve">
<value>Balance</value>
</data>
<data name="AccountPlan_Header_Budget" xml:space="preserve">
<value>Budget</value>
</data>
<data name="AccountPlan_Header_Edit" xml:space="preserve">
<value>Edit</value>
</data>
<data name="AccountPlan_Header_Flags" xml:space="preserve">
<value>Flags</value>
</data>
<data name="AccountPlan_Header_Owner" xml:space="preserve">
<value>Owner</value>
</data>
</root>
+39 -23
View File
@@ -104,6 +104,22 @@
$(this).parent().css('box-shadow', '0 0 1px 0 #FFFFC0');
var callParameters = "{'accountId': '" + escape(accountId) + "', 'switchName':'" + $(this).attr("rel") + "','switchValue':'" + $(this).prop('checked') + "'}";
// If changing Active, set Expensable.Enabled to Active.Checked. If false, set Expensable.Checked to false, too
if ($(this).attr("rel") == "Active") {
if (!$(this).prop('checked')) {
$("#CheckAccountExpensable").prop("checked", false).change();
}
}
// If changing Expensable to true, make sure that Active is true, too
if ($(this).attr("rel") == "Expensable") {
if ($(this).prop('checked')) {
$("#CheckAccountActive").prop("checked", true).change();
}
}
$.ajax({
type: "POST",
url: "AccountPlan.aspx/SetAccountSwitch",
@@ -258,7 +274,7 @@
}
if (accountType == 'C' && newAccountBudget[0] != '-') {
alertify.alert("This is an Expenses account. Such accounts normally have a budget in the negative, since they drain assets from the organization. Your proposed budget was changed to negative.");
alertify.alert('<asp:Literal ID="LiteralExpensesBudgetsAreNegative" runat="server" />');
newAccountBudget = "-" + newAccountBudget;
}
@@ -426,12 +442,12 @@
idField="id" treeField="accountName">
<thead>
<tr>
<th field="accountName" width="240"><asp:Literal ID="LiteralHeaderAccountName" runat="server"/>Account Name</th>
<th field="owner" width="160" align="left">Owner</th>
<th field="balance" width="80" align="right">Balance</th>
<th field="budget" width="80" align="right">Budget</th>
<th field="class" width="65" align="center">Flags</th>
<th field="action" width="40" align="center">Edit</th>
<th field="accountName" width="240"><asp:Literal ID="LiteralHeaderAccountName" runat="server"/></th>
<th field="owner" width="160" align="left"><asp:Literal ID="LiteralHeaderOwner" runat="server"/></th>
<th field="balance" width="80" align="right"><asp:Literal ID="LiteralHeaderBalance" runat="server"/></th>
<th field="budget" width="80" align="right"><asp:Literal ID="LiteralHeaderBudget" runat="server"/></th>
<th field="class" width="65" align="center"><asp:Literal ID="LiteralHeaderFlags" runat="server"/></th>
<th field="action" width="40" align="center"><asp:Literal ID="LiteralHeaderEdit" runat="server"/></th>
</tr>
</thead>
</table>
@@ -440,32 +456,32 @@
<div id="divModalCover" class="modalcover">
<div id="divModalBox" class="box modal">
<div class="content">
<div style="float:right;margin-top: 2px;margin-right: -5px"><img id="IconCloseEdit" src="/Images/Icons/iconshock-cross-16px.png" /></div><h2 id="HeaderModal">Editing account</h2>
<div style="float:right;margin-top: 2px;margin-right: -5px"><img id="IconCloseEdit" src="/Images/Icons/iconshock-cross-16px.png" /></div><h2 id="HeaderModal"><asp:Literal ID="LiteralHeaderEditingAccount" runat="server"/></h2>
<div id="DivModalFields" class="entryFields"><input type="text" id="TextAccountName" />&nbsp;<br />
<Swarmops5:ComboBudgets ID="DropParents" runat="server" OnClientLoaded="onAccountTreeLoaded" OnClientSelect="onAccountTreeSelect" />&nbsp;<br/>
&nbsp;<br/>
<div id="DivEditProfitLossControls"><Swarmops5:ComboPeople ID="DropOwner" OnClientSelect="onOwnerChange" runat="server" />&nbsp;<br/>
<input type="text" id="TextAccountBudget" style="text-align: right"/>&nbsp;<br/>
&nbsp;<br/>
<label for="CheckAccountActive">Active</label><div class="CheckboxContainer"><input type="checkbox" rel="Active" class="EditCheck" id="CheckAccountActive"/></div><br/>
<label for="CheckAccountExpensable">Expensable</label><div class="CheckboxContainer"><input type="checkbox" rel="Expensable" class="EditCheck" id="CheckAccountExpensable"/></div><br/>
<label for="CheckAccountAdministrative">Admin</label><div class="CheckboxContainer"><input type="checkbox" rel="Administrative" class="EditCheck" id="CheckAccountAdministrative"/></div>
<label for="CheckAccountActive"><asp:Literal ID="LiteralLabelActiveShort" runat="server"/></label><div class="CheckboxContainer"><input type="checkbox" rel="Active" class="EditCheck" id="CheckAccountActive"/></div><br/>
<label for="CheckAccountExpensable"><asp:Literal ID="LiteralLabelExpensableShort" runat="server"/></label><div class="CheckboxContainer"><input type="checkbox" rel="Expensable" class="EditCheck" id="CheckAccountExpensable"/></div><br/>
<label for="CheckAccountAdministrative"><asp:Literal ID="LiteralLabelAdministrativeShort" runat="server"/></label><div class="CheckboxContainer"><input type="checkbox" rel="Administrative" class="EditCheck" id="CheckAccountAdministrative"/></div>
&nbsp;<br/></div>
<div id="DivEditAssetControls"><asp:DropDownList runat="server" ID="DropAccountUploadFormats"/>
<input type="text" id="TextAutomationPaymentTag" readonly="readonly"/>&nbsp;<br/></div>
</div>
<div class="entryLabels">Account name<br/>
Parent account or group<br/>
<div id="DivEditProfitLossLabels"><h2>Daily operations</h2>
Owner<br/>
Budget (balance is <span id="SpanTextCurrency">foo</span> <span id="SpanEditBalance">bar</span>)<br/>
<h2>Configuration</h2>
Is this account open for transactions?<br/>
Can people use this account for expense reports?<br/>
Are transactions here excluded from 2-D reports?<br/></div>
<div id="DivEditAssetLabels"><h2>Automation</h2>
File upload profile<br/>
<span id="SpanUploadParameterName">Upload parameter, if any</span></div>
<div class="entryLabels"><asp:Literal ID="LiteralLabelAccountName" runat="server"/><br/>
<asp:Literal ID="LiteralLabelParent" runat="server"/><br/>
<div id="DivEditProfitLossLabels"><h2><asp:Literal ID="LiteralLabelHeaderDailyOperations" runat="server"/></h2>
<asp:Literal ID="LiteralLabelOwner" runat="server"/><br/>
<asp:Literal ID="LiteralLabelBudgetBalance" runat="server"/><br/>
<h2><asp:Literal ID="LiteralLabelHeaderConfiguration" runat="server"/></h2>
<asp:Literal ID="LiteralLabelActiveLong" runat="server"/><br/>
<asp:Literal ID="LiteralLabelExpensableLong" runat="server"/><br/>
<asp:Literal ID="LiteralLabelAdministrativeLong" runat="server"/><br/></div>
<div id="DivEditAssetLabels"><h2><asp:Literal ID="LiteralLabelHeaderAutomation" runat="server"/></h2>
<asp:Literal ID="LiteralLabelFileUploadProfile" runat="server"/><br/>
<span id="SpanUploadParameterName">Upload parameter, if any</span></div>
</div>
</div>
</div>
+37 -4
View File
@@ -24,9 +24,40 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
return;
}
this.PageIcon = "iconshock-openbook";
this.PageTitle = Resources.Pages.Ledgers.AccountPlan_PageTitle;
this.InfoBoxLiteral = Resources.Pages.Ledgers.AccountPlan_Info;
if (!Page.IsPostBack)
{
// Localize
this.PageIcon = "iconshock-openbook";
this.PageTitle = Resources.Pages.Ledgers.AccountPlan_PageTitle;
this.InfoBoxLiteral = Resources.Pages.Ledgers.AccountPlan_Info;
this.LiteralExpensesBudgetsAreNegative.Text = Resources.Pages.Ledgers.AccountPlan_ExpensesBudgetsAreNegaive;
this.LiteralHeaderAccountName.Text = Resources.Pages.Ledgers.AccountPlan_Header_AccountName;
this.LiteralHeaderBalance.Text = Resources.Pages.Ledgers.AccountPlan_Header_Balance;
this.LiteralHeaderBudget.Text = Resources.Pages.Ledgers.AccountPlan_Header_Budget;
this.LiteralHeaderEdit.Text = Resources.Pages.Ledgers.AccountPlan_Header_Edit;
this.LiteralHeaderEditingAccount.Text = Resources.Pages.Ledgers.AccountPlan_Edit_Header;
this.LiteralHeaderFlags.Text = Resources.Pages.Ledgers.AccountPlan_Header_Flags;
this.LiteralHeaderOwner.Text = Resources.Pages.Ledgers.AccountPlan_Header_Owner;
this.LiteralLabelAccountName.Text = Resources.Pages.Ledgers.AccountPlan_Edit_AccountName;
this.LiteralLabelActiveLong.Text = Resources.Pages.Ledgers.AccountPlan_Edit_ActiveLong;
this.LiteralLabelActiveShort.Text = Resources.Pages.Ledgers.AccountPlan_Edit_ActiveShort;
this.LiteralLabelAdministrativeLong.Text = Resources.Pages.Ledgers.AccountPlan_Edit_AdministrativeLong;
this.LiteralLabelAdministrativeShort.Text = Resources.Pages.Ledgers.AccountPlan_Edit_AdministrativeShort;
this.LiteralLabelBudgetBalance.Text = Resources.Pages.Ledgers.AccountPlan_Edit_BudgetBalance;
this.LiteralLabelExpensableLong.Text = Resources.Pages.Ledgers.AccountPlan_Edit_ExpensableLong;
this.LiteralLabelExpensableShort.Text = Resources.Pages.Ledgers.AccountPlan_Edit_ExpensableShort;
this.LiteralLabelFileUploadProfile.Text = Resources.Pages.Ledgers.AccountPlan_Edit_FileUploadProfile;
this.LiteralLabelHeaderAutomation.Text = Resources.Pages.Ledgers.AccountPlan_Edit_HeaderAutomation;
this.LiteralLabelHeaderConfiguration.Text = Resources.Pages.Ledgers.AccountPlan_Edit_HeaderConfiguration;
this.LiteralLabelHeaderDailyOperations.Text =
Resources.Pages.Ledgers.AccountPlan_Edit_HeaderDailyOperations;
this.LiteralLabelOwner.Text = Resources.Pages.Ledgers.AccountPlan_Edit_Owner;
this.LiteralLabelParent.Text = Resources.Pages.Ledgers.AccountPlan_Edit_Parent;
}
this.PageAccessRequired = new Access(this.CurrentOrganization, AccessAspect.Bookkeeping, AccessType.Write);
this.DbVersionRequired = 2; // Account reparenting
}
@@ -90,7 +121,9 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
try
{
if (checkOpenedYear && account.OpenedYear <= authData.CurrentOrganization.Parameters.FiscalBooksClosedUntilYear)
int ledgersClosedUntilYear = authData.CurrentOrganization.Parameters.FiscalBooksClosedUntilYear;
if (checkOpenedYear && ledgersClosedUntilYear > 0 && account.OpenedYear <= ledgersClosedUntilYear)
{
// This require breaking the account, which we can't do yet (in this sprint, will come next sprint).
return false;