Added footer to VAT report data

This commit is contained in:
Falkvinge
2017-10-28 13:23:35 +02:00
parent 90ba19dfe7
commit 83bfaf53dd
3 changed files with 38 additions and 1 deletions
+18
View File
@@ -2032,6 +2032,15 @@ namespace Resources.Pages {
}
}
/// <summary>
/// Looks up a localized string similar to -- nothing to report --.
/// </summary>
internal static string ViewVatReports_EmptyReport {
get {
return ResourceManager.GetString("ViewVatReports_EmptyReport", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Report Totals.
/// </summary>
@@ -2113,6 +2122,15 @@ namespace Resources.Pages {
}
}
/// <summary>
/// Looks up a localized string similar to Totals for this report.
/// </summary>
internal static string ViewVatReports_ReportTotals {
get {
return ResourceManager.GetString("ViewVatReports_ReportTotals", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to View.
/// </summary>
@@ -906,4 +906,12 @@
<value>View</value>
<comment>This is the word or words before the name of the displayed VAT report.</comment>
</data>
<data name="ViewVatReports_EmptyReport" xml:space="preserve">
<value>-- nothing to report --</value>
<comment>This is displayed when there are no items at all in a VAT report.</comment>
</data>
<data name="ViewVatReports_ReportTotals" xml:space="preserve">
<value>Totals for this report</value>
<comment>Displayed as description of footer</comment>
</data>
</root>
@@ -81,7 +81,18 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
lines.Add("{" + element + "}");
}
Response.Write("[" + String.Join(",", lines.ToArray()) + "]");
if (lines.Count == 0) // add empty report line
{
lines.Add(String.Format("\"id\":\"0\",\"description\":\"{0}\"",
JsonSanitize(Resources.Pages.Ledgers.ViewVatReports_EmptyReport)));
}
Response.Write("{\"rows\":[" + String.Join(",", lines.ToArray()) + "],");
Response.Write(String.Format("\"footer\":[\"id\":\"0\",\"description\":\"{0}\",\"turnover\":\"{1:N2}\",\"inbound\":\"{2:N2}\",\"outbound\":\"{3:N2}\"]",
JsonSanitize(Resources.Pages.Ledgers.ViewVatReports_Footer_Total.ToUpperInvariant()), turnoverCentsTotal / 100.0, inboundCentsTotal / 100.0, outboundCentsTotal / 100.0));
Response.Write("}"); // needs to be separate to not trigger String.Format warning
// TODO: FOOTER