More on Open Ledgers

This commit is contained in:
Rick Falkvinge
2015-03-03 21:18:00 +01:00
parent 91fb2bc3fc
commit 1040a488ce
4 changed files with 26 additions and 5 deletions
@@ -670,4 +670,7 @@
<data name="CloseLedgers_AnnualProfit" xml:space="preserve">
<value>Annual Profit</value>
</data>
<data name="InspectLedgers_TxDetail_DescriptionWithheld" xml:space="preserve">
<value>(detailed description withheld)</value>
</data>
</root>
+6 -4
View File
@@ -147,12 +147,12 @@
var selectedYear = $('#<%=DropYears.ClientID %>').val();
var selectedMonth = $('#<%=DropMonths.ClientID %>').val();
currentYear = selectedYear;
$('#gridLedgers').datagrid({ url: 'Json-InspectLedgerData.aspx?Year=' + selectedYear + "&Month=" + selectedMonth + "&AccountId=" + accountId});
$('#imageLoadIndicator').show();
$('div.datagrid').css('opacity', 0.4);
// $('#gridOutstandingAccounts').datagrid('reload');
}
function prefillUnbalancedAmount() {
@@ -190,7 +190,7 @@
var jsonData = {};
jsonData.txId = transactionId;
if (canWriteRows) {
if (canWriteRows && ledgersClosedUntil < currentYear) {
prefillUnbalancedAmount();
}
@@ -223,7 +223,7 @@
} else {
$('#divTransactionTracking').hide();
if (canWriteRows) {
if (canWriteRows && currentYear > ledgersClosedUntil) {
$('#divEditTransaction').show();
} else {
$('#divEditTransaction').hide();
@@ -248,6 +248,8 @@
var canSeeDetail = <asp:Literal ID="LiteralDetailAccess" runat="server" />;
var canWriteRows = <asp:Literal ID="LiteralWriteAccess" runat="server" />;
var canAuditTx = <asp:Literal ID="LiteralAuditAccess" runat="server" />;
var ledgersClosedUntil = <asp:Literal ID="LiteralLedgersClosedUntil" runat="server" />;
var currentYear = 0;
</script>
@@ -10,6 +10,7 @@ using Swarmops.Common.Enums;
using Swarmops.Common.Interfaces;
using Swarmops.Logic.Financial;
using Swarmops.Logic.Security;
using Swarmops.Logic.Structure;
using Swarmops.Logic.Support;
namespace Swarmops.Frontend.Pages.v5.Ledgers
@@ -120,6 +121,8 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
(CurrentUser.HasAccess(new Access(CurrentOrganization, AccessAspect.BookkeepingDetails, AccessType.Read)))
? "true"
: "false";
this.LiteralLedgersClosedUntil.Text = CurrentOrganization.Parameters.FiscalBooksClosedUntilYear.ToString();
}
[WebMethod]
@@ -135,6 +138,12 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
}
FinancialTransaction transaction = FinancialTransaction.FromIdentity(txId);
if (authData.CurrentOrganization.Parameters.FiscalBooksClosedUntilYear >= transaction.DateTime.Year)
{
return false; // can't edit closed books
}
FinancialAccount account = FinancialAccount.FromIdentity (accountId);
Double amountFloat = Double.Parse (amountString);
@@ -55,6 +55,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
DateTime balanceStart = dawnOfMankind;
bool zeroStart = false;
bool zeroEnd = false;
bool displayDescription = CurrentUser.HasAccess (new Access (CurrentOrganization, AccessAspect.BookkeepingDetails, AccessType.Read));
if (month > 0 && month <= 12)
{
@@ -142,6 +143,12 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
{
string creditString = string.Empty;
string debitString = string.Empty;
string description = row.Description;
if (!displayDescription)
{
description = Resources.Pages.Ledgers.InspectLedgers_TxDetail_DescriptionWithheld;
}
if (row.AmountCents < 0)
{
@@ -163,7 +170,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
"\"deltaPos\":\"{3}\",\"deltaNeg\":\"{4}\",\"balance\":\"{5:N0}\",\"action\":\"{6}\"",
row.FinancialTransactionId,
row.TransactionDateTime,
JsonSanitize (row.Description),
JsonSanitize (description),
debitString,
creditString,
runningBalance/100.0,