1 line
16 KiB
Plaintext
1 line
16 KiB
Plaintext
{"Name":"109x EXAMPLE PO using #if, #unless and custom #if_eq","Active":true,"Notes":"HTML handlebars #unless example (i.e. #unless is \"if not\" - as in if not true do this. no 'else' aspect) , #if example that checks for truthiness - if false, undefined, null, \"\", 0, or [], Handlebars will not render the block","Roles":124927,"AType":26,"IncludeWoItemDescendants":false,"Template":"<html>\n<body>\n\t<div >\t\n {{#each ayReportData}}\t <!-- the #each aspect MUST encompass the section where the class is that forces page break -->\n\t\t<table class=\"singlePage\" > \t<!-- the css to start a new page when a new object -->\n \t\t<thead> <!--table header will repeat on multiple pages if total thead content is less than 25% of page - IF NOT SHOWING ON 2nd PAGE of PO, is because is too high - note css -->\n <tr>\n <td colspan=\"3\" class=\"centerlean heading\">{{ ayLogo \"small\" }}</td> \n <td colspan=\"2\" class=\"rightlean heading\">Our Internal PO#:</td>\n <td colspan=\"2\" class=\"leftlean heading fontgreen\">{{Serial}}</td>\n <td colspan=\"3\" class=\"rightlean heading\">Addt'l Ref #:</td>\n <td colspan=\"2\" class=\"rightlean heading fontgreen\"> {{ReferenceNumber}}</td>\n </tr>\n <tr> \n <td colspan=\"7\" class=\"fontgreen\" >data from ayReportData shows in greenfont </td>\n <td colspan=\"3\" class=\"rightlean\">Ordered Date:</td> \n <td colspan=\"2\" class=\"rightlean fontgreen\"> {{ayDate OrderedDate}}</td> \n </tr>\n <tr>\n <td colspan=\"7\" class=\"fontblue\" >data derived from Prepare shows in bluefont</td>\n <td colspan=\"3\" class=\"rightlean\">ETA Date: {{ayDate ExpectedReceiveDate}}</td> \n <td colspan=\"2\" class=\"rightlean fontgreen\">{{ayDate ExpectedReceiveDate}}</td> \n </tr>\n <tr> \n <td colspan=\"7\" class=\"fontred\" >data derived from Helper shows in redfont</td>\n <td colspan=\"3\" class=\"rightlean\">Todays date from Helper:</td> \n <td colspan=\"2\" class=\"rightlean fontred\"> {{todaysMonthDDYYYYDate}}</td> \n </tr>\n <tr> \n <td colspan=\"5\" class=\"heading\">VENDOR:</td>\n <td colspan=\"2\" class=\"centerlean heading\"></td>\n <td colspan=\"5\" class=\"rightlean heading\">DELIVER TO:</td>\n </tr>\n <tr>\n <td colspan=\"5\" class=\"fontgreen\" >{{VendorViz}}</td> \n <td colspan=\"2\" class=\"centerlean\"></td> \n {{#if DropShipToCustomerViz}}<td colspan=\"5\" class=\"rightlean fontgreen\">{{DropShipToCustomerViz}}</td>{{else}} <td colspan=\"5\" class=\"rightlean\">My Company Name</td>{{/if}}\n <!-- above if else checks to see if DropShipToCustomerViz is \"true\" (has value). If has a value, shows value. Else (as is null or empty) shows static My Company Name -->\n </tr> \n <tr>\n <td colspan=\"5\" >unsure where to get vendor contact information</td> <!-- unsure where to get this from? --> \n <td colspan=\"2\" class=\"centerlean\"></td> \n {{#if DropShipToCustomerViz}}<td colspan=\"5\"class=\"rightlean fontgreen\" >customer contact data unknown how to get</td>{{else}} <td colspan=\"5\"class=\"rightlean\" >123 - 123 MyStreetname Ave My City, My State, My Postal</td>{{/if}} \n <!-- above if else checks to see if DropShipToCustomerViz is \"true\" (has value). If has a value, shows value. Else (as is null or empty) shows static My Company Name - at this time unsure where to get customer's address etc from. -->\n </tr>\n\n <tr>\n <td colspan=\"5\" >vendor contact not part of dataset</td>\n <td colspan=\"2\" class=\"centerlean\"></td>\n {{#if DropShipToCustomerViz}}<td colspan=\"5\" class=\"rightlean fontgreen\">customer contact data unknown how to get</td>{{else}} <td colspan=\"5\" class=\"rightlean\">Ordered By: creator Phone: creatorphone</td>{{/if}}\n </tr>\n\n <tr>\n <td colspan=\"12\"> </td>\n </tr>\n \n <tr > \n <td colspan=\"2\" class=\"leftlean heading\" >Part # & Name:</td>\n <td colspan=\"4\" class=\"centerlean heading\" >Serials Received:</td>\n <td colspan=\"1\" class=\"centerlean heading\" >Qty</td> \n <td colspan=\"1\" class=\"centerlean heading\" >Price Per:</td>\n <td colspan=\"1\" class=\"centerlean heading\" >Net:</td>\n <td colspan=\"1\" class=\"centerlean heading\" >Tax A:</td>\n <td colspan=\"1\" class=\"centerlean heading\" >Tax B:</td>\n <td class=\"rightlean heading\" colspan=\"1\" >Line Total:</td> \n </tr> \n </thead>\n \n \t\t<tbody >\n\t\t\t\t{{#each Items}} <!-- place the # each within the tbody before the tr - basically, for each row display the following -->\n\t\t\t\t<tr>\t\t\t\t\n\t\t\t\t <td colspan=\"2\" class=\"fontgreen\" > {{PartViz}} {{PartNameViz}}</td>\n <!-- #unless is \"if not\" - as in if not true do this. no 'else' aspect -->\n {{#unless Serials}}<td colspan=\"4\" class=\"fontgreen fontsmall\" >no serials listed</td>{{else}}<td colspan=\"4\" class=\"fontblue fontsmall\" >{{Serials}}</td> {{/unless}}\n \t\t\n <!--note the additional Helper that made #if_eq to do a direct comparison -->\n {{#if_eq QuantityOrdered \"5\"}}<td colspan=\"1\" class=\"centerlean fontblue\" >LOTS</td>{{else}}<td colspan=\"1\" class=\"centerlean fontgreen\" >{{QuantityOrdered}}</td>{{/if_eq}}\n \n \t\t<td colspan=\"1\" class=\"centerlean fontgreen\" >{{ayCurrency PurchaseOrderCost}}</td>\n \t\t<td colspan=\"1\" class=\"centerlean fontgreen\" >{{ayCurrency NetTotalViz}}</td>\n <!--The if helper only checks the truthiness – does NOT provide comparisons - If its argument returns false, undefined, null, \"\", 0, or [], Handlebars will not render the block-->\n \t\t{{#if TaxAViz}}<td colspan=\"1\" class=\"centerlean fontgreen\" >{{ayCurrency TaxAViz}}</td>{{else}} <td colspan=\"1\" class=\"centerlean fontgreen\" >0.00</td>{{/if}}\n \t\t{{#if TaxBViz}}<td colspan=\"1\" class=\"centerlean fontgreen\" >{{ayCurrency TaxBViz}}</td>{{else}} <td colspan=\"1\" class=\"centerlean fontgreen\" >0.00</td>{{/if}}\n \t\t<td colspan=\"1\" class=\"rightlean fontgreen\">{{ayCurrency LineTotalViz}}</td> \t\t\n\t\t\t\t</tr>\n\t\t\t \t{{/each}}\n\t\t\t</tbody>\n \n <tfoot> <!--to have footer ONLY display on last page, place within its own table. otherwise have tfoot part of existing table. note css to have repeating footer -->\n \n <tr>\n\t\t\t\t<td colspan=\"12\"> </td>\n\t\t\t\t</tr> \n\t\t\t\t<tr>\n\t\t\t\t<td colspan=\"8\" ></td>\n\t\t\t\t<td colspan=\"2\" class=\"rightlean heading\">Net Total:</td>\n\t\t\t\t<td colspan=\"2\" class=\"rightlean heading fontblue\" >{{ ayCurrency ThisPONet }}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t<td colspan=\"8\"> </td>\n\t\t\t\t<td colspan=\"2\" class=\"rightlean heading\">Tax A Total:</td>\n\t\t\t\t{{#if ThisPOTaxA}}<td colspan=\"2\" class=\"rightlean heading fontblue\" >{{ ayCurrency ThisPOTaxA }}</td>{{else}} <td colspan=\"2\" class=\"rightlean heading fontblue\" >0.00</td>{{/if}}\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t<td colspan=\"8\">Direct all inquiries to My Company 1-888-555-5555</td>\n\t\t\t\t<td colspan=\"2\" class=\"rightlean heading \">Tax B Total:</td>\n\t\t\t\t{{#if ThisPOTaxB}}<td colspan=\"2\" class=\"rightlean heading fontblue\" >{{ ayCurrency ThisPOTaxB }}</td>{{else}} <td colspan=\"2\" class=\"rightlean heading fontblue\" >0.00</td>{{/if}}\n\t\t\t\t</tr>\n \t\t\t<tr>\n \t\t\t<td colspan=\"8\">Approval for off-specification goods must be obtained via a new purchase order</td>\n \t\t\t<td colspan=\"2\" class=\"rightlean heading\">PO Total:</td>\n \t\t\t<td colspan=\"2\" class=\"rightlean heading fontblue\" >{{ ayCurrency ThisPODollarAmount }}</td> \n \t\t\t</tr>\n </tfoot>\n \n\t\t</table>\n {{/each}}\n\t</div>\n</body>\n</html>","Style":".singlePage\n{\npage-break-after: always;\n}\n\ntable { \n font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;\n border-collapse: collapse;\n white-space: pre-wrap;\n font-size: 9pt;\n width: 100%;\n }\n\nthead {\n display: table-header-group; /* so as to print the table-header on all subsequent pages */\n}\n\n.heading {\n border-style: solid;\n border-width: 1pt;\n border-color: #e8e5e5; \n margin: 10pt;\n background-color: #e8e5e5;\n padding: 5pt; \n font-size: 12pt; \n} \n\ntbody tr:nth-child(even) {\n font-size: 14pt;\n background-color: lightgray; /* MUST checkmark Print background in PDF Options for this to show */\n} \ntbody tr:nth-child(odd) {\n font-size: 14pt;\n background-color: lightgoldenrodyellow; /* MUST checkmark Print background in PDF Options for this to show */\n} \n\ntfoot {\n display: table-footer-group; /* so as to print the table-footer on all subsequent pages */\n page-break-inside: avoid;\n /* position: fixed; uncommenting position: will force footer to bottom always BUT then leftlean and rightlean don't work AND tbody overwrites */\n font-size: 12pt; \n bottom: 0;\n width: 90%;\n border-top: 1px solid black;\n}\n\n.fontsmall {\n font-size: 8px;\n}\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\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 //Example of both manipulating the reportData before rendering the report (by adding a running total field)\n //and adding a field to the overall data calculating the total dollar amount for all records\n\nlet AllPONet = 0; //Declare a temporary variable to hold the running net total for all POs in this list\n //Iterate through all the records in the reportData adding the dollar amount of each item to the AllPONet variable\n for (EachPO of reportData.ayReportData) \n {\n let ThisPONet = 0; //Declare a temporary variable to hold the running net total for THIS po\n for (Item of EachPO.Items) //Iterate through all the poitems of THIS po adding the dollar amount of each item to the ThisPONet variable\n {\n //make sure it has a value before attempting to add it to the running total\n if (Item.NetTotalViz != null) \n {\n ThisPONet += Item.NetTotalViz;\n }\n Item.PONetRunning=ThisPONet;\n }\n EachPO.ThisPONet=ThisPONet;\n AllPONet += ThisPONet; //Use ThisPONet to display the running Net total for THIS PO\n }\n //Add the AllPONet variable to the reportData so it can be accessed in the report template i.e. a final running total of ALL PO's Net\n reportData.AllPONetRunning=AllPONet;\n \nlet AllPOTaxA = 0; //Declare a temporary variable to hold the running Tax A total for all POs in the list\n //Iterate through all the records in the reportData adding the Tax A dollar amount of each item to the AllPOTaxA variable\n for (EachPO of reportData.ayReportData) \n {\n let ThisPOTaxA = 0; //Declare a temporary variable to hold the running Tax A total for THIS po\n for (Item of EachPO.Items) //Iterate through all the poitems of THIS po adding the dollar amount of each item to the ThisPOTaxA variable\n {\n //make sure it has a value before attempting to add it to the running total\n if (Item.TaxAViz != null) \n {\n ThisPOTaxA += Item.TaxAViz;\n }\n Item.POTaxARunning=ThisPOTaxA;\n }\n EachPO.ThisPOTaxA=ThisPOTaxA;\n AllPOTaxA += ThisPOTaxA; // Use ThisPOTaxA to display the running Tax A total for THIS PO\n }\n //Add the AllPONet variable to the reportData so it can be accessed in the report template i.e. a final running total of ALL PO's Tax A\n reportData.AllPOTaxARunning=AllPOTaxA; \n \nlet AllPOTaxB = 0; //Declare a temporary variable to hold the running Tax B total for all POs in the list\n //Iterate through all the records in the reportData adding the Tax B dollar amount of each item to the AllPOTaxA variable\n for (EachPO of reportData.ayReportData) \n {\n let ThisPOTaxB = 0; //Declare a temporary variable to hold the running Tax B total for THIS po\n for (Item of EachPO.Items) //Iterate through all the poitems of THIS po adding the dollar amount of each item to the ThisPOTaxB variable\n {\n //make sure it has a value before attempting to add it to the running total\n if (Item.TaxBViz != null) \n {\n ThisPOTaxB += Item.TaxBViz;\n }\n Item.POTaxBRunning=ThisPOTaxB;\n }\n EachPO.ThisPOTaxB=ThisPOTaxB;\n AllPOTaxB += ThisPOTaxB; // Use ThisPOTaxB to display the running Tax B total for THIS PO\n }\n //Add the AllPOTaxB variable to the reportData so it can be accessed in the report template i.e. a final running total of ALL PO's Tax B\n reportData.AllPOTaxBRunning=AllPOTaxB; \n\nlet AllPODollarAmount = 0; //Declare a temporary variable to hold the running total of all POs in this list\n //Iterate through all the records in the reportData\n //adding the dollar amount of each item to the AllPODollarAmount variable\n for (EachPO of reportData.ayReportData) \n {\n let ThisPODollarAmount = 0; //Declare a temporary variable to hold the running total of THIS PO\n for (Item of EachPO.Items)\n {\n //make sure it has a value before attempting to add it to the running total\n if (Item.LineTotalViz != null) \n {\n ThisPODollarAmount += Item.LineTotalViz;\n }\n Item.PORunningTotal=ThisPODollarAmount;\n }\n EachPO.ThisPODollarAmount=ThisPODollarAmount;\n AllPODollarAmount += ThisPODollarAmount; // Use ThisPODoallarAmount to display the running Total for THIS PO\n }\n //Add the AllPODollarAmount variable to the reportData so it can be accessed in the report template \n reportData.AllPORunningTotal=AllPODollarAmount;\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})\nHandlebars.registerHelper('words', function() {\n return \"stuff and text\"\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\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","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} |