diff --git a/.vscode/launch.json b/.vscode/launch.json index 8705b69c..172b8a51 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -48,6 +48,7 @@ "AYANOVA_DATA_PATH": "c:\\temp\\ravendata", "AYANOVA_USE_URLS": "http://*:7575;", "AYANOVA_SERVER_TEST_MODE": "false", + "AYANOVA_REPORT_RENDERING_MAX_INSTANCES":"1", // "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small", "AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin\\" }, diff --git a/server/AyaNova/biz/IReportAbleObject.cs b/server/AyaNova/biz/IReportAbleObject.cs index c8b30990..df656583 100644 --- a/server/AyaNova/biz/IReportAbleObject.cs +++ b/server/AyaNova/biz/IReportAbleObject.cs @@ -13,6 +13,7 @@ namespace AyaNova.Biz //called by ReportBiz rendering code Task GetReportData(DataListSelectedRequest dataListSelectedRequest); const int REPORT_DATA_BATCH_SIZE = 100; + } diff --git a/server/AyaNova/biz/ReportBiz.cs b/server/AyaNova/biz/ReportBiz.cs index 61b7b9d5..9fefa3dc 100644 --- a/server/AyaNova/biz/ReportBiz.cs +++ b/server/AyaNova/biz/ReportBiz.cs @@ -383,7 +383,9 @@ namespace AyaNova.Biz public async Task RenderReport(DataListReportRequest reportRequest, string apiUrl) { var log = AyaNova.Util.ApplicationLogging.CreateLogger("ReportBiz::RenderReport"); - +#if (DEBUG) + log.LogInformation($"DBG: ReportBiz::RenderReport called"); +#endif //Customer User Report? bool RequestIsCustomerWorkOrderReport = false; if (reportRequest.ReportId == -100) @@ -398,6 +400,9 @@ namespace AyaNova.Biz } //get report, vet security, see what we need before init in case of issue +#if (DEBUG) + log.LogInformation($"DBG: ReportBiz::RenderReport get report from db"); +#endif var report = await ct.Report.FirstOrDefaultAsync(z => z.Id == reportRequest.ReportId); if (report == null) { @@ -436,12 +441,18 @@ namespace AyaNova.Biz reportRequest.IncludeWoItemDescendants = report.IncludeWoItemDescendants; //Get data +#if (DEBUG) + log.LogInformation($"DBG: ReportBiz::RenderReport GetReportData"); +#endif var ReportData = await GetReportData(reportRequest, RequestIsCustomerWorkOrderReport);//###### TODO: SLOW NEEDS TIMEOUT HERE ONCE IT WORKS IS SUPPORTED //if GetReportData errored then will return null so need to return that as well here if (ReportData == null) { return null; } +#if (DEBUG) + log.LogInformation($"DBG: ReportBiz::RenderReport got report data"); +#endif //initialization log.LogDebug("Initializing report rendering system"); @@ -461,7 +472,7 @@ namespace AyaNova.Biz var lo = new LaunchOptions { Headless = true }; if (!AutoDownloadChromium) { - lo.ExecutablePath = ServerBootConfig.AYANOVA_REPORT_RENDER_BROWSER_PATH; + lo.ExecutablePath = ServerBootConfig.AYANOVA_REPORT_RENDER_BROWSER_PATH; /* troubleshooting links: https://developers.google.com/web/tools/puppeteer/troubleshooting @@ -480,6 +491,9 @@ namespace AyaNova.Biz } else { +#if (DEBUG) + log.LogInformation($"DBG: ReportBiz::calling browserfetcher"); +#endif log.LogDebug($"Windows: Calling browserFetcher download async now:"); await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultChromiumRevision); } @@ -500,11 +514,14 @@ namespace AyaNova.Biz //API DOCS http://www.puppeteersharp.com/api/index.html log.LogDebug($"Launching headless Browser now:"); +#if (DEBUG) + log.LogInformation($"DBG: ReportBiz::launching browser now"); +#endif using (var browser = await Puppeteer.LaunchAsync(lo)) using (var page = await browser.NewPageAsync()) { //track this process so it can be cancelled if it times out - ReportRenderManager.AddProcess(browser.Process.Id); + ReportRenderManager.AddProcess(browser.Process.Id, log); page.DefaultTimeout = 0;//infinite timeout as we are controlling how long the process can live for with the reportprocessmanager try { @@ -623,17 +640,25 @@ namespace AyaNova.Biz //prePareData / preRender var ReportDataObject = $"{{ ayReportData:{ReportData}, ayReportMetaData:{reportMeta}, ayClientMetaData:{clientMeta}, ayServerMetaData:{serverMeta} }}"; log.LogDebug($"Calling ayPreRender..."); - - //PRE_RENDER WITH TIMEOUT +#if (DEBUG) + log.LogInformation($"DBG: ReportBiz::RenderReport - preRender"); +#endif + //PRE_RENDER (WITH TIMEOUT???) await page.WaitForExpressionAsync($"ayPreRender({ReportDataObject})"); //compile the template log.LogDebug($"Calling Handlebars.compile..."); +#if (DEBUG) + log.LogInformation($"DBG: ReportBiz::RenderReport - compiling handlebars template"); +#endif var compileScript = $"Handlebars.compile(`{report.Template}`)(PreParedReportDataObject);"; var compiledHTML = await page.EvaluateExpressionAsync(compileScript); //render report as HTML log.LogDebug($"Setting page content to compiled HTML"); +#if (DEBUG) + log.LogInformation($"DBG: ReportBiz::RenderReport - settting html on page contents"); +#endif await page.SetContentAsync(compiledHTML); //add style (after page or it won't work) @@ -650,6 +675,9 @@ namespace AyaNova.Biz //Set PDF options //https://pptr.dev/#?product=Puppeteer&version=v5.3.0&show=api-pagepdfoptions log.LogDebug($"Resolving PDF Options from report settings"); +#if (DEBUG) + log.LogInformation($"DBG: ReportBiz::RenderReport - settting pdf options"); +#endif var PdfOptions = new PdfOptions() { }; PdfOptions.DisplayHeaderFooter = report.DisplayHeaderFooter; @@ -726,7 +754,9 @@ namespace AyaNova.Biz //render to pdf and return log.LogDebug($"Calling render page contents to PDF"); - +#if (DEBUG) + log.LogInformation($"DBG: ReportBiz::RenderReport - rendering to pdf"); +#endif await page.PdfAsync(outputFullPath, PdfOptions);//###### TODO: SLOW NEEDS TIMEOUT HERE ONCE SUPPORTED, open bug: https://github.com/hardkoded/puppeteer-sharp/issues/1710 log.LogDebug($"Completed, returning results"); @@ -748,6 +778,9 @@ namespace AyaNova.Biz } finally { +#if (DEBUG) + log.LogInformation($"DBG: ReportBiz::RenderReport - closing browser"); +#endif log.LogDebug($"Closing browser"); await browser.CloseAsync(); ReportRenderManager.RemoveProcess(browser.Process.Id, log); diff --git a/server/AyaNova/biz/WorkOrderBiz.cs b/server/AyaNova/biz/WorkOrderBiz.cs index 4437eb83..a73a51dd 100644 --- a/server/AyaNova/biz/WorkOrderBiz.cs +++ b/server/AyaNova/biz/WorkOrderBiz.cs @@ -299,6 +299,7 @@ namespace AyaNova.Biz if (logTheGetEvent && ret != null) await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, AyaEvent.Retrieved), ct); } + return ret; } @@ -326,7 +327,7 @@ namespace AyaNova.Biz ret.CustomerReferenceNumber = sourceWo.CustomerReferenceNumber; ret.CustomerContactName = sourceWo.CustomerContactName; ret.InvoiceNumber = sourceWo.InvoiceNumber; - ret.CanReport=customerEffectiveRights.ThisWOEffectiveWOReportId!=null; + ret.CanReport = customerEffectiveRights.ThisWOEffectiveWOReportId != null; return ret; } @@ -857,6 +858,7 @@ namespace AyaNova.Biz // internal async Task WorkOrderGetPartialAsync(AyaType ayaType, long id, bool includeWoItemDescendants, bool populateForReporting) { + //if it's the entire workorder just get, populate and return as normal if (ayaType == AyaType.WorkOrder) return await WorkOrderGetAsync(id, true, false, populateForReporting); @@ -927,6 +929,7 @@ namespace AyaNova.Biz ret.Items.Add(woitem); await WorkOrderPopulateVizFields(ret, false, populateForReporting); + return ret; } @@ -935,6 +938,9 @@ namespace AyaNova.Biz // public async Task GetReportData(DataListSelectedRequest dataListSelectedRequest) { +#if (DEBUG) + var watch = System.Diagnostics.Stopwatch.StartNew(); +#endif //workorder reports for entire workorder or just sub parts all go through here //if the ayatype is a descendant of the workorder then only the portion of the workorder from that descendant directly up to the header will be populated and returned //however if the report template has includeWoItemDescendants=true then the woitems is fully populated @@ -974,6 +980,10 @@ namespace AyaNova.Biz ReportData.Add(jo); } } +#if (DEBUG) + watch.Stop(); + System.Diagnostics.Debug.WriteLine($"Workorderbiz::GetReportData took ms: {watch.ElapsedMilliseconds}"); +#endif return ReportData; } @@ -2032,16 +2042,62 @@ namespace AyaNova.Biz //////////////////////////////////////////////////////////////////////////////////////////////// //VIZ POPULATE // + + //CACHING TEST + + private Dictionary _vizCache = new Dictionary(); + private void vizAdd(string value, string key, long? id = 0) + { + _vizCache[$"{key}{id}"] = value; + } + private string vizGet(string key, long? id = 0) + { + string value = null; + if (_vizCache.TryGetValue($"{key}{id}", out value)) + { + System.Diagnostics.Debug.WriteLine($"vizGet cache hit {key}{id}"); + return value; + } + else + { + System.Diagnostics.Debug.WriteLine($"vizGet cache miss {key}{id}"); + return null; + } + } + private async Task ItemPopulateVizFields(WorkOrderItem o, bool populateForReporting) { + + // System.Diagnostics.Debug.WriteLine($"ItemPopulateVizFields nCacheTestValue is {nCacheTest}"); + if (o.FromCSRId != null) - o.FromCSRViz = await ct.CustomerServiceRequest.AsNoTracking().Where(x => x.Id == o.FromCSRId).Select(x => x.Name).FirstOrDefaultAsync(); + { + string value = vizGet("csr", o.FromCSRId); + if (value == null) + { + value = await ct.CustomerServiceRequest.AsNoTracking().Where(x => x.Id == o.FromCSRId).Select(x => x.Name).FirstOrDefaultAsync(); + vizAdd(value, "csr", o.FromCSRId); + } + o.FromCSRViz = value; + } if (o.WorkOrderItemStatusId != null) { - var StatusInfo = await ct.WorkOrderItemStatus.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.WorkOrderItemStatusId); - o.WorkOrderItemStatusNameViz = StatusInfo.Name; - o.WorkOrderItemStatusColorViz = StatusInfo.Color; + string value = vizGet("woistatname", o.WorkOrderItemStatusId); + if (value == null) + { + var StatusInfo = await ct.WorkOrderItemStatus.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.WorkOrderItemStatusId); + + vizAdd(StatusInfo.Name, "woistatname", o.WorkOrderItemStatusId); + vizAdd(StatusInfo.Color, "woistatcolor", o.WorkOrderItemStatusId); + o.WorkOrderItemStatusNameViz = StatusInfo.Name; + o.WorkOrderItemStatusColorViz = StatusInfo.Color; + } + else + { + o.WorkOrderItemStatusNameViz = value; + o.WorkOrderItemStatusColorViz = vizGet("woistatcolor", o.WorkOrderItemStatusId); + } } if (o.WorkOrderItemPriorityId != null) @@ -3985,7 +4041,7 @@ namespace AyaNova.Biz part = await ct.Part.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.PartId); else return;//this should never happen but this is insurance in case it does - + o.PartNameViz = part.Name; o.UpcViz = part.UPC; @@ -4687,7 +4743,7 @@ namespace AyaNova.Biz if (o.PartId != 0) part = await ct.Part.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.PartId); o.PartNameViz = part.Name; - o.PartDescriptionViz=part.Description; + o.PartDescriptionViz = part.Description; o.UpcViz = part.UPC; PurchaseOrder po = null; diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE report template name notes ayReportMetaData.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE report template name notes ayReportMetaData.ayrt index 41e01775..d5bbde57 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE report template name notes ayReportMetaData.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE report template name notes ayReportMetaData.ayrt @@ -1 +1 @@ -{"Name":"💡 report template name notes ayReportMetaData","Active":true,"Notes":"Examples of displaying ayReportMetaData data such as ","Roles":50538,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n
\n{{#each ayReportData}}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n {{#if ServiceDate }}\n {{else}}{{/if}}\n \n \n \n \n \n\n
Column to the right displays all of your ayReportMetaData :{{ayJSON ../ayReportMetaData }}
Column to the right displays this report template's name as is - with the quotation marks:{{ayJSON ../ayReportMetaData.Name}}
Column to the right displays this report template's name:{{../ayReportMetaData.Name}}
Column to the right displays the notes for this report template:{{../ayReportMetaData.Notes}}
Column to the right displays where this report template is accessed from:{{../ayReportMetaData.AType}}
 
{{ayT 'WorkOrder'}}{{ayT 'Customer'}}{{ayT 'WorkOrderServiceDate'}}{{ayT 'Report'}} {{ayT 'ReportName'}}{{ayT 'ReportNotes'}}
{{Serial}}{{CustomerViz}}{{ayDate ServiceDate}}no Service Date specified{{../ayReportMetaData.Name}}{{ ../ayReportMetaData.Notes}}
\n{{/each}}\n
\n\n","Style":".singlePage\n{\npage-break-after: always;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 11pt; \n color: #9e9e9e;\n} \n\ntable, td, th {\n border: 1px solid black;\n}\n\ntable { \n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n /* border-bottom: solid 1pt #9e9e9e; */\n height: 30px;\n font-size: 9pt; \n color: #9e9e9e;\n}\n\ntd {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n text-align: center;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([\"WorkOrder\", \"Customer\", \"WorkOrderServiceDate\", \"ReportNotes\", \"ReportName\", \"Report\" ]);\n\n\t\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"15mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_report template name notes ayReportMetaData","Active":true,"Notes":"Examples of displaying ayReportMetaData data such as ","Roles":50538,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n
\n{{#each ayReportData}}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n {{#if ServiceDate }}\n {{else}}{{/if}}\n \n \n \n \n \n\n
Column to the right displays all of your ayReportMetaData :{{ayJSON ../ayReportMetaData }}
Column to the right displays this report template's name as is - with the quotation marks:{{ayJSON ../ayReportMetaData.Name}}
Column to the right displays this report template's name:{{../ayReportMetaData.Name}}
Column to the right displays the notes for this report template:{{../ayReportMetaData.Notes}}
Column to the right displays where this report template is accessed from:{{../ayReportMetaData.AType}}
 
{{ayT 'WorkOrder'}}{{ayT 'Customer'}}{{ayT 'WorkOrderServiceDate'}}{{ayT 'Report'}} {{ayT 'ReportName'}}{{ayT 'ReportNotes'}}
{{Serial}}{{CustomerViz}}{{ayDate ServiceDate}}no Service Date specified{{../ayReportMetaData.Name}}{{ ../ayReportMetaData.Notes}}
\n{{/each}}\n
\n\n","Style":".singlePage\n{\npage-break-after: always;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 11pt; \n color: #9e9e9e;\n} \n\ntable, td, th {\n border: 1px solid black;\n}\n\ntable { \n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n /* border-bottom: solid 1pt #9e9e9e; */\n height: 30px;\n font-size: 9pt; \n color: #9e9e9e;\n}\n\ntd {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n text-align: center;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([\"WorkOrder\", \"Customer\", \"WorkOrderServiceDate\", \"ReportNotes\", \"ReportName\", \"Report\" ]);\n\n\t\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"15mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Barcode using built in ayBC.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Barcode using built in ayBC.ayrt index 1efc1243..edc2c8e3 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Barcode using built in ayBC.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Barcode using built in ayBC.ayrt @@ -1 +1 @@ -{"Name":"💡 Barcode using built in ayBC","Active":true,"Notes":"Example of displaying barcodes \n","Roles":124927,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n
\n\n

Example: Bar code helper

\n

See Report editor help documentation for additional details

\n\n {{#each ayReportData}}\n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{#each Items}}\n {{#each Units}}\n \n \n \n \n \n {{/each}}\n\n \n \n \n {{#each Parts}}\n \n \n \n \n \n {{/each}}\n\n \n {{/each}}\n
{{ayT \"WorkOrder\" }} {{ayT \"WorkOrderServiceNumber\" }} {{Serial}} as \"CODE-128\" BarCode with scale 1:{{ ayBC Serial '{ \"bcid\": \"code128\",\"includetext\":true, \"scale\":1}' }}
{{ayT \"WorkOrder\" }} {{ayT \"WorkOrderServiceNumber\" }} {{Serial}} as \"QR\" Code with scale 1:{{ ayBC Serial '{ \"bcid\": \"qrcode\",\"includetext\":true, \"scale\":1}' }}
{{ayT \"WorkOrder\" }} {{ayT \"WorkOrderServiceNumber\" }} {{Serial}} as \"QR\" Code with scale 3:{{ ayBC Serial '{ \"bcid\": \"qrcode\",\"includetext\":true, \"scale\":3}' }}
Sample \"UPC-A\" Code using a hard coded number 712345678904 as example:{{ ayBC \"712345678904\" '{ \"bcid\": \"upca\",\"includetext\":true, \"scale\":1}' }}
 
 {{ayT 'Unit'}} {{UnitViz}} displayed as as \"CODE-128\" BarCode with scale 1:{{ ayBC UnitViz '{ \"bcid\": \"code128\",\"includetext\":true, \"scale\":1}' }}
 
 {{ayT 'WorkOrderItemPartPartID'}}: {{PartNameViz}} displayed as \"CODE-128\" BarCode with scale 1:{{ ayBC PartNameViz '{ \"bcid\": \"code128\",\"includetext\":true, \"scale\":1}' }}
\n {{/each}}\n\n
\n\n\n\n","Style":"/* if not using a rule set or specific property it is recommended to comment out or delete fully for report performance*/\n\n.singlePage\n{\npage-break-after: always;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n} \n\ntable { \n table-layout: fixed; \n border-collapse: collapse;\n white-space: pre-wrap;\n font-size: 9pt;\n width: 100%;\n }\n\n\nth {\n height: 20px;\n color: #9e9e9e;\n}\n\ntbody tr {\n height: 10px;\n word-wrap: break-word;\n}\n\ntd {\n padding: 10px;\n}\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([ \"WorkOrder\", \"WorkOrderServiceNumber\", \"Unit\", \"WorkOrderItemPartPartID\" ]);\n\n\n\n\t\n\n return reportData;\n}","JsHelpers":"Handlebars.registerHelper('todaysMonthDDYYYYDate', function() {\n var dt3=new Date();\n return dt3.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n ) ;\n});// today's date displayed in MONTH DD, YYYY format EXAMPLE SHOW: June 9, 2021\n\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE HELPER\n//\nHandlebars.registerHelper('myDate', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleDateString method to format the date\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString\n return parsedDate.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n );\n});\n\n","RenderType":0,"HeaderTemplate":" ","FooterTemplate":"          Printed date: \n   Page  of         ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_Barcode using built in ayBC","Active":true,"Notes":"Example of displaying barcodes \n","Roles":124927,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n
\n\n

Example: Bar code helper

\n

See Report editor help documentation for additional details

\n\n {{#each ayReportData}}\n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{#each Items}}\n {{#each Units}}\n \n \n \n \n \n {{/each}}\n\n \n \n \n {{#each Parts}}\n \n \n \n \n \n {{/each}}\n\n \n {{/each}}\n
{{ayT \"WorkOrder\" }} {{ayT \"WorkOrderServiceNumber\" }} {{Serial}} as \"CODE-128\" BarCode with scale 1:{{ ayBC Serial '{ \"bcid\": \"code128\",\"includetext\":true, \"scale\":1}' }}
{{ayT \"WorkOrder\" }} {{ayT \"WorkOrderServiceNumber\" }} {{Serial}} as \"QR\" Code with scale 1:{{ ayBC Serial '{ \"bcid\": \"qrcode\",\"includetext\":true, \"scale\":1}' }}
{{ayT \"WorkOrder\" }} {{ayT \"WorkOrderServiceNumber\" }} {{Serial}} as \"QR\" Code with scale 3:{{ ayBC Serial '{ \"bcid\": \"qrcode\",\"includetext\":true, \"scale\":3}' }}
Sample \"UPC-A\" Code using a hard coded number 712345678904 as example:{{ ayBC \"712345678904\" '{ \"bcid\": \"upca\",\"includetext\":true, \"scale\":1}' }}
 
 {{ayT 'Unit'}} {{UnitViz}} displayed as as \"CODE-128\" BarCode with scale 1:{{ ayBC UnitViz '{ \"bcid\": \"code128\",\"includetext\":true, \"scale\":1}' }}
 
 {{ayT 'WorkOrderItemPartPartID'}}: {{PartNameViz}} displayed as \"CODE-128\" BarCode with scale 1:{{ ayBC PartNameViz '{ \"bcid\": \"code128\",\"includetext\":true, \"scale\":1}' }}
\n {{/each}}\n\n
\n\n\n\n","Style":"/* if not using a rule set or specific property it is recommended to comment out or delete fully for report performance*/\n\n.singlePage\n{\npage-break-after: always;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n} \n\ntable { \n table-layout: fixed; \n border-collapse: collapse;\n white-space: pre-wrap;\n font-size: 9pt;\n width: 100%;\n }\n\n\nth {\n height: 20px;\n color: #9e9e9e;\n}\n\ntbody tr {\n height: 10px;\n word-wrap: break-word;\n}\n\ntd {\n padding: 10px;\n}\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([ \"WorkOrder\", \"WorkOrderServiceNumber\", \"Unit\", \"WorkOrderItemPartPartID\" ]);\n\n\n\n\t\n\n return reportData;\n}","JsHelpers":"Handlebars.registerHelper('todaysMonthDDYYYYDate', function() {\n var dt3=new Date();\n return dt3.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n ) ;\n});// today's date displayed in MONTH DD, YYYY format EXAMPLE SHOW: June 9, 2021\n\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE HELPER\n//\nHandlebars.registerHelper('myDate', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleDateString method to format the date\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString\n return parsedDate.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n );\n});\n\n","RenderType":0,"HeaderTemplate":" ","FooterTemplate":"          Printed date: \n   Page  of         ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Custom fields.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Custom fields.ayrt index 48196a48..56727dd5 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Custom fields.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Custom fields.ayrt @@ -1 +1 @@ -{"Name":"💡 Custom fields","Active":true,"Notes":"example of using AyaNova provided Helpers to format custom fields - requires the object to have custom fields enabled\n","Roles":124927,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n
\n

Example assumes have used Customize... to make visible the Custom fields for the {{ayT 'WorkOrder'}}, {{ayT 'WorkOrderItem'}} and {{ayT 'WorkOrderItemUnit'}}

\n\n\n {{#each ayReportData}}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{#each Items}}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{#each Units}}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{/each}}\n {{/each}} \n \n
{{ayT 'WorkOrder'}} {{ayT 'WorkOrderServiceNumber'}}{{ Serial }}
 
{{ayT 'WorkOrder'}} {{ayT 'WorkOrderCustom1'}} displayed with no additional formating{{ CustomFields.c1 }}
 
{{ayT 'WorkOrder'}} {{ayT 'WorkOrderCustom2'}} displayed with no additional formating{{ CustomFields.c2 }}
If {{ayT 'WorkOrderCustom2'}} has {{ayT 'ObjectCustomFieldFieldType'}} of DateTime, shows with additional formating via ayDateTime{{ ayDateTime CustomFields.c2 }}
 
{{ayT 'WorkOrder'}} {{ayT 'WorkOrderCustom3'}} displayed with no additional formating{{ CustomFields.c3 }}
If {{ayT 'WorkOrderCustom3'}} has {{ayT 'ObjectCustomFieldFieldType'}} of Money, shows with additional formating via ayCurrency{{ayCurrency CustomFields.c3 }}
 
 {{ayT 'WorkOrderItem'}} {{ayT 'WorkOrderItemSummary'}}{{Notes}}
 {{ayT 'WorkOrderItem'}} {{ayT 'WorkOrderItemCustom1'}} displayed with no additional formating{{CustomFields.c1}}
 
 {{ayT 'WorkOrderItem'}} {{ayT 'WorkOrderItemCustom2'}} displayed with no additional formating{{CustomFields.c2}}
 If {{ayT 'WorkOrderItemCustom2'}} has {{ayT 'ObjectCustomFieldFieldType'}} of DateTime, shows with additional formating via ayDateTime{{ayDateTime CustomFields.c2}}
 
 {{ayT 'WorkOrderItem'}} {{ayT 'WorkOrderItemCustom3'}} displayed with no additional formating{{CustomFields.c3}}
 If {{ayT 'WorkOrderItemCustom3'}} has {{ayT 'ObjectCustomFieldFieldType'}} of Money, shows with additional formating via ayCurrency{{ayCurrency CustomFields.c3}}
 
 {{ayT 'WorkOrderItemUnit'}}{{UnitViz}} - {{UnitModelNameViz}}
 {{ayT 'WorkOrderItemUnit'}} {{ayT 'WorkOrderItemUnitCustom1'}} displayed with no additional formating{{CustomFields.c1}}
 
 {{ayT 'WorkOrderItemUnit'}} {{ayT 'WorkOrderItemUnitCustom2'}} displayed with no additional formating{{CustomFields.c2}}
 If {{ayT 'WorkOrderItemCustom2'}} has {{ayT 'ObjectCustomFieldFieldType'}} of DateTime, shows with additional formating via ayDateTime{{ayDateTime CustomFields.c2}}
 
 {{ayT 'WorkOrderItemUnit'}} {{ayT 'WorkOrderItemUnitCustom3'}} displayed with no additional formating{{CustomFields.c3}}
 If {{ayT 'WorkOrderItemUnit'}} has {{ayT 'ObjectCustomFieldFieldType'}} of Money, shows with additional formating via ayCurrency{{ayCurrency CustomFields.c3}}
 
\n {{/each}}\n
\n\n\n\n","Style":"/* if not using a rule set or specific property it is recommended to comment out or delete fully for report performance*/\n\n.singlePage\n{\npage-break-after: always;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n} \n\ntable { \n table-layout: fixed; //setting this to fixed causes columns to be evenly spaced for the entire table regardless of cell content, and then colspan then \"works\" as expected\n border-collapse: collapse;\n white-space: pre-wrap;\n font-size: 8pt;\n width: 100%;\n }\n\n\nth {\n height: 20px;\n color: #9e9e9e;\n}\n\ntbody tr {\n height: 5px;\n word-wrap: break-word;\n}\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([ \"ObjectCustomFieldFieldType\", \"WorkOrder\", \"WorkOrderServiceNumber\", \"WorkOrderCustom1\", \"WorkOrderCustom2\",\"WorkOrderCustom3\", \"WorkOrderItemSummary\", \"WorkOrderItem\", \"WorkOrderItemCustom1\", \"WorkOrderItemCustom2\", \"WorkOrderItemCustom3\", \"WorkOrderItemUnit\", \"WorkOrderItemUnitCustom1\", \"WorkOrderItemUnitCustom2\", \"WorkOrderItemUnitCustom3\" ]);\n\n\n\n\n return reportData;\n}","JsHelpers":"Handlebars.registerHelper('todaysMonthDDYYYYDate', function() {\n var dt3=new Date();\n return dt3.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n ) ;\n});// today's date displayed in MONTH DD, YYYY format EXAMPLE SHOW: June 9, 2021\n\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE HELPER\n//\nHandlebars.registerHelper('myDate', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleDateString method to format the date\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString\n return parsedDate.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n );\n});\n\n","RenderType":0,"HeaderTemplate":" ","FooterTemplate":"          Printed date: \n   Page  of         ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_Custom fields","Active":true,"Notes":"example of using AyaNova provided Helpers to format custom fields - requires the object to have custom fields enabled\n","Roles":124927,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n
\n

Example assumes have used Customize... to make visible the Custom fields for the {{ayT 'WorkOrder'}}, {{ayT 'WorkOrderItem'}} and {{ayT 'WorkOrderItemUnit'}}

\n\n\n {{#each ayReportData}}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{#each Items}}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{#each Units}}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{/each}}\n {{/each}} \n \n
{{ayT 'WorkOrder'}} {{ayT 'WorkOrderServiceNumber'}}{{ Serial }}
 
{{ayT 'WorkOrder'}} {{ayT 'WorkOrderCustom1'}} displayed with no additional formating{{ CustomFields.c1 }}
 
{{ayT 'WorkOrder'}} {{ayT 'WorkOrderCustom2'}} displayed with no additional formating{{ CustomFields.c2 }}
If {{ayT 'WorkOrderCustom2'}} has {{ayT 'ObjectCustomFieldFieldType'}} of DateTime, shows with additional formating via ayDateTime{{ ayDateTime CustomFields.c2 }}
 
{{ayT 'WorkOrder'}} {{ayT 'WorkOrderCustom3'}} displayed with no additional formating{{ CustomFields.c3 }}
If {{ayT 'WorkOrderCustom3'}} has {{ayT 'ObjectCustomFieldFieldType'}} of Money, shows with additional formating via ayCurrency{{ayCurrency CustomFields.c3 }}
 
 {{ayT 'WorkOrderItem'}} {{ayT 'WorkOrderItemSummary'}}{{Notes}}
 {{ayT 'WorkOrderItem'}} {{ayT 'WorkOrderItemCustom1'}} displayed with no additional formating{{CustomFields.c1}}
 
 {{ayT 'WorkOrderItem'}} {{ayT 'WorkOrderItemCustom2'}} displayed with no additional formating{{CustomFields.c2}}
 If {{ayT 'WorkOrderItemCustom2'}} has {{ayT 'ObjectCustomFieldFieldType'}} of DateTime, shows with additional formating via ayDateTime{{ayDateTime CustomFields.c2}}
 
 {{ayT 'WorkOrderItem'}} {{ayT 'WorkOrderItemCustom3'}} displayed with no additional formating{{CustomFields.c3}}
 If {{ayT 'WorkOrderItemCustom3'}} has {{ayT 'ObjectCustomFieldFieldType'}} of Money, shows with additional formating via ayCurrency{{ayCurrency CustomFields.c3}}
 
 {{ayT 'WorkOrderItemUnit'}}{{UnitViz}} - {{UnitModelNameViz}}
 {{ayT 'WorkOrderItemUnit'}} {{ayT 'WorkOrderItemUnitCustom1'}} displayed with no additional formating{{CustomFields.c1}}
 
 {{ayT 'WorkOrderItemUnit'}} {{ayT 'WorkOrderItemUnitCustom2'}} displayed with no additional formating{{CustomFields.c2}}
 If {{ayT 'WorkOrderItemCustom2'}} has {{ayT 'ObjectCustomFieldFieldType'}} of DateTime, shows with additional formating via ayDateTime{{ayDateTime CustomFields.c2}}
 
 {{ayT 'WorkOrderItemUnit'}} {{ayT 'WorkOrderItemUnitCustom3'}} displayed with no additional formating{{CustomFields.c3}}
 If {{ayT 'WorkOrderItemUnit'}} has {{ayT 'ObjectCustomFieldFieldType'}} of Money, shows with additional formating via ayCurrency{{ayCurrency CustomFields.c3}}
 
\n {{/each}}\n
\n\n\n\n","Style":"/* if not using a rule set or specific property it is recommended to comment out or delete fully for report performance*/\n\n.singlePage\n{\npage-break-after: always;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n} \n\ntable { \n table-layout: fixed; //setting this to fixed causes columns to be evenly spaced for the entire table regardless of cell content, and then colspan then \"works\" as expected\n border-collapse: collapse;\n white-space: pre-wrap;\n font-size: 8pt;\n width: 100%;\n }\n\n\nth {\n height: 20px;\n color: #9e9e9e;\n}\n\ntbody tr {\n height: 5px;\n word-wrap: break-word;\n}\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([ \"ObjectCustomFieldFieldType\", \"WorkOrder\", \"WorkOrderServiceNumber\", \"WorkOrderCustom1\", \"WorkOrderCustom2\",\"WorkOrderCustom3\", \"WorkOrderItemSummary\", \"WorkOrderItem\", \"WorkOrderItemCustom1\", \"WorkOrderItemCustom2\", \"WorkOrderItemCustom3\", \"WorkOrderItemUnit\", \"WorkOrderItemUnitCustom1\", \"WorkOrderItemUnitCustom2\", \"WorkOrderItemUnitCustom3\" ]);\n\n\n\n\n return reportData;\n}","JsHelpers":"Handlebars.registerHelper('todaysMonthDDYYYYDate', function() {\n var dt3=new Date();\n return dt3.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n ) ;\n});// today's date displayed in MONTH DD, YYYY format EXAMPLE SHOW: June 9, 2021\n\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE HELPER\n//\nHandlebars.registerHelper('myDate', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleDateString method to format the date\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString\n return parsedDate.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n );\n});\n\n","RenderType":0,"HeaderTemplate":" ","FooterTemplate":"          Printed date: \n   Page  of         ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Footer forced to bottom of each page of multi-page work order.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Footer forced to bottom of each page of multi-page work order.ayrt index dc362ae6..756a1103 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Footer forced to bottom of each page of multi-page work order.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Footer forced to bottom of each page of multi-page work order.ayrt @@ -1 +1 @@ -{"Name":"💡 Footer forced to bottom of each page of multi-page work order","Active":true,"Notes":"NOTE: this is NOT compatible with printing multiple work orders at same time.\nExample of HTML and CSS code to force footer contents to bottom of the page regardless of body contents ","Roles":124927,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n \n\n
\n {{#each ayReportData}}\n \n \n \n \n \n \n \n \n \n\n \n {{#if ../ayServerMetaData.HasSmallLogo}}\n \n \n \n \n \n \n\t\t\t\t\n\t\t\t\n {{else}} \n \n \n \n \n \n \n \n \n \n \n\t\t\t\t\n\t\t\t\n {{/if}} \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t\t\t\t\n\t\t\t\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{#each Items}}\n \n \n \n \n {{#each Units}}\n \n \n \n \n {{/each}}\n\n \n \n \n \n \n \n \n \n \n\n {{#each Expenses}}\n {{#if ChargeToCustomer}}\n \n \n \n \n \n \n \n \n \n \n {{#if ChargeTaxCodeId}}{{else}} {{/if}}\n {{#if ChargeTaxCodeId}}{{else}} {{/if}}\n \n \n {{else}} \n \n {{/if}}\n {{/each}}\n {{#each Loans}}\n \n \n \n \n \n \n {{#if TaxAViz}}{{else}}{{/if}}\n {{#if TaxBViz}}{{else}}{{/if}}\n \n \n {{/each}}\n {{#each Labors}}\n \n \n \n \n \n \n {{#if TaxAViz}}{{else}}{{/if}}\n {{#if TaxBViz}}{{else}}{{/if}}\n \n \n {{#if ServiceDetails}}\n \n \n \n \n \n {{else}}{{/if}}\n {{/each}}\n {{#each Parts}}\n \n \n \n \n \n \n {{#if TaxAViz}}{{else}}{{/if}}\n {{#if TaxBViz}}{{else}}{{/if}}\n \n \n {{#if Serials}}\n \n \n \n \n {{else}}{{/if}}\n {{/each}}\n {{#each Travels}}\n \n \n \n \n \n \n {{#if TaxAViz}}{{else}}{{/if}}\n {{#if TaxBViz}}{{else}}{{/if}}\n \n \n {{#if TravelDetails}}\n \n \n \n \n \n {{else}}{{/if}}\n {{/each}}\n {{#each OutsideServices}}\n \n \n \n \n {{#if TaxAViz}}{{else}}{{/if}}\n {{#if TaxBViz}}{{else}}{{/if}}\n \n \n {{/each}}\n \n \n \n {{/each}}\n \n \n \n \n \n \n\t\t\t\n\t\t\t\t\n\t\t\t\n \n\t\t\t\t\n\t\t\t\n \n\t\t\t\t\n\t\t\t\n \n\t\t\t\t\n\t\t\t\n \n\t\t\t\t\n\t\t\t\n \n\t\t\t\t\n\t\t\t\n \n\t\t\t\t\n\t\t\t\n \n\t\t\t\t\n\t\t\t\n \n\t\t\t\t\n\t\t\t\n\t\t\n
NOTE: THIS EXAMPLE IS ONLY FOR USE WHEN PRINTING A SINGLE WORK ORDER AT A TIME, AS THE TOTALS IN THE FOOTER WILL ONLY REFER TO THE \"LAST\" WORK ORDER IN THE PRINT JOB
Refer to the HTML and CSS within this report template for requirements
{{ ayLogo \"small\" }}{{ayT 'WorkOrderServiceNumber'}}{{Serial}}
 
{{../ayServerMetaData.CompanyName}}{{ayT 'WorkOrderServiceNumber'}}{{Serial}}
{{../ayServerMetaData.CompanyPostAddress}} {{../ayServerMetaData.CompanyPostCity}}
 
Service performed forPrinted Date{{todaysMonthDDYYYYDate}}
{{CustomerViz}}
 {{Address}}, {{City}} 
 {{CustomerPhone1Viz}} 
 
{{ayT 'WorkOrderServiceDate'}}{{ayT 'WorkOrderCustomerReferenceNumber'}}{{ayT 'WorkOrderInvoiceNumber'}}
{{myDate ServiceDate}}{{CustomerReferenceNumber}}{{InvoiceNumber}}
 
{{ayT 'WorkOrderItemSummary'}}{{Notes}}
{{ayT 'Unit'}}{{UnitViz}} - {{UnitModelNameViz}}
 {{ayT 'WorkOrderItemPartQuantity'}}{{ayT 'Price'}}{{ayT 'NetValue'}}{{ayT 'TaxCodeTaxA'}}{{ayT 'TaxCodeTaxB'}}{{ayT 'LineTotal'}}
 {{ayT 'WorkOrderItemExpenses'}}: {{Name}}{{ayCurrency ChargeAmount}}{{ayCurrency TaxAViz}}{{ayCurrency TaxPaid}}{{ayCurrency TaxBViz}} {{ayCurrency LineTotalViz}}
{{ayT 'WorkOrderItemExpenses'}}: {{Name}} at no charge to customer
 {{ayT 'WorkOrderItemLoanList'}}: {{LoanUnitViz}} / {{UnitOfMeasureViz}}{{Quantity}}{{ayCurrency PriceViz}}{{ayCurrency NetViz}}{{ayCurrency TaxAViz}}$0.00{{ayCurrency TaxBViz}}{{ayCurrency 0.00}}{{ayCurrency LineTotalViz}}
 {{ayT 'WorkOrderItemLabors'}} performed {{ayDateTime ServiceStartDate}} with {{ayT 'WorkOrderItemLaborServiceRateID'}} of {{ServiceRateViz}}{{ServiceRateQuantity}}{{ayCurrency PriceViz}}{{ayCurrency NetViz}}{{ayCurrency TaxAViz}}$0.00{{ayCurrency TaxBViz}}$0.00{{ayCurrency LineTotalViz}}
 {{ayT 'WorkOrderItemLaborServiceDetails'}}:{{ServiceDetails}}
 {{ayT 'WorkOrderItemPartPartID'}}: {{PartNameViz}} {{PartDescriptionViz}}{{Quantity}}{{ayCurrency PriceViz}}{{ayCurrency NetViz}}{{ayCurrency TaxAViz}}$0.00{{ayCurrency TaxBViz}}$0.00{{ayCurrency LineTotalViz}}
 {{ayT 'WorkOrderItemPartPartID'}} {{ayT 'WorkOrderItemPartPartSerialID'}}: {{Serials}}
 {{ayT 'WorkOrderItemTravels'}} performed {{ayDate TravelStartDate}} with {{ayT 'WorkOrderItemTravelServiceRateID'}} of {{TravelRateViz}}{{TravelRateQuantity}}{{ayCurrency PriceViz}}{{ayCurrency NetViz}}{{ayCurrency TaxAViz}}$0.00{{ayCurrency TaxBViz}}$0.00{{ayCurrency LineTotalViz}}
 {{ayT 'WorkOrderItemTravelDetails'}}:{{TravelDetails}}
 {{ayT 'WorkOrderItemOutsideService'}} performed on Unit: {{UnitViz}}{{ayCurrency NetViz}}{{ayCurrency TaxAViz}}$0.00{{ayCurrency TaxBViz}}$0.00{{ayCurrency LineTotalViz}}
 
 
 
 
 
 
 
 
 
 
 
\n\n \n \n\t\t\n \n \n \n \n \n \n \n \n \n \n {{#if ThisWOTotalTaxAs}}{{else}}{{/if}}\n {{#if ThisWOTotalTaxBs}}{{else}}{{/if}}\n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n {{#if CustomerSignature}}{{else}} {{/if}}\n {{#if CustomerSignature}}{{else}} {{/if}}\n\n {{#if CustomerSignatureCaptured}}{{else}} {{/if}}\n {{#if CustomerSignatureCaptured}}{{else}} {{/if}}\n\n {{#if CustomerSignatureName}}{{else}} {{/if}}\n {{#if CustomerSignatureName}}{{else}} {{/if}}\n \n\t\t\n\t\t
Total NetsTotal TaxATotal TaxBGrand Total
{{ayCurrency ThisWOTotalNets}}{{ayCurrency ThisWOTotalTaxAs}}$0.00{{ayCurrency ThisWOTotalTaxBs}}$0.00{{ayCurrency ThisWOTotalGrand}}
 
Thank you for your business!Terms: Net 30 days
 
I acknowledge the satisfactory provision and completion of the above for {{ayT 'WorkOrderServiceNumber'}} {{Serial}}
 
Digital {{ayT 'CustomerSignature'}}{{ayT 'CustomerSignature'}} ___________________Digital Signature DateSignature Date{{ayDateTime CustomerSignatureCaptured}}____________________Digital Print of NamePrint of Name{{CustomerSignatureName}}____________________
\n\n\n\n {{/each}}\n
\n\n\n\n","Style":"/* this css required along with the HTML code to have footer FORCED to the bottom of the page regardless of body content and number of pages for the work order */\n.footerdisplay { \n position: fixed; \n font-size: 8pt; \n bottom: 0px;\n width: 100%;\n border-top: 1px solid #9e9e9e;; \n}\n\n.singlePage\n{\npage-break-after: always;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n} \n\ntable { \n table-layout: fixed; /* setting this to fixed causes columns to be evenly spaced for the entire table regardless of cell content, and then colspan then \"works\" as expected */\n border-collapse: collapse;\n white-space: pre-wrap;\n font-size: 9pt;\n width: 100%;\n }\n\n\nth {\n height: 20px;\n color: #9e9e9e;\n}\n\ntbody tr {\n height: 10px;\n word-wrap: break-word;\n}\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([\"WorkOrderInvoiceNumber\", \"WorkOrderServiceDate\", \"WorkOrderServiceNumber\", \"WorkOrderCustomerReferenceNumber\", \"Unit\", \"WorkOrderItemSummary\", \"WorkOrderItemPartQuantity\", \"Price\", \"NetValue\", \"TaxCodeTaxA\", \"TaxCodeTaxB\", \"LineTotal\", \"WorkOrderItemExpenses\", \"WorkOrderItemLoanList\", \"WorkOrderItemPartPartID\", \"WorkOrderItemPartPartSerialID\", \"WorkOrderItemLabors\", \"WorkOrderItemLaborServiceRateID\", \"WorkOrderItemLaborServiceDetails\", \"WorkOrderItemTravels\", \"WorkOrderItemTravelDetails\", \"WorkOrderItemTravelServiceRateID\", \"WorkOrderItemOutsideService\", \"CustomerSignature\" ]);\n\n\t//below checks if any parts have Serials to remove carriage returns so parts serials display on same line\n for (EachWO of reportData.ayReportData) {\n for (Item of EachWO.Items) {\n for (Part of Item.Parts) {\n if (Part.Serials != null) {\n s = Part.Serials; \n Part.Serials = s.replace(/[\\n\\r]+/g, ' ');\n }\n }\n }\n }\n\n\n//********************//NOTE if you customize this report template and do NOT need a function or key identified below, remove to increase report performance\n\n\nfor (EachWO of reportData.ayReportData) \n\t{\n\t//below declares a key on the entire wo to hold all Labor Net Viz from all Items in this wo so it exists\n\tEachWO.ThisWOAllLaborsNetViz = 0;\n\t//below declares a key on the entire wo to hold all Part Net Viz from all Items in this wo so it exists\n\tEachWO.ThisWOAllPartsNetViz = 0;\n\t//below declares a key on the entire wo to hold all Travel Net Viz from all Items in this wo so it exists\n\tEachWO.ThisWOAllTravelsNetViz = 0;\n\t//below declares a key on the entire wo to hold all Exp Net ChargeAmount from all Items in this wo so it exists\n\tEachWO.ThisWOAllExpsNetChargeAmount = 0;\n\t//below declares a key on the entire wo to hold all Loan Net Viz from all Items in this wo so it exists\n\tEachWO.ThisWOAllLoansNetViz = 0;\n\t//below declares a key on the entire wo to hold all Outside Net Viz from all Items in this wo so it exists\n\tEachWO.ThisWOAllOutsidesNetViz = 0;\t\n\n\t//below declares a key on the entire wo to hold ALL of THIS workorder's Nets so it exists\n\tEachWO.ThisWOTotalNets = 0;\n\n\t//below declares a key on the entire wo to hold THIS workorder's Tax A (for all items) so it exists \n\tEachWO.ThisWOTotalTaxAs = 0;\n\t//below declares a key on the entire wo to hold THIS workorder's Tax B (for all items) so it exists\n\tEachWO.ThisWOTotalTaxBs = 0;\t\n\t//below declares a key on the entire wo to hold THIS workorder's Grand Total so it exists\n\tEachWO.ThisWOTotalGrand = 0;\n\n\t//below is to Iterate through each item of the wo's Items\n\tfor (Item of EachWO.Items)\n\t\t{\n\t\t\tItem.ThisItemAllLaborsNetViz = 0; //declare a key on the Item to hold all of this item's labor nets and set it initially to 0 \n\t\t\t\n\t\t\t//below is to Iterate through each labor record of the wo's Item\n\t\t\tfor (Labor of Item.Labors)\n\t\t\t{\n\t\t\t//make sure it has a value before attempting to add it to the running total\n \tif (Labor.NetViz != null) \n \t \t{\n \t \tItem.ThisItemAllLaborsNetViz += Labor.NetViz; //this IS where the actual adding to running total for this WOItem's Net Labors\n\t\t\t\t\t\tEachWO.ThisWOAllLaborsNetViz += Labor.NetViz; //this IS where the actual adding to the running total for this entire WO's Net Labors\n\t\t\t\t\t\tEachWO.ThisWOTotalNets += Labor.NetViz; //this IS where the actual adding to the running total for ALL NETS for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Labor.NetViz; //this IS where the actual adding to the running total for GrandTotal for THIS workorders in this report data\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxAs += Labor.TaxAViz; //this IS where the actual adding of Labor's Tax A to the running total for ALL Tax A for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Labor.TaxAViz; //this IS where the actual adding of Labor's Tax A to the running total for GrandTotal for THIS workorders in this report data\n\t\t\t\t\t\t\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxBs += Labor.TaxBViz; //this IS where the actual adding of Labor's Tax B to the running total for ALL Tax B for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Labor.TaxBViz; //this IS where the actual adding of Labor's Tax B to the running total for GrandTotal for THIS workorders in this report data\n \t \t\t}\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\t\n\t\t\t}\n\n\t\t\tItem.ThisItemAllPartsNetViz = 0; //declare a key on the Item to hold all of this item's parts nets and set it initially to 0 \n\t\t\t\n\t\t\t//below is to Iterate through each Part record of the wo's Item\n\t\t\tfor (Part of Item.Parts)\n\t\t\t{\n\t\t\t//make sure it has a value before attempting to add it to the running total\n \tif (Part.NetViz != null) \n \t \t{\n \t \tItem.ThisItemAllPartsNetViz += Part.NetViz; //this IS where the actual adding to running total for this WOItem's Net Parts\n\t\t\t\t\t\tEachWO.ThisWOAllPartsNetViz += Part.NetViz;//this IS where the actual adding to the running total for this entire WO's Net Parts\n\t\t\t\t\t\tEachWO.ThisWOTotalNets += Part.NetViz; //this IS where the actual adding to the running total for ALL NETS for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Part.NetViz; //this IS where the actual adding to the running total for GrandTotal for THIS workorders in this report data\t\t\t\t\t\t\n\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxAs += Part.TaxAViz; //this IS where the actual adding of Part's Tax A to the running total for ALL Tax A for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Part.TaxAViz; //this IS where the actual adding of Part's Tax A to the running total for GrandTotal for THIS workorders in this report data\n\t\t\t\t\t\t\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxBs += Part.TaxBViz; //this IS where the actual adding of Part's Tax B to the running total for ALL Tax B for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Part.TaxBViz; //this IS where the actual adding of Part's Tax B to the running total for GrandTotal for THIS workorders in this report data\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\t\t\t}\n\n\t\t\tItem.ThisItemAllTravelsNetViz = 0; //declare a key on the Item to hold all of this item's travel nets and set it initially to 0 \n\t\t\t\n\t\t\t//below is to Iterate through each Travel record of the wo's Item\n\t\t\tfor (Travel of Item.Travels)\n\t\t\t{\n\t\t\t//make sure it has a value before attempting to add it to the running total\n \tif (Travel.NetViz != null) \n \t \t{\n\t\t\t\t\t\t\n \t \tItem.ThisItemAllTravelsNetViz += Travel.NetViz;//this IS where the actual adding to running total for this WOItem's Net Travels\n\t\t\t\t\t\tEachWO.ThisWOAllTravelsNetViz += Travel.NetViz;//this IS where the actual adding to the running total for this entire WO's Net Travels\n\t\t\t\t\t\tEachWO.ThisWOTotalNets += Travel.NetViz;//this IS where the actual adding to the running total for ALL NETS for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Travel.NetViz; //this IS where the actual adding to the running total for GrandTotal for THIS workorders in this report data\n\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxAs += Travel.TaxAViz; //this IS where the actual adding of Travel's Tax A to the running total for ALL Tax A for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Travel.TaxAViz; //this IS where the actual adding of Travel's Tax A to the running total for GrandTotal for THIS workorders in this report data\n\t\t\t\t\t\t\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxBs += Travel.TaxBViz; //this IS where the actual adding of Travel's Tax B to the running total for ALL Tax B for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Travel.TaxBViz; //this IS where the actual adding of Travel's Tax B to the running total for GrandTotal for THIS workorders in this report data\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\t\t\t}\n\n\t\t\t//note additional statements for misc expense to ONLY add to running totals if ChargeToCustomer is true\n\t\t\t\n\t\t\tItem.ThisItemAllExpsNetChargeAmount = 0; //declare a key on the Item to hold all of this item's misc nets and set it initially to 0 \n\t\t\t\n\t\t\t//below is to Iterate through each Exp record of the wo's Item\n\t\t\tfor (Exp of Item.Expenses)\n\t\t\t{\n\t\t\t//if this expense has a ChargeAmount value AND the ChargeToCustomer is true then adds the ChargeAmount to running totals\n \tif (Exp.ChargeAmount != null && Exp.ChargeToCustomer == true) \n \t \t{\n\t\t\t\t\t\t\n \t \tItem.ThisItemAllExpsNetChargeAmount += Exp.ChargeAmount;//this IS where the actual adding to running total for this WOItem's Net Exps\n\t\t\t\t\t\tEachWO.ThisWOAllExpsNetChargeAmount += Exp.ChargeAmount;//this IS where the actual adding to the running total for this entire WO's Net ChargeAmounts\n\t\t\t\t\t\tEachWO.ThisWOTotalNets += Exp.ChargeAmount;//this IS where the actual adding to the running total for ALL NET ChargeAmountS for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Exp.ChargeAmount; //this IS where the actual adding to the running total for GrandTotal for THIS workorders in this report data\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\n\t\t\t//if this expense the ChargeToCustomer is true AND ChargeTaxCode has a value then adds the TaxAViz and TaxBViz to running totals\t\t\n\t\t\t\t\tif (Exp.ChargeToCustomer == true && Exp.ChargeTaxCodeId != null ) \n \t \t{\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxAs += Exp.TaxAViz; //this IS where the actual adding of Exp's Tax A to the running total for ALL Tax A for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Exp.TaxAViz; //this IS where the actual adding of Exp's Tax A to the running total for GrandTotal for THIS workorders in this report data\n\t\t\t\t\t\t\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxBs += Exp.TaxBViz; //this IS where the actual adding of Exp's Tax B to the running total for ALL Tax B for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Exp.TaxBViz; //this IS where the actual adding of Exp's Tax B to the running total for GrandTotal for THIS workorders in this report data\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\t\t\t\t\telse if (Exp.ChargeToCustomer == true && Exp.ChargeTaxCodeId == null ) //else if ChargeToCustomer is true AND ChargeTaxCodeID is null, then add TaxPaid to TaxA running total and Grand Total\t\t\n\t\t\t\t\t\t{\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxAs += Exp.TaxPaid; //this IS where the actual adding of Exp's TaxPaid to the running total for ALL Tax A for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Exp.TaxPaid; //this IS where the actual adding of Exp's TaxPaid to the running total for GrandTotal for THIS workorders in this report data\n\t\t\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t\n\t\t\tItem.ThisItemAllLoansNetViz = 0; //declare a key on the Item to hold all of this item's loans nets and set it initially to 0 \n\t\t\t\n\t\t\t//below is to Iterate through each Loan record of the wo's Item\n\t\t\tfor (Loan of Item.Loans)\n\t\t\t{\n\t\t\t//make sure it has a value before attempting to add it to the running total\n \tif (Loan.NetViz != null) \n \t \t{\n \t \tItem.ThisItemAllLoansNetViz += Loan.NetViz;//this IS where the actual adding to running total for this WOItem's Net Loans\n\t\t\t\t\t\tEachWO.ThisWOAllLoansNetViz += Loan.NetViz;//this IS where the actual adding to the running total for this entire WO's Net Loans\n\t\t\t\t\t\tEachWO.ThisWOTotalNets += Loan.NetViz;//this IS where the actual adding to the running total for ALL NETS for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Loan.NetViz; //this IS where the actual adding to the running total for GrandTotal for THIS workorders in this report data\n\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxAs += Loan.TaxAViz; //this IS where the actual adding of Loan's Tax A to the running total for ALL Tax A for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Loan.TaxAViz; //this IS where the actual adding of Loan's Tax A to the running total for GrandTotal for THIS workorders in this report data\n\t\t\t\t\t\t\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxBs += Loan.TaxBViz; //this IS where the actual adding of Loan's Tax B to the running total for ALL Tax B for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Loan.TaxBViz; //this IS where the actual adding of Loan's Tax B to the running total for GrandTotal for THIS workorders in this report data\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\t\t\t}\n\n\t\t\tItem.ThisItemAllOutsidesNetViz = 0; //declare a key on the Item to hold all of this item's Outsie nets and set it initially to 0 \n\t\t\t\n\t\t\t//below is to Iterate through each Outside record of the wo's Item\n\t\t\tfor (Outside of Item.OutsideServices)\n\t\t\t{\n\t\t\t//make sure it has a value before attempting to add it to the running total\n \tif (Outside.NetViz != null) \n \t \t{\n\t\t\t\t\t\t\n \t \tItem.ThisItemAllOutsidesNetViz += Outside.NetViz;//this IS where the actual adding to running total for this WOItem's Net Outside\n\t\t\t\t\t\tEachWO.ThisWOAllOutsidesNetViz += Outside.NetViz;//this IS where the actual adding to the running total for this entire WO's Net Outsides\n\t\t\t\t\t\tEachWO.ThisWOTotalNets += Outside.NetViz;//this IS where the actual adding to the running total for ALL NETS for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Outside.NetViz; //this IS where the actual adding to the running total for GrandTotal for THIS workorders in this report data\n\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxAs += Outside.TaxAViz; //this IS where the actual adding of Outside's Tax A to the running total for ALL Tax A for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Outside.TaxAViz; //this IS where the actual adding of Outside's Tax A to the running total for GrandTotal for THIS workorders in this report data\n\t\t\t\t\t\t\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxBs += Outside.TaxBViz; //this IS where the actual adding of Outside's Tax B to the running total for ALL Tax B for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Outside.TaxBViz; //this IS where the actual adding of Outside's Tax B to the running total for GrandTotal for THIS workorders in this report data\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\t\t\t}\n\t\t}\n\t}\n\t\n\n return reportData;\n}","JsHelpers":"Handlebars.registerHelper('todaysMonthDDYYYYDate', function() {\n var dt3=new Date();\n return dt3.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n ) ;\n});// today's date displayed in MONTH DD, YYYY format EXAMPLE SHOW: June 9, 2021\n\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE HELPER\n//\nHandlebars.registerHelper('myDate', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleDateString method to format the date\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString\n return parsedDate.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n );\n});\n\n","RenderType":0,"HeaderTemplate":" ","FooterTemplate":"          Printed date: \n   Page  of         ","DisplayHeaderFooter":false,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_Footer forced to bottom of each page of multi-page work order","Active":true,"Notes":"NOTE: this is NOT compatible with printing multiple work orders at same time.\nExample of HTML and CSS code to force footer contents to bottom of the page regardless of body contents ","Roles":124927,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n \n\n
\n {{#each ayReportData}}\n \n \n \n \n \n \n \n \n \n\n \n {{#if ../ayServerMetaData.HasSmallLogo}}\n \n \n \n \n \n \n\t\t\t\t\n\t\t\t\n {{else}} \n \n \n \n \n \n \n \n \n \n \n\t\t\t\t\n\t\t\t\n {{/if}} \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t\t\t\t\n\t\t\t\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{#each Items}}\n \n \n \n \n {{#each Units}}\n \n \n \n \n {{/each}}\n\n \n \n \n \n \n \n \n \n \n\n {{#each Expenses}}\n {{#if ChargeToCustomer}}\n \n \n \n \n \n \n \n \n \n \n {{#if ChargeTaxCodeId}}{{else}} {{/if}}\n {{#if ChargeTaxCodeId}}{{else}} {{/if}}\n \n \n {{else}} \n \n {{/if}}\n {{/each}}\n {{#each Loans}}\n \n \n \n \n \n \n {{#if TaxAViz}}{{else}}{{/if}}\n {{#if TaxBViz}}{{else}}{{/if}}\n \n \n {{/each}}\n {{#each Labors}}\n \n \n \n \n \n \n {{#if TaxAViz}}{{else}}{{/if}}\n {{#if TaxBViz}}{{else}}{{/if}}\n \n \n {{#if ServiceDetails}}\n \n \n \n \n \n {{else}}{{/if}}\n {{/each}}\n {{#each Parts}}\n \n \n \n \n \n \n {{#if TaxAViz}}{{else}}{{/if}}\n {{#if TaxBViz}}{{else}}{{/if}}\n \n \n {{#if Serials}}\n \n \n \n \n {{else}}{{/if}}\n {{/each}}\n {{#each Travels}}\n \n \n \n \n \n \n {{#if TaxAViz}}{{else}}{{/if}}\n {{#if TaxBViz}}{{else}}{{/if}}\n \n \n {{#if TravelDetails}}\n \n \n \n \n \n {{else}}{{/if}}\n {{/each}}\n {{#each OutsideServices}}\n \n \n \n \n {{#if TaxAViz}}{{else}}{{/if}}\n {{#if TaxBViz}}{{else}}{{/if}}\n \n \n {{/each}}\n \n \n \n {{/each}}\n \n \n \n \n \n \n\t\t\t\n\t\t\t\t\n\t\t\t\n \n\t\t\t\t\n\t\t\t\n \n\t\t\t\t\n\t\t\t\n \n\t\t\t\t\n\t\t\t\n \n\t\t\t\t\n\t\t\t\n \n\t\t\t\t\n\t\t\t\n \n\t\t\t\t\n\t\t\t\n \n\t\t\t\t\n\t\t\t\n \n\t\t\t\t\n\t\t\t\n\t\t\n
NOTE: THIS EXAMPLE IS ONLY FOR USE WHEN PRINTING A SINGLE WORK ORDER AT A TIME, AS THE TOTALS IN THE FOOTER WILL ONLY REFER TO THE \"LAST\" WORK ORDER IN THE PRINT JOB
Refer to the HTML and CSS within this report template for requirements
{{ ayLogo \"small\" }}{{ayT 'WorkOrderServiceNumber'}}{{Serial}}
 
{{../ayServerMetaData.CompanyName}}{{ayT 'WorkOrderServiceNumber'}}{{Serial}}
{{../ayServerMetaData.CompanyPostAddress}} {{../ayServerMetaData.CompanyPostCity}}
 
Service performed forPrinted Date{{todaysMonthDDYYYYDate}}
{{CustomerViz}}
 {{Address}}, {{City}} 
 {{CustomerPhone1Viz}} 
 
{{ayT 'WorkOrderServiceDate'}}{{ayT 'WorkOrderCustomerReferenceNumber'}}{{ayT 'WorkOrderInvoiceNumber'}}
{{myDate ServiceDate}}{{CustomerReferenceNumber}}{{InvoiceNumber}}
 
{{ayT 'WorkOrderItemSummary'}}{{Notes}}
{{ayT 'Unit'}}{{UnitViz}} - {{UnitModelNameViz}}
 {{ayT 'WorkOrderItemPartQuantity'}}{{ayT 'Price'}}{{ayT 'NetValue'}}{{ayT 'TaxCodeTaxA'}}{{ayT 'TaxCodeTaxB'}}{{ayT 'LineTotal'}}
 {{ayT 'WorkOrderItemExpenses'}}: {{Name}}{{ayCurrency ChargeAmount}}{{ayCurrency TaxAViz}}{{ayCurrency TaxPaid}}{{ayCurrency TaxBViz}} {{ayCurrency LineTotalViz}}
{{ayT 'WorkOrderItemExpenses'}}: {{Name}} at no charge to customer
 {{ayT 'WorkOrderItemLoanList'}}: {{LoanUnitViz}} / {{UnitOfMeasureViz}}{{Quantity}}{{ayCurrency PriceViz}}{{ayCurrency NetViz}}{{ayCurrency TaxAViz}}$0.00{{ayCurrency TaxBViz}}{{ayCurrency 0.00}}{{ayCurrency LineTotalViz}}
 {{ayT 'WorkOrderItemLabors'}} performed {{ayDateTime ServiceStartDate}} with {{ayT 'WorkOrderItemLaborServiceRateID'}} of {{ServiceRateViz}}{{ServiceRateQuantity}}{{ayCurrency PriceViz}}{{ayCurrency NetViz}}{{ayCurrency TaxAViz}}$0.00{{ayCurrency TaxBViz}}$0.00{{ayCurrency LineTotalViz}}
 {{ayT 'WorkOrderItemLaborServiceDetails'}}:{{ServiceDetails}}
 {{ayT 'WorkOrderItemPartPartID'}}: {{PartNameViz}} {{PartDescriptionViz}}{{Quantity}}{{ayCurrency PriceViz}}{{ayCurrency NetViz}}{{ayCurrency TaxAViz}}$0.00{{ayCurrency TaxBViz}}$0.00{{ayCurrency LineTotalViz}}
 {{ayT 'WorkOrderItemPartPartID'}} {{ayT 'WorkOrderItemPartPartSerialID'}}: {{Serials}}
 {{ayT 'WorkOrderItemTravels'}} performed {{ayDate TravelStartDate}} with {{ayT 'WorkOrderItemTravelServiceRateID'}} of {{TravelRateViz}}{{TravelRateQuantity}}{{ayCurrency PriceViz}}{{ayCurrency NetViz}}{{ayCurrency TaxAViz}}$0.00{{ayCurrency TaxBViz}}$0.00{{ayCurrency LineTotalViz}}
 {{ayT 'WorkOrderItemTravelDetails'}}:{{TravelDetails}}
 {{ayT 'WorkOrderItemOutsideService'}} performed on Unit: {{UnitViz}}{{ayCurrency NetViz}}{{ayCurrency TaxAViz}}$0.00{{ayCurrency TaxBViz}}$0.00{{ayCurrency LineTotalViz}}
 
 
 
 
 
 
 
 
 
 
 
\n\n \n \n\t\t\n \n \n \n \n \n \n \n \n \n \n {{#if ThisWOTotalTaxAs}}{{else}}{{/if}}\n {{#if ThisWOTotalTaxBs}}{{else}}{{/if}}\n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n {{#if CustomerSignature}}{{else}} {{/if}}\n {{#if CustomerSignature}}{{else}} {{/if}}\n\n {{#if CustomerSignatureCaptured}}{{else}} {{/if}}\n {{#if CustomerSignatureCaptured}}{{else}} {{/if}}\n\n {{#if CustomerSignatureName}}{{else}} {{/if}}\n {{#if CustomerSignatureName}}{{else}} {{/if}}\n \n\t\t\n\t\t
Total NetsTotal TaxATotal TaxBGrand Total
{{ayCurrency ThisWOTotalNets}}{{ayCurrency ThisWOTotalTaxAs}}$0.00{{ayCurrency ThisWOTotalTaxBs}}$0.00{{ayCurrency ThisWOTotalGrand}}
 
Thank you for your business!Terms: Net 30 days
 
I acknowledge the satisfactory provision and completion of the above for {{ayT 'WorkOrderServiceNumber'}} {{Serial}}
 
Digital {{ayT 'CustomerSignature'}}{{ayT 'CustomerSignature'}} ___________________Digital Signature DateSignature Date{{ayDateTime CustomerSignatureCaptured}}____________________Digital Print of NamePrint of Name{{CustomerSignatureName}}____________________
\n\n\n\n {{/each}}\n
\n\n\n\n","Style":"/* this css required along with the HTML code to have footer FORCED to the bottom of the page regardless of body content and number of pages for the work order */\n.footerdisplay { \n position: fixed; \n font-size: 8pt; \n bottom: 0px;\n width: 100%;\n border-top: 1px solid #9e9e9e;; \n}\n\n.singlePage\n{\npage-break-after: always;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n} \n\ntable { \n table-layout: fixed; /* setting this to fixed causes columns to be evenly spaced for the entire table regardless of cell content, and then colspan then \"works\" as expected */\n border-collapse: collapse;\n white-space: pre-wrap;\n font-size: 9pt;\n width: 100%;\n }\n\n\nth {\n height: 20px;\n color: #9e9e9e;\n}\n\ntbody tr {\n height: 10px;\n word-wrap: break-word;\n}\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([\"WorkOrderInvoiceNumber\", \"WorkOrderServiceDate\", \"WorkOrderServiceNumber\", \"WorkOrderCustomerReferenceNumber\", \"Unit\", \"WorkOrderItemSummary\", \"WorkOrderItemPartQuantity\", \"Price\", \"NetValue\", \"TaxCodeTaxA\", \"TaxCodeTaxB\", \"LineTotal\", \"WorkOrderItemExpenses\", \"WorkOrderItemLoanList\", \"WorkOrderItemPartPartID\", \"WorkOrderItemPartPartSerialID\", \"WorkOrderItemLabors\", \"WorkOrderItemLaborServiceRateID\", \"WorkOrderItemLaborServiceDetails\", \"WorkOrderItemTravels\", \"WorkOrderItemTravelDetails\", \"WorkOrderItemTravelServiceRateID\", \"WorkOrderItemOutsideService\", \"CustomerSignature\" ]);\n\n\t//below checks if any parts have Serials to remove carriage returns so parts serials display on same line\n for (EachWO of reportData.ayReportData) {\n for (Item of EachWO.Items) {\n for (Part of Item.Parts) {\n if (Part.Serials != null) {\n s = Part.Serials; \n Part.Serials = s.replace(/[\\n\\r]+/g, ' ');\n }\n }\n }\n }\n\n\n//********************//NOTE if you customize this report template and do NOT need a function or key identified below, remove to increase report performance\n\n\nfor (EachWO of reportData.ayReportData) \n\t{\n\t//below declares a key on the entire wo to hold all Labor Net Viz from all Items in this wo so it exists\n\tEachWO.ThisWOAllLaborsNetViz = 0;\n\t//below declares a key on the entire wo to hold all Part Net Viz from all Items in this wo so it exists\n\tEachWO.ThisWOAllPartsNetViz = 0;\n\t//below declares a key on the entire wo to hold all Travel Net Viz from all Items in this wo so it exists\n\tEachWO.ThisWOAllTravelsNetViz = 0;\n\t//below declares a key on the entire wo to hold all Exp Net ChargeAmount from all Items in this wo so it exists\n\tEachWO.ThisWOAllExpsNetChargeAmount = 0;\n\t//below declares a key on the entire wo to hold all Loan Net Viz from all Items in this wo so it exists\n\tEachWO.ThisWOAllLoansNetViz = 0;\n\t//below declares a key on the entire wo to hold all Outside Net Viz from all Items in this wo so it exists\n\tEachWO.ThisWOAllOutsidesNetViz = 0;\t\n\n\t//below declares a key on the entire wo to hold ALL of THIS workorder's Nets so it exists\n\tEachWO.ThisWOTotalNets = 0;\n\n\t//below declares a key on the entire wo to hold THIS workorder's Tax A (for all items) so it exists \n\tEachWO.ThisWOTotalTaxAs = 0;\n\t//below declares a key on the entire wo to hold THIS workorder's Tax B (for all items) so it exists\n\tEachWO.ThisWOTotalTaxBs = 0;\t\n\t//below declares a key on the entire wo to hold THIS workorder's Grand Total so it exists\n\tEachWO.ThisWOTotalGrand = 0;\n\n\t//below is to Iterate through each item of the wo's Items\n\tfor (Item of EachWO.Items)\n\t\t{\n\t\t\tItem.ThisItemAllLaborsNetViz = 0; //declare a key on the Item to hold all of this item's labor nets and set it initially to 0 \n\t\t\t\n\t\t\t//below is to Iterate through each labor record of the wo's Item\n\t\t\tfor (Labor of Item.Labors)\n\t\t\t{\n\t\t\t//make sure it has a value before attempting to add it to the running total\n \tif (Labor.NetViz != null) \n \t \t{\n \t \tItem.ThisItemAllLaborsNetViz += Labor.NetViz; //this IS where the actual adding to running total for this WOItem's Net Labors\n\t\t\t\t\t\tEachWO.ThisWOAllLaborsNetViz += Labor.NetViz; //this IS where the actual adding to the running total for this entire WO's Net Labors\n\t\t\t\t\t\tEachWO.ThisWOTotalNets += Labor.NetViz; //this IS where the actual adding to the running total for ALL NETS for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Labor.NetViz; //this IS where the actual adding to the running total for GrandTotal for THIS workorders in this report data\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxAs += Labor.TaxAViz; //this IS where the actual adding of Labor's Tax A to the running total for ALL Tax A for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Labor.TaxAViz; //this IS where the actual adding of Labor's Tax A to the running total for GrandTotal for THIS workorders in this report data\n\t\t\t\t\t\t\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxBs += Labor.TaxBViz; //this IS where the actual adding of Labor's Tax B to the running total for ALL Tax B for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Labor.TaxBViz; //this IS where the actual adding of Labor's Tax B to the running total for GrandTotal for THIS workorders in this report data\n \t \t\t}\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\t\n\t\t\t}\n\n\t\t\tItem.ThisItemAllPartsNetViz = 0; //declare a key on the Item to hold all of this item's parts nets and set it initially to 0 \n\t\t\t\n\t\t\t//below is to Iterate through each Part record of the wo's Item\n\t\t\tfor (Part of Item.Parts)\n\t\t\t{\n\t\t\t//make sure it has a value before attempting to add it to the running total\n \tif (Part.NetViz != null) \n \t \t{\n \t \tItem.ThisItemAllPartsNetViz += Part.NetViz; //this IS where the actual adding to running total for this WOItem's Net Parts\n\t\t\t\t\t\tEachWO.ThisWOAllPartsNetViz += Part.NetViz;//this IS where the actual adding to the running total for this entire WO's Net Parts\n\t\t\t\t\t\tEachWO.ThisWOTotalNets += Part.NetViz; //this IS where the actual adding to the running total for ALL NETS for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Part.NetViz; //this IS where the actual adding to the running total for GrandTotal for THIS workorders in this report data\t\t\t\t\t\t\n\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxAs += Part.TaxAViz; //this IS where the actual adding of Part's Tax A to the running total for ALL Tax A for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Part.TaxAViz; //this IS where the actual adding of Part's Tax A to the running total for GrandTotal for THIS workorders in this report data\n\t\t\t\t\t\t\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxBs += Part.TaxBViz; //this IS where the actual adding of Part's Tax B to the running total for ALL Tax B for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Part.TaxBViz; //this IS where the actual adding of Part's Tax B to the running total for GrandTotal for THIS workorders in this report data\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\t\t\t}\n\n\t\t\tItem.ThisItemAllTravelsNetViz = 0; //declare a key on the Item to hold all of this item's travel nets and set it initially to 0 \n\t\t\t\n\t\t\t//below is to Iterate through each Travel record of the wo's Item\n\t\t\tfor (Travel of Item.Travels)\n\t\t\t{\n\t\t\t//make sure it has a value before attempting to add it to the running total\n \tif (Travel.NetViz != null) \n \t \t{\n\t\t\t\t\t\t\n \t \tItem.ThisItemAllTravelsNetViz += Travel.NetViz;//this IS where the actual adding to running total for this WOItem's Net Travels\n\t\t\t\t\t\tEachWO.ThisWOAllTravelsNetViz += Travel.NetViz;//this IS where the actual adding to the running total for this entire WO's Net Travels\n\t\t\t\t\t\tEachWO.ThisWOTotalNets += Travel.NetViz;//this IS where the actual adding to the running total for ALL NETS for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Travel.NetViz; //this IS where the actual adding to the running total for GrandTotal for THIS workorders in this report data\n\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxAs += Travel.TaxAViz; //this IS where the actual adding of Travel's Tax A to the running total for ALL Tax A for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Travel.TaxAViz; //this IS where the actual adding of Travel's Tax A to the running total for GrandTotal for THIS workorders in this report data\n\t\t\t\t\t\t\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxBs += Travel.TaxBViz; //this IS where the actual adding of Travel's Tax B to the running total for ALL Tax B for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Travel.TaxBViz; //this IS where the actual adding of Travel's Tax B to the running total for GrandTotal for THIS workorders in this report data\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\t\t\t}\n\n\t\t\t//note additional statements for misc expense to ONLY add to running totals if ChargeToCustomer is true\n\t\t\t\n\t\t\tItem.ThisItemAllExpsNetChargeAmount = 0; //declare a key on the Item to hold all of this item's misc nets and set it initially to 0 \n\t\t\t\n\t\t\t//below is to Iterate through each Exp record of the wo's Item\n\t\t\tfor (Exp of Item.Expenses)\n\t\t\t{\n\t\t\t//if this expense has a ChargeAmount value AND the ChargeToCustomer is true then adds the ChargeAmount to running totals\n \tif (Exp.ChargeAmount != null && Exp.ChargeToCustomer == true) \n \t \t{\n\t\t\t\t\t\t\n \t \tItem.ThisItemAllExpsNetChargeAmount += Exp.ChargeAmount;//this IS where the actual adding to running total for this WOItem's Net Exps\n\t\t\t\t\t\tEachWO.ThisWOAllExpsNetChargeAmount += Exp.ChargeAmount;//this IS where the actual adding to the running total for this entire WO's Net ChargeAmounts\n\t\t\t\t\t\tEachWO.ThisWOTotalNets += Exp.ChargeAmount;//this IS where the actual adding to the running total for ALL NET ChargeAmountS for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Exp.ChargeAmount; //this IS where the actual adding to the running total for GrandTotal for THIS workorders in this report data\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\n\t\t\t//if this expense the ChargeToCustomer is true AND ChargeTaxCode has a value then adds the TaxAViz and TaxBViz to running totals\t\t\n\t\t\t\t\tif (Exp.ChargeToCustomer == true && Exp.ChargeTaxCodeId != null ) \n \t \t{\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxAs += Exp.TaxAViz; //this IS where the actual adding of Exp's Tax A to the running total for ALL Tax A for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Exp.TaxAViz; //this IS where the actual adding of Exp's Tax A to the running total for GrandTotal for THIS workorders in this report data\n\t\t\t\t\t\t\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxBs += Exp.TaxBViz; //this IS where the actual adding of Exp's Tax B to the running total for ALL Tax B for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Exp.TaxBViz; //this IS where the actual adding of Exp's Tax B to the running total for GrandTotal for THIS workorders in this report data\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\t\t\t\t\telse if (Exp.ChargeToCustomer == true && Exp.ChargeTaxCodeId == null ) //else if ChargeToCustomer is true AND ChargeTaxCodeID is null, then add TaxPaid to TaxA running total and Grand Total\t\t\n\t\t\t\t\t\t{\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxAs += Exp.TaxPaid; //this IS where the actual adding of Exp's TaxPaid to the running total for ALL Tax A for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Exp.TaxPaid; //this IS where the actual adding of Exp's TaxPaid to the running total for GrandTotal for THIS workorders in this report data\n\t\t\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t\n\t\t\tItem.ThisItemAllLoansNetViz = 0; //declare a key on the Item to hold all of this item's loans nets and set it initially to 0 \n\t\t\t\n\t\t\t//below is to Iterate through each Loan record of the wo's Item\n\t\t\tfor (Loan of Item.Loans)\n\t\t\t{\n\t\t\t//make sure it has a value before attempting to add it to the running total\n \tif (Loan.NetViz != null) \n \t \t{\n \t \tItem.ThisItemAllLoansNetViz += Loan.NetViz;//this IS where the actual adding to running total for this WOItem's Net Loans\n\t\t\t\t\t\tEachWO.ThisWOAllLoansNetViz += Loan.NetViz;//this IS where the actual adding to the running total for this entire WO's Net Loans\n\t\t\t\t\t\tEachWO.ThisWOTotalNets += Loan.NetViz;//this IS where the actual adding to the running total for ALL NETS for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Loan.NetViz; //this IS where the actual adding to the running total for GrandTotal for THIS workorders in this report data\n\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxAs += Loan.TaxAViz; //this IS where the actual adding of Loan's Tax A to the running total for ALL Tax A for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Loan.TaxAViz; //this IS where the actual adding of Loan's Tax A to the running total for GrandTotal for THIS workorders in this report data\n\t\t\t\t\t\t\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxBs += Loan.TaxBViz; //this IS where the actual adding of Loan's Tax B to the running total for ALL Tax B for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Loan.TaxBViz; //this IS where the actual adding of Loan's Tax B to the running total for GrandTotal for THIS workorders in this report data\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\t\t\t}\n\n\t\t\tItem.ThisItemAllOutsidesNetViz = 0; //declare a key on the Item to hold all of this item's Outsie nets and set it initially to 0 \n\t\t\t\n\t\t\t//below is to Iterate through each Outside record of the wo's Item\n\t\t\tfor (Outside of Item.OutsideServices)\n\t\t\t{\n\t\t\t//make sure it has a value before attempting to add it to the running total\n \tif (Outside.NetViz != null) \n \t \t{\n\t\t\t\t\t\t\n \t \tItem.ThisItemAllOutsidesNetViz += Outside.NetViz;//this IS where the actual adding to running total for this WOItem's Net Outside\n\t\t\t\t\t\tEachWO.ThisWOAllOutsidesNetViz += Outside.NetViz;//this IS where the actual adding to the running total for this entire WO's Net Outsides\n\t\t\t\t\t\tEachWO.ThisWOTotalNets += Outside.NetViz;//this IS where the actual adding to the running total for ALL NETS for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Outside.NetViz; //this IS where the actual adding to the running total for GrandTotal for THIS workorders in this report data\n\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxAs += Outside.TaxAViz; //this IS where the actual adding of Outside's Tax A to the running total for ALL Tax A for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Outside.TaxAViz; //this IS where the actual adding of Outside's Tax A to the running total for GrandTotal for THIS workorders in this report data\n\t\t\t\t\t\t\n\t\t\t\t\t\tEachWO.ThisWOTotalTaxBs += Outside.TaxBViz; //this IS where the actual adding of Outside's Tax B to the running total for ALL Tax B for THIS workorders in this report data\n\t\t\t\t\t\tEachWO.ThisWOTotalGrand += Outside.TaxBViz; //this IS where the actual adding of Outside's Tax B to the running total for GrandTotal for THIS workorders in this report data\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\t\t\t}\n\t\t}\n\t}\n\t\n\n return reportData;\n}","JsHelpers":"Handlebars.registerHelper('todaysMonthDDYYYYDate', function() {\n var dt3=new Date();\n return dt3.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n ) ;\n});// today's date displayed in MONTH DD, YYYY format EXAMPLE SHOW: June 9, 2021\n\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE HELPER\n//\nHandlebars.registerHelper('myDate', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleDateString method to format the date\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString\n return parsedDate.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n );\n});\n\n","RenderType":0,"HeaderTemplate":" ","FooterTemplate":"          Printed date: \n   Page  of         ","DisplayHeaderFooter":false,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE PO custom Helper #if_eq if equal to.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE PO custom Helper #if_eq if equal to.ayrt index 61d7d4c1..6f4ab822 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE PO custom Helper #if_eq if equal to.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE PO custom Helper #if_eq if equal to.ayrt @@ -1 +1 @@ -{"Name":"💡 PO custom Helper #if_eq if equal to","Active":true,"Notes":"example custom Helper if_eq to compare ordered to received, if equals will show in greenfont. if NOT equal, shows in redfont\nexample use of HTML if else /if - if serials present then show, else show preset text","Roles":124927,"AType":26,"IncludeWoItemDescendants":false,"Template":"\n\n\t\n\t\n \n \n \n \n \n \n \n \n \n \n {{#each ayReportData}}\n \n {{#each Items}} \n \n \n \n \n\n \n {{#if_eq QuantityOrdered QuantityReceived}} {{else}}{{/if_eq}}\n\t\t\t\t\t\n \n {{#if Serials}}{{else}}{{/if}}\n \n {{/each}}\n \n \n \n \n {{/each}}\n
{{ayT 'PurchaseOrderPONumber'}}{{ayT 'Part'}}{{ayT 'PurchaseOrderItemQuantityOrdered'}}{{ayT 'PurchaseOrderItemQuantityReceived'}}{{ayT 'PurchaseOrderItemSerialNumbers'}}
{{../Serial}} {{PartNameViz}} {{QuantityOrdered}}{{QuantityReceived}} (same as quantity ordered){{QuantityReceived}} (not the same as ordered){{Serials}}no serials documented
 
\n\t\n\n","Style":".singlePage\n{\npage-break-after: always;\n\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n color: #9e9e9e;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n height: 50px;\n font-size: 11pt; \n color: #9e9e9e;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n text-align: center;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n await ayGetTranslations([ \"Part\", \"PurchaseOrderItemQuantityOrdered\", \"PurchaseOrderPONumber\", \"PurchaseOrderItemSerialNumbers\", \"PurchaseOrderItemQuantityReceived\" ]);\n\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})\n\n//custom helper so can do a direct comparison - i.e. if value equals xxxx, then show, else show yyyyy\n//note that this HAS to be added here in Helpers, is NOT built in\nHandlebars.registerHelper('if_eq', function(a, b, opts) {\n if(a == b) // Or === depending on your needs\n return opts.fn(this);\n else\n return opts.inverse(this);\n});\n","RenderType":0,"HeaderTemplate":"                Printed date: PDFDate\nPage of                ","FooterTemplate":"  ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_PO custom Helper #if_eq if equal to","Active":true,"Notes":"example custom Helper if_eq to compare ordered to received, if equals will show in greenfont. if NOT equal, shows in redfont\nexample use of HTML if else /if - if serials present then show, else show preset text","Roles":124927,"AType":26,"IncludeWoItemDescendants":false,"Template":"\n\n\t\n\t\n \n \n \n \n \n \n \n \n \n \n {{#each ayReportData}}\n \n {{#each Items}} \n \n \n \n \n\n \n {{#if_eq QuantityOrdered QuantityReceived}} {{else}}{{/if_eq}}\n\t\t\t\t\t\n \n {{#if Serials}}{{else}}{{/if}}\n \n {{/each}}\n \n \n \n \n {{/each}}\n
{{ayT 'PurchaseOrderPONumber'}}{{ayT 'Part'}}{{ayT 'PurchaseOrderItemQuantityOrdered'}}{{ayT 'PurchaseOrderItemQuantityReceived'}}{{ayT 'PurchaseOrderItemSerialNumbers'}}
{{../Serial}} {{PartNameViz}} {{QuantityOrdered}}{{QuantityReceived}} (same as quantity ordered){{QuantityReceived}} (not the same as ordered){{Serials}}no serials documented
 
\n\t\n\n","Style":".singlePage\n{\npage-break-after: always;\n\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n color: #9e9e9e;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n height: 50px;\n font-size: 11pt; \n color: #9e9e9e;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n text-align: center;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n await ayGetTranslations([ \"Part\", \"PurchaseOrderItemQuantityOrdered\", \"PurchaseOrderPONumber\", \"PurchaseOrderItemSerialNumbers\", \"PurchaseOrderItemQuantityReceived\" ]);\n\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})\n\n//custom helper so can do a direct comparison - i.e. if value equals xxxx, then show, else show yyyyy\n//note that this HAS to be added here in Helpers, is NOT built in\nHandlebars.registerHelper('if_eq', function(a, b, opts) {\n if(a == b) // Or === depending on your needs\n return opts.fn(this);\n else\n return opts.inverse(this);\n});\n","RenderType":0,"HeaderTemplate":"                Printed date: PDFDate\nPage of                ","FooterTemplate":"  ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Wiki displayed PO.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Wiki displayed PO.ayrt index 717950ea..54d329eb 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Wiki displayed PO.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Wiki displayed PO.ayrt @@ -1 +1 @@ -{"Name":"💡 Wiki displayed PO","Active":true,"Notes":"","Roles":124927,"AType":26,"IncludeWoItemDescendants":false,"Template":"\n\t\n\t\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\n\t{{#each ayReportData}}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\n\t{{/each}}\n\n\t\n\t\t\n\t\t\t\n\t\t\n\t\t\n\n\t
column header 1column header 2
{{ayT 'PurchaseOrder'}} {{Serial}}{{ayWiki Wiki}}
and some footer text
\t\n\n\n","Style":".singlePage\n{\npage-break-after: always;\n}\n\n.footertext {\n font-size: 14pt;\n font-style: italic;\n background-color: pink;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n color: #9e9e9e;\n text-align: center;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n border-bottom: solid 1pt #9e9e9e;\n height: 50px;\n font-size: 13pt; \n color: #9e9e9e;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n await ayGetTranslations([\"PurchaseOrder\" ]);\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"    Todays date:    set in PDF Options","FooterTemplate":"  set in PDF Options  Page  of     ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_Wiki displayed PO","Active":true,"Notes":"","Roles":124927,"AType":26,"IncludeWoItemDescendants":false,"Template":"\n\t\n\t\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\n\t{{#each ayReportData}}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\n\t{{/each}}\n\n\t\n\t\t\n\t\t\t\n\t\t\n\t\t\n\n\t
column header 1column header 2
{{ayT 'PurchaseOrder'}} {{Serial}}{{ayWiki Wiki}}
and some footer text
\t\n\n\n","Style":".singlePage\n{\npage-break-after: always;\n}\n\n.footertext {\n font-size: 14pt;\n font-style: italic;\n background-color: pink;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n color: #9e9e9e;\n text-align: center;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n border-bottom: solid 1pt #9e9e9e;\n height: 50px;\n font-size: 13pt; \n color: #9e9e9e;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n await ayGetTranslations([\"PurchaseOrder\" ]);\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"    Todays date:    set in PDF Options","FooterTemplate":"  set in PDF Options  Page  of     ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Wiki displayed.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Wiki displayed.ayrt index 8756a3eb..95fdb7b1 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Wiki displayed.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Wiki displayed.ayrt @@ -1 +1 @@ -{"Name":"💡 Wiki displayed","Active":true,"Notes":"","Roles":124927,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\t\n\t\t\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\n\t{{#each ayReportData}}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\n\t{{/each}}\n\n\t\n\t\t\n\t\t\t\n\t\t\n\t\t\n\n\t
column header text repeats every pagecolumn header 2
{{ayT 'WorkOrder'}} {{Serial}}{{ayWiki Wiki}}
and some footer text that will be repeated every page
\t\n\n\n","Style":".singlePage\n{\npage-break-after: always;\n}\n\n.footertext {\n font-size: 14pt;\n font-style: italic;\n background-color: lightsteelblue;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n color: #9e9e9e;\n text-align: center;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n border-bottom: solid 1pt #9e9e9e;\n height: 50px;\n font-size: 13pt; \n color: #9e9e9e;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n}\n\n\ntbody tr:nth-child(odd) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n await ayGetTranslations([\"WorkOrder\" ]);\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"    Todays date:    set in PDF Options","FooterTemplate":"  set in PDF Options  Page  of     ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_Wiki displayed","Active":true,"Notes":"","Roles":124927,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\t\n\t\t\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\n\t{{#each ayReportData}}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\n\t{{/each}}\n\n\t\n\t\t\n\t\t\t\n\t\t\n\t\t\n\n\t
column header text repeats every pagecolumn header 2
{{ayT 'WorkOrder'}} {{Serial}}{{ayWiki Wiki}}
and some footer text that will be repeated every page
\t\n\n\n","Style":".singlePage\n{\npage-break-after: always;\n}\n\n.footertext {\n font-size: 14pt;\n font-style: italic;\n background-color: lightsteelblue;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n color: #9e9e9e;\n text-align: center;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n border-bottom: solid 1pt #9e9e9e;\n height: 50px;\n font-size: 13pt; \n color: #9e9e9e;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n}\n\n\ntbody tr:nth-child(odd) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n await ayGetTranslations([\"WorkOrder\" ]);\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"    Todays date:    set in PDF Options","FooterTemplate":"  set in PDF Options  Page  of     ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE additional Today's Date Time Helpers.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE additional Today's Date Time Helpers.ayrt index b45fb834..3115efa2 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE additional Today's Date Time Helpers.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE additional Today's Date Time Helpers.ayrt @@ -1 +1 @@ -{"Name":"💡 additional Today's Date Time Helpers","Active":true,"Notes":"example Custom Helpers to display todays date in different formats","Roles":124927,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n\t
\n\t\t

Additional custom time date helpers

\n\t

today's date using custom Helper todaysDate no formatting: {{ todaysDate}}

\n\t

today's date using custom Helper date.toLocaleDateString() : {{ todaysLocaleStringDate}}

\n\ttoday's date using custom Helper todaysget that users date.getFullYear etc: {{ todaysget}}

\n\t

today's date using custom Helper long format of ayClientMetaData: {{ todaysMonthDDYYYYDate}}

\n\t

today's date using custom Helper todaysDateYearFromParts formatter.formatToParts(parsedDate): {{ todaysDateYearFromParts}}

\n\t

all can be further customized to display short, long, etc format

\n\t
\n\n\n","Style":".example {\n color: blue;\n}","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\n\n\nHandlebars.registerHelper('todaysDate', function() {\n var dt1=new Date();\n return dt1\n});// today's date with no formatting EXAMPLE SHOW: Wed Jun 09 2021 16:17:27 GMT-0700 (Pacific Daylight Time)\n\nHandlebars.registerHelper('todaysLocaleStringDate', function() {\n var dt2=new Date();\n return dt2.toLocaleDateString() \n});// today's date displayed in the localedatestring EXAMPLE SHOW: 09/06/2021\n\n\nHandlebars.registerHelper('todaysget', function() {\n var dt5 =new Date();\n var date = dt5.getFullYear()+'-'+(dt5.getMonth()+1)+'-'+dt5.getDate() + \" \" + +dt5.getHours() + \":\" + +dt5.getMinutes() ;\n return date\n});// today's date displayed EXAMPLE SHOW: 2021-6-9 16:17\n\n\nHandlebars.registerHelper('todaysMonthDDYYYYDate', function() {\n var dt3=new Date();\n return dt3.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n ) ;\n});// today's date displayed in MONTH DD, YYYY format EXAMPLE SHOW: June 9, 2021\n\n\n\n\n\n//\n// CUSTOM FORMAT TO PARTS HELPER\n// this offers the most control over the return format\n// Locale aware conversion to parts that can be returned in any format\n//\nHandlebars.registerHelper('todaysDateYearFromParts', function () {\n\n //parse todays date\n let parsedDate = new Date();\n\n //Set formatter options\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts\n let formatter = new Intl.DateTimeFormat('en-us', {\n weekday: 'long',\n year: 'numeric',\n month: 'long', //long to show the full name of month, short to show short name, numeric to show the month number\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n fractionalSecondDigits: 3,\n hour12: true,\n timeZone: 'Canada/Pacific' //refer to https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for appropriate TZ database name to use\n //OR use what is displayed in the output for your ayClientMetaData's TimeZoneName:\n });\n\n let parts = formatter.formatToParts(parsedDate);\n /*\n // parts example return value: \n [ \n { type: 'weekday', value: 'Monday' }, \n { type: 'literal', value: ', ' }, \n { type: 'month', value: '12' }, \n { type: 'literal', value: '/' }, \n { type: 'day', value: '17' }, \n { type: 'literal', value: '/' }, \n { type: 'year', value: '2012' }, \n { type: 'literal', value: ', ' }, \n { type: 'hour', value: '3' }, \n { type: 'literal', value: ':' }, \n { type: 'minute', value: '00' }, \n { type: 'literal', value: ':' }, \n { type: 'second', value: '42' }, \n { type: 'fractionalSecond', value: '000' },\n { type: 'literal', value: ' ' }, \n { type: 'dayPeriod', value: 'AM' } \n ]\n */\n//identify here which of the above will use when returning\n let partWeekDay = parts.find(({ type }) => type === 'weekday').value;\n let partDay = parts.find(({ type }) => type === 'day').value;\n let partMonth = parts.find(({ type }) => type === 'month').value;\n let partYear = parts.find(({ type }) => type === 'year').value;\n let partHour = parts.find(({ type }) => type === 'hour').value;\n let partMin = parts.find(({ type }) => type === 'minute').value;\n let partdayPeriod = parts.find(({ type }) => type === 'dayPeriod').value;\n\n\n \n //return in some custom format\n return `${partWeekDay} ${partDay}, ${partMonth} ${partYear} - ${partHour}:${partMin} ${partdayPeriod}`; // EXAMPLE SHOW Wednesday 9, June 2021 - 4:17 PM\n\n \n //return below instead to see array of the possible values for each type while initially figuring out what to customize to\n //return JSON.stringify(parts);\n});","RenderType":0,"HeaderTemplate":null,"FooterTemplate":null,"DisplayHeaderFooter":false,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"10mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_additional Today's Date Time Helpers","Active":true,"Notes":"example Custom Helpers to display todays date in different formats","Roles":124927,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n\t
\n\t\t

Additional custom time date helpers

\n\t

today's date using custom Helper todaysDate no formatting: {{ todaysDate}}

\n\t

today's date using custom Helper date.toLocaleDateString() : {{ todaysLocaleStringDate}}

\n\ttoday's date using custom Helper todaysget that users date.getFullYear etc: {{ todaysget}}

\n\t

today's date using custom Helper long format of ayClientMetaData: {{ todaysMonthDDYYYYDate}}

\n\t

today's date using custom Helper todaysDateYearFromParts formatter.formatToParts(parsedDate): {{ todaysDateYearFromParts}}

\n\t

all can be further customized to display short, long, etc format

\n\t
\n\n\n","Style":".example {\n color: blue;\n}","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\n\n\nHandlebars.registerHelper('todaysDate', function() {\n var dt1=new Date();\n return dt1\n});// today's date with no formatting EXAMPLE SHOW: Wed Jun 09 2021 16:17:27 GMT-0700 (Pacific Daylight Time)\n\nHandlebars.registerHelper('todaysLocaleStringDate', function() {\n var dt2=new Date();\n return dt2.toLocaleDateString() \n});// today's date displayed in the localedatestring EXAMPLE SHOW: 09/06/2021\n\n\nHandlebars.registerHelper('todaysget', function() {\n var dt5 =new Date();\n var date = dt5.getFullYear()+'-'+(dt5.getMonth()+1)+'-'+dt5.getDate() + \" \" + +dt5.getHours() + \":\" + +dt5.getMinutes() ;\n return date\n});// today's date displayed EXAMPLE SHOW: 2021-6-9 16:17\n\n\nHandlebars.registerHelper('todaysMonthDDYYYYDate', function() {\n var dt3=new Date();\n return dt3.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n ) ;\n});// today's date displayed in MONTH DD, YYYY format EXAMPLE SHOW: June 9, 2021\n\n\n\n\n\n//\n// CUSTOM FORMAT TO PARTS HELPER\n// this offers the most control over the return format\n// Locale aware conversion to parts that can be returned in any format\n//\nHandlebars.registerHelper('todaysDateYearFromParts', function () {\n\n //parse todays date\n let parsedDate = new Date();\n\n //Set formatter options\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts\n let formatter = new Intl.DateTimeFormat('en-us', {\n weekday: 'long',\n year: 'numeric',\n month: 'long', //long to show the full name of month, short to show short name, numeric to show the month number\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n fractionalSecondDigits: 3,\n hour12: true,\n timeZone: 'Canada/Pacific' //refer to https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for appropriate TZ database name to use\n //OR use what is displayed in the output for your ayClientMetaData's TimeZoneName:\n });\n\n let parts = formatter.formatToParts(parsedDate);\n /*\n // parts example return value: \n [ \n { type: 'weekday', value: 'Monday' }, \n { type: 'literal', value: ', ' }, \n { type: 'month', value: '12' }, \n { type: 'literal', value: '/' }, \n { type: 'day', value: '17' }, \n { type: 'literal', value: '/' }, \n { type: 'year', value: '2012' }, \n { type: 'literal', value: ', ' }, \n { type: 'hour', value: '3' }, \n { type: 'literal', value: ':' }, \n { type: 'minute', value: '00' }, \n { type: 'literal', value: ':' }, \n { type: 'second', value: '42' }, \n { type: 'fractionalSecond', value: '000' },\n { type: 'literal', value: ' ' }, \n { type: 'dayPeriod', value: 'AM' } \n ]\n */\n//identify here which of the above will use when returning\n let partWeekDay = parts.find(({ type }) => type === 'weekday').value;\n let partDay = parts.find(({ type }) => type === 'day').value;\n let partMonth = parts.find(({ type }) => type === 'month').value;\n let partYear = parts.find(({ type }) => type === 'year').value;\n let partHour = parts.find(({ type }) => type === 'hour').value;\n let partMin = parts.find(({ type }) => type === 'minute').value;\n let partdayPeriod = parts.find(({ type }) => type === 'dayPeriod').value;\n\n\n \n //return in some custom format\n return `${partWeekDay} ${partDay}, ${partMonth} ${partYear} - ${partHour}:${partMin} ${partdayPeriod}`; // EXAMPLE SHOW Wednesday 9, June 2021 - 4:17 PM\n\n \n //return below instead to see array of the possible values for each type while initially figuring out what to customize to\n //return JSON.stringify(parts);\n});","RenderType":0,"HeaderTemplate":null,"FooterTemplate":null,"DisplayHeaderFooter":false,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"10mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE ayGetFromAPI display additional data from linked customer object.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE ayGetFromAPI display additional data from linked customer object.ayrt index 45215c6e..3189ca15 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE ayGetFromAPI display additional data from linked customer object.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE ayGetFromAPI display additional data from linked customer object.ayrt @@ -1 +1 @@ -{"Name":"💡 ayGetFromAPI display additional data from linked customer object","Active":true,"Notes":"Example of using the ayGetFromAPI to display data from the Customer record when reporting on the Unit record","Roles":124927,"AType":31,"IncludeWoItemDescendants":false,"Template":"\n \n\t
\t\n\t\t
\n\t\t\t

Using API method to obtain additional data from the {{ayT 'Customer'}} record

\n\t\t
\n \n \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t \n \t\t\n\t\t\t \n\t\t\t\t {{#each ayReportData}} \n\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t \n\t\t\t\t {{/each}}\n\t\t\t \n
Data from the Unit recordData from the Customer record obtained using API method
{{ayT 'Customer'}} {{ayT 'Unit'}}{{ayT 'Customer'}}{{ayT 'Customer'}} {{ayT 'CustomerEmail'}}{{ayT 'Customer'}} {{ayT 'CustomerPhone1'}}{{ayT 'Customer'}} {{ayT 'HeadOffice'}}
{{Serial}} {{UnitModelNameViz}}{{CustomerViz}}{{myCustomerInfo.emailAddress}}{{myCustomerInfo.phone1}}{{myCustomerInfo.headOfficeViz}}
\n\n \n {{#each ayReportData}}\n \n \n \n \n \n\t\t\t \n \n \n {{/each}}\n
This is a printout of the data returned from the custom Prepare that this report now uses for each unit in the datalist. To display any of the Customer data ported over, just identify in mustaches myCustomerInfo.xxxx where xxx is the key as in CustomerInfo.phone1
{{ayJSON this}}
\n\n
\n\n","Style":".singlePage\r\n{\r\npage-break-after: always;\r\n\r\n}\r\nbody {\r\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \r\n}\r\n\r\n.reporttitle { \r\n margin-bottom: 20pt; \r\n font-weight: bold; \r\n font-size: 13pt; \r\n color: #9e9e9e;\r\n text-align: center;\r\n} \r\n\r\ntable { \r\n border-collapse: collapse;\r\n white-space: pre-wrap;\r\n width: 100%;\r\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\r\n }\r\n\r\nth {\r\n /* border-bottom: solid 1pt #9e9e9e; */\r\n height: 30px;\r\n font-size: 11pt; \r\n color: #9e9e9e;\r\n}\r\n\r\ntbody td {\r\n padding: 10px;\r\n word-wrap: break-word;\r\n font-size: 9pt;\r\n}\r\n\r\n\r\ntbody tr:nth-child(even) {\r\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\r\n}\r\n\r\n\r\n.rightlean {\r\n text-align: right;\r\n}\r\n.leftlean {\r\n text-align: left;\r\n}\r\n.centerlean {\r\n text-align: center;\r\n}\r\n\r\n\r\n.fontgreen {\r\n color: green;\r\n font-size: 16pt;\r\n}\r\n.fontblue {\r\n color: blue;\r\n}\r\n.fontred {\r\n color:red;\r\n}\r\n\r\n","JsPrerender":"async function ayPrepareData(ayData) {\n\n await ayGetTranslations([\"Unit\", \"Customer\", \"CustomerEmail\", \"CustomerPhone1\", \"HeadOffice\" ]);\n \n //Loop through all the records in the raw report data\n for (let i = 0; i < ayData.ayReportData.length; i++) {\n //set a temporary variable to each record to save typing it all out\n let item = ayData.ayReportData[i];\n\n //call into the AyaNova API and get the customer record for this report data's customer id\n const apiResult = await ayGetFromAPI(`customer/${item.CustomerId}`);\n\n //if a result comes back, insert it into the report data so it's available to the template\n if (apiResult) {\n //put the return data customer record on a key in each record called 'myCustomerInfo' (you can call it anything as long as it doesn't conflict with an existing key)\n item.myCustomerInfo = apiResult.data\n }\n }\n return ayData;\n}","JsHelpers":"","RenderType":0,"HeaderTemplate":"                Printed date: PDFDate\n\nPage of                ","FooterTemplate":"  ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"20mm","MarginOptionsTop":"20mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_ayGetFromAPI display additional data from linked customer object","Active":true,"Notes":"Example of using the ayGetFromAPI to display data from the Customer record when reporting on the Unit record","Roles":124927,"AType":31,"IncludeWoItemDescendants":false,"Template":"\n \n\t
\t\n\t\t
\n\t\t\t

Using API method to obtain additional data from the {{ayT 'Customer'}} record

\n\t\t
\n \n \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t \n \t\t\n\t\t\t \n\t\t\t\t {{#each ayReportData}} \n\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t \n\t\t\t\t {{/each}}\n\t\t\t \n
Data from the Unit recordData from the Customer record obtained using API method
{{ayT 'Customer'}} {{ayT 'Unit'}}{{ayT 'Customer'}}{{ayT 'Customer'}} {{ayT 'CustomerEmail'}}{{ayT 'Customer'}} {{ayT 'CustomerPhone1'}}{{ayT 'Customer'}} {{ayT 'HeadOffice'}}
{{Serial}} {{UnitModelNameViz}}{{CustomerViz}}{{myCustomerInfo.emailAddress}}{{myCustomerInfo.phone1}}{{myCustomerInfo.headOfficeViz}}
\n\n \n {{#each ayReportData}}\n \n \n \n \n \n\t\t\t \n \n \n {{/each}}\n
This is a printout of the data returned from the custom Prepare that this report now uses for each unit in the datalist. To display any of the Customer data ported over, just identify in mustaches myCustomerInfo.xxxx where xxx is the key as in CustomerInfo.phone1
{{ayJSON this}}
\n\n
\n\n","Style":".singlePage\r\n{\r\npage-break-after: always;\r\n\r\n}\r\nbody {\r\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \r\n}\r\n\r\n.reporttitle { \r\n margin-bottom: 20pt; \r\n font-weight: bold; \r\n font-size: 13pt; \r\n color: #9e9e9e;\r\n text-align: center;\r\n} \r\n\r\ntable { \r\n border-collapse: collapse;\r\n white-space: pre-wrap;\r\n width: 100%;\r\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\r\n }\r\n\r\nth {\r\n /* border-bottom: solid 1pt #9e9e9e; */\r\n height: 30px;\r\n font-size: 11pt; \r\n color: #9e9e9e;\r\n}\r\n\r\ntbody td {\r\n padding: 10px;\r\n word-wrap: break-word;\r\n font-size: 9pt;\r\n}\r\n\r\n\r\ntbody tr:nth-child(even) {\r\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\r\n}\r\n\r\n\r\n.rightlean {\r\n text-align: right;\r\n}\r\n.leftlean {\r\n text-align: left;\r\n}\r\n.centerlean {\r\n text-align: center;\r\n}\r\n\r\n\r\n.fontgreen {\r\n color: green;\r\n font-size: 16pt;\r\n}\r\n.fontblue {\r\n color: blue;\r\n}\r\n.fontred {\r\n color:red;\r\n}\r\n\r\n","JsPrerender":"async function ayPrepareData(ayData) {\n\n await ayGetTranslations([\"Unit\", \"Customer\", \"CustomerEmail\", \"CustomerPhone1\", \"HeadOffice\" ]);\n \n //Loop through all the records in the raw report data\n for (let i = 0; i < ayData.ayReportData.length; i++) {\n //set a temporary variable to each record to save typing it all out\n let item = ayData.ayReportData[i];\n\n //call into the AyaNova API and get the customer record for this report data's customer id\n const apiResult = await ayGetFromAPI(`customer/${item.CustomerId}`);\n\n //if a result comes back, insert it into the report data so it's available to the template\n if (apiResult) {\n //put the return data customer record on a key in each record called 'myCustomerInfo' (you can call it anything as long as it doesn't conflict with an existing key)\n item.myCustomerInfo = apiResult.data\n }\n }\n return ayData;\n}","JsHelpers":"","RenderType":0,"HeaderTemplate":"                Printed date: PDFDate\n\nPage of                ","FooterTemplate":"  ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"20mm","MarginOptionsTop":"20mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE ayGroupByTag group by a specific Tag only.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE ayGroupByTag group by a specific Tag only.ayrt index 8bed8dd9..06835d89 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE ayGroupByTag group by a specific Tag only.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE ayGroupByTag group by a specific Tag only.ayrt @@ -1 +1 @@ -{"Name":"💡 ayGroupByTag group by a specific Tag only","Active":true,"Notes":"USE: Example custom Prepare that groups by a specific Tag - i.e. black","Roles":49514,"AType":20,"IncludeWoItemDescendants":false,"Template":"\n\n\n\t
\n\t\t
\n\t\t\t

Parts by Tag

\n\t\t
\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\t{{#each ayReportData}}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{#each items}}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{/each}}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{/each}}\n\t\t\t\n\t\t
{{ayT 'Tag'}}{{ayT 'Part'}}{{ayT 'PartManufacturerID'}}{{ayT 'PartCost'}}{{ayT 'PartRetail'}}
{{group}}
 {{Name}}{{ManufacturerViz}}{{ayCurrency Cost}}{{ayCurrency Retail}}
# of parts for {{ayT 'Tag'}} {{group}}: {{count}}
 
\n\n\t\t\n {{#each ayReportData}}\n \n \n \n \n \n\t\t\t \n \n \n {{/each}}\n
This is a printout of the data returned from the Custom Prepare that this report now uses. Compare against the data that shows in the \"Sample Data\" when editing this report template.
{{ayJSON this}}
\n\n\n","Style":".singlePage\r\n{\r\npage-break-after: always;\r\n\r\n}\r\nbody {\r\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \r\n}\r\n\r\n.reporttitle { \r\n margin-bottom: 20pt; \r\n font-weight: bold; \r\n font-size: 13pt; \r\n color: #9e9e9e;\r\n} \r\n\r\ntable { \r\n border-collapse: collapse;\r\n white-space: pre-wrap;\r\n width: 100%;\r\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\r\n }\r\n\r\nth {\r\n border-bottom: solid 1pt #9e9e9e;\r\n height: 50px;\r\n font-size: 11pt; \r\n color: #9e9e9e;\r\n}\r\n\r\ntbody td {\r\n padding: 10px;\r\n word-wrap: break-word;\r\n font-size: 9pt;\r\n}\r\n\r\n\r\ntbody tr:nth-child(even) {\r\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\r\n}\r\n\r\n\r\n.rightlean {\r\n text-align: right;\r\n}\r\n.leftlean {\r\n text-align: left;\r\n}\r\n.centerlean {\r\n text-align: center;\r\n}\r\n\r\n\r\n.fontgreen {\r\n color: green;\r\n font-size: 16pt;\r\n}\r\n.fontblue {\r\n color: blue;\r\n}\r\n.fontred {\r\n color:red;\r\n}\r\n\r\n","JsPrerender":"async function ayPrepareData(ayData) {\n\n await ayGetTranslations([\"Part\", \"PartManufacturerID\", \"PartRetail\", \"PartCost\", \"PartSerialNumbersAvailable\", \"Tag\" ]);\n\n\n //Example below is to group by each and every Tag\n //ayData.ayReportData = ayGroupByTag(ayData.ayReportData);\n\n //Example below of how to group by specific text of tags - below example only if contains the 'black'\n ayData.ayReportData = ayGroupByTag(ayData.ayReportData, 'black');\n\n return ayData;\n}\n\nfunction ayGroupByTag(reportDataArray, tagContains) {\n //array to hold grouped data\n const ret = [];\n const containsQuery = tagContains != null && tagContains != '';\n\n //iterate through the raw reprot data \n for (let i = 0; i < reportDataArray.length; i++) {\n //get a reference to each object to save typing\n let o = reportDataArray[i];\n //don't bother with any that don't have tags at all\n if (o.Tags && o.Tags.length) {\n //loop through all tags for this record\n o.Tags.forEach(t => {//t=each tag\n //if not a contains query just process it, if it is a contains query then only process if tag contains tagContains\n if (!containsQuery || t.includes(tagContains)) {\n let groupObject = ret.find(z => z.group == t);\n if (groupObject != undefined) {\n //there is already a matching group in the return array so just push this raw report data record into it\n groupObject.items.push(o);\n //update the count for this group's items\n groupObject.count++;\n } else {\n //No group yet, so start a new one in the ret array and push this raw report data record\n ret.push({ group: t, items: [o], count: 1 });\n }\n }\n })\n }\n }\n\n //Sort based on the group name in a locale aware manner\n ret.sort(function (a, b) {\n return a.group.localeCompare(b.group);\n });\n return ret;\n}","JsHelpers":"","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"20mm","MarginOptionsRight":"20mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_ayGroupByTag group by a specific Tag only","Active":true,"Notes":"USE: Example custom Prepare that groups by a specific Tag - i.e. black","Roles":49514,"AType":20,"IncludeWoItemDescendants":false,"Template":"\n\n\n\t
\n\t\t
\n\t\t\t

Parts by Tag

\n\t\t
\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\t{{#each ayReportData}}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{#each items}}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{/each}}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{/each}}\n\t\t\t\n\t\t
{{ayT 'Tag'}}{{ayT 'Part'}}{{ayT 'PartManufacturerID'}}{{ayT 'PartCost'}}{{ayT 'PartRetail'}}
{{group}}
 {{Name}}{{ManufacturerViz}}{{ayCurrency Cost}}{{ayCurrency Retail}}
# of parts for {{ayT 'Tag'}} {{group}}: {{count}}
 
\n\n\t\t\n {{#each ayReportData}}\n \n \n \n \n \n\t\t\t \n \n \n {{/each}}\n
This is a printout of the data returned from the Custom Prepare that this report now uses. Compare against the data that shows in the \"Sample Data\" when editing this report template.
{{ayJSON this}}
\n\n\n","Style":".singlePage\r\n{\r\npage-break-after: always;\r\n\r\n}\r\nbody {\r\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \r\n}\r\n\r\n.reporttitle { \r\n margin-bottom: 20pt; \r\n font-weight: bold; \r\n font-size: 13pt; \r\n color: #9e9e9e;\r\n} \r\n\r\ntable { \r\n border-collapse: collapse;\r\n white-space: pre-wrap;\r\n width: 100%;\r\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\r\n }\r\n\r\nth {\r\n border-bottom: solid 1pt #9e9e9e;\r\n height: 50px;\r\n font-size: 11pt; \r\n color: #9e9e9e;\r\n}\r\n\r\ntbody td {\r\n padding: 10px;\r\n word-wrap: break-word;\r\n font-size: 9pt;\r\n}\r\n\r\n\r\ntbody tr:nth-child(even) {\r\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\r\n}\r\n\r\n\r\n.rightlean {\r\n text-align: right;\r\n}\r\n.leftlean {\r\n text-align: left;\r\n}\r\n.centerlean {\r\n text-align: center;\r\n}\r\n\r\n\r\n.fontgreen {\r\n color: green;\r\n font-size: 16pt;\r\n}\r\n.fontblue {\r\n color: blue;\r\n}\r\n.fontred {\r\n color:red;\r\n}\r\n\r\n","JsPrerender":"async function ayPrepareData(ayData) {\n\n await ayGetTranslations([\"Part\", \"PartManufacturerID\", \"PartRetail\", \"PartCost\", \"PartSerialNumbersAvailable\", \"Tag\" ]);\n\n\n //Example below is to group by each and every Tag\n //ayData.ayReportData = ayGroupByTag(ayData.ayReportData);\n\n //Example below of how to group by specific text of tags - below example only if contains the 'black'\n ayData.ayReportData = ayGroupByTag(ayData.ayReportData, 'black');\n\n return ayData;\n}\n\nfunction ayGroupByTag(reportDataArray, tagContains) {\n //array to hold grouped data\n const ret = [];\n const containsQuery = tagContains != null && tagContains != '';\n\n //iterate through the raw reprot data \n for (let i = 0; i < reportDataArray.length; i++) {\n //get a reference to each object to save typing\n let o = reportDataArray[i];\n //don't bother with any that don't have tags at all\n if (o.Tags && o.Tags.length) {\n //loop through all tags for this record\n o.Tags.forEach(t => {//t=each tag\n //if not a contains query just process it, if it is a contains query then only process if tag contains tagContains\n if (!containsQuery || t.includes(tagContains)) {\n let groupObject = ret.find(z => z.group == t);\n if (groupObject != undefined) {\n //there is already a matching group in the return array so just push this raw report data record into it\n groupObject.items.push(o);\n //update the count for this group's items\n groupObject.count++;\n } else {\n //No group yet, so start a new one in the ret array and push this raw report data record\n ret.push({ group: t, items: [o], count: 1 });\n }\n }\n })\n }\n }\n\n //Sort based on the group name in a locale aware manner\n ret.sort(function (a, b) {\n return a.group.localeCompare(b.group);\n });\n return ret;\n}","JsHelpers":"","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"20mm","MarginOptionsRight":"20mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE ayGroupByTag group by each Tag.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE ayGroupByTag group by each Tag.ayrt index 8e488c8f..b2950cb1 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE ayGroupByTag group by each Tag.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE ayGroupByTag group by each Tag.ayrt @@ -1 +1 @@ -{"Name":"💡 ayGroupByTag group by each Tag","Active":true,"Notes":"USE: Example custom Prepare that groups by the Tags - nothing shows if no tag(s) match","Roles":49514,"AType":20,"IncludeWoItemDescendants":false,"Template":"\n\n\n\t
\n\t\t
\n\t\t\t

Parts by Tag

\n\t\t
\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\t{{#each ayReportData}}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{#each items}}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{/each}}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{/each}}\n\t\t\t\n\t\t
{{ayT 'Tag'}}{{ayT 'Part'}}{{ayT 'PartManufacturerID'}}{{ayT 'PartCost'}}{{ayT 'PartRetail'}}
{{group}}
 {{Name}}{{ManufacturerViz}}{{ayCurrency Cost}}{{ayCurrency Retail}}
# of parts for {{ayT 'Tag'}} {{group}}: {{count}}
 
\n\n\t\t\n {{#each ayReportData}}\n \n \n \n \n \n\t\t\t \n \n \n {{/each}}\n
This is a printout of the data returned from the Custom Prepare that this report now uses, each \"group\" is an object. Compare against the data that shows in the \"Sample Data\" when editing this report template.
{{ayJSON this}}
\n\t
\n\n\n","Style":".singlePage\r\n{\r\npage-break-after: always;\r\n\r\n}\r\nbody {\r\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \r\n}\r\n\r\n.reporttitle { \r\n margin-bottom: 20pt; \r\n font-weight: bold; \r\n font-size: 13pt; \r\n color: #9e9e9e;\r\n} \r\n\r\ntable { \r\n border-collapse: collapse;\r\n white-space: pre-wrap;\r\n width: 100%;\r\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\r\n }\r\n\r\nth {\r\n border-bottom: solid 1pt #9e9e9e;\r\n height: 50px;\r\n font-size: 11pt; \r\n color: #9e9e9e;\r\n}\r\n\r\ntbody td {\r\n padding: 10px;\r\n word-wrap: break-word;\r\n font-size: 9pt;\r\n}\r\n\r\n\r\ntbody tr:nth-child(even) {\r\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\r\n}\r\n\r\n\r\n.rightlean {\r\n text-align: right;\r\n}\r\n.leftlean {\r\n text-align: left;\r\n}\r\n.centerlean {\r\n text-align: center;\r\n}\r\n\r\n\r\n.fontgreen {\r\n color: green;\r\n font-size: 16pt;\r\n}\r\n.fontblue {\r\n color: blue;\r\n}\r\n.fontred {\r\n color:red;\r\n}\r\n\r\n","JsPrerender":"async function ayPrepareData(ayData) {\n\n await ayGetTranslations([\"Part\", \"PartManufacturerID\", \"PartRetail\", \"PartCost\", \"PartSerialNumbersAvailable\", \"Tag\" ]);\n\n\n //Group by all tags no filter using the function declared outside\n ayData.ayReportData = ayGroupByTag(ayData.ayReportData);\n\n //Example below of how to group by specific text of tags - below example only if contains the 'zone' - comment out above, and uncomment below\n //ayData.ayReportData = ayGroupByTag(ayData.ayReportData, 'zone');\n\n return ayData;\n}\n\nfunction ayGroupByTag(reportDataArray, tagContains) {\n //array to hold grouped data\n const ret = [];\n const containsQuery = tagContains != null && tagContains != '';\n\n //iterate through the raw reprot data \n for (let i = 0; i < reportDataArray.length; i++) {\n //get a reference to each object to save typing\n let o = reportDataArray[i];\n //don't bother with any that don't have tags at all\n if (o.Tags && o.Tags.length) {\n //loop through all tags for this record\n o.Tags.forEach(t => {//t=each tag\n //if not a contains query just process it, if it is a contains query then only process if tag contains tagContains\n if (!containsQuery || t.includes(tagContains)) {\n let groupObject = ret.find(z => z.group == t);\n if (groupObject != undefined) {\n //there is already a matching group in the return array so just push this raw report data record into it\n groupObject.items.push(o);\n //update the count for this group's items\n groupObject.count++;\n } else {\n //No group yet, so start a new one in the ret array and push this raw report data record\n ret.push({ group: t, items: [o], count: 1 });\n }\n }\n })\n }\n }\n\n //Sort based on the group name in a locale aware manner\n ret.sort(function (a, b) {\n return a.group.localeCompare(b.group);\n });\n return ret;\n}","JsHelpers":"","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"20mm","MarginOptionsRight":"20mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_ayGroupByTag group by each Tag","Active":true,"Notes":"USE: Example custom Prepare that groups by the Tags - nothing shows if no tag(s) match","Roles":49514,"AType":20,"IncludeWoItemDescendants":false,"Template":"\n\n\n\t
\n\t\t
\n\t\t\t

Parts by Tag

\n\t\t
\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\t{{#each ayReportData}}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{#each items}}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{/each}}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{/each}}\n\t\t\t\n\t\t
{{ayT 'Tag'}}{{ayT 'Part'}}{{ayT 'PartManufacturerID'}}{{ayT 'PartCost'}}{{ayT 'PartRetail'}}
{{group}}
 {{Name}}{{ManufacturerViz}}{{ayCurrency Cost}}{{ayCurrency Retail}}
# of parts for {{ayT 'Tag'}} {{group}}: {{count}}
 
\n\n\t\t\n {{#each ayReportData}}\n \n \n \n \n \n\t\t\t \n \n \n {{/each}}\n
This is a printout of the data returned from the Custom Prepare that this report now uses, each \"group\" is an object. Compare against the data that shows in the \"Sample Data\" when editing this report template.
{{ayJSON this}}
\n\t
\n\n\n","Style":".singlePage\r\n{\r\npage-break-after: always;\r\n\r\n}\r\nbody {\r\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \r\n}\r\n\r\n.reporttitle { \r\n margin-bottom: 20pt; \r\n font-weight: bold; \r\n font-size: 13pt; \r\n color: #9e9e9e;\r\n} \r\n\r\ntable { \r\n border-collapse: collapse;\r\n white-space: pre-wrap;\r\n width: 100%;\r\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\r\n }\r\n\r\nth {\r\n border-bottom: solid 1pt #9e9e9e;\r\n height: 50px;\r\n font-size: 11pt; \r\n color: #9e9e9e;\r\n}\r\n\r\ntbody td {\r\n padding: 10px;\r\n word-wrap: break-word;\r\n font-size: 9pt;\r\n}\r\n\r\n\r\ntbody tr:nth-child(even) {\r\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\r\n}\r\n\r\n\r\n.rightlean {\r\n text-align: right;\r\n}\r\n.leftlean {\r\n text-align: left;\r\n}\r\n.centerlean {\r\n text-align: center;\r\n}\r\n\r\n\r\n.fontgreen {\r\n color: green;\r\n font-size: 16pt;\r\n}\r\n.fontblue {\r\n color: blue;\r\n}\r\n.fontred {\r\n color:red;\r\n}\r\n\r\n","JsPrerender":"async function ayPrepareData(ayData) {\n\n await ayGetTranslations([\"Part\", \"PartManufacturerID\", \"PartRetail\", \"PartCost\", \"PartSerialNumbersAvailable\", \"Tag\" ]);\n\n\n //Group by all tags no filter using the function declared outside\n ayData.ayReportData = ayGroupByTag(ayData.ayReportData);\n\n //Example below of how to group by specific text of tags - below example only if contains the 'zone' - comment out above, and uncomment below\n //ayData.ayReportData = ayGroupByTag(ayData.ayReportData, 'zone');\n\n return ayData;\n}\n\nfunction ayGroupByTag(reportDataArray, tagContains) {\n //array to hold grouped data\n const ret = [];\n const containsQuery = tagContains != null && tagContains != '';\n\n //iterate through the raw reprot data \n for (let i = 0; i < reportDataArray.length; i++) {\n //get a reference to each object to save typing\n let o = reportDataArray[i];\n //don't bother with any that don't have tags at all\n if (o.Tags && o.Tags.length) {\n //loop through all tags for this record\n o.Tags.forEach(t => {//t=each tag\n //if not a contains query just process it, if it is a contains query then only process if tag contains tagContains\n if (!containsQuery || t.includes(tagContains)) {\n let groupObject = ret.find(z => z.group == t);\n if (groupObject != undefined) {\n //there is already a matching group in the return array so just push this raw report data record into it\n groupObject.items.push(o);\n //update the count for this group's items\n groupObject.count++;\n } else {\n //No group yet, so start a new one in the ret array and push this raw report data record\n ret.push({ group: t, items: [o], count: 1 });\n }\n }\n })\n }\n }\n\n //Sort based on the group name in a locale aware manner\n ret.sort(function (a, b) {\n return a.group.localeCompare(b.group);\n });\n return ret;\n}","JsHelpers":"","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"20mm","MarginOptionsRight":"20mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE ayGroupByTag group inventory by Tag.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE ayGroupByTag group inventory by Tag.ayrt index 1005823c..9d2e0cc0 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE ayGroupByTag group inventory by Tag.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE ayGroupByTag group inventory by Tag.ayrt @@ -1 +1 @@ -{"Name":"💡 ayGroupByTag group inventory by Tag","Active":true,"Notes":"USE: Example custom Prepare that groups by the Tags - nothing shows if no tag(s) match","Roles":49258,"AType":90,"IncludeWoItemDescendants":false,"Template":"\n\n\n\t
\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\t{{#each ayReportData}}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{#each items}}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{/each}}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{/each}}\n\t\t\t\n\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\n\n\n","Style":".singlePage\n{\npage-break-after: always;\n\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n color: #9e9e9e;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; \n font-size: 9pt;\n }\n\nth {\n height: 20px;\n font-size: 11pt; \n color: #9e9e9e;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n \n}\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}","JsPrerender":"async function ayPrepareData(ayData) {\n\n await ayGetTranslations([\"Part\", \"PartList\", \"PartInventoryList\", \"PartRetail\", \"PartByWarehouseInventoryQuantityOnHand\", \"PartSerialNumbersAvailable\", \"Tag\", \"Tags\", \"PartWarehouse\" ]);\n\n //Group by all tags no filter\n ayData.ayReportData = ayGroupByTag(ayData.ayReportData);\n\n //Group by filtered tags that contain 'zone'\n //ayData.ayReportData = ayGroupByTag(ayData.ayReportData, 'zone');\n\n return ayData;\n}\n\nfunction ayGroupByTag(reportDataArray, tagContains) {\n //array to hold grouped data\n const ret = [];\n const containsQuery = tagContains != null && tagContains != '';\n\n//NOTE that tags are referred to as PartTags so this custom Prepare must reference PartTags, not Tags\n\n //iterate through the raw reprot data \n for (let i = 0; i < reportDataArray.length; i++) {\n //get a reference to each object to save typing\n let o = reportDataArray[i];\n //don't bother with any that don't have tags at all\n if (o.PartTags && o.PartTags.length) {\n //loop through all tags for this record\n o.PartTags.forEach(t => {//t=each tag\n //if not a contains query just process it, if it is a contains query then only process if tag contains tagContains\n if (!containsQuery || t.includes(tagContains)) {\n let groupObject = ret.find(z => z.group == t);\n if (groupObject != undefined) {\n //there is already a matching group in the return array so just push this raw report data record into it\n groupObject.items.push(o);\n //update the count for this group's items\n groupObject.count++;\n } else {\n //No group yet, so start a new one in the ret array and push this raw report data record\n ret.push({ group: t, items: [o], count: 1 });\n }\n }\n })\n }\n }\n\n //Sort based on the group name in a locale aware manner\n ret.sort(function (a, b) {\n return a.group.localeCompare(b.group);\n });\n return ret;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"                Printed date: PDFDate\nPage of                ","FooterTemplate":"  ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"20mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_ayGroupByTag group inventory by Tag","Active":true,"Notes":"USE: Example custom Prepare that groups by the Tags - nothing shows if no tag(s) match","Roles":49258,"AType":90,"IncludeWoItemDescendants":false,"Template":"\n\n\n\t
\n\t\t
{{ayServerMetaData.CompanyName}} {{ayT 'PartInventoryList'}}
 
{{ayT 'Part'}}{{ayT 'PartWarehouse'}}{{ayT 'Tags'}}{{ayT 'PartRetail'}}{{ayT 'PartByWarehouseInventoryQuantityOnHand'}}Actual CountDifference + / (-)
# of {{ayT 'PartList'}} with {{ayT 'Tag'}} {{group}}: {{count}}
{{PartName}}{{PartWarehouseName}}{{PartTags}} {{ayCurrency PartRetail}}{{OnHandQty}}
 
 
Count By:__________________________________________Count Date:__________________________________________
 
 
Signature:__________________________________________
\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\t{{#each ayReportData}}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{#each items}}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{/each}}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{/each}}\n\t\t\t\n\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\n\n\n","Style":".singlePage\n{\npage-break-after: always;\n\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n color: #9e9e9e;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; \n font-size: 9pt;\n }\n\nth {\n height: 20px;\n font-size: 11pt; \n color: #9e9e9e;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n \n}\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}","JsPrerender":"async function ayPrepareData(ayData) {\n\n await ayGetTranslations([\"Part\", \"PartList\", \"PartInventoryList\", \"PartRetail\", \"PartByWarehouseInventoryQuantityOnHand\", \"PartSerialNumbersAvailable\", \"Tag\", \"Tags\", \"PartWarehouse\" ]);\n\n //Group by all tags no filter\n ayData.ayReportData = ayGroupByTag(ayData.ayReportData);\n\n //Group by filtered tags that contain 'zone'\n //ayData.ayReportData = ayGroupByTag(ayData.ayReportData, 'zone');\n\n return ayData;\n}\n\nfunction ayGroupByTag(reportDataArray, tagContains) {\n //array to hold grouped data\n const ret = [];\n const containsQuery = tagContains != null && tagContains != '';\n\n//NOTE that tags are referred to as PartTags so this custom Prepare must reference PartTags, not Tags\n\n //iterate through the raw reprot data \n for (let i = 0; i < reportDataArray.length; i++) {\n //get a reference to each object to save typing\n let o = reportDataArray[i];\n //don't bother with any that don't have tags at all\n if (o.PartTags && o.PartTags.length) {\n //loop through all tags for this record\n o.PartTags.forEach(t => {//t=each tag\n //if not a contains query just process it, if it is a contains query then only process if tag contains tagContains\n if (!containsQuery || t.includes(tagContains)) {\n let groupObject = ret.find(z => z.group == t);\n if (groupObject != undefined) {\n //there is already a matching group in the return array so just push this raw report data record into it\n groupObject.items.push(o);\n //update the count for this group's items\n groupObject.count++;\n } else {\n //No group yet, so start a new one in the ret array and push this raw report data record\n ret.push({ group: t, items: [o], count: 1 });\n }\n }\n })\n }\n }\n\n //Sort based on the group name in a locale aware manner\n ret.sort(function (a, b) {\n return a.group.localeCompare(b.group);\n });\n return ret;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"                Printed date: PDFDate\nPage of                ","FooterTemplate":"  ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"20mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE company name address logo URL ayServerMetaData.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE company name address logo URL ayServerMetaData.ayrt index afa897b5..5fdffc66 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE company name address logo URL ayServerMetaData.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE company name address logo URL ayServerMetaData.ayrt @@ -1 +1 @@ -{"Name":"💡 company name address logo URL ayServerMetaData","Active":true,"Notes":"Examples of displaying ayServerMetaData data such as licensed company name, company logo, company contact information as entered via Global Settings","Roles":50538,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n
\n{{#each ayReportData}}\n
{{ayServerMetaData.CompanyName}} {{ayT 'PartInventoryList'}}
 
{{ayT 'Part'}}{{ayT 'PartWarehouse'}}{{ayT 'Tags'}}{{ayT 'PartRetail'}}{{ayT 'PartByWarehouseInventoryQuantityOnHand'}}Actual CountDifference + / (-)
# of {{ayT 'PartList'}} with {{ayT 'Tag'}} {{group}}: {{count}}
{{PartName}}{{PartWarehouseName}}{{PartTags}} {{ayCurrency PartRetail}}{{OnHandQty}}
 
 
Count By:__________________________________________Count Date:__________________________________________
 
 
Signature:__________________________________________
\n \n \n \n \n \n \n \n {{#if ../ayServerMetaData.HasSmallLogo}}\n {{else}}{{/if}}\n \n \n \n \n \n \n \n \n \n \n \n {{#if ../ayServerMetaData.CompanyPhone1}}\n {{else}}{{/if}}\n \n \n \n {{#if ../ayServerMetaData.HasPostalAddress}}\n {{else}}{{/if}}\n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n {{#if ServiceDate }}\n {{else}}{{/if}}\n \n {{#if ../ayServerMetaData.CompanyPhone1 }}\n {{else}}{{/if}}\n \n \n \n\n
Column to the right displays all of your ayServerMetaData:{{ayJSON ../ayServerMetaData}}
Column to the right displays the small company logo IF uploaded via Global Settings:{{ayLogo 'small'}}No small logo has been uploaded via your Global Settings
Column to the right displays your licensed Company Name as is - with the quotation marks:{{ayJSON ../ayServerMetaData.CompanyName}}
Column to the right displays your licensed Company Name:{{../ayServerMetaData.CompanyName}}
Column to the right displays your company phone number as entered via Global Settings:{{../ayServerMetaData.CompanyPhone1}}Your company phone number has NOT been entered via your Global Settings
Column to the right displays your company postal address as entered via Global Settings:{{ ../ayServerMetaData.CompanyPostAddress}} {{ ../ayServerMetaData.CompanyPostCity}}Your company postal address has NOT been entered via your Global Settings
 
{{ayT 'WorkOrder'}}{{ayT 'Customer'}}{{ayT 'WorkOrderServiceDate'}}Licensed Company NameCompany Phone Entered via Global Settings
{{Serial}}{{CustomerViz}}{{ayDate ServiceDate}}no Service Date specified{{../ayServerMetaData.CompanyName}}{{ ../ayServerMetaData.CompanyPhone1}}no company phone number specified in Global Settings
\n{{/each}}\n
\n\n","Style":"\n.singlePage\n{\npage-break-after: always;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 11pt; \n color: #9e9e9e;\n} \n\ntable, td, th {\n border: 1px solid black;\n}\n\ntable { \n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n height: 30px;\n font-size: 9pt; \n color: #9e9e9e;\n}\n\ntd {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n text-align: center;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([\"WorkOrder\", \"Customer\", \"WorkOrderServiceDate\" ]);\n\n\t\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"15mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_company name address logo URL ayServerMetaData","Active":true,"Notes":"Examples of displaying ayServerMetaData data such as licensed company name, company logo, company contact information as entered via Global Settings","Roles":50538,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n
\n{{#each ayReportData}}\n \n \n \n \n \n \n \n \n {{#if ../ayServerMetaData.HasSmallLogo}}\n {{else}}{{/if}}\n \n \n \n \n \n \n \n \n \n \n \n {{#if ../ayServerMetaData.CompanyPhone1}}\n {{else}}{{/if}}\n \n \n \n {{#if ../ayServerMetaData.HasPostalAddress}}\n {{else}}{{/if}}\n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n {{#if ServiceDate }}\n {{else}}{{/if}}\n \n {{#if ../ayServerMetaData.CompanyPhone1 }}\n {{else}}{{/if}}\n \n \n \n\n
Column to the right displays all of your ayServerMetaData:{{ayJSON ../ayServerMetaData}}
Column to the right displays the small company logo IF uploaded via Global Settings:{{ayLogo 'small'}}No small logo has been uploaded via your Global Settings
Column to the right displays your licensed Company Name as is - with the quotation marks:{{ayJSON ../ayServerMetaData.CompanyName}}
Column to the right displays your licensed Company Name:{{../ayServerMetaData.CompanyName}}
Column to the right displays your company phone number as entered via Global Settings:{{../ayServerMetaData.CompanyPhone1}}Your company phone number has NOT been entered via your Global Settings
Column to the right displays your company postal address as entered via Global Settings:{{ ../ayServerMetaData.CompanyPostAddress}} {{ ../ayServerMetaData.CompanyPostCity}}Your company postal address has NOT been entered via your Global Settings
 
{{ayT 'WorkOrder'}}{{ayT 'Customer'}}{{ayT 'WorkOrderServiceDate'}}Licensed Company NameCompany Phone Entered via Global Settings
{{Serial}}{{CustomerViz}}{{ayDate ServiceDate}}no Service Date specified{{../ayServerMetaData.CompanyName}}{{ ../ayServerMetaData.CompanyPhone1}}no company phone number specified in Global Settings
\n{{/each}}\n
\n\n","Style":"\n.singlePage\n{\npage-break-after: always;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 11pt; \n color: #9e9e9e;\n} \n\ntable, td, th {\n border: 1px solid black;\n}\n\ntable { \n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n height: 30px;\n font-size: 9pt; \n color: #9e9e9e;\n}\n\ntd {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n text-align: center;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([\"WorkOrder\", \"Customer\", \"WorkOrderServiceDate\" ]);\n\n\t\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"15mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE custom date time format Helpers.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE custom date time format Helpers.ayrt index 6098673e..ffe6aeb0 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE custom date time format Helpers.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE custom date time format Helpers.ayrt @@ -1 +1 @@ -{"Name":"💡 custom date time format Helpers","Active":true,"Notes":"examples of custom Helpers to format date and date/time data fields","Roles":124927,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n\t

Example: custom formatted date time helpers

\n\t

Below shows example of each {{ayT 'WorkOrder'}}'s {{ayT 'WorkOrderServiceDate'}} in various formats:

\n\n\t{{#each ayReportData}}\n\t\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t
{{ayT 'WorkOrder'}} {{ Serial }}
The raw UTC / GMT AyaNova stored value from server:{{ServiceDate}}
Available Built in helpers:
 ayDateTime helper:{{ ayDateTime ServiceDate}}
 ayDate helper:{{ ayDate ServiceDate}}
 ayTime helper:{{ ayTime ServiceDate}}
Custom helpers in this report template:
 myDateTime custom helper:{{ myDateTime ServiceDate}}
 myDate custom helper:{{ myDate ServiceDate}}
 myTime custom helper:{{ myTime ServiceDate}}
 myDateTimeAustralia custom helper:{{ myDateTimeAustralia ServiceDate}}
 myDateTimeArabic custom helper:{{ myDateTimeArabic ServiceDate}}
 myDateTimeFromParts custom helper: {{ myDateTimeFromParts ServiceDate}}
\n\t
\n\t{{/each}}\n\n\n\n\n","Style":".singlePage\n{\npage-break-after: always;\n\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 14pt; \n color: #9e9e9e;\n text-align: left;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n font-size: 9pt; \n table-layout: fixed;\n }\n\nth {\n border-bottom: solid 1pt #9e9e9e; \n height: 30px;\n font-size: 10pt; \n color: #9e9e9e;\n}\n\ntfoot th{\n border-top: solid 1pt #9e9e9e;\n height: 50px;\n font-size: 10pt; \n text-align: right;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n await ayGetTranslations([\"WorkOrderServiceDate\", \"WorkOrder\" ]);\n\n return reportData;\n}","JsHelpers":"//////////////////////////////////// /////////////////////////////\n// \n// CUSTOM DATE AND TIME HELPER\n//\nHandlebars.registerHelper('myDateTime', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date \n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleString method to format the date and time\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString\n return parsedDate.toLocaleString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\",\n timeStyle: \"long\",\n hour12: AYMETA.ayClientMetaData.Hour12 //Use User setting for 12/24 hour clock\n }\n );\n});\n\n\n\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE HELPER\n//\nHandlebars.registerHelper('myDate', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleDateString method to format the date\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString\n return parsedDate.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n );\n});\n\n\n\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM TIME HELPER\n//\nHandlebars.registerHelper('myTime', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleTimeString method to format the date and time\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString\n return parsedDate.toLocaleTimeString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone \n timeStyle: \"long\",//display the time zone used \n hour12: AYMETA.ayClientMetaData.Hour12 //Use User setting for 12/24 hour clock\n }\n );\n});\n\n\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE AND TIME HELPER WITH AUSTRALIAN OPTIONS\n//\nHandlebars.registerHelper('myDateTimeAustralia', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleString method to format the date and time\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString \n return parsedDate.toLocaleString(\n \"en-au\",//use English-Australia locale (Day / Month / Year is Australia default format)\n {\n timeZone: \"Australia/Sydney\",//use forced time zone, see \"tz database\" column for name in list here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n // timeZoneName: \"long\",//display the time zone used - AS OF alpha.109 unable to use this?\n dateStyle: \"short\",\n timeStyle: \"long\"\n }\n );\n});\n\n\n\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE AND TIME HELPER WITH Arabic OPTIONS \n//\nHandlebars.registerHelper('myDateTimeArabic', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleString method to format the date and time\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString \n return parsedDate.toLocaleString(\n \"ar-EG\",//use Arabic locale \n {\n timeZone: \"Asia/Dubai\",//use forced time zone, see \"tz database\" column for name in list here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n // timeZoneName: \"short\",//display the time zone used \n dateStyle: \"short\",\n timeStyle: \"long\"\n }\n );\n});\n\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM FORMAT TO PARTS HELPER\n// this offers the most control over the return format\n// Locale aware conversion to parts that can be returned in any format\n//\nHandlebars.registerHelper('myDateTimeFromParts', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Set formatter options\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts\n let formatter = new Intl.DateTimeFormat('en-us', {\n weekday: 'long',\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n fractionalSecondDigits: 3,\n hour12: true,\n timeZone: 'UTC'\n });\n\n let parts = formatter.formatToParts(parsedDate);\n /*\n // parts example return value: \n [ \n { type: 'weekday', value: 'Monday' }, \n { type: 'literal', value: ', ' }, \n { type: 'month', value: '12' }, \n { type: 'literal', value: '/' }, \n { type: 'day', value: '17' }, \n { type: 'literal', value: '/' }, \n { type: 'year', value: '2012' }, \n { type: 'literal', value: ', ' }, \n { type: 'hour', value: '3' }, \n { type: 'literal', value: ':' }, \n { type: 'minute', value: '00' }, \n { type: 'literal', value: ':' }, \n { type: 'second', value: '42' }, \n { type: 'fractionalSecond', value: '000' },\n { type: 'literal', value: ' ' }, \n { type: 'dayPeriod', value: 'AM' } \n ]\n */\n\n let partWeekDay = parts.find(({ type }) => type === 'weekday').value;\n let partDay = parts.find(({ type }) => type === 'day').value;\n let partYear = parts.find(({ type }) => type === 'year').value;\n \n //return in some custom format\n return `DAY:${partWeekDay}-${partDay} YEAR: ${partYear}`;\n //return this instead to see the actual return array\n //return JSON.stringify(parts);\n});","RenderType":0,"HeaderTemplate":"                Printed date: PDFDate\nPage of                ","FooterTemplate":"  ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"10mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_custom date time format Helpers","Active":true,"Notes":"examples of custom Helpers to format date and date/time data fields","Roles":124927,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n\t

Example: custom formatted date time helpers

\n\t

Below shows example of each {{ayT 'WorkOrder'}}'s {{ayT 'WorkOrderServiceDate'}} in various formats:

\n\n\t{{#each ayReportData}}\n\t\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t
{{ayT 'WorkOrder'}} {{ Serial }}
The raw UTC / GMT AyaNova stored value from server:{{ServiceDate}}
Available Built in helpers:
 ayDateTime helper:{{ ayDateTime ServiceDate}}
 ayDate helper:{{ ayDate ServiceDate}}
 ayTime helper:{{ ayTime ServiceDate}}
Custom helpers in this report template:
 myDateTime custom helper:{{ myDateTime ServiceDate}}
 myDate custom helper:{{ myDate ServiceDate}}
 myTime custom helper:{{ myTime ServiceDate}}
 myDateTimeAustralia custom helper:{{ myDateTimeAustralia ServiceDate}}
 myDateTimeArabic custom helper:{{ myDateTimeArabic ServiceDate}}
 myDateTimeFromParts custom helper: {{ myDateTimeFromParts ServiceDate}}
\n\t
\n\t{{/each}}\n\n\n\n\n","Style":".singlePage\n{\npage-break-after: always;\n\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 14pt; \n color: #9e9e9e;\n text-align: left;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n font-size: 9pt; \n table-layout: fixed;\n }\n\nth {\n border-bottom: solid 1pt #9e9e9e; \n height: 30px;\n font-size: 10pt; \n color: #9e9e9e;\n}\n\ntfoot th{\n border-top: solid 1pt #9e9e9e;\n height: 50px;\n font-size: 10pt; \n text-align: right;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n await ayGetTranslations([\"WorkOrderServiceDate\", \"WorkOrder\" ]);\n\n return reportData;\n}","JsHelpers":"//////////////////////////////////// /////////////////////////////\n// \n// CUSTOM DATE AND TIME HELPER\n//\nHandlebars.registerHelper('myDateTime', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date \n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleString method to format the date and time\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString\n return parsedDate.toLocaleString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\",\n timeStyle: \"long\",\n hour12: AYMETA.ayClientMetaData.Hour12 //Use User setting for 12/24 hour clock\n }\n );\n});\n\n\n\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE HELPER\n//\nHandlebars.registerHelper('myDate', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleDateString method to format the date\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString\n return parsedDate.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n );\n});\n\n\n\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM TIME HELPER\n//\nHandlebars.registerHelper('myTime', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleTimeString method to format the date and time\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString\n return parsedDate.toLocaleTimeString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone \n timeStyle: \"long\",//display the time zone used \n hour12: AYMETA.ayClientMetaData.Hour12 //Use User setting for 12/24 hour clock\n }\n );\n});\n\n\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE AND TIME HELPER WITH AUSTRALIAN OPTIONS\n//\nHandlebars.registerHelper('myDateTimeAustralia', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleString method to format the date and time\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString \n return parsedDate.toLocaleString(\n \"en-au\",//use English-Australia locale (Day / Month / Year is Australia default format)\n {\n timeZone: \"Australia/Sydney\",//use forced time zone, see \"tz database\" column for name in list here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n // timeZoneName: \"long\",//display the time zone used - AS OF alpha.109 unable to use this?\n dateStyle: \"short\",\n timeStyle: \"long\"\n }\n );\n});\n\n\n\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE AND TIME HELPER WITH Arabic OPTIONS \n//\nHandlebars.registerHelper('myDateTimeArabic', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleString method to format the date and time\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString \n return parsedDate.toLocaleString(\n \"ar-EG\",//use Arabic locale \n {\n timeZone: \"Asia/Dubai\",//use forced time zone, see \"tz database\" column for name in list here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n // timeZoneName: \"short\",//display the time zone used \n dateStyle: \"short\",\n timeStyle: \"long\"\n }\n );\n});\n\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM FORMAT TO PARTS HELPER\n// this offers the most control over the return format\n// Locale aware conversion to parts that can be returned in any format\n//\nHandlebars.registerHelper('myDateTimeFromParts', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Set formatter options\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts\n let formatter = new Intl.DateTimeFormat('en-us', {\n weekday: 'long',\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n fractionalSecondDigits: 3,\n hour12: true,\n timeZone: 'UTC'\n });\n\n let parts = formatter.formatToParts(parsedDate);\n /*\n // parts example return value: \n [ \n { type: 'weekday', value: 'Monday' }, \n { type: 'literal', value: ', ' }, \n { type: 'month', value: '12' }, \n { type: 'literal', value: '/' }, \n { type: 'day', value: '17' }, \n { type: 'literal', value: '/' }, \n { type: 'year', value: '2012' }, \n { type: 'literal', value: ', ' }, \n { type: 'hour', value: '3' }, \n { type: 'literal', value: ':' }, \n { type: 'minute', value: '00' }, \n { type: 'literal', value: ':' }, \n { type: 'second', value: '42' }, \n { type: 'fractionalSecond', value: '000' },\n { type: 'literal', value: ' ' }, \n { type: 'dayPeriod', value: 'AM' } \n ]\n */\n\n let partWeekDay = parts.find(({ type }) => type === 'weekday').value;\n let partDay = parts.find(({ type }) => type === 'day').value;\n let partYear = parts.find(({ type }) => type === 'year').value;\n \n //return in some custom format\n return `DAY:${partWeekDay}-${partDay} YEAR: ${partYear}`;\n //return this instead to see the actual return array\n //return JSON.stringify(parts);\n});","RenderType":0,"HeaderTemplate":"                Printed date: PDFDate\nPage of                ","FooterTemplate":"  ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"10mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE if key value X show Y via custom Helpers.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE if key value X show Y via custom Helpers.ayrt index 2fdfe31d..93c65819 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE if key value X show Y via custom Helpers.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE if key value X show Y via custom Helpers.ayrt @@ -1 +1 @@ -{"Name":"💡 if key value X show Y via custom Helpers","Active":true,"Notes":"example custom Helper if has tag X then show Y, else return something else like preset text\nexample custom Helper of how to correctly wrap output in a safestring as result of Helper if need to use CSS styling","Roles":124927,"AType":26,"IncludeWoItemDescendants":false,"Template":"\n\n\n\t
\n\t

Use of Custom Helpers to display specific aspects if {{ayT 'Tags'}} have a specific value

\n\t\n\t
\n\t\n\t\t{{#each ayReportData}}\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t{{#if CustomFields.c1}} {{else}} {{/if}}\n\t\t\t\n\t\t\t{{#each Items}}\n\t\t\t\n\t\t\t\t\n\t\t\t\t{{#if QuantityReceived}} {{else}} {{/if}}\n\t\t\t\n\t\t\t{{/each}}\n\t\t\n\t\t{{/each}}\n\t
For {{ayT 'PurchaseOrderPONumber'}} {{ Serial }}
Using HTML5 mustache to display all {{ayT 'Tags'}} for this {{ayT 'PurchaseOrder'}}{{ Tags}}
Using HTML5 mustache to display ONLY the 1st {{ayT 'Tag'}} for this {{ayT 'PurchaseOrder'}} {{ayT 'Tags'}}{{ Tags.[0]}}
Custom Helper to display if has {{ayT 'Tag'}} 'gold':{{ isInTag Tags}}
Custom Helper to display if has {{ayT 'Tag'}} 'brown':{{ isInTag2 Tags}}
Custom Helper to display if has {{ayT 'Tag'}} 'green' will display using safestring call of the CSS styling fontgreen else displays safestring call of the CSS styling fontred:{{ isInTag3 Tags}}
HTML5 use of #if to display PO's CustomFields.c1 value with CSS fontgreen applied to the text, else will display fontred if is is false, undefined, null, \"\", 0, or []{{CustomFields.c1}}No value has been entered in Custom1 field for this PO
HTML5 use of #each for each POitem - #if to display text in fontred if QuantyReceived is false, undefined, null, \"\", 0, or [], else display in fontgreen{{ayT 'Part'}} {{PartNameViz}} {{ayT 'PurchaseOrderItemQuantityOrdered'}} = {{QuantityOrdered}}
{{ayT \"PurchaseOrderItemQuantityReceived\"}} value is {{QuantityReceived}}
{{ayT 'Part'}} {{PartNameViz}} {{ayT 'PurchaseOrderItemQuantityOrdered'}} = {{QuantityOrdered}}
{{ayT 'Part'}} {{PartNameViz}} {{QuantityReceived}} value is {{ayT \"PurchaseOrderItemQuantityReceived\"}}!
\n \n\n\n","Style":".singlePage\n{\npage-break-after: always;\n\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n color: #9e9e9e;\n text-align: center;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n border-bottom: solid 1pt #9e9e9e;\n height: 50px;\n font-size: 11pt; \n color: #9e9e9e;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(ayData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n await ayGetTranslations([\"Part\", \"PurchaseOrderItemQuantityReceived\", \"PurchaseOrderItemQuantityOrdered\", \"Tag\", \"Tags\", \"PurchaseOrderPONumber\", \"PurchaseOrder\" ]);\n\n return ayData;\n}","JsHelpers":"Handlebars.registerHelper('isInTag', function (Tags) \n{\n for (var i=0; i\" + \"THE TEXT green IS IN FOUND IN THE TAGS ARRAY FOR THIS PO!! See how this shows in greenfont!\" +\"

\"); //if want to use CSS styling, be sure to wrap in a safestring\n\t\t}\n }\n return new Handlebars.SafeString(\"

\" + 'NOPE, THE TEXT green ISN\\'T IN THE TAGS ARRAY FOR THIS PO' +\"

\"); //if don't want to return any element at all, comment this else aspect out fully\n});\n","RenderType":0,"HeaderTemplate":"                Printed date: PDFDate\nPage of                ","FooterTemplate":"  ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_if key value X show Y via custom Helpers","Active":true,"Notes":"example custom Helper if has tag X then show Y, else return something else like preset text\nexample custom Helper of how to correctly wrap output in a safestring as result of Helper if need to use CSS styling","Roles":124927,"AType":26,"IncludeWoItemDescendants":false,"Template":"\n\n\n\t
\n\t

Use of Custom Helpers to display specific aspects if {{ayT 'Tags'}} have a specific value

\n\t\n\t
\n\t\n\t\t{{#each ayReportData}}\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t{{#if CustomFields.c1}} {{else}} {{/if}}\n\t\t\t\n\t\t\t{{#each Items}}\n\t\t\t\n\t\t\t\t\n\t\t\t\t{{#if QuantityReceived}} {{else}} {{/if}}\n\t\t\t\n\t\t\t{{/each}}\n\t\t\n\t\t{{/each}}\n\t
For {{ayT 'PurchaseOrderPONumber'}} {{ Serial }}
Using HTML5 mustache to display all {{ayT 'Tags'}} for this {{ayT 'PurchaseOrder'}}{{ Tags}}
Using HTML5 mustache to display ONLY the 1st {{ayT 'Tag'}} for this {{ayT 'PurchaseOrder'}} {{ayT 'Tags'}}{{ Tags.[0]}}
Custom Helper to display if has {{ayT 'Tag'}} 'gold':{{ isInTag Tags}}
Custom Helper to display if has {{ayT 'Tag'}} 'brown':{{ isInTag2 Tags}}
Custom Helper to display if has {{ayT 'Tag'}} 'green' will display using safestring call of the CSS styling fontgreen else displays safestring call of the CSS styling fontred:{{ isInTag3 Tags}}
HTML5 use of #if to display PO's CustomFields.c1 value with CSS fontgreen applied to the text, else will display fontred if is is false, undefined, null, \"\", 0, or []{{CustomFields.c1}}No value has been entered in Custom1 field for this PO
HTML5 use of #each for each POitem - #if to display text in fontred if QuantyReceived is false, undefined, null, \"\", 0, or [], else display in fontgreen{{ayT 'Part'}} {{PartNameViz}} {{ayT 'PurchaseOrderItemQuantityOrdered'}} = {{QuantityOrdered}}
{{ayT \"PurchaseOrderItemQuantityReceived\"}} value is {{QuantityReceived}}
{{ayT 'Part'}} {{PartNameViz}} {{ayT 'PurchaseOrderItemQuantityOrdered'}} = {{QuantityOrdered}}
{{ayT 'Part'}} {{PartNameViz}} {{QuantityReceived}} value is {{ayT \"PurchaseOrderItemQuantityReceived\"}}!
\n \n\n\n","Style":".singlePage\n{\npage-break-after: always;\n\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n color: #9e9e9e;\n text-align: center;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n border-bottom: solid 1pt #9e9e9e;\n height: 50px;\n font-size: 11pt; \n color: #9e9e9e;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(ayData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n await ayGetTranslations([\"Part\", \"PurchaseOrderItemQuantityReceived\", \"PurchaseOrderItemQuantityOrdered\", \"Tag\", \"Tags\", \"PurchaseOrderPONumber\", \"PurchaseOrder\" ]);\n\n return ayData;\n}","JsHelpers":"Handlebars.registerHelper('isInTag', function (Tags) \n{\n for (var i=0; i\" + \"THE TEXT green IS IN FOUND IN THE TAGS ARRAY FOR THIS PO!! See how this shows in greenfont!\" +\"

\"); //if want to use CSS styling, be sure to wrap in a safestring\n\t\t}\n }\n return new Handlebars.SafeString(\"

\" + 'NOPE, THE TEXT green ISN\\'T IN THE TAGS ARRAY FOR THIS PO' +\"

\"); //if don't want to return any element at all, comment this else aspect out fully\n});\n","RenderType":0,"HeaderTemplate":"                Printed date: PDFDate\nPage of                ","FooterTemplate":"  ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE if key value is X show Y via custom Helpers Tags.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE if key value is X show Y via custom Helpers Tags.ayrt index e486b765..5b88ffd4 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE if key value is X show Y via custom Helpers Tags.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE if key value is X show Y via custom Helpers Tags.ayrt @@ -1 +1 @@ -{"Name":"💡 if key value is X show Y via custom Helpers Tags","Active":true,"Notes":"example custom Helper if has tag X then show Y, else return something else like preset text\nexample custom Helper of how to correctly wrap output in a safestring as result of Helper if need to use CSS styling","Roles":124927,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n\t
\n\t

Use of Custom Helpers to display specific aspects if {{ayT 'Tags'}} have a specific value

\n\t\n\t
\n\t\n\t\t{{#each ayReportData}}\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t{{#if CustomFields.c1}} {{else}} {{/if}}\n\t\t\t\n\t\t\t{{#each Items}}\n\t\t\t\t{{#each Parts}}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t{{#if Serials}} {{else}} {{/if}}\n\t\t\t\t\n\t\t\t\t{{/each}}\n\t\t\t{{/each}}\n\t\t\n\t\t{{/each}}\n\t
For {{ayT 'WorkOrder'}} {{ Serial }}
Using HTML5 mustache to display all {{ayT 'Tags'}} for this {{ayT 'WorkOrder'}}{{ Tags}}
Using HTML5 mustache to display ONLY the 1st {{ayT 'Tag'}} for this {{ayT 'WorkOrder'}} {{ayT 'Tags'}}{{ Tags.[0]}}
Custom Helper to display if has {{ayT 'Tag'}} 'gold':{{ isInTag Tags}}
Custom Helper to display if has {{ayT 'Tag'}} 'brown':{{ isInTag2 Tags}}
Custom Helper to display if has {{ayT 'Tag'}} 'green' will display using safestring call of the CSS styling fontgreen, else displays safestring call of the CSS styling fontred:{{ isInTag3 Tags}}
HTML5 use of #if to display WO's CustomFields.c1 value with CSS fontgreen applied to the text, else will display fontred if is is false, undefined, null, \"\", 0, or []{{CustomFields.c1}}No value has been entered in {{ayT 'WorkOrderCustom1'}} field for this {{ayT 'WorkOrder'}}
HTML5 use of #each for each WorkOrderItemPart record - #if to display text in fontred if Serials value is false, undefined, null, \"\", 0, or [], else display value in fontgreen{{ayT 'Part'}} {{PartNameViz}} {{ayT 'WorkOrderItemPartPartSerialID'}} = {{Serials}}{{ayT 'Part'}} {{PartNameViz}} has no {{ayT 'WorkOrderItemPartPartSerialID'}}!
\n \n\n\n","Style":".singlePage\n{\npage-break-after: always;\n\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n color: #9e9e9e;\n text-align: center;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n border-bottom: solid 1pt #9e9e9e;\n height: 50px;\n font-size: 11pt; \n color: #9e9e9e;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(ayData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n await ayGetTranslations([\"Part\", \"WorkOrderItemPartPartSerialID\", \"Tag\", \"Tags\", \"WorkOrderCustom1\", \"WorkOrder\" ]);\n\n return ayData;\n}","JsHelpers":"Handlebars.registerHelper('isInTag', function (Tags) \n{\n for (var i=0; i\" + \"THE TEXT green IS IN FOUND IN THE TAGS ARRAY FOR THIS WO!! See how this shows in greenfont!\" +\"

\"); //if want to use CSS styling, be sure to wrap in a safestring\n\t\t}\n }\n return new Handlebars.SafeString(\"

\" + 'NOPE, THE TEXT green ISN\\'T IN THE TAGS ARRAY FOR THIS WO' +\"

\"); //if don't want to return any element at all, comment this else aspect out fully\n});\n","RenderType":0,"HeaderTemplate":"                Printed date: PDFDate\nPage of                ","FooterTemplate":"  ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_if key value is X show Y via custom Helpers Tags","Active":true,"Notes":"example custom Helper if has tag X then show Y, else return something else like preset text\nexample custom Helper of how to correctly wrap output in a safestring as result of Helper if need to use CSS styling","Roles":124927,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n\t
\n\t

Use of Custom Helpers to display specific aspects if {{ayT 'Tags'}} have a specific value

\n\t\n\t
\n\t\n\t\t{{#each ayReportData}}\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t{{#if CustomFields.c1}} {{else}} {{/if}}\n\t\t\t\n\t\t\t{{#each Items}}\n\t\t\t\t{{#each Parts}}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t{{#if Serials}} {{else}} {{/if}}\n\t\t\t\t\n\t\t\t\t{{/each}}\n\t\t\t{{/each}}\n\t\t\n\t\t{{/each}}\n\t
For {{ayT 'WorkOrder'}} {{ Serial }}
Using HTML5 mustache to display all {{ayT 'Tags'}} for this {{ayT 'WorkOrder'}}{{ Tags}}
Using HTML5 mustache to display ONLY the 1st {{ayT 'Tag'}} for this {{ayT 'WorkOrder'}} {{ayT 'Tags'}}{{ Tags.[0]}}
Custom Helper to display if has {{ayT 'Tag'}} 'gold':{{ isInTag Tags}}
Custom Helper to display if has {{ayT 'Tag'}} 'brown':{{ isInTag2 Tags}}
Custom Helper to display if has {{ayT 'Tag'}} 'green' will display using safestring call of the CSS styling fontgreen, else displays safestring call of the CSS styling fontred:{{ isInTag3 Tags}}
HTML5 use of #if to display WO's CustomFields.c1 value with CSS fontgreen applied to the text, else will display fontred if is is false, undefined, null, \"\", 0, or []{{CustomFields.c1}}No value has been entered in {{ayT 'WorkOrderCustom1'}} field for this {{ayT 'WorkOrder'}}
HTML5 use of #each for each WorkOrderItemPart record - #if to display text in fontred if Serials value is false, undefined, null, \"\", 0, or [], else display value in fontgreen{{ayT 'Part'}} {{PartNameViz}} {{ayT 'WorkOrderItemPartPartSerialID'}} = {{Serials}}{{ayT 'Part'}} {{PartNameViz}} has no {{ayT 'WorkOrderItemPartPartSerialID'}}!
\n \n\n\n","Style":".singlePage\n{\npage-break-after: always;\n\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n color: #9e9e9e;\n text-align: center;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n border-bottom: solid 1pt #9e9e9e;\n height: 50px;\n font-size: 11pt; \n color: #9e9e9e;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(ayData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n await ayGetTranslations([\"Part\", \"WorkOrderItemPartPartSerialID\", \"Tag\", \"Tags\", \"WorkOrderCustom1\", \"WorkOrder\" ]);\n\n return ayData;\n}","JsHelpers":"Handlebars.registerHelper('isInTag', function (Tags) \n{\n for (var i=0; i\" + \"THE TEXT green IS IN FOUND IN THE TAGS ARRAY FOR THIS WO!! See how this shows in greenfont!\" +\"

\"); //if want to use CSS styling, be sure to wrap in a safestring\n\t\t}\n }\n return new Handlebars.SafeString(\"

\" + 'NOPE, THE TEXT green ISN\\'T IN THE TAGS ARRAY FOR THIS WO' +\"

\"); //if don't want to return any element at all, comment this else aspect out fully\n});\n","RenderType":0,"HeaderTemplate":"                Printed date: PDFDate\nPage of                ","FooterTemplate":"  ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE myData ServerInfo .ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE myData ServerInfo .ayrt index f1e4db90..66926098 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE myData ServerInfo .ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE myData ServerInfo .ayrt @@ -1 +1 @@ -{"Name":"💡 myData ServerInfo ","Active":true,"Notes":"Examples of obtaining ServerInfo using custom Prepare such as server version, schema version, server's LocalTime, licensing information","Roles":50538,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n
\n{{#each ayReportData}}\n
\n

Display of the ServerInfo obtained through the custom Prepare:

\n

{{ayJSON ../myData.ServerInfo}}

\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n {{#if ServiceDate }}\n {{else}}{{/if}}\n \n \n \n \n \n\n
Column to the right displays the myData.ServerInfo.data.serverVersion obtained:{{../myData.ServerInfo.data.serverVersion}}
Column to the right displays the myData.ServerInfo.data.serverTimeZone obtained:{{../myData.ServerInfo.data.serverTimeZone}}
Column to the right displays the myData.ServerInfo.data.license.license.licenseExpiration obtained:{{../myData.ServerInfo.data.license.license.licenseExpiration}}
 
{{ayT 'WorkOrder'}}{{ayT 'Customer'}}{{ayT 'WorkOrderServiceDate'}}Licensed ToServer's Time Zone
{{Serial}}{{CustomerViz}}{{ayDate ServiceDate}}no Service Date specified{{../myData.ServerInfo.data.license.license.licensedTo}}{{ ../myData.ServerInfo.data.serverTimeZone}}
\n{{/each}}\n
\n\n","Style":".singlePage\n{\npage-break-after: always;\n}\n\np {\n word-wrap: break-word;\n font-size: 9pt;\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 11pt; \n color: #9e9e9e;\n} \n\ntable, td, th {\n border: 1px solid black;\n}\n\ntable { \n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n height: 30px;\n font-size: 9pt; \n color: #9e9e9e;\n}\n\ntd {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n text-align: center;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([\"WorkOrder\", \"Customer\", \"WorkOrderServiceDate\", \"ReportNotes\", \"ReportName\", \"Report\" ]);\n\n //Put the data into the main report data object so it's available to the template\n reportData.myData={ServerInfo:await ayGetFromAPI(\"server-info\")};\n\n\t\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"15mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_myData ServerInfo ","Active":true,"Notes":"Examples of obtaining ServerInfo using custom Prepare such as server version, schema version, server's LocalTime, licensing information","Roles":50538,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n
\n{{#each ayReportData}}\n
\n

Display of the ServerInfo obtained through the custom Prepare:

\n

{{ayJSON ../myData.ServerInfo}}

\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n {{#if ServiceDate }}\n {{else}}{{/if}}\n \n \n \n \n \n\n
Column to the right displays the myData.ServerInfo.data.serverVersion obtained:{{../myData.ServerInfo.data.serverVersion}}
Column to the right displays the myData.ServerInfo.data.serverTimeZone obtained:{{../myData.ServerInfo.data.serverTimeZone}}
Column to the right displays the myData.ServerInfo.data.license.license.licenseExpiration obtained:{{../myData.ServerInfo.data.license.license.licenseExpiration}}
 
{{ayT 'WorkOrder'}}{{ayT 'Customer'}}{{ayT 'WorkOrderServiceDate'}}Licensed ToServer's Time Zone
{{Serial}}{{CustomerViz}}{{ayDate ServiceDate}}no Service Date specified{{../myData.ServerInfo.data.license.license.licensedTo}}{{ ../myData.ServerInfo.data.serverTimeZone}}
\n{{/each}}\n
\n\n","Style":".singlePage\n{\npage-break-after: always;\n}\n\np {\n word-wrap: break-word;\n font-size: 9pt;\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 11pt; \n color: #9e9e9e;\n} \n\ntable, td, th {\n border: 1px solid black;\n}\n\ntable { \n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n height: 30px;\n font-size: 9pt; \n color: #9e9e9e;\n}\n\ntd {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n text-align: center;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([\"WorkOrder\", \"Customer\", \"WorkOrderServiceDate\", \"ReportNotes\", \"ReportName\", \"Report\" ]);\n\n //Put the data into the main report data object so it's available to the template\n reportData.myData={ServerInfo:await ayGetFromAPI(\"server-info\")};\n\n\t\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"15mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE myData search results.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE myData search results.ayrt index c95ca3d7..010225e6 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE myData search results.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE myData search results.ayrt @@ -1 +1 @@ -{"Name":"💡 myData search results","Active":true,"Notes":"Examples of obtaining custom search results using custom Prepare ","Roles":50538,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n
\n\n
\n

myData.SearchResults - Fetched dynamically from API route enum-list/list/AyaType using report template's Prepare

\n

specifically, Prepare searches for the text \"Purple\" in any object in the database and returns....

\n

{{ayJSON myData.SearchResults}}

\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n {{#each myData.SearchResults.data.searchResults}}\n \n \n \n \n \n \n \n {{/each}}\n\n
Column to the right displays the individual property myData.SearchResults.data.totalResultsFound obtained:{{ayJSON myData.SearchResults.data.totalResultsFound}}
Column to the right displays the third array in the search results:{{ayJSON myData.SearchResults.data.searchResults.[2]}}
 
Below displays each record that has the search result
NameTypeID
{{name}}{{type}}{{id}}
\n\n
\n\n","Style":".singlePage\n{\npage-break-after: always;\n}\n\np {\n word-wrap: break-word;\n font-size: 9pt;\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 11pt; \n color: #9e9e9e;\n} \n\ntable, td, th {\n border: 1px solid black;\n}\n\ntable { \n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n height: 30px;\n font-size: 9pt; \n color: #9e9e9e;\n}\n\ntd {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n text-align: center;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\n //Put the data into the main report data object so it's available to the template\n reportData.myData={ServerInfo:await ayGetFromAPI(\"server-info\")};\n \n //Example API POST method to fetch data from api server\n let searchPostData={phrase: \"Purple\"};\n reportData.myData.SearchResults=await ayPostToAPI(\"search\", searchPostData);\n\n\t\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"15mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_myData search results","Active":true,"Notes":"Examples of obtaining custom search results using custom Prepare ","Roles":50538,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n
\n\n
\n

myData.SearchResults - Fetched dynamically from API route enum-list/list/AyaType using report template's Prepare

\n

specifically, Prepare searches for the text \"Purple\" in any object in the database and returns....

\n

{{ayJSON myData.SearchResults}}

\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n {{#each myData.SearchResults.data.searchResults}}\n \n \n \n \n \n \n \n {{/each}}\n\n
Column to the right displays the individual property myData.SearchResults.data.totalResultsFound obtained:{{ayJSON myData.SearchResults.data.totalResultsFound}}
Column to the right displays the third array in the search results:{{ayJSON myData.SearchResults.data.searchResults.[2]}}
 
Below displays each record that has the search result
NameTypeID
{{name}}{{type}}{{id}}
\n\n
\n\n","Style":".singlePage\n{\npage-break-after: always;\n}\n\np {\n word-wrap: break-word;\n font-size: 9pt;\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 11pt; \n color: #9e9e9e;\n} \n\ntable, td, th {\n border: 1px solid black;\n}\n\ntable { \n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n height: 30px;\n font-size: 9pt; \n color: #9e9e9e;\n}\n\ntd {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n text-align: center;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\n //Put the data into the main report data object so it's available to the template\n reportData.myData={ServerInfo:await ayGetFromAPI(\"server-info\")};\n \n //Example API POST method to fetch data from api server\n let searchPostData={phrase: \"Purple\"};\n reportData.myData.SearchResults=await ayPostToAPI(\"search\", searchPostData);\n\n\t\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"15mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE replace carriage return with space.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE replace carriage return with space.ayrt index 629015be..954c5e69 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE replace carriage return with space.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE replace carriage return with space.ayrt @@ -1 +1 @@ -{"Name":"💡 replace carriage return with space","Active":true,"Notes":"Example custom Prepare to replace carriage return with space for a specific key of this object ","Roles":124927,"AType":8,"IncludeWoItemDescendants":false,"Template":"\n\n\n\t
\n\t\t
\n\t\t\t

Custom Prepare to remove carriage returns

\n\t\t
\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\t{{#each ayReportData}}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{/each}}\n\t\t\t\n\t\t
{{ayT 'Customer'}} {{ayT 'CustomerNotes'}} Customized {{ayT 'CustomerNotes'}}
{{Name}} {{Notes}} {{NotesNoCarriage}}
 
\n\n\t\t\n {{#each ayReportData}}\n \n\t\t\t \t\n\t\t\t\t\t\n\t\t\t\t\n \n \n \n \n\t\t\t \n \n \n {{/each}}\n
 
This is a printout of the data returned from the Custom Prepare that this report now uses, each \"group\" is an object. Compare against the data that shows in the \"Sample Data\" when editing this report template.
{{ayJSON this}}
\n\t
\n\n","Style":"\r\n.singlePage\r\n{\r\npage-break-after: always;\r\n}\r\n\r\nbody {\r\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \r\n}\r\n\r\n.reporttitle { \r\n margin-bottom: 20pt; \r\n font-weight: bold; \r\n font-size: 13pt; \r\n text-align: center;\r\n color: #9e9e9e;\r\n} \r\n\r\n\r\ntable { \r\n table-layout: fixed; //setting this to fixed causes columns to be evenly spaced for the entire table regardless of cell content, and then colspan then \"works\" as expected\r\n font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;\r\n border-collapse: collapse;\r\n white-space: pre-wrap;\r\n font-size: 8pt;\r\n width: 100%;\r\n }\r\n\r\n\r\nth {\r\n height: 30px;\r\n text-align: left;\r\n color: #9e9e9e;\r\n}\r\n\r\n\r\ntbody tr {\r\n height: 10px;\r\n word-wrap: break-word;\r\n}\r\n\r\ntbody tr:nth-child(even) {\r\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\r\n}\r\n\r\n\r\n.fontgreen {\r\n color: green;\r\n}\r\n.fontblue {\r\n color: blue;\r\n}\r\n.fontred {\r\n color:red;\r\n}\r\n\r\n\r\n.rightlean {\r\n text-align: right;\r\n}\r\n.leftlean {\r\n text-align: left;\r\n}\r\n.centerlean {\r\n text-align: center;\r\n}","JsPrerender":"async function ayPrepareData(ayData){ \n\n await ayGetTranslations([ \"Customer\", \"CustomerNotes\" ]);\n\n //for each Customer, if the General Notes field is NOT null, creates a new key NotesNoCarriage and puts into it the text from Notes replacing ANY carriage returns with a space, so all text is on same line(s)\n for (EachCU of ayData.ayReportData) {\n if (EachCU.Notes != null) {\n n = EachCU.Notes;\n EachCU.NotesNoCarriage = n.replace(/[\\n\\r]+/g, ' ');\n }\n }\n\n return ayData;\n}","JsHelpers":"","RenderType":0,"HeaderTemplate":"                Printed date: PDFDate\nPage of                ","FooterTemplate":"  ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"20mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"15mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_replace carriage return with space","Active":true,"Notes":"Example custom Prepare to replace carriage return with space for a specific key of this object ","Roles":124927,"AType":8,"IncludeWoItemDescendants":false,"Template":"\n\n\n\t
\n\t\t
\n\t\t\t

Custom Prepare to remove carriage returns

\n\t\t
\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\t{{#each ayReportData}}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{{/each}}\n\t\t\t\n\t\t
{{ayT 'Customer'}} {{ayT 'CustomerNotes'}} Customized {{ayT 'CustomerNotes'}}
{{Name}} {{Notes}} {{NotesNoCarriage}}
 
\n\n\t\t\n {{#each ayReportData}}\n \n\t\t\t \t\n\t\t\t\t\t\n\t\t\t\t\n \n \n \n \n\t\t\t \n \n \n {{/each}}\n
 
This is a printout of the data returned from the Custom Prepare that this report now uses, each \"group\" is an object. Compare against the data that shows in the \"Sample Data\" when editing this report template.
{{ayJSON this}}
\n\t
\n\n","Style":"\r\n.singlePage\r\n{\r\npage-break-after: always;\r\n}\r\n\r\nbody {\r\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \r\n}\r\n\r\n.reporttitle { \r\n margin-bottom: 20pt; \r\n font-weight: bold; \r\n font-size: 13pt; \r\n text-align: center;\r\n color: #9e9e9e;\r\n} \r\n\r\n\r\ntable { \r\n table-layout: fixed; //setting this to fixed causes columns to be evenly spaced for the entire table regardless of cell content, and then colspan then \"works\" as expected\r\n font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;\r\n border-collapse: collapse;\r\n white-space: pre-wrap;\r\n font-size: 8pt;\r\n width: 100%;\r\n }\r\n\r\n\r\nth {\r\n height: 30px;\r\n text-align: left;\r\n color: #9e9e9e;\r\n}\r\n\r\n\r\ntbody tr {\r\n height: 10px;\r\n word-wrap: break-word;\r\n}\r\n\r\ntbody tr:nth-child(even) {\r\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\r\n}\r\n\r\n\r\n.fontgreen {\r\n color: green;\r\n}\r\n.fontblue {\r\n color: blue;\r\n}\r\n.fontred {\r\n color:red;\r\n}\r\n\r\n\r\n.rightlean {\r\n text-align: right;\r\n}\r\n.leftlean {\r\n text-align: left;\r\n}\r\n.centerlean {\r\n text-align: center;\r\n}","JsPrerender":"async function ayPrepareData(ayData){ \n\n await ayGetTranslations([ \"Customer\", \"CustomerNotes\" ]);\n\n //for each Customer, if the General Notes field is NOT null, creates a new key NotesNoCarriage and puts into it the text from Notes replacing ANY carriage returns with a space, so all text is on same line(s)\n for (EachCU of ayData.ayReportData) {\n if (EachCU.Notes != null) {\n n = EachCU.Notes;\n EachCU.NotesNoCarriage = n.replace(/[\\n\\r]+/g, ' ');\n }\n }\n\n return ayData;\n}","JsHelpers":"","RenderType":0,"HeaderTemplate":"                Printed date: PDFDate\nPage of                ","FooterTemplate":"  ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"20mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"15mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE table layout parent child grandchild.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE table layout parent child grandchild.ayrt index 366edb44..d5d5e5f5 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE table layout parent child grandchild.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE table layout parent child grandchild.ayrt @@ -1 +1 @@ -{"Name":"💡 table layout parent child grandchild","Active":true,"Notes":"","Roles":124927,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\t\n\n\t

Examples within this report template of how to access showing parent (i.e. property of the Work Order) child (i.e. property of the Work Order Item) and grandchild (property of Labor) all on same row

\n\t\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\n\t{{#each ayReportData}}\n\t\t\n\t\t\t\n\t\t{{#each Items}} \n\t\t\t{{#each Labors}}\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t{{/each}}\n\t\t{{/each}}\t\t\n\t\n\t{{/each}}\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\n\t
{{ayT 'WorkOrder'}} {{ayT 'WorkOrderItemWorkOrderStatusID'}}{{ayT 'WorkOrderItemLaborServiceStartDate'}}{{ayT 'AuthorizationRoleTech'}}
{{../../Serial}} {{../WorkOrderItemStatusNameViz}} {{ServiceStartDate}}{{UserViz}}
footer stuff 1expands across two columns with or without having to have textfooter stuff 3
\t\n\n\n","Style":".singlePage\n{\npage-break-after: always;\n}\n\n.footertext {\n font-size: 14pt;\n font-style: italic;\n background-color: lightsteelblue;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n border-bottom: solid 1pt #9e9e9e;\n height: 50px;\n color: #9e9e9e;\n font-size: 11pt;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n await ayGetTranslations([\"WorkOrder\", \"WorkOrderItemWorkOrderStatusID\", \"WorkOrderItemLaborServiceStartDate\", \"AuthorizationRoleTech\" ]);\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"    Todays date:    set in PDF Options","FooterTemplate":"  set in PDF Options  Page  of     ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_table layout parent child grandchild","Active":true,"Notes":"","Roles":124927,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\t\n\n\t

Examples within this report template of how to access showing parent (i.e. property of the Work Order) child (i.e. property of the Work Order Item) and grandchild (property of Labor) all on same row

\n\t\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\n\t{{#each ayReportData}}\n\t\t\n\t\t\t\n\t\t{{#each Items}} \n\t\t\t{{#each Labors}}\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t{{/each}}\n\t\t{{/each}}\t\t\n\t\n\t{{/each}}\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\n\t
{{ayT 'WorkOrder'}} {{ayT 'WorkOrderItemWorkOrderStatusID'}}{{ayT 'WorkOrderItemLaborServiceStartDate'}}{{ayT 'AuthorizationRoleTech'}}
{{../../Serial}} {{../WorkOrderItemStatusNameViz}} {{ServiceStartDate}}{{UserViz}}
footer stuff 1expands across two columns with or without having to have textfooter stuff 3
\t\n\n\n","Style":".singlePage\n{\npage-break-after: always;\n}\n\n.footertext {\n font-size: 14pt;\n font-style: italic;\n background-color: lightsteelblue;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n border-bottom: solid 1pt #9e9e9e;\n height: 50px;\n color: #9e9e9e;\n font-size: 11pt;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n await ayGetTranslations([\"WorkOrder\", \"WorkOrderItemWorkOrderStatusID\", \"WorkOrderItemLaborServiceStartDate\", \"AuthorizationRoleTech\" ]);\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"    Todays date:    set in PDF Options","FooterTemplate":"  set in PDF Options  Page  of     ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE table layout parent child.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE table layout parent child.ayrt index 54ba08ba..ab753b15 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE table layout parent child.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE table layout parent child.ayrt @@ -1 +1 @@ -{"Name":"💡 table layout parent child","Active":true,"Notes":"example of displaying a Parent value when the #each references a Child, use a ../ in front of the Property name in the mustaches","Roles":124927,"AType":26,"IncludeWoItemDescendants":false,"Template":"\n\t\n\t\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\n\t{{#each ayReportData}}\n\t\t\n\t\t\t\n\t\t{{#each Items}} \n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t{{/each}}\t\t\n\t\n\t{{/each}}\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\n\t
column header 1 column header 2column header 3{{ayT 'PurchaseOrderItemSerialNumbers'}}
{{ayT 'PurchaseOrder'}} {{../Serial}} {{ayT 'PurchaseOrderItemPartNumber'}} {{PartNameViz}} {{ayT 'PurchaseOrderItemQuantityOrdered'}} {{QuantityOrdered}}{{Serials}}
footer stuff 1expands across two columns with or without having to have textfooter stuff 3
\t\n\n\n","Style":".singlePage\n{\npage-break-after: always;\n}\n\n.footertext {\n font-size: 14pt;\n font-style: italic;\n background-color: pink;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n color: #9e9e9e;\n text-align: center;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n border-bottom: solid 1pt #9e9e9e;\n height: 50px;\n font-size: 13pt; \n color: #9e9e9e;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n await ayGetTranslations([\"PurchaseOrder\", \"PurchaseOrderItemPartNumber\", \"PurchaseOrderItemQuantityOrdered\", \"PurchaseOrderItemSerialNumbers\" ]);\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"    Todays date:    set in PDF Options","FooterTemplate":"  set in PDF Options  Page  of     ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_table layout parent child","Active":true,"Notes":"example of displaying a Parent value when the #each references a Child, use a ../ in front of the Property name in the mustaches","Roles":124927,"AType":26,"IncludeWoItemDescendants":false,"Template":"\n\t\n\t\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\n\t{{#each ayReportData}}\n\t\t\n\t\t\t\n\t\t{{#each Items}} \n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t{{/each}}\t\t\n\t\n\t{{/each}}\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\n\t
column header 1 column header 2column header 3{{ayT 'PurchaseOrderItemSerialNumbers'}}
{{ayT 'PurchaseOrder'}} {{../Serial}} {{ayT 'PurchaseOrderItemPartNumber'}} {{PartNameViz}} {{ayT 'PurchaseOrderItemQuantityOrdered'}} {{QuantityOrdered}}{{Serials}}
footer stuff 1expands across two columns with or without having to have textfooter stuff 3
\t\n\n\n","Style":".singlePage\n{\npage-break-after: always;\n}\n\n.footertext {\n font-size: 14pt;\n font-style: italic;\n background-color: pink;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 13pt; \n color: #9e9e9e;\n text-align: center;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n border-bottom: solid 1pt #9e9e9e;\n height: 50px;\n font-size: 13pt; \n color: #9e9e9e;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n await ayGetTranslations([\"PurchaseOrder\", \"PurchaseOrderItemPartNumber\", \"PurchaseOrderItemQuantityOrdered\", \"PurchaseOrderItemSerialNumbers\" ]);\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"    Todays date:    set in PDF Options","FooterTemplate":"  set in PDF Options  Page  of     ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE user logged in TimeZone Currency ayClientMetaData.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE user logged in TimeZone Currency ayClientMetaData.ayrt index a00f463f..0fabdff0 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE user logged in TimeZone Currency ayClientMetaData.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE user logged in TimeZone Currency ayClientMetaData.ayrt @@ -1 +1 @@ -{"Name":"💡 user logged in TimeZone Currency ayClientMetaData","Active":true,"Notes":"Examples of displaying ayClientMetaData data such as logged in username, TimeZone name, Currency name, PDFDate, PDFTime","Roles":50538,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n
\n{{#each ayReportData}}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n {{#if ServiceDate }}\n {{else}}{{/if}}\n \n \n \n \n \n\n
Column to the right displays all of your ayClientMetaData :{{ayJSON ../ayClientMetaData }}
Column to the right displays your AyaNova logged in user name as is - with the quotation marks:{{ayJSON ../ayClientMetaData.UserName}}
Column to the right displays your AyaNova logged in user name:{{../ayClientMetaData.UserName}}
Column to the right displays your TimeZone:{{../ayClientMetaData.TimeZoneName}}
Column to the right displays your logged in currency:{{../ayClientMetaData.CurrencyName}}
Column to the right displays your date and time:{{../ayClientMetaData.PDFDate}} {{../ayClientMetaData.PDFTime}}
 
{{ayT 'WorkOrder'}}{{ayT 'Customer'}}{{ayT 'WorkOrderServiceDate'}}{{ayT 'User'}}{{ayT 'DefaultLanguage'}}
{{Serial}}{{CustomerViz}}{{ayDate ServiceDate}}no Service Date specified{{../ayClientMetaData.UserName}}{{ ../ayClientMetaData.LanguageName}}
\n{{/each}}\n
\n\n","Style":".singlePage\n{\npage-break-after: always;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 11pt; \n color: #9e9e9e;\n} \n\ntable, td, th {\n border: 1px solid black;\n}\n\ntable { \n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n /* border-bottom: solid 1pt #9e9e9e; */\n height: 30px;\n font-size: 9pt; \n color: #9e9e9e;\n}\n\ntd {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n text-align: center;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([\"WorkOrder\", \"Customer\", \"WorkOrderServiceDate\", \"User\", \"DefaultLanguage\" ]);\n\n\t\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"15mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"z_user logged in TimeZone Currency ayClientMetaData","Active":true,"Notes":"Examples of displaying ayClientMetaData data such as logged in username, TimeZone name, Currency name, PDFDate, PDFTime","Roles":50538,"AType":34,"IncludeWoItemDescendants":false,"Template":"\n\n\n
\n{{#each ayReportData}}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n {{#if ServiceDate }}\n {{else}}{{/if}}\n \n \n \n \n \n\n
Column to the right displays all of your ayClientMetaData :{{ayJSON ../ayClientMetaData }}
Column to the right displays your AyaNova logged in user name as is - with the quotation marks:{{ayJSON ../ayClientMetaData.UserName}}
Column to the right displays your AyaNova logged in user name:{{../ayClientMetaData.UserName}}
Column to the right displays your TimeZone:{{../ayClientMetaData.TimeZoneName}}
Column to the right displays your logged in currency:{{../ayClientMetaData.CurrencyName}}
Column to the right displays your date and time:{{../ayClientMetaData.PDFDate}} {{../ayClientMetaData.PDFTime}}
 
{{ayT 'WorkOrder'}}{{ayT 'Customer'}}{{ayT 'WorkOrderServiceDate'}}{{ayT 'User'}}{{ayT 'DefaultLanguage'}}
{{Serial}}{{CustomerViz}}{{ayDate ServiceDate}}no Service Date specified{{../ayClientMetaData.UserName}}{{ ../ayClientMetaData.LanguageName}}
\n{{/each}}\n
\n\n","Style":".singlePage\n{\npage-break-after: always;\n}\n\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 11pt; \n color: #9e9e9e;\n} \n\ntable, td, th {\n border: 1px solid black;\n}\n\ntable { \n white-space: pre-wrap;\n width: 100%;\n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n /* border-bottom: solid 1pt #9e9e9e; */\n height: 30px;\n font-size: 9pt; \n color: #9e9e9e;\n}\n\ntd {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\n text-align: center;\n}\n\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([\"WorkOrder\", \"Customer\", \"WorkOrderServiceDate\", \"User\", \"DefaultLanguage\" ]);\n\n\t\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"15mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/PRODUCTION PM Parts Summary .ayrt b/server/AyaNova/resource/rpt/stock-report-templates/PRODUCTION PM Parts Summary .ayrt index 611e641e..5d801cd0 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/PRODUCTION PM Parts Summary .ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/PRODUCTION PM Parts Summary .ayrt @@ -1 +1 @@ -{"Name":" PM Parts Summary ","Active":true,"Notes":"Custom Prepare to obtain translations, group by the woitempart, derived amounts and running totals","Roles":49258,"AType":21,"IncludeWoItemDescendants":false,"Template":"\n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{#each ayReportData}}\n \n \n \n {{#each items}}\n \n \n \n \n \n \n \n \n \n {{#if NetCost }} {{else}}{{/if}}\n {{#if NetViz }} {{else}}{{/if}}\n {{#if NetDiff }} {{else}}{{/if}} \n \n {{/each}}\n \n \n \n \n \n \n \n \n \n \n \n \n {{/each}}\n \n
{{ayT 'PreventiveMaintenance'}} {{ayT 'WorkOrderItemParts'}} {{ayT 'PartCost'}} {{ayT 'NetValue'}}
 
{{ayT 'Part'}}{{ayT 'PreventiveMaintenance'}}{{ayT 'PMNextServiceDate'}}{{ayT 'WorkOrderItemPartQuantity'}}{{ayT 'PartCost'}} Per{{ayT 'PartRetail'}} Per {{ayT 'PartCost'}} {{ayT 'NetValue'}}{{ayT 'PartRetail'}} {{ayT 'NetValue'}}Difference
 
{{group}}
 {{Serial}}{{ayDate NextServiceDate}}{{Quantity}}{{UnitOfMeasureViz}}{{ayCurrency Cost}}{{ayCurrency PriceViz}} {{ayCurrency NetCost}}{{Quantity}}{{ayCurrency NetViz}}{{Quantity}}{{ayCurrency NetDiff}}{{Quantity}}
 
{{ayT 'Total'}} for part {{group}}{{ayCurrency GroupPartsNetCost}}{{ayCurrency GroupPartsNetViz}}{{ayCurrency GroupPartsDiff}}
 
\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{#if AllWOPartsNetCost}} {{else}} {{/if}}\n {{#if AllWOPartsNetViz}} {{else}} {{/if}} \n {{#if AllWOPartsDiff}} {{else}} {{/if}}\n \n \n \n
 
{{ayT 'Total'}} for all {{ayT 'WorkOrderItemParts'}} in this reportAll Net CostAll Net ChargeAll Diff
 {{ ayCurrency AllWOPartsNetCost}}$0.00{{ ayCurrency AllWOPartsNetViz}}$0.00{{ayCurrency AllWOPartsDiff}}$0.00
\n\n","Style":".singlePage\n{\npage-break-after: always;\n\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 14pt; \n color: #9e9e9e;\n text-align: left;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%; \n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n height: 20px;\n font-size: 10pt; \n color: #9e9e9e;\n text-align: center;\n}\n\ntbody td {\n padding: 2px;\n word-wrap: break-word;\n font-size: 9pt;\n text-align: center;\n}\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n font-weight: bold;\n}\n.fontpurple {\n color: purple;\n}\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([\"WorkOrderItemParts\", \"Part\", \"PMNextServiceDate\", \"WorkOrderItemPartQuantity\", \"PreventiveMaintenance\", \"NetValue\", \"PartCost\", \"PartRetail\", \"Total\" ]);\n\n\t//below is the code to group by the part - the PartNameViz\n\tlet ret = [];\n //iterate pms -> items -> pm item parts\n reportData.ayReportData.forEach(pm => {\n pm.Items.forEach(pmitem => {\n pmitem.Parts.forEach(part => {\n //new shape of data required for report \n let record = {\n Serial: pm.Serial,\n\t\t\t\t\tNextServiceDate: pm.NextServiceDate,\n\t\t\t\t\tNetViz: part.NetViz,\n\t\t\t\t\tPriceOverride: part.PriceOverride,\n\t\t\t\t\tListPrice: part.ListPrice,\n UnitOfMeasureViz: part.UnitOfMeasureViz,\n PriceViz: part.PriceViz,\n Cost: part.Cost,\n SuggestedQuantity: part.SuggestedQuantity,\n Quantity: part.Quantity,\n PartWarehouseViz: part.PartWarehouseViz,\n UpcViz: part.UpcViz,\n Serials: part.Serials,\n PartDescriptionViz: part.PartDescriptionViz ?? \"\",\n };\n\n //Find or create group and insert this record \n let groupObject = ret.find(z => z.group == (part.PartNameViz + \" \" + record.PartDescriptionViz) );\n if (groupObject != undefined) {\n //there is already a matching group in the return array so just push this record into it\n groupObject.items.push(record);\n //update the count for this group's items\n groupObject.count++;\n } else {\n //No group yet, so start a new one in the ret array and push this record into it\n ret.push({ group: (part.PartNameViz + \" \" + record.PartDescriptionViz), items: [record], count: 1 });\n \n }\n\n })\n })\n });\n\n //replace the ayReportData with our new shaped format of data\n reportData.ayReportData = ret;\n\n \n//need to now edit below to get running totals of THE DATA returned above - can't reference items as not in the returned data\n\n\n\n\n//********************//NOTE if you customize this report template and do NOT need a function or key identified below, remove to increase report performance\n\n\n//below declares a key on the entire wo to hold all Part Net, costs, profit (nets - costs), from all pms so it exists and a key to hold all Part Net Costs\nreportData.AllWOPartsNetViz = 0;\nreportData.AllWOPartsNetCost = 0;\nreportData.AllWOPartsDiff = 0;\n\n\nfor (EachGroup of reportData.ayReportData) \n\t{\n\n\n\t//below declares a key on the entire group to hold all Part Net, costs, profit/loss (nets - costs), for this group (this group is a single Part that has one or more wo item parts records)\n\tEachGroup.GroupPartsNetViz = 0;\n\tEachGroup.GroupPartsNetCost = 0;\n\tEachGroup.GroupPartsDiff = 0; \n\t\n\n\t//below is to Iterate through each woitempart record for this part - groupitem is a woitempart record\n\tfor (groupitem of EachGroup.items)\n\t\t{\n\t\t\t\t\t\n\t\t\tgroupitem.ThisItemPartNetViz = 0; //declare a key on the Item to hold all of this item's parts nets and set it initially to 0 \n\t\t\tgroupitem.ThisItemPartNetCost = 0; //declare a key on the Item to hold all of this item's parts costs and set it initially to 0 \n\t\t\tgroupitem.ThisItemPartDiff = 0; //declare a key on the Item to hold all of this item's part profit/loss (nets - costs) and set it initially to 0 \n\t\t\t\n\n\t\t\t//make sure it has a value before attempting to add it to the running total\n \tif (groupitem.Quantity != 0) \n \t \t{\n\t\t\t\t\t\tEachGroup.GroupPartsNetViz += groupitem.NetViz;\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\treportData.AllWOPartsNetViz += groupitem.NetViz;\t\n\n\n\t\t\t\t\t\tgroupitem.NetCost = (groupitem.Cost * groupitem.Quantity);\t\t\t\t\t\t\n\t\t\t\t\t\tEachGroup.GroupPartsNetCost += groupitem.NetCost;\n\t\t\t\t\t\treportData.AllWOPartsNetCost += groupitem.NetCost;\n\n\n\t\t\t\t\t\tif (groupitem.NetViz != 0) \n\t\t\t\t\t\t{\n\t\t\t\t\t\tgroupitem.NetDiff = (groupitem.NetViz - groupitem.NetCost)\n\t\t\t\t\t\tEachGroup.GroupPartsDiff += groupitem.NetDiff; //\n\t\t\t\t\t\treportData.AllWOPartsDiff += groupitem.NetDiff; //\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\n\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\t\t\t\n\n\t\t\t\n\t\t}\n\n }\n\n return reportData; \n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"20mm","MarginOptionsRight":"20mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"PM Parts Summary ","Active":true,"Notes":"Custom Prepare to obtain translations, group by the woitempart, derived amounts and running totals","Roles":49258,"AType":21,"IncludeWoItemDescendants":false,"Template":"\n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{#each ayReportData}}\n \n \n \n {{#each items}}\n \n \n \n \n \n \n \n \n \n {{#if NetCost }} {{else}}{{/if}}\n {{#if NetViz }} {{else}}{{/if}}\n {{#if NetDiff }} {{else}}{{/if}} \n \n {{/each}}\n \n \n \n \n \n \n \n \n \n \n \n \n {{/each}}\n \n
{{ayT 'PreventiveMaintenance'}} {{ayT 'WorkOrderItemParts'}} {{ayT 'PartCost'}} {{ayT 'NetValue'}}
 
{{ayT 'Part'}}{{ayT 'PreventiveMaintenance'}}{{ayT 'PMNextServiceDate'}}{{ayT 'WorkOrderItemPartQuantity'}}{{ayT 'PartCost'}} Per{{ayT 'PartRetail'}} Per {{ayT 'PartCost'}} {{ayT 'NetValue'}}{{ayT 'PartRetail'}} {{ayT 'NetValue'}}Difference
 
{{group}}
 {{Serial}}{{ayDate NextServiceDate}}{{Quantity}}{{UnitOfMeasureViz}}{{ayCurrency Cost}}{{ayCurrency PriceViz}} {{ayCurrency NetCost}}{{Quantity}}{{ayCurrency NetViz}}{{Quantity}}{{ayCurrency NetDiff}}{{Quantity}}
 
{{ayT 'Total'}} for part {{group}}{{ayCurrency GroupPartsNetCost}}{{ayCurrency GroupPartsNetViz}}{{ayCurrency GroupPartsDiff}}
 
\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{#if AllWOPartsNetCost}} {{else}} {{/if}}\n {{#if AllWOPartsNetViz}} {{else}} {{/if}} \n {{#if AllWOPartsDiff}} {{else}} {{/if}}\n \n \n \n
 
{{ayT 'Total'}} for all {{ayT 'WorkOrderItemParts'}} in this reportAll Net CostAll Net ChargeAll Diff
 {{ ayCurrency AllWOPartsNetCost}}$0.00{{ ayCurrency AllWOPartsNetViz}}$0.00{{ayCurrency AllWOPartsDiff}}$0.00
\n\n","Style":".singlePage\n{\npage-break-after: always;\n\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 14pt; \n color: #9e9e9e;\n text-align: left;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%; \n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n height: 20px;\n font-size: 10pt; \n color: #9e9e9e;\n text-align: center;\n}\n\ntbody td {\n padding: 2px;\n word-wrap: break-word;\n font-size: 9pt;\n text-align: center;\n}\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n font-weight: bold;\n}\n.fontpurple {\n color: purple;\n}\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([\"WorkOrderItemParts\", \"Part\", \"PMNextServiceDate\", \"WorkOrderItemPartQuantity\", \"PreventiveMaintenance\", \"NetValue\", \"PartCost\", \"PartRetail\", \"Total\" ]);\n\n\t//below is the code to group by the part - the PartNameViz\n\tlet ret = [];\n //iterate pms -> items -> pm item parts\n reportData.ayReportData.forEach(pm => {\n pm.Items.forEach(pmitem => {\n pmitem.Parts.forEach(part => {\n //new shape of data required for report \n let record = {\n Serial: pm.Serial,\n\t\t\t\t\tNextServiceDate: pm.NextServiceDate,\n\t\t\t\t\tNetViz: part.NetViz,\n\t\t\t\t\tPriceOverride: part.PriceOverride,\n\t\t\t\t\tListPrice: part.ListPrice,\n UnitOfMeasureViz: part.UnitOfMeasureViz,\n PriceViz: part.PriceViz,\n Cost: part.Cost,\n SuggestedQuantity: part.SuggestedQuantity,\n Quantity: part.Quantity,\n PartWarehouseViz: part.PartWarehouseViz,\n UpcViz: part.UpcViz,\n Serials: part.Serials,\n PartDescriptionViz: part.PartDescriptionViz ?? \"\",\n };\n\n //Find or create group and insert this record \n let groupObject = ret.find(z => z.group == (part.PartNameViz + \" \" + record.PartDescriptionViz) );\n if (groupObject != undefined) {\n //there is already a matching group in the return array so just push this record into it\n groupObject.items.push(record);\n //update the count for this group's items\n groupObject.count++;\n } else {\n //No group yet, so start a new one in the ret array and push this record into it\n ret.push({ group: (part.PartNameViz + \" \" + record.PartDescriptionViz), items: [record], count: 1 });\n \n }\n\n })\n })\n });\n\n //replace the ayReportData with our new shaped format of data\n reportData.ayReportData = ret;\n\n \n//need to now edit below to get running totals of THE DATA returned above - can't reference items as not in the returned data\n\n\n\n\n//********************//NOTE if you customize this report template and do NOT need a function or key identified below, remove to increase report performance\n\n\n//below declares a key on the entire wo to hold all Part Net, costs, profit (nets - costs), from all pms so it exists and a key to hold all Part Net Costs\nreportData.AllWOPartsNetViz = 0;\nreportData.AllWOPartsNetCost = 0;\nreportData.AllWOPartsDiff = 0;\n\n\nfor (EachGroup of reportData.ayReportData) \n\t{\n\n\n\t//below declares a key on the entire group to hold all Part Net, costs, profit/loss (nets - costs), for this group (this group is a single Part that has one or more wo item parts records)\n\tEachGroup.GroupPartsNetViz = 0;\n\tEachGroup.GroupPartsNetCost = 0;\n\tEachGroup.GroupPartsDiff = 0; \n\t\n\n\t//below is to Iterate through each woitempart record for this part - groupitem is a woitempart record\n\tfor (groupitem of EachGroup.items)\n\t\t{\n\t\t\t\t\t\n\t\t\tgroupitem.ThisItemPartNetViz = 0; //declare a key on the Item to hold all of this item's parts nets and set it initially to 0 \n\t\t\tgroupitem.ThisItemPartNetCost = 0; //declare a key on the Item to hold all of this item's parts costs and set it initially to 0 \n\t\t\tgroupitem.ThisItemPartDiff = 0; //declare a key on the Item to hold all of this item's part profit/loss (nets - costs) and set it initially to 0 \n\t\t\t\n\n\t\t\t//make sure it has a value before attempting to add it to the running total\n \tif (groupitem.Quantity != 0) \n \t \t{\n\t\t\t\t\t\tEachGroup.GroupPartsNetViz += groupitem.NetViz;\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\treportData.AllWOPartsNetViz += groupitem.NetViz;\t\n\n\n\t\t\t\t\t\tgroupitem.NetCost = (groupitem.Cost * groupitem.Quantity);\t\t\t\t\t\t\n\t\t\t\t\t\tEachGroup.GroupPartsNetCost += groupitem.NetCost;\n\t\t\t\t\t\treportData.AllWOPartsNetCost += groupitem.NetCost;\n\n\n\t\t\t\t\t\tif (groupitem.NetViz != 0) \n\t\t\t\t\t\t{\n\t\t\t\t\t\tgroupitem.NetDiff = (groupitem.NetViz - groupitem.NetCost)\n\t\t\t\t\t\tEachGroup.GroupPartsDiff += groupitem.NetDiff; //\n\t\t\t\t\t\treportData.AllWOPartsDiff += groupitem.NetDiff; //\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\n\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\t\t\t\n\n\t\t\t\n\t\t}\n\n }\n\n return reportData; \n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"20mm","MarginOptionsRight":"20mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/PRODUCTION Part Grouped Net Cost Difference.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/PRODUCTION Part Grouped Net Cost Difference.ayrt index 5c6aea7d..1301d282 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/PRODUCTION Part Grouped Net Cost Difference.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/PRODUCTION Part Grouped Net Cost Difference.ayrt @@ -1 +1 @@ -{"Name":" Part Grouped Net Cost Difference","Active":true,"Notes":"Custom Prepare to obtain translations, group by the woitempart, derived amounts and running totals","Roles":49258,"AType":39,"IncludeWoItemDescendants":false,"Template":"\n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{#each ayReportData}}\n \n \n \n {{#each items}}\n \n \n \n {{#if ServiceDate }}{{else}} {{/if}}\n \n \n \n \n {{#if NetCost }} {{else}}{{/if}}\n {{#if NetViz }} {{else}}{{/if}}\n {{#if NetDiff }} {{else}}{{/if}} \n \n {{/each}}\n \n \n \n \n \n \n \n \n \n \n \n \n {{/each}}\n \n
{{ayT 'WorkOrder'}} {{ayT 'WorkOrderItemParts'}} {{ayT 'PartCost'}} {{ayT 'NetValue'}}
 
{{ayT 'Part'}}{{ayT 'WorkOrder'}}{{ayT 'WorkOrderServiceDate'}}{{ayT 'WorkOrderItemPartQuantity'}}{{ayT 'PartCost'}}{{ayT 'PartRetail'}}{{ayT 'PartCost'}} {{ayT 'NetValue'}}{{ayT 'PartRetail'}} {{ayT 'NetValue'}}Difference
{{group}}
 {{Serial}}{{ayDate ServiceDate}}no Service Date specified{{Quantity}}{{UnitOfMeasureViz}}{{ayCurrency Cost}}{{ayCurrency PriceViz}}{{ayCurrency NetCost}}{{Quantity}}{{ayCurrency NetViz}}{{Quantity}}{{ayCurrency NetDiff}}{{Quantity}}
 
{{ayT 'Total'}} for part {{group}}{{ayCurrency GroupPartsNetCost}}{{ayCurrency GroupPartsNetViz}}{{ayCurrency GroupPartsDiff}}
 
\n\n \n \n \n \n \n \n \n \n \n \n \n \n {{#if AllWOPartsNetCost}} {{else}} {{/if}}\n {{#if AllWOPartsNetViz}} {{else}} {{/if}} \n {{#if AllWOPartsDiff}} {{else}} {{/if}}\n \n \n \n
{{ayT 'Total'}} for all {{ayT 'WorkOrderItemParts'}} in this reportAll Net CostAll Net ChargeAll Diff
 {{ ayCurrency AllWOPartsNetCost}}$0.00{{ ayCurrency AllWOPartsNetViz}}$0.00{{ayCurrency AllWOPartsDiff}}$0.00
\n
\n\n","Style":".singlePage\n{\npage-break-after: always;\n\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 14pt; \n color: #9e9e9e;\n text-align: left;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%; \n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n height: 30px;\n font-size: 10pt; \n color: #9e9e9e;\n text-align: center;\n}\n\ntbody td {\n padding: 2px;\n word-wrap: break-word;\n font-size: 9pt;\n text-align: center;\n}\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n font-weight: bold;\n}\n.fontpurple {\n color: purple;\n}\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([\"WorkOrderItemParts\", \"Part\", \"WorkOrderServiceDate\", \"WorkOrderItemPartQuantity\", \"WorkOrder\", \"WorkOrderList\", \"NetValue\", \"PartCost\", \"PartRetail\", \"Total\" ]);\n\n\t//below is the code to group by the part - the PartNameViz\n\tlet ret = [];\n //iterate workorders -> items -> workorder item parts\n reportData.ayReportData.forEach(workorder => {\n workorder.Items.forEach(workorderitem => {\n workorderitem.Parts.forEach(part => {\n //new shape of data required for report\n let record = {\n Serial: workorder.Serial,\n\t\t\t\t\tServiceDate: workorder.ServiceDate,\n\t\t\t\t\tNetViz: part.NetViz,\n\t\t\t\t\tPriceOverride: part.PriceOverride,\n\t\t\t\t\tListPrice: part.ListPrice,\n UnitOfMeasureViz: part.UnitOfMeasureViz,\n PriceViz: part.PriceViz,\n Cost: part.Cost,\n SuggestedQuantity: part.SuggestedQuantity,\n Quantity: part.Quantity,\n PartWarehouseViz: part.PartWarehouseViz,\n UpcViz: part.UpcViz,\n\t\t\t\t\tPartDescriptionViz: part.PartDescriptionViz ?? \"\",\n Serials: part.Serials\n };\n\n //Find or create group and insert this record \n let groupObject = ret.find(z => z.group == part.PartNameViz + \" \" + record.PartDescriptionViz);\n if (groupObject != undefined) {\n //there is already a matching group in the return array so just push this record into it\n groupObject.items.push(record);\n //update the count for this group's items\n groupObject.count++;\n } else {\n //No group yet, so start a new one in the ret array and push this record into it\n ret.push({ group: part.PartNameViz + \" \" + record.PartDescriptionViz, items: [record], count: 1 });\n }\n\n })\n })\n });\n\n //replace the ayReportData with our new shaped format of data\n reportData.ayReportData = ret;\n\n \n//need to now edit below to get running totals of THE DATA returned above - can't reference items as not in the returned data\n\n\n\n\n//********************//NOTE if you customize this report template and do NOT need a function or key identified below, remove to increase report performance\n\n\n//below declares a key on the entire wo to hold all Part Net, costs, profit (nets - costs), from all workorders so it exists and a key to hold all Part Net Costs\nreportData.AllWOPartsNetViz = 0;\nreportData.AllWOPartsNetCost = 0;\nreportData.AllWOPartsDiff = 0;\n\n\nfor (EachGroup of reportData.ayReportData) \n\t{\n\n\n\t//below declares a key on the entire group to hold all Part Net, costs, profit/loss (nets - costs), for this group (this group is a single Part that has one or more wo item parts records)\n\tEachGroup.GroupPartsNetViz = 0;\n\tEachGroup.GroupPartsNetCost = 0;\n\tEachGroup.GroupPartsDiff = 0; \n\t\n\n\t//below is to Iterate through each woitempart record for this part - groupitem is a woitempart record\n\tfor (groupitem of EachGroup.items)\n\t\t{\n\t\t\t\t\t\n\t\t\tgroupitem.ThisItemPartNetViz = 0; //declare a key on the Item to hold all of this item's parts nets and set it initially to 0 \n\t\t\tgroupitem.ThisItemPartNetCost = 0; //declare a key on the Item to hold all of this item's parts costs and set it initially to 0 \n\t\t\tgroupitem.ThisItemPartDiff = 0; //declare a key on the Item to hold all of this item's part profit/loss (nets - costs) and set it initially to 0 \n\t\t\t\n\n\t\t\t//make sure it has a value before attempting to add it to the running total\n \tif (groupitem.Quantity != 0) \n \t \t{\n\t\t\t\t\t\tEachGroup.GroupPartsNetViz += groupitem.NetViz;\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\treportData.AllWOPartsNetViz += groupitem.NetViz;\t\n\n\n\t\t\t\t\t\tgroupitem.NetCost = (groupitem.Cost * groupitem.Quantity);\t\t\t\t\t\t\n\t\t\t\t\t\tEachGroup.GroupPartsNetCost += groupitem.NetCost;\n\t\t\t\t\t\treportData.AllWOPartsNetCost += groupitem.NetCost;\n\n\n\t\t\t\t\t\tif (groupitem.NetViz != 0) \n\t\t\t\t\t\t{\n\t\t\t\t\t\tgroupitem.NetDiff = (groupitem.NetViz - groupitem.NetCost)\n\t\t\t\t\t\tEachGroup.GroupPartsDiff += groupitem.NetDiff; //\n\t\t\t\t\t\treportData.AllWOPartsDiff += groupitem.NetDiff; //\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\n\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\t\t\t\n\n\t\t\t\n\t\t}\n\n }\n\n return reportData; \n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"20mm","MarginOptionsRight":"20mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"Part Grouped Net Cost Difference","Active":true,"Notes":"Custom Prepare to obtain translations, group by the woitempart, derived amounts and running totals","Roles":49258,"AType":39,"IncludeWoItemDescendants":false,"Template":"\n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{#each ayReportData}}\n \n \n \n {{#each items}}\n \n \n \n {{#if ServiceDate }}{{else}} {{/if}}\n \n \n \n \n {{#if NetCost }} {{else}}{{/if}}\n {{#if NetViz }} {{else}}{{/if}}\n {{#if NetDiff }} {{else}}{{/if}} \n \n {{/each}}\n \n \n \n \n \n \n \n \n \n \n \n \n {{/each}}\n \n
{{ayT 'WorkOrder'}} {{ayT 'WorkOrderItemParts'}} {{ayT 'PartCost'}} {{ayT 'NetValue'}}
 
{{ayT 'Part'}}{{ayT 'WorkOrder'}}{{ayT 'WorkOrderServiceDate'}}{{ayT 'WorkOrderItemPartQuantity'}}{{ayT 'PartCost'}}{{ayT 'PartRetail'}}{{ayT 'PartCost'}} {{ayT 'NetValue'}}{{ayT 'PartRetail'}} {{ayT 'NetValue'}}Difference
{{group}}
 {{Serial}}{{ayDate ServiceDate}}no Service Date specified{{Quantity}}{{UnitOfMeasureViz}}{{ayCurrency Cost}}{{ayCurrency PriceViz}}{{ayCurrency NetCost}}{{Quantity}}{{ayCurrency NetViz}}{{Quantity}}{{ayCurrency NetDiff}}{{Quantity}}
 
{{ayT 'Total'}} for part {{group}}{{ayCurrency GroupPartsNetCost}}{{ayCurrency GroupPartsNetViz}}{{ayCurrency GroupPartsDiff}}
 
\n\n \n \n \n \n \n \n \n \n \n \n \n \n {{#if AllWOPartsNetCost}} {{else}} {{/if}}\n {{#if AllWOPartsNetViz}} {{else}} {{/if}} \n {{#if AllWOPartsDiff}} {{else}} {{/if}}\n \n \n \n
{{ayT 'Total'}} for all {{ayT 'WorkOrderItemParts'}} in this reportAll Net CostAll Net ChargeAll Diff
 {{ ayCurrency AllWOPartsNetCost}}$0.00{{ ayCurrency AllWOPartsNetViz}}$0.00{{ayCurrency AllWOPartsDiff}}$0.00
\n
\n\n","Style":".singlePage\n{\npage-break-after: always;\n\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 14pt; \n color: #9e9e9e;\n text-align: left;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%; \n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n height: 30px;\n font-size: 10pt; \n color: #9e9e9e;\n text-align: center;\n}\n\ntbody td {\n padding: 2px;\n word-wrap: break-word;\n font-size: 9pt;\n text-align: center;\n}\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n font-weight: bold;\n}\n.fontpurple {\n color: purple;\n}\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([\"WorkOrderItemParts\", \"Part\", \"WorkOrderServiceDate\", \"WorkOrderItemPartQuantity\", \"WorkOrder\", \"WorkOrderList\", \"NetValue\", \"PartCost\", \"PartRetail\", \"Total\" ]);\n\n\t//below is the code to group by the part - the PartNameViz\n\tlet ret = [];\n //iterate workorders -> items -> workorder item parts\n reportData.ayReportData.forEach(workorder => {\n workorder.Items.forEach(workorderitem => {\n workorderitem.Parts.forEach(part => {\n //new shape of data required for report\n let record = {\n Serial: workorder.Serial,\n\t\t\t\t\tServiceDate: workorder.ServiceDate,\n\t\t\t\t\tNetViz: part.NetViz,\n\t\t\t\t\tPriceOverride: part.PriceOverride,\n\t\t\t\t\tListPrice: part.ListPrice,\n UnitOfMeasureViz: part.UnitOfMeasureViz,\n PriceViz: part.PriceViz,\n Cost: part.Cost,\n SuggestedQuantity: part.SuggestedQuantity,\n Quantity: part.Quantity,\n PartWarehouseViz: part.PartWarehouseViz,\n UpcViz: part.UpcViz,\n\t\t\t\t\tPartDescriptionViz: part.PartDescriptionViz ?? \"\",\n Serials: part.Serials\n };\n\n //Find or create group and insert this record \n let groupObject = ret.find(z => z.group == part.PartNameViz + \" \" + record.PartDescriptionViz);\n if (groupObject != undefined) {\n //there is already a matching group in the return array so just push this record into it\n groupObject.items.push(record);\n //update the count for this group's items\n groupObject.count++;\n } else {\n //No group yet, so start a new one in the ret array and push this record into it\n ret.push({ group: part.PartNameViz + \" \" + record.PartDescriptionViz, items: [record], count: 1 });\n }\n\n })\n })\n });\n\n //replace the ayReportData with our new shaped format of data\n reportData.ayReportData = ret;\n\n \n//need to now edit below to get running totals of THE DATA returned above - can't reference items as not in the returned data\n\n\n\n\n//********************//NOTE if you customize this report template and do NOT need a function or key identified below, remove to increase report performance\n\n\n//below declares a key on the entire wo to hold all Part Net, costs, profit (nets - costs), from all workorders so it exists and a key to hold all Part Net Costs\nreportData.AllWOPartsNetViz = 0;\nreportData.AllWOPartsNetCost = 0;\nreportData.AllWOPartsDiff = 0;\n\n\nfor (EachGroup of reportData.ayReportData) \n\t{\n\n\n\t//below declares a key on the entire group to hold all Part Net, costs, profit/loss (nets - costs), for this group (this group is a single Part that has one or more wo item parts records)\n\tEachGroup.GroupPartsNetViz = 0;\n\tEachGroup.GroupPartsNetCost = 0;\n\tEachGroup.GroupPartsDiff = 0; \n\t\n\n\t//below is to Iterate through each woitempart record for this part - groupitem is a woitempart record\n\tfor (groupitem of EachGroup.items)\n\t\t{\n\t\t\t\t\t\n\t\t\tgroupitem.ThisItemPartNetViz = 0; //declare a key on the Item to hold all of this item's parts nets and set it initially to 0 \n\t\t\tgroupitem.ThisItemPartNetCost = 0; //declare a key on the Item to hold all of this item's parts costs and set it initially to 0 \n\t\t\tgroupitem.ThisItemPartDiff = 0; //declare a key on the Item to hold all of this item's part profit/loss (nets - costs) and set it initially to 0 \n\t\t\t\n\n\t\t\t//make sure it has a value before attempting to add it to the running total\n \tif (groupitem.Quantity != 0) \n \t \t{\n\t\t\t\t\t\tEachGroup.GroupPartsNetViz += groupitem.NetViz;\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\treportData.AllWOPartsNetViz += groupitem.NetViz;\t\n\n\n\t\t\t\t\t\tgroupitem.NetCost = (groupitem.Cost * groupitem.Quantity);\t\t\t\t\t\t\n\t\t\t\t\t\tEachGroup.GroupPartsNetCost += groupitem.NetCost;\n\t\t\t\t\t\treportData.AllWOPartsNetCost += groupitem.NetCost;\n\n\n\t\t\t\t\t\tif (groupitem.NetViz != 0) \n\t\t\t\t\t\t{\n\t\t\t\t\t\tgroupitem.NetDiff = (groupitem.NetViz - groupitem.NetCost)\n\t\t\t\t\t\tEachGroup.GroupPartsDiff += groupitem.NetDiff; //\n\t\t\t\t\t\treportData.AllWOPartsDiff += groupitem.NetDiff; //\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\n\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\t\t\t\n\n\t\t\t\n\t\t}\n\n }\n\n return reportData; \n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"20mm","MarginOptionsRight":"20mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/PRODUCTION Quote Parts Summary.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/PRODUCTION Quote Parts Summary.ayrt index 236d666c..5cf570b6 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/PRODUCTION Quote Parts Summary.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/PRODUCTION Quote Parts Summary.ayrt @@ -1 +1 @@ -{"Name":" Quote Parts Summary","Active":true,"Notes":"Custom Prepare to obtain translations, group by the woitempart, derived amounts and running totals","Roles":49258,"AType":27,"IncludeWoItemDescendants":false,"Template":"\n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{#each ayReportData}}\n \n \n \n {{#each items}}\n \n \n \n {{#if Requested }}{{else}} {{/if}}\n \n \n \n \n \n {{#if NetCost }} {{else}}{{/if}}\n {{#if NetViz }} {{else}}{{/if}}\n {{#if NetDiff }} {{else}}{{/if}} \n \n {{/each}}\n \n \n \n \n \n \n \n \n \n \n \n \n {{/each}}\n \n
{{ayT 'Quote'}} {{ayT 'WorkOrderItemParts'}} {{ayT 'PartCost'}} {{ayT 'NetValue'}}
 
 
{{ayT 'Part'}}{{ayT 'Quote'}}{{ayT 'QuoteQuoteRequestDate'}}{{ayT 'WorkOrderItemPartQuantity'}}{{ayT 'PartCost'}} Per{{ayT 'PartRetail'}} Per {{ayT 'PartCost'}} {{ayT 'NetValue'}}{{ayT 'PartRetail'}} {{ayT 'NetValue'}}Difference
{{group}}
 {{Serial}}{{ayDate Requested}}no date specified{{Quantity}}{{UnitOfMeasureViz}}{{ayCurrency Cost}}{{ayCurrency PriceViz}} {{ayCurrency NetCost}}{{Quantity}}{{ayCurrency NetViz}}{{Quantity}}{{ayCurrency NetDiff}}{{Quantity}}
 
{{ayT 'Total'}} for part {{group}}{{ayCurrency GroupPartsNetCost}}{{ayCurrency GroupPartsNetViz}}{{ayCurrency GroupPartsDiff}}
 
\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{#if AllWOPartsNetCost}} {{else}} {{/if}}\n {{#if AllWOPartsNetViz}} {{else}} {{/if}} \n {{#if AllWOPartsDiff}} {{else}} {{/if}}\n \n \n \n
 
{{ayT 'Total'}} for all {{ayT 'WorkOrderItemParts'}} in this reportAll Net CostAll Net ChargeAll Diff
 {{ ayCurrency AllWOPartsNetCost}}$0.00{{ ayCurrency AllWOPartsNetViz}}$0.00{{ayCurrency AllWOPartsDiff}}$0.00
\n\n","Style":".singlePage\n{\npage-break-after: always;\n\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 14pt; \n color: #9e9e9e;\n text-align: left;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%; \n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n height: 20px;\n font-size: 10pt; \n color: #9e9e9e;\n text-align: center;\n}\n\ntbody td {\n padding: 2px;\n word-wrap: break-word;\n font-size: 9pt;\n text-align: center;\n}\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n font-weight: bold;\n}\n.fontpurple {\n color: purple;\n}\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([\"WorkOrderItemParts\", \"Part\", \"QuoteQuoteRequestDate\", \"WorkOrderItemPartQuantity\", \"Quote\", \"NetValue\", \"PartCost\", \"PartRetail\", \"Total\" ]);\n\n\t//below is the code to group by the part - the PartNameViz\n\tlet ret = [];\n //iterate quotes -> items -> quote item parts\n reportData.ayReportData.forEach(quote => {\n quote.Items.forEach(quoteitem => {\n quoteitem.Parts.forEach(part => {\n //new shape of data required for report \n let record = {\n Serial: quote.Serial,\n\t\t\t\t\tRequested: quote.Requested,\n\t\t\t\t\tNetViz: part.NetViz,\n\t\t\t\t\tPriceOverride: part.PriceOverride,\n\t\t\t\t\tListPrice: part.ListPrice,\n UnitOfMeasureViz: part.UnitOfMeasureViz,\n PriceViz: part.PriceViz,\n Cost: part.Cost,\n SuggestedQuantity: part.SuggestedQuantity,\n Quantity: part.Quantity,\n PartWarehouseViz: part.PartWarehouseViz,\n UpcViz: part.UpcViz,\n Serials: part.Serials,\n PartDescriptionViz: part.PartDescriptionViz ?? \"\",\n };\n\n //Find or create group and insert this record \n let groupObject = ret.find(z => z.group == (part.PartNameViz + \" \" + record.PartDescriptionViz) );\n if (groupObject != undefined) {\n //there is already a matching group in the return array so just push this record into it\n groupObject.items.push(record);\n //update the count for this group's items\n groupObject.count++;\n } else {\n //No group yet, so start a new one in the ret array and push this record into it\n ret.push({ group: (part.PartNameViz + \" \" + record.PartDescriptionViz), items: [record], count: 1 });\n \n }\n\n })\n })\n });\n\n //replace the ayReportData with our new shaped format of data\n reportData.ayReportData = ret;\n\n \n//need to now edit below to get running totals of THE DATA returned above - can't reference items as not in the returned data\n\n\n\n\n//********************//NOTE if you customize this report template and do NOT need a function or key identified below, remove to increase report performance\n\n\n//below declares a key on the entire wo to hold all Part Net, costs, profit (nets - costs), from all quotes so it exists and a key to hold all Part Net Costs\nreportData.AllWOPartsNetViz = 0;\nreportData.AllWOPartsNetCost = 0;\nreportData.AllWOPartsDiff = 0;\n\n\nfor (EachGroup of reportData.ayReportData) \n\t{\n\n\n\t//below declares a key on the entire group to hold all Part Net, costs, profit/loss (nets - costs), for this group (this group is a single Part that has one or more wo item parts records)\n\tEachGroup.GroupPartsNetViz = 0;\n\tEachGroup.GroupPartsNetCost = 0;\n\tEachGroup.GroupPartsDiff = 0; \n\t\n\n\t//below is to Iterate through each woitempart record for this part - groupitem is a woitempart record\n\tfor (groupitem of EachGroup.items)\n\t\t{\n\t\t\t\t\t\n\t\t\tgroupitem.ThisItemPartNetViz = 0; //declare a key on the Item to hold all of this item's parts nets and set it initially to 0 \n\t\t\tgroupitem.ThisItemPartNetCost = 0; //declare a key on the Item to hold all of this item's parts costs and set it initially to 0 \n\t\t\tgroupitem.ThisItemPartDiff = 0; //declare a key on the Item to hold all of this item's part profit/loss (nets - costs) and set it initially to 0 \n\t\t\t\n\n\t\t\t//make sure it has a value before attempting to add it to the running total\n \tif (groupitem.Quantity != 0) \n \t \t{\n\t\t\t\t\t\tEachGroup.GroupPartsNetViz += groupitem.NetViz;\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\treportData.AllWOPartsNetViz += groupitem.NetViz;\t\n\n\n\t\t\t\t\t\tgroupitem.NetCost = (groupitem.Cost * groupitem.Quantity);\t\t\t\t\t\t\n\t\t\t\t\t\tEachGroup.GroupPartsNetCost += groupitem.NetCost;\n\t\t\t\t\t\treportData.AllWOPartsNetCost += groupitem.NetCost;\n\n\n\t\t\t\t\t\tif (groupitem.NetViz != 0) \n\t\t\t\t\t\t{\n\t\t\t\t\t\tgroupitem.NetDiff = (groupitem.NetViz - groupitem.NetCost)\n\t\t\t\t\t\tEachGroup.GroupPartsDiff += groupitem.NetDiff; //\n\t\t\t\t\t\treportData.AllWOPartsDiff += groupitem.NetDiff; //\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\n\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\t\t\t\n\n\t\t\t\n\t\t}\n\n }\n\n return reportData; \n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"20mm","MarginOptionsRight":"20mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"Quote Parts Summary","Active":true,"Notes":"Custom Prepare to obtain translations, group by the woitempart, derived amounts and running totals","Roles":49258,"AType":27,"IncludeWoItemDescendants":false,"Template":"\n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{#each ayReportData}}\n \n \n \n {{#each items}}\n \n \n \n {{#if Requested }}{{else}} {{/if}}\n \n \n \n \n \n {{#if NetCost }} {{else}}{{/if}}\n {{#if NetViz }} {{else}}{{/if}}\n {{#if NetDiff }} {{else}}{{/if}} \n \n {{/each}}\n \n \n \n \n \n \n \n \n \n \n \n \n {{/each}}\n \n
{{ayT 'Quote'}} {{ayT 'WorkOrderItemParts'}} {{ayT 'PartCost'}} {{ayT 'NetValue'}}
 
 
{{ayT 'Part'}}{{ayT 'Quote'}}{{ayT 'QuoteQuoteRequestDate'}}{{ayT 'WorkOrderItemPartQuantity'}}{{ayT 'PartCost'}} Per{{ayT 'PartRetail'}} Per {{ayT 'PartCost'}} {{ayT 'NetValue'}}{{ayT 'PartRetail'}} {{ayT 'NetValue'}}Difference
{{group}}
 {{Serial}}{{ayDate Requested}}no date specified{{Quantity}}{{UnitOfMeasureViz}}{{ayCurrency Cost}}{{ayCurrency PriceViz}} {{ayCurrency NetCost}}{{Quantity}}{{ayCurrency NetViz}}{{Quantity}}{{ayCurrency NetDiff}}{{Quantity}}
 
{{ayT 'Total'}} for part {{group}}{{ayCurrency GroupPartsNetCost}}{{ayCurrency GroupPartsNetViz}}{{ayCurrency GroupPartsDiff}}
 
\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {{#if AllWOPartsNetCost}} {{else}} {{/if}}\n {{#if AllWOPartsNetViz}} {{else}} {{/if}} \n {{#if AllWOPartsDiff}} {{else}} {{/if}}\n \n \n \n
 
{{ayT 'Total'}} for all {{ayT 'WorkOrderItemParts'}} in this reportAll Net CostAll Net ChargeAll Diff
 {{ ayCurrency AllWOPartsNetCost}}$0.00{{ ayCurrency AllWOPartsNetViz}}$0.00{{ayCurrency AllWOPartsDiff}}$0.00
\n\n","Style":".singlePage\n{\npage-break-after: always;\n\n}\nbody {\n font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif; \n}\n\n.reporttitle { \n margin-bottom: 20pt; \n font-weight: bold; \n font-size: 14pt; \n color: #9e9e9e;\n text-align: left;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%; \n table-layout: fixed; /* the # of columns set in the first row of the thead will be fixed and applied throughout table and rows */\n }\n\nth {\n height: 20px;\n font-size: 10pt; \n color: #9e9e9e;\n text-align: center;\n}\n\ntbody td {\n padding: 2px;\n word-wrap: break-word;\n font-size: 9pt;\n text-align: center;\n}\n\ntbody tr:nth-child(even) {\n background-color: #f8f8f8; /* MUST checkmark Print background in PDF Options for this to show */\n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n font-weight: bold;\n}\n.fontpurple {\n color: purple;\n}\n","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n\n\tawait ayGetTranslations([\"WorkOrderItemParts\", \"Part\", \"QuoteQuoteRequestDate\", \"WorkOrderItemPartQuantity\", \"Quote\", \"NetValue\", \"PartCost\", \"PartRetail\", \"Total\" ]);\n\n\t//below is the code to group by the part - the PartNameViz\n\tlet ret = [];\n //iterate quotes -> items -> quote item parts\n reportData.ayReportData.forEach(quote => {\n quote.Items.forEach(quoteitem => {\n quoteitem.Parts.forEach(part => {\n //new shape of data required for report \n let record = {\n Serial: quote.Serial,\n\t\t\t\t\tRequested: quote.Requested,\n\t\t\t\t\tNetViz: part.NetViz,\n\t\t\t\t\tPriceOverride: part.PriceOverride,\n\t\t\t\t\tListPrice: part.ListPrice,\n UnitOfMeasureViz: part.UnitOfMeasureViz,\n PriceViz: part.PriceViz,\n Cost: part.Cost,\n SuggestedQuantity: part.SuggestedQuantity,\n Quantity: part.Quantity,\n PartWarehouseViz: part.PartWarehouseViz,\n UpcViz: part.UpcViz,\n Serials: part.Serials,\n PartDescriptionViz: part.PartDescriptionViz ?? \"\",\n };\n\n //Find or create group and insert this record \n let groupObject = ret.find(z => z.group == (part.PartNameViz + \" \" + record.PartDescriptionViz) );\n if (groupObject != undefined) {\n //there is already a matching group in the return array so just push this record into it\n groupObject.items.push(record);\n //update the count for this group's items\n groupObject.count++;\n } else {\n //No group yet, so start a new one in the ret array and push this record into it\n ret.push({ group: (part.PartNameViz + \" \" + record.PartDescriptionViz), items: [record], count: 1 });\n \n }\n\n })\n })\n });\n\n //replace the ayReportData with our new shaped format of data\n reportData.ayReportData = ret;\n\n \n//need to now edit below to get running totals of THE DATA returned above - can't reference items as not in the returned data\n\n\n\n\n//********************//NOTE if you customize this report template and do NOT need a function or key identified below, remove to increase report performance\n\n\n//below declares a key on the entire wo to hold all Part Net, costs, profit (nets - costs), from all quotes so it exists and a key to hold all Part Net Costs\nreportData.AllWOPartsNetViz = 0;\nreportData.AllWOPartsNetCost = 0;\nreportData.AllWOPartsDiff = 0;\n\n\nfor (EachGroup of reportData.ayReportData) \n\t{\n\n\n\t//below declares a key on the entire group to hold all Part Net, costs, profit/loss (nets - costs), for this group (this group is a single Part that has one or more wo item parts records)\n\tEachGroup.GroupPartsNetViz = 0;\n\tEachGroup.GroupPartsNetCost = 0;\n\tEachGroup.GroupPartsDiff = 0; \n\t\n\n\t//below is to Iterate through each woitempart record for this part - groupitem is a woitempart record\n\tfor (groupitem of EachGroup.items)\n\t\t{\n\t\t\t\t\t\n\t\t\tgroupitem.ThisItemPartNetViz = 0; //declare a key on the Item to hold all of this item's parts nets and set it initially to 0 \n\t\t\tgroupitem.ThisItemPartNetCost = 0; //declare a key on the Item to hold all of this item's parts costs and set it initially to 0 \n\t\t\tgroupitem.ThisItemPartDiff = 0; //declare a key on the Item to hold all of this item's part profit/loss (nets - costs) and set it initially to 0 \n\t\t\t\n\n\t\t\t//make sure it has a value before attempting to add it to the running total\n \tif (groupitem.Quantity != 0) \n \t \t{\n\t\t\t\t\t\tEachGroup.GroupPartsNetViz += groupitem.NetViz;\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\treportData.AllWOPartsNetViz += groupitem.NetViz;\t\n\n\n\t\t\t\t\t\tgroupitem.NetCost = (groupitem.Cost * groupitem.Quantity);\t\t\t\t\t\t\n\t\t\t\t\t\tEachGroup.GroupPartsNetCost += groupitem.NetCost;\n\t\t\t\t\t\treportData.AllWOPartsNetCost += groupitem.NetCost;\n\n\n\t\t\t\t\t\tif (groupitem.NetViz != 0) \n\t\t\t\t\t\t{\n\t\t\t\t\t\tgroupitem.NetDiff = (groupitem.NetViz - groupitem.NetCost)\n\t\t\t\t\t\tEachGroup.GroupPartsDiff += groupitem.NetDiff; //\n\t\t\t\t\t\treportData.AllWOPartsDiff += groupitem.NetDiff; //\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\n\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\t\t\t\n\n\t\t\t\n\t\t}\n\n }\n\n return reportData; \n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":"  ","FooterTemplate":"                Printed date: PDFDate\nPage of                ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"20mm","MarginOptionsRight":"20mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/util/ReportProcessManager.cs b/server/AyaNova/util/ReportProcessManager.cs index 9b65aff6..7a78d10d 100644 --- a/server/AyaNova/util/ReportProcessManager.cs +++ b/server/AyaNova/util/ReportProcessManager.cs @@ -17,19 +17,24 @@ namespace AyaNova.Util internal static class ReportRenderManager { /* - expired processes are removed by the act of tryign to get a new slot so in this way it still supports running super long reports overnight for example as long as there is no contention + expired processes are removed by the act of trying to get a new slot so in this way it still supports running super long reports overnight for example as long as there is no contention The other way was by a job that looks for expired processes but that would mean all old jobs would expire all the time so there would be an issue with huge reports never working */ - //thread safe collection for unordered items, optimized for single thread produce/consume (which is the norm here) but supports multithread produce / consume (which is needed for separate cleanup job) - private static ConcurrentBag _baginstances = new ConcurrentBag(); + internal static ConcurrentBag _baginstances;// = new ConcurrentBag(); - public class ReportRenderInstanceInfo + + static ReportRenderManager() { - public int ReporterProcessId { get; set; } - public DateTime Expires { get; set; } + _baginstances = new ConcurrentBag(); + } - public ReportRenderInstanceInfo(int processId) + internal class ReportRenderInstanceInfo + { + internal int ReporterProcessId { get; set; } + internal DateTime Expires { get; set; } + + internal ReportRenderInstanceInfo(int processId) { ReporterProcessId = processId; Expires = DateTime.UtcNow.AddMilliseconds(ServerBootConfig.AYANOVA_REPORT_RENDERING_TIMEOUT); @@ -37,16 +42,16 @@ namespace AyaNova.Util } - public static bool RenderSlotAvailable(ILogger log) + internal static bool RenderSlotAvailable(ILogger log) { log.LogTrace("RenderSlotAvailable check"); - var count = _baginstances.Count; -// #if (DEBUG) -// log.LogInformation($"DBG: RenderSlotAvailable check, there are currently {count} instances in the bag"); -// #endif - if (count >= ServerBootConfig.AYANOVA_REPORT_RENDERING_MAX_INSTANCES) + //var count = _baginstances.Count; +#if (DEBUG) + log.LogInformation($"DBG: RenderSlotAvailable check, there are currently {_baginstances.Count} instances in the bag"); +#endif + if (_baginstances.Count >= ServerBootConfig.AYANOVA_REPORT_RENDERING_MAX_INSTANCES) { - log.LogTrace($"RenderSlotAvailable there are no free report rendering slots available, current count is {count}, checking for expired slots to force closed"); + log.LogTrace($"RenderSlotAvailable there are no free report rendering slots available, current count is {_baginstances.Count}, checking for expired slots to force closed"); //check for expired and remove var Instances = _baginstances.ToArray(); var dtNow = DateTime.UtcNow; @@ -54,9 +59,9 @@ namespace AyaNova.Util { if (i.Expires < dtNow) { -// #if (DEBUG) -// log.LogInformation($"DBG: RenderSlotAvailable attempting kill of expired process {i.ReporterProcessId}"); -// #endif +#if (DEBUG) + log.LogInformation($"DBG: RenderSlotAvailable attempting kill of expired process {i.ReporterProcessId}"); +#endif ForceCloseProcess(i, log); } } @@ -65,7 +70,7 @@ namespace AyaNova.Util return _baginstances.Count < ServerBootConfig.AYANOVA_REPORT_RENDERING_MAX_INSTANCES; } - private static bool ForceCloseProcess(ReportRenderInstanceInfo instance, ILogger log) + internal static bool ForceCloseProcess(ReportRenderInstanceInfo instance, ILogger log) { log.LogTrace($"ForceCloseProcess on instance id {instance.ReporterProcessId} started {instance.Expires.ToString()} utc"); try @@ -97,16 +102,26 @@ namespace AyaNova.Util //The process specified by the processId parameter is not running. The identifier might be expired. _baginstances.TryTake(out instance); return true; - } + } } - internal static void AddProcess(int processId) + internal static void AddProcess(int processId, ILogger log) { +#if (DEBUG) + log.LogInformation($"DBG: RenderSlotAvailable::AddProcess {processId} in the bag"); +#endif _baginstances.Add(new ReportRenderInstanceInfo(processId)); + + #if (DEBUG) + log.LogInformation($"DBG: RenderSlotAvailable::AddProcess, there are currently {_baginstances.Count} instances in the bag"); +#endif } internal static void RemoveProcess(int processId, ILogger log) { +#if (DEBUG) + log.LogInformation($"DBG: RenderSlotAvailable::RemoveProcess {processId} from the bag"); +#endif foreach (var i in _baginstances) { if (i.ReporterProcessId == processId)