1 line
16 KiB
Plaintext
1 line
16 KiB
Plaintext
{"Name":"112 EXAMPLE PO Basic with Custom.c1 Shipping charge","Active":true,"Notes":"Example of utilizing a custom field for entering Shipping Charges, and custom Prepare to derive the subtotals and totals including shipping\nHTML If else /if \nMISSING: customer AND vendor contact info & address (not yet exposed in Sample Data)","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 null or not. If not null, shows value. Else (as is null) 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 null or not. If not null, shows value - at this time unsure where to get customer's address etc from. Else if null shows static My Company Name -->\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=\"6\" class=\"centerlean heading\" >Our Part#:</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}} \n\t\t\t\t<tr>\t\t\t\t\n\t\t\t\t <td colspan=\"6\" class=\"fontgreen\" > {{PartViz}} {{PartNameViz}}</td>\n \t\t<td colspan=\"1\" class=\"centerlean fontgreen\" >{{QuantityOrdered}}</td> \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 \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 <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\">ThisPODollarAmountBeforeShip:</td>\n \t\t\t<td colspan=\"2\" class=\"rightlean heading fontblue\" >{{ ayCurrency ThisPODollarAmountBeforeShip }}</td> \n \t\t\t</tr>\n <tr>\n \t\t\t<td colspan=\"8\"></td>\n \t\t\t{{#if CustomFields.c1}}<td colspan=\"2\" class=\"rightlean heading\">This text shows IF THERE IS A Custom Shipping currency amount in CustomFields.c1:</td>{{else}}<td colspan=\"2\" class=\"rightlean heading\">This is the text that shows IF NO Custom Shipping Charge currenty amount in CustomFields.c1:</td>{{/if}}\n \t\t\t<td colspan=\"2\" class=\"rightlean heading fontgreen\" >{{ ayCurrency CustomFields.c1 }}</td> \n \t\t\t</tr>\n <tr>\n \t\t\t<td colspan=\"8\"></td>\n \t\t\t<td colspan=\"2\" class=\"rightlean heading\">ThisPODollarAmountWithShip:</td>\n \t\t\t<td colspan=\"2\" class=\"rightlean heading fontblue\" >{{ ayCurrency ThisPODollarAmountWithShip }}</td> \n \t\t\t</tr>\n </tfoot>\n \n\t\t</table>\n {{/each}}\n\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 BUT then leftlean and rightlean don't work AND tbody overwrites */\n font-size: 8pt; \n bottom: 0;\n width: 100%;\n border-top: 1px solid black; \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 //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\n\n//remove statements not needed, for example ALLPOxxx are not needed\n//let AllPONet = 0; //Declare a temporary variable to hold the running net total for all POs in this list\n//let AllPOTaxA = 0; //Declare a temporary variable to hold the running Tax A total for all POs in the list\n//let AllPOTaxB = 0; //Declare a temporary variable to hold the running Tax B total for all POs in the list\n//let AllPODollarAmountBeforeShip = 0; //Declare a temporary variable to hold the running total of all POs (no shipping) in this list\n//let AllPODollarAmountWithShip = 0; //Declare a temporary variable to hold the running total of all POs with shipping custom amount\n \n\n //Iterate through all the records in the reportData adding the dollar amount of each specified property to the appropriate declared variable\n\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; //remove statements not needed, for example ALLPOxxx are not needed\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; //remove statements not needed, for example ALLPOxxx are not needed\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; //remove statements not needed, for example ALLPOxxx are not needed\n\n let ShipCharge=0; // has to be declared first before below \n if ( EachPO.CustomFields != null && EachPO.CustomFields.c1 != null )// then this - this first checks that CustomFields is NOT null, if so then checks that c1 isNOT null\n {\n const tempc1 = parseFloat(EachPO.CustomFields.c1); // const instead of let because not declaring it more than once per PO\n if ( tempc1 != NaN) // don't check if Null, instead check if NaN because return value for parseFloat is either NaN or the floating point number \n {\n ShipCharge = tempc1; //don't declare, update the existing instead\n }\n \n }\n\n let ThisPODollarAmountBeforeShip = 0; //Declare a temporary variable to hold the running total of THIS PO before adding shipcharge\n let ThisPODollarAmountWithShip = 0; //Declare a temporary variable to hold the running total of THIS PO WITH shipcharge\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 ThisPODollarAmountBeforeShip += Item.LineTotalViz;\n }\n Item.PORunningTotal=ThisPODollarAmountBeforeShip;\n ThisPODollarAmountWithShip=ThisPODollarAmountBeforeShip + ShipCharge; // this working when using ShipCharge = 12 for testing, BUT while trying to use CustomFields.c1\n //isn't \"seeing\" CustomFields.c1 or EachPO.CustomFields.c1 value resulting in AllPODollarAmountWithShip showing innvalid number as well as ThisPODollarAmountWithShip not includes the actual shipping$\n }\n \n EachPO.ThisPODollarAmountBeforeShip =ThisPODollarAmountBeforeShip; // \n EachPO.ThisPODollarAmountWithShip = ThisPODollarAmountWithShip; // \n \n \n // AllPODollarAmountBeforeShip += ThisPODollarAmountBeforeShip; //remove statements not needed, for example ALLPOxxx are not needed\n // AllPODollarAmountWithShip += ThisPODollarAmountWithShip; //remove statements not needed, for example ALLPOxxx are not needed\n \n\n\n\n }\n \n // reportData.AllPONetRunning=AllPONet; //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.AllPOTaxARunning=AllPOTaxA; //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.AllPOTaxBRunning=AllPOTaxB; //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.AllPORunningTotalwithoutShip=AllPODollarAmountBeforeShip; \n // reportData.AllPORunningTotalwithShip=AllPODollarAmountWithShip; \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":"<span style=\"font-size:6pt;width: 94%; text-align:left; \"> (from PDF Options) Printed date: <span class=\"date\"></span></span>","FooterTemplate":null,"DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"10mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} |