First test on VAT report data
This commit is contained in:
@@ -61,5 +61,10 @@ namespace Swarmops.Logic.Financial
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public FinancialTransaction Transaction
|
||||
{
|
||||
get { return FinancialTransaction.FromIdentity(this.FinancialTransactionId); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" Inherits="Swarmops.Frontend.Pages.v5.Ledgers.Json_VatReportData" Codebehind="Json-VatReportData.aspx.cs" %>
|
||||
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using Swarmops.Common.Enums;
|
||||
using Swarmops.Database;
|
||||
using Swarmops.Logic.Financial;
|
||||
|
||||
namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
{
|
||||
public partial class Json_VatReportData : DataV5Base
|
||||
{
|
||||
private AuthenticationData _authenticationData;
|
||||
|
||||
private int _reportId = 0;
|
||||
|
||||
protected void Page_Load (object sender, EventArgs e)
|
||||
{
|
||||
// Get auth data
|
||||
|
||||
this._authenticationData = GetAuthenticationDataAndCulture();
|
||||
|
||||
string reportIdParameter = Request.QueryString["ReportId"];
|
||||
string reportKeyParameter = Request.QueryString["ReportKey"];
|
||||
|
||||
if (!string.IsNullOrEmpty (reportIdParameter))
|
||||
{
|
||||
this._reportId = Int32.Parse (reportIdParameter); // will throw if non-numeric - don't matter for app
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(reportKeyParameter))
|
||||
{
|
||||
this._reportId =
|
||||
SwarmDb.GetDatabaseForReading().GetVatReportIdFromGuid(reportKeyParameter.ToLowerInvariant().Trim());
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException("No Report Requested");
|
||||
}
|
||||
|
||||
VatReport report = VatReport.FromIdentity(_reportId);
|
||||
|
||||
Response.ContentType = "application/json";
|
||||
|
||||
Int64 turnoverTotal;
|
||||
Int64 inboundTotal;
|
||||
Int64 outboundTotal;
|
||||
|
||||
StringBuilder response = new StringBuilder(16384);
|
||||
|
||||
VatReportItems items = report.Items;
|
||||
List<string> lines = new List<string>();
|
||||
|
||||
foreach (VatReportItem item in items)
|
||||
{
|
||||
FinancialTransaction transaction = item.Transaction;
|
||||
|
||||
string element = string.Format("\"id\":\"{0}\",\"txid\":\"{1}\",\"datetime\":\"{2}\",\"description\":\"{3}\"",
|
||||
transaction.Identity,
|
||||
transaction.OrganizationSequenceId,
|
||||
"date time",
|
||||
JsonSanitize(transaction.Description));
|
||||
|
||||
|
||||
lines.Add("{" + element + "}");
|
||||
}
|
||||
|
||||
Response.Write("[" + String.Join(",", lines.ToArray()) + "]");
|
||||
|
||||
Response.End();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Swarmops.Frontend.Pages.v5.Ledgers {
|
||||
|
||||
|
||||
public partial class Json_VatReportData {
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
<h2><div class="elementFloatFar"><%= CurrentOrganization.Currency.DisplayCode %></div><asp:Label ID="LabelContentHeader" runat="server" /> <asp:DropDownList runat="server" ID="DropReports"/> <img alt="Loading" src="/Images/Abstract/ajaxloader-blackcircle.gif" ID="imageLoadIndicator" /></h2>
|
||||
<table id="tableVatReport" title="" class="easyui-treegrid" style="width:680px;height:600px"
|
||||
url="Json-VatReportData.aspx"
|
||||
url="Json-VatReportData.aspx?ReportId=<%=this.InitialReportId %>"
|
||||
rownumbers="false"
|
||||
animate="true"
|
||||
fitColumns="true" showFooter="true"
|
||||
|
||||
@@ -50,6 +50,8 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
report.Identity.ToString(CultureInfo.InvariantCulture)));
|
||||
}
|
||||
|
||||
this.InitialReportId = reports.Last().Identity;
|
||||
|
||||
Localize();
|
||||
}
|
||||
|
||||
@@ -69,5 +71,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
this.LiteralHeaderDox.Text = Resources.Global.Global_Dox;
|
||||
// Localize all controls - todo
|
||||
}
|
||||
|
||||
public int InitialReportId { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -397,6 +397,13 @@
|
||||
<Compile Include="Pages\v5\Ledgers\Json-AccountPlanData.aspx.designer.cs">
|
||||
<DependentUpon>Json-AccountPlanData.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\v5\Ledgers\Json-VatReportData.aspx.cs">
|
||||
<DependentUpon>Json-VatReportData.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Pages\v5\Ledgers\Json-VatReportData.aspx.designer.cs">
|
||||
<DependentUpon>Json-VatReportData.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\v5\Ledgers\Json-BalanceSheetDataSimplified.aspx.cs">
|
||||
<DependentUpon>Json-BalanceSheetDataSimplified.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
@@ -1100,6 +1107,7 @@
|
||||
<Content Include="Pages\v5\Ledgers\DebugLedgers.aspx" />
|
||||
<Content Include="Pages\v5\Ledgers\InspectLedgers.aspx" />
|
||||
<Content Include="Pages\v5\Ledgers\Json-AccountPlanData.aspx" />
|
||||
<Content Include="Pages\v5\Ledgers\Json-VatReportData.aspx" />
|
||||
<Content Include="Pages\v5\Ledgers\Json-BalanceSheetDataSimplified.aspx" />
|
||||
<Content Include="Pages\v5\Ledgers\Json-BalanceSheetData.aspx" />
|
||||
<Content Include="Pages\v5\Ledgers\Json-BitcoinHotwalletData.aspx" />
|
||||
|
||||
Reference in New Issue
Block a user