1 line
5.8 KiB
Plaintext
1 line
5.8 KiB
Plaintext
{"Name":"Sample Units with API method to get additional customer data","Active":true,"Notes":"Shows example of using Prepare to obtain additional data via the CustomerId\nNOTE: NEEDS UPDATING presently using 135 alpha key for Last WO and Last Service Date","Roles":124927,"AType":31,"IncludeWoItemDescendants":false,"Template":"<html>\n <body>\n\t<div >\t\n <table>\n <thead>\n\t\t\t\t<tr>\n\t\t\t\t<td colspan=\"24\"> </td>\n\t\t\t\t</tr>\n <tr>\n\t\t\t\t<td rowspan=\"2\" colspan=\"12\" class=\"leftlean\">{{ ayLogo \"small\" }}</td>\n <td colspan=\"12\" class=\"rightlean\"> </td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t<td colspan=\"12\" class=\"rightlean\">Report using API method to obtain additional data about Customer</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class=\"bodyhead\" >\n\t\t\t\t\t<td colspan=\"2\">Serial</td>\n <td colspan=\"4\">Unit Model</td>\n\t\t\t\t\t<td colspan=\"4\">Customer</td>\n\t\t\t\t\t<td colspan=\"2\">Last WO</td>\t\t\t\t\t\n\t\t\t\t\t<td colspan=\"4\">Last Service Date</td>\n\t\t\t\t\t<td colspan=\"2\">Customer Phone via API</td>\n\t\t\t\t\t<td colspan=\"6\">Unit Notes</td>\n\t\t\t\t </tr>\n \t\t</thead>\n\t\t\t <tbody>\n\t\t\t\t {{#each ayReportData}} \n <tr>\n\t\t\t\t\t<td colspan=\"2\">{{Serial}}</td>\n <td colspan=\"4\">{{UnitModelNameViz}}</td>\n\t\t\t\t\t<td colspan=\"4\">{{CustomerViz}}</td>\n\t\t\t\t\t<td colspan=\"2\">{{LastWorkOrderViz}}</td>\t\t\t\t\t\n\t\t\t\t\t<td colspan=\"4\">{{ayDate LastServiceDateViz}}</td>\n\t\t\t\t\t<td colspan=\"2\">{{myCustomerInfo.phone1}}</td>\n\t\t\t\t\t<td colspan=\"6\">{{Notes}}</td>\n\t\t\t\t </tr>\n\t\t\t\t {{/each}}\n\t\t\t </tbody>\n </table>\n\n <table>\n {{#each ayReportData}}\n <tbody>\n <tr>\n <td colspan=\"24\">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</td>\n </tr>\n <tr>\n\t\t\t <td colspan=\"24\" class=\"leftlean\">{{ayJSON this}}</td>\n </tr>\n </tbody>\n {{/each}}\n </table>\n\n </div>\n</body>\n</html>","Style":".singlePage\r\n{\r\npage-break-after: always;\r\n}\r\n\r\ntable { \r\n font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;\r\n border-collapse: collapse;\r\n white-space: pre-wrap;\r\n width: 100%;\r\n table-layout: fixed;\r\n }\r\n\r\nthead {\r\n display: table-header-group; /* so as to print the table-header on all subsequent pages */\r\n}\r\n\r\n.heading {\r\n border-style: solid;\r\n border-width: 1pt;\r\n border-color: #e8e5e5; \r\n margin: 10pt;\r\n background-color: #e8e5e5;\r\n padding: 5pt; \r\n font-size: 14pt; \r\n text-align: center;\r\n} \r\n\r\n.bodyhead {\r\n border-style: solid;\r\n border-width: 1pt;\r\n border-color: #e8e5e5; \r\n margin: 10pt;\r\n background-color: #e8e5e5;\r\n font-size: 12pt; \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\ntbody tr:nth-child(even) {\r\n font-size: 9pt;\r\n background-color: lightgray; /* MUST checkmark Print background in PDF Options for this to show */\r\n height: 50px;\r\n overflow-wrap: break-word;\r\n} \r\ntbody tr:nth-child(odd) {\r\n font-size: 9pt;\r\n background-color: lightgoldenrodyellow; /* MUST checkmark Print background in PDF Options for this to show */\r\n height: 50px;\r\n overflow-wrap: break-word;\r\n} \r\n\r\n\r\ntfoot {\r\n /* display: table-footer-group; uncomment to print the table-footer on all pages, not just last page - */\r\n page-break-inside: avoid;\r\n /* position: fixed; uncommenting position: will force footer to bottom BUT then leftlean and rightlean don't work AND tbody overwrites */\r\n \r\n bottom: 0;\r\n width: 100%;\r\n border-top: 1px solid black; \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","JsPrerender":"async function ayPrepareData(ayData) {\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":"<span style=\"font-size:6pt;width: 94%; text-align:left; \"> (set in report template's PDF Options) Printed date: <span class=\"date\"></span></span>","FooterTemplate":"<span style=\"font-size:6pt;width: 96%; text-align: right; \"> (set in report template's PDF Options showing x of ALL pages printed) Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\">","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"10mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} |