{"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":50538,"AType":8,"IncludeWoItemDescendants":false,"Template":"<html>\n\n<body>\n\t<div>\n\t\t<div class=\"reporttitle\">\n\t\t\t<p>Custom Prepare to remove carriage returns in {{ayT 'CustomerNotes'}}</p>\n\t\t</div>\n\t\t<table>\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th colspan=\"7\" class=\"leftlean\">{{ayT 'Customer'}}</th>\n\t\t\t\t\t<th colspan=\"1\">&nbsp;</th>\n\t\t\t\t\t<th colspan=\"7\">{{ayT 'CustomerNotes'}}</th>\n\t\t\t\t\t<th colspan=\"1\">&nbsp;</th>\n\t\t\t\t\t<th colspan=\"8\">Carriage returns removed in {{ayT 'CustomerNotes'}}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\n\t\t\t<tbody>\n\t\t\t\t{{#each ayReportData}}\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=\"7\">{{Name}}</td>\n\t\t\t\t\t<td colspan=\"1\">&nbsp;</td>\n\t\t\t\t\t<td colspan=\"7\">{{Notes}}</td>\n\t\t\t\t\t<td colspan=\"1\">&nbsp;</td>\n\t\t\t\t\t<td colspan=\"8\">{{NotesNoCarriage}}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=\"24\">&nbsp;</td>\n\t\t\t\t</tr>\n\t\t\t\t{{/each}}\n\t\t\t</tbody>\n\t\t</table>\n\n\t\t<table><!-- remove or comment this out if no need to see printout of data returned from the custom Prepare -->\n            {{#each ayReportData}}\n          <tbody>\n\t\t\t  \t<tr>\n\t\t\t\t\t<td colspan=\"24\">&nbsp;</td>\n\t\t\t\t</tr>\n                <tr>\n                  <td colspan=\"24\">This is a printout of the data returned from the Custom Prepare that this report now uses, each \"group\" is an object instead of data from the \"Sample Data\".</td>\n                </tr>\n                <tr>\n\t\t\t        <td colspan=\"24\">{{ayJSON this}}</td>\n                </tr>\n          </tbody>\n          {{/each}}\n        </table>\n\t</div>\n</body>\n</html>","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; \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 (const EachCU of ayData.ayReportData) {\n        if (EachCU.Notes != null) {\n            const n = EachCU.Notes;\n            EachCU.NotesNoCarriage = n.replace(/[\\n\\r]+/g, '  ');\n        }\n    }\n\n    return ayData;\n}","JsHelpers":"","RenderType":0,"HeaderTemplate":"<span style=\"font-size:6pt; width: 96%;text-align:left; \">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; 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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;</span>","FooterTemplate":"<span>&nbsp; </span>","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"20mm","MarginOptionsLeft":"15mm","MarginOptionsRight":"15mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000}