General Ledger starts working, it seems

This commit is contained in:
Rick Falkvinge
2018-01-01 21:31:19 +01:00
parent cac41d8129
commit 540fc7e094
2 changed files with 37 additions and 6 deletions
+2 -2
View File
@@ -350,9 +350,9 @@
idField="id" treeField="id">
<thead>
<tr>
<th data-options="field:'id',width:80"><asp:Label ID="LabelTreeHeaderId" runat="server" Text="ID#"/></th>
<th data-options="field:'id',width:90"><asp:Label ID="LabelTreeHeaderId" runat="server" Text="ID#"/></th>
<th data-options="field:'datetime',width:90,sortable:true"><asp:Label ID="LabelTreeHeaderDateTime" runat="server" Text="XYZ DateTime" /></th>
<th data-options="field:'description',width:230"><asp:Label ID="LabelTreeHeaderDescriptionAccount" runat="server" Text="XYZ Description, Account" /></th>
<th data-options="field:'description',width:220"><asp:Label ID="LabelTreeHeaderDescriptionAccount" runat="server" Text="XYZ Description, Account" /></th>
<th data-options="field:'deltaPos',width:70,align:'right'"><asp:Label ID="LabelTreeHeaderDeltaPositive" runat="server" Text="XYZ Debit" /></th>
<th data-options="field:'deltaNeg',width:70,align:'right'"><asp:Label ID="LabelTreeHeaderDeltaNegative" runat="server" Text="XYZ Credit" /></th>
<th data-options="field:'balance',width:80,align:'right'"><asp:Label ID="LabelTreeHeaderBalance" runat="server" Text="XYZ Balance" /></th>
@@ -126,7 +126,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
string description = transaction.Description;
result.Append("{" + String.Format(
"\"id\":\"<span class='weight-emphasis'>{0:N0}</span>\",\"datetime\":\"<span class='weight-emphasis'>{1:MMM-dd HH:mm}</span>\",\"description\":\"<span class='weight-emphasis'>{2}</span>\"," +
"\"id\":\"<span class='weight-more-emphasis'>{0:N0}</span>\",\"datetime\":\"<span class='weight-more-emphasis'>{1:MMM-dd HH:mm}</span>\",\"description\":\"<span class='weight-more-emphasis'>{2}</span>\"," +
"\"state\":\"open\",\"children\":[",
row.Transaction.OrganizationSequenceId,
row.TransactionDateTime,
@@ -179,12 +179,43 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
//result.Append("{\"description\":\"child\"}");
string accountClass;
switch (accountLookup[row.FinancialAccountId].AccountType)
{
case FinancialAccountType.Asset:
accountClass = Resources.Global.Financial_Asset;
break;
case FinancialAccountType.Debt:
accountClass = Resources.Global.Financial_Debt;
break;
case FinancialAccountType.Income:
accountClass = Resources.Global.Financial_Income;
break;
case FinancialAccountType.Cost:
accountClass = Resources.Global.Financial_Cost;
break;
default:
throw new NotImplementedException();
}
string accountName = account.Name;
if (account.ParentIdentity != 0)
{
if (!accountLookup.ContainsKey(account.ParentIdentity))
{
accountLookup[account.ParentIdentity] = account.Parent;
}
accountName = accountLookup[account.ParentIdentity].Name + " » " + accountName;
}
result.Append ("{" + String.Format (
"\"id\":\"{0:N0}:{6:N0}\",\"datetime\":\"{1:MMM-dd HH:mm}\",\"description\":\"{2}\"," +
"\"id\":\"{0:N0}:{6:N0}\",\"datetime\":\"{1}\",\"description\":\"{2}\"," +
"\"deltaPos\":\"{3}\",\"deltaNeg\":\"{4}\",\"balance\":\"{5:N2}\"",
row.Transaction.OrganizationSequenceId,
row.TransactionDateTime,
JsonSanitize ("description"),
JsonSanitize (accountClass),
JsonSanitize (accountName),
debitString,
creditString,
runningBalanceLookup[row.FinancialAccountId]/100.0,