1 line
4.9 KiB
Plaintext
1 line
4.9 KiB
Plaintext
{"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":"<html>\n<body>\n\t\n\t<table>\n \n <thead>\n <tr>\n <th>{{ayT 'PurchaseOrderPONumber'}}</th>\n <th>{{ayT 'Part'}}</th>\n <th>{{ayT 'PurchaseOrderItemQuantityOrdered'}}</th>\n <th>{{ayT 'PurchaseOrderItemQuantityReceived'}}</th>\n <th>{{ayT 'PurchaseOrderItemSerialNumbers'}}</th>\n </tr>\n </thead>\n {{#each ayReportData}}\n <tbody> \n {{#each Items}} \n <tr> <!--note the additional Helper created #if_eq with which to do a direct comparison -->\n <td>{{../Serial}}</td> <!-- reference the 'parent' scope by placing ../ in front of the property name -->\n <td>{{PartNameViz}} </td> <!-- whereas this is within 'Items' so no prefix of ../ -->\n <td>{{QuantityOrdered}}</td>\n\n <!-- if_eq else statements below basically does: if received equals ordered display in green, if not equal, displays in red -->\n {{#if_eq QuantityOrdered QuantityReceived}}<td class=\"fontgreen\">{{QuantityReceived}} (same as quantity ordered)</td> {{else}}<td class=\"fontred\">{{QuantityReceived}} (not the same as ordered)</td>{{/if_eq}}\n\t\t\t\t\t\n <!-- if else statements below basically does: if poitem has any serial numbers display, else if no serial display that preset text in red -->\n {{#if Serials}}<td>{{Serials}}</td>{{else}}<td class=\"fontblue\">no serials documented</td>{{/if}}\n </tr>\n {{/each}}\n <tr>\n <td colspan=\"5\"> </td><!-- this causes an empty row to be displayed after every PO -->\n </tr>\n </tbody>\n {{/each}}\n </table>\n\t\n</body>\n</html>","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":"<span style=\"font-size:6pt; width: 96%;text-align:left; \"> Printed date: PDFDate</span>\n<span style=\"font-size:6pt;width: 96%; text-align: right; \">Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\"></span> </span>","FooterTemplate":"<span> </span>","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} |