This commit is contained in:
@@ -124,7 +124,7 @@ namespace AyaNova.Biz
|
||||
public static async Task PrimeReportTemplates()
|
||||
{
|
||||
//Read in each stock translation from a text file and then create them in the DB
|
||||
var ReportFilesPath = Path.Combine(ServerBootConfig.AYANOVA_CONTENT_ROOT_PATH, "resource","rpt","stock-report-templates");
|
||||
var ReportFilesPath = Path.Combine(ServerBootConfig.AYANOVA_CONTENT_ROOT_PATH, "resource", "rpt", "stock-report-templates");
|
||||
if (!Directory.Exists(ReportFilesPath))
|
||||
{
|
||||
throw new System.Exception($"E1012: \"stock-report-templates\" folder not found where expected: \"{ReportFilesPath}\", installation damaged?");
|
||||
@@ -138,7 +138,8 @@ namespace AyaNova.Biz
|
||||
System.IO.DirectoryInfo di = new DirectoryInfo(ReportFilesPath);
|
||||
foreach (FileInfo file in di.EnumerateFiles())
|
||||
{
|
||||
await r.ImportAsync(JObject.Parse(await File.ReadAllTextAsync(file.FullName)));
|
||||
if (file.Extension.ToLowerInvariant() == "ayrt")
|
||||
await r.ImportAsync(JObject.Parse(await File.ReadAllTextAsync(file.FullName)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"Name":"EXAMPLE modify data before rendering","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"<html>\n\n<body>\n\t{{#each ayReportData}}\n\tName: {{ Name }}, DollarAmount: {{ ayCurrency DollarAmount }}, RunningTotal: {{ ayCurrency MyRunningTotal }} <br/>\n\t{{/each}}\n\n\t<h2>Total dollar amount: {{ ayCurrency MyTotalDollarAmount }}\n</body>\n\n</html>","Style":"","JsPrerender":"async function ayPrepareData(reportData) {\n //Example of both manipulating the reportData before rendering the report (by adding a running total field)\n //and adding a field to the overall data calculating the total dollar amount for all records\n\n //Declare a temporary variable to hold the running total\n let TotalDollarAmount = 0;\n\n //Iterate through all the records in the reportData\n //adding the dollar amount of each item to the TotalDollarAmount variable\n for (MyItem of reportData.ayReportData) {\n\n //make sure it has a value before attempting to add it to the running total\n if (MyItem.DollarAmount != null) {\n TotalDollarAmount += MyItem.DollarAmount;\n }\n\n //add a new key to each record in the reportData object named \"MyRunningTotal\" with the running total so far\n MyItem.MyRunningTotal=TotalDollarAmount;\n }\n\n //Add the TotalDollarAmount variable to the reportData so it can be \n //accessed in the report template\n reportData.MyTotalDollarAmount=TotalDollarAmount;\n\n return reportData;\n}","JsHelpers":"","RenderType":0}
|
||||
Reference in New Issue
Block a user