More work on VAT report data

This commit is contained in:
Falkvinge
2017-10-28 12:42:10 +02:00
parent 87a4a9c84b
commit d86e0a6aab
3 changed files with 30 additions and 9 deletions
@@ -41,9 +41,9 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
Response.ContentType = "application/json";
Int64 turnoverTotal;
Int64 inboundTotal;
Int64 outboundTotal;
Int64 turnoverCentsTotal = 0;
Int64 inboundCentsTotal = 0;
Int64 outboundCentsTotal = 0;
StringBuilder response = new StringBuilder(16384);
@@ -54,18 +54,37 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
{
FinancialTransaction transaction = item.Transaction;
string element = string.Format("\"id\":\"{0}\",\"txid\":\"{1}\",\"datetime\":\"{2}\",\"description\":\"{3}\"",
string element = string.Format("\"id\":\"{0}\",\"txid\":\"{1}\",\"datetime\":\"{2: MMM dd}\",\"description\":\"{3}\"",
transaction.Identity,
transaction.OrganizationSequenceId,
"date time",
transaction.DateTime,
JsonSanitize(transaction.Description));
if (item.TurnoverCents > 0)
{
element += String.Format("\"turnover\":\"{0:N2}\"", item.TurnoverCents / 100.0);
turnoverCentsTotal += item.TurnoverCents;
}
if (item.VatInboundCents > 0)
{
element += String.Format("\"inbound\":\"{0:N2}\"", item.VatInboundCents/ 100.0);
inboundCentsTotal += item.VatInboundCents;
}
if (item.VatOutboundCents > 0)
{
element += String.Format("\"outbound\":\"{0:N2}\"", item.VatOutboundCents/ 100.0);
outboundCentsTotal += item.VatOutboundCents;
}
lines.Add("{" + element + "}");
}
Response.Write("[" + String.Join(",", lines.ToArray()) + "]");
// TODO: FOOTER
Response.End();
}
+5 -4
View File
@@ -18,6 +18,7 @@
$('#<%=DropReports.ClientID %>').change(function () {
var selectedReportId = $('#<%=DropReports.ClientID %>').val();
console.log("Selected Report Id: " + selectedReportId);
$('#tableVatReport').treegrid({ url: 'Json-VatReportData.aspx?ReportId=' + selectedReportId });
$('#imageLoadIndicator').show();
@@ -65,16 +66,16 @@
rownumbers="false"
animate="true"
fitColumns="true" showFooter="true"
idField="id" treeField="txid">
idField="id">
<thead>
<tr>
<th field="txid" width="40"><asp:Literal ID="LiteralHeaderTransactionId" Text="Tx#" runat="server"/></th>
<th field="datetime" width="100"><asp:Literal ID="LiteralHeaderDateTime" runat="server" /></th>
<th field="txid" width="60"><asp:Literal ID="LiteralHeaderTransactionId" Text="Tx#" runat="server"/></th>
<th field="datetime" width="80"><asp:Literal ID="LiteralHeaderDateTime" runat="server" /></th>
<th field="description" width="280"><asp:Literal ID="LiteralHeaderDescription" runat="server" /></th>
<th field="turnover" width="140" align="right"><asp:Literal ID="LiteralHeaderTurnover" runat="server" /></th>
<th field="vatoutbound" width="110" align="right"><asp:Literal ID="LiteralHeaderVatOutbound" runat="server" /></th>
<th field="vatinbound" width="100" align="right"><asp:Literal ID="LiteralHeaderVatInbound" runat="server" /></th>
<th field="dox" width="40" align="center"><asp:Literal ID="LiteralHeaderDox" runat="server" /></th>
<th field="dox" width="60" align="center"><asp:Literal ID="LiteralHeaderDox" runat="server" /></th>
</tr>
</thead>
</table>
@@ -51,6 +51,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
}
this.InitialReportId = reports.Last().Identity;
this.DropReports.SelectedValue = this.InitialReportId.ToString(CultureInfo.InvariantCulture);
Localize();
}