Account Plan enhancements 2
This commit is contained in:
@@ -562,4 +562,8 @@
|
||||
<value>Initial Balance (inbound into {0}), {1}</value>
|
||||
<comment>{0} is the first ledger year in Swarmops. {1} is the currency code.</comment>
|
||||
</data>
|
||||
<data name="AccountPlan_Options_ShowInactive" xml:space="preserve">
|
||||
<value>Show Inactive Accounts (<span id="SpanInactiveCount">{0:N0}</span>)</value>
|
||||
<comment>The {0} is the number of inactive accounts.</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -51,9 +51,10 @@
|
||||
},
|
||||
|
||||
rowStyler: function (rowData) {
|
||||
if (rowData.inactive == true)
|
||||
console.log(rowData);
|
||||
if (rowData.inactive == "true")
|
||||
{
|
||||
return { class: 'RowInactive', style: { color: '#c0c0c0' } };
|
||||
return { class: 'RowInactive' };
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -200,6 +201,16 @@
|
||||
});
|
||||
});
|
||||
|
||||
$('#CheckOptionsShowInactive').change(function() {
|
||||
if ($(this).prop("checked"))
|
||||
{
|
||||
$('.RowInactive').slideDown();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.RowInactive').slideUp();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -332,6 +343,8 @@
|
||||
boxShadow: '0 0 10px 2px rgba(0,255,0,0)'
|
||||
}, 250);
|
||||
accountDirty = true;
|
||||
// update the "inactive count" display for all success calls, even though we only need it for "active"
|
||||
updateInactiveCount();
|
||||
} else {
|
||||
suppressSwitchChangeAction = true;
|
||||
$(this).click();
|
||||
@@ -407,6 +420,20 @@
|
||||
|
||||
}
|
||||
|
||||
function updateInactiveCount()
|
||||
{
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/Pages/v5/Ledgers/AccountPlan.aspx/GetInactiveAccountCount",
|
||||
data: "{}",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function(msg) {
|
||||
$("#SpanInactiveCount").text(msg.d);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function modalShow() {
|
||||
$('#divModalCover').fadeIn();
|
||||
}
|
||||
@@ -533,6 +560,7 @@
|
||||
.RowInactive
|
||||
{
|
||||
color: #C0C0C0;
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -606,8 +634,10 @@
|
||||
<h2 class="blue"><asp:Label ID="LabelSidebarOptions" Text="Options" runat="server" /><span class="arrow"></span></h2>
|
||||
|
||||
<div class="box">
|
||||
<div class="content">
|
||||
<input type="checkbox" id="checkOptionsShowInactive" /><label for="checkOptionsShowInactive"><asp:Label ID="LabelOptionsShowInactive" runat="server" Text="Show inactive accounts XYZ"/></label>
|
||||
<div class="content" style="margin-left:5px">
|
||||
<div class="link-row-encaps" style="cursor:default; margin-left:2px">
|
||||
<span style="position:relative;top:2px;left:1px"><input type="checkbox" id="CheckOptionsShowInactive" /></span> <label for="CheckOptionsShowInactive"><asp:Label ID="LabelOptionsShowInactive" runat="server" Text="Show inactive accounts XYZ"/></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Web;
|
||||
@@ -87,6 +88,11 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
this.LiteralLabelInitialAmount.Text =
|
||||
String.Format (Resources.Pages.Ledgers.AccountPlan_Edit_InitialBalance,
|
||||
CurrentOrganization.FirstFiscalYear, CurrentOrganization.Currency.DisplayCode);
|
||||
|
||||
FinancialAccounts organizationAccounts = FinancialAccounts.ForOrganization(this.CurrentOrganization);
|
||||
int inactiveCount = organizationAccounts.Count(account => !account.Active);
|
||||
|
||||
this.LabelOptionsShowInactive.Text = String.Format(Resources.Pages.Ledgers.AccountPlan_Options_ShowInactive, inactiveCount);
|
||||
}
|
||||
PageAccessRequired = new Access (CurrentOrganization, AccessAspect.Bookkeeping, AccessType.Write);
|
||||
DbVersionRequired = 2; // Account reparenting
|
||||
@@ -383,12 +389,22 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
Int64 newSingleBudget = newTreeBudget - suballocatedBudget;
|
||||
|
||||
account.SetBudgetCents (DateTime.Today.Year, newSingleBudget);
|
||||
|
||||
// Once we've set the budget, also update the "yearly result" budget
|
||||
|
||||
int thisYear = DateTime.UtcNow.Year;
|
||||
FinancialAccounts allProfitLossAccounts = FinancialAccounts.ForOrganization(authData.CurrentOrganization);
|
||||
Int64 newProfitLossProjection = allProfitLossAccounts.Where(queryAccount => queryAccount.Identity != authData.CurrentOrganization.FinancialAccounts.CostsYearlyResult.Identity).Sum(queryAccount => queryAccount.GetBudgetCents(thisYear));
|
||||
|
||||
authData.CurrentOrganization.FinancialAccounts.CostsYearlyResult.SetBudgetCents(thisYear, -newProfitLossProjection);
|
||||
|
||||
return new ChangeAccountDataResult
|
||||
{
|
||||
Result = ChangeAccountDataOperationsResult.Changed,
|
||||
NewData = (newTreeBudget/100).ToString ("N0", CultureInfo.CurrentCulture)
|
||||
};
|
||||
}
|
||||
|
||||
return new ChangeAccountDataResult
|
||||
{
|
||||
Result = ChangeAccountDataOperationsResult.Invalid
|
||||
@@ -436,6 +452,16 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public static string GetInactiveAccountCount()
|
||||
{
|
||||
AuthenticationData authData = GetAuthenticationDataAndCulture();
|
||||
|
||||
int inactiveAccountCount = FinancialAccounts.ForOrganization(authData.CurrentOrganization).Count(account => !account.Active);
|
||||
return inactiveAccountCount.ToString("N0");
|
||||
}
|
||||
|
||||
|
||||
public class ChangeAccountDataResult
|
||||
{
|
||||
public ChangeAccountDataOperationsResult Result { set; get; }
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
CultureInfo.CurrentCulture)
|
||||
: string.Empty,
|
||||
editString,
|
||||
account.Active? "true":"false"
|
||||
account.Active? "false":"true" // reverses condition on purpose
|
||||
) + grandChildren + '}');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user