Files
raven/server/AyaNova/resource/rpt/stock-report-templates/Purchase Order Summaries.ayrt
2022-02-17 00:25:16 +00:00

1 line
11 KiB
Plaintext

{"Name":"Purchase Order Summaries","Active":true,"Notes":"custom Prepare - derived running totals for nets, taxes and totals for EACH PO on single line, and running total for all POs Nets, Taxes, Totals at bottom of report","Roles":49258,"AType":26,"IncludeWoItemDescendants":false,"Template":"<html>\n<body>\n\t<div >\t \n\t\t<table > \n \t\t<thead>\n <tr >\n\t\t\t <th colspan=\"24\" class=\"reporttitle\">Purchase Order Summaries</th>\n\t\t </tr>\n <tr>\n <td colspan=\"24\">&nbsp;</td>\n </tr>\n <tr>\n <th colspan=\"2\">{{ayT 'PurchaseOrderOrderedDate'}}</th>\n <th colspan=\"2\">{{ayT 'PurchaseOrderExpectedReceiveDate'}}</th>\n <th colspan=\"4\">{{ayT 'PurchaseOrderItemUIOrderedFrom'}}</th>\n <th colspan=\"4\">{{ayT 'PurchaseOrderStatus'}}</th>\n <th colspan=\"2\">{{ayT 'PurchaseOrderReferenceNumber'}}</th>\n <th colspan=\"2\">{{ayT 'PurchaseOrder'}}</th>\n \n <th colspan=\"2\">{{ayT 'NetPrice'}}</th>\n <th colspan=\"2\">{{ayT 'TaxCodeTaxA'}}</th>\n <th colspan=\"2\">{{ayT 'TaxCodeTaxB'}}</th>\n <th colspan=\"2\">{{ayT 'Total'}}</th> \n </tr>\n <tr>\n <td colspan=\"24\">&nbsp;</td>\n </tr>\n \t\t</thead>\n \n <tbody> \n {{#each ayReportData}}<!-- the #each for the Sample Data MUST encompass the section where its gonna show - in this case the tbody, so needs to be placed within -->\n <!-- to get alternating coloured rows when one PO per line, need CSS statements PLUS this # each MUST be placed BEFORE the tr /tr -->\n <tr>\n <td colspan=\"2\">{{ayDate OrderedDate}}</td>\n <td colspan=\"2\">{{ayDate ExpectedReceiveDate}}</td> \n <td colspan=\"4\">{{VendorViz}}</td>\n <td colspan=\"4\">{{StatusViz}}</td>\n <td colspan=\"2\">{{ReferenceNumber}}</td>\n <td colspan=\"2\">{{Serial}}</td>\n \n <td colspan=\"2\" class=\"rightlean\">{{ayCurrency ThisPONet}}</td> \n {{#if ThisPOTaxA}}<td colspan=\"2\" class=\"rightlean\">{{ayCurrency ThisPOTaxA}}</td>{{else}} <td colspan=\"2\" class=\"rightlean\">$0.00</td>{{/if}} \n {{#if ThisPOTaxB}}<td colspan=\"2\" class=\"rightlean\">{{ayCurrency ThisPOTaxB}}</td>{{else}} <td colspan=\"2\" class=\"rightlean\">$0.00</td>{{/if}}\n <td colspan=\"2\" class=\"rightlean\">{{ayCurrency ThisPOTotalofLines}}</td> \n </tr>\n \t {{/each}}\n </tbody>\n </table>\n\n <table> <!-- as in its own table, this displays footer ONLY on bottom of LAST page -->\n <tfoot>\n <tr> <!-- note no #each here - the data below is from Prepare's reportData.xxxx as in reportData.AllPOTaxBRunning -->\n <th colspan=\"12\"></th>\n <th colspan=\"3\">All {{ayT 'NetPrice'}}</th>\n <th colspan=\"3\">All {{ayT 'TaxCodeTaxA'}}</th>\n <th colspan=\"3\">All {{ayT 'TaxCodeTaxB'}}</th>\n <th colspan=\"3\">All {{ayT 'Total'}}</th> \n </tr>\n <tr> <!-- note no #each here - the data below is from Prepare's reportData.xxxx as in reportData.AllPOTaxBRunning -->\n <td colspan=\"12\"></td>\n <td colspan=\"3\" class=\"rightlean\">{{ ayCurrency AllPONetRunning }}</td>\n {{#if AllPOTaxARunning}}<td colspan=\"3\" class=\"rightlean\">{{ ayCurrency AllPOTaxARunning }}</td>{{else}} <td colspan=\"3\" class=\"rightlean\">$0.00</td>{{/if}} \n {{#if AllPOTaxBRunning}}<td colspan=\"3\" class=\"rightlean\">{{ ayCurrency AllPOTaxBRunning }}</td>{{else}} <td colspan=\"3\" class=\"rightlean\">$0.00</td>{{/if}} \n <td colspan=\"3\" class=\"rightlean\"> {{ ayCurrency AllPOTotal }}</td> \n </tr>\n </tfoot>\n </table>\n \n\t</div>\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: 14pt; \n color: #9e9e9e;\n text-align: left;\n} \n\ntable { \n border-collapse: collapse;\n white-space: pre-wrap;\n width: 100%;\n font-size: 9pt; \n table-layout: fixed; \n }\n\nth {\n /* border-bottom: solid 1pt #9e9e9e; */\n height: 30px;\n font-size: 10pt; \n color: #9e9e9e;\n}\n\ntfoot th{\n border-top: solid 1pt #9e9e9e;\n height: 50px;\n font-size: 10pt; \n text-align: right;\n}\n\ntbody td {\n padding: 10px;\n word-wrap: break-word;\n font-size: 9pt;\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 font-size: 16pt;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\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 fields to the overall data such as calculating the total dollar amount for all records\n\n await ayGetTranslations([\"PurchaseOrderItemUIOrderedFrom\", \"PurchaseOrderStatus\", \"PurchaseOrderReferenceNumber\", \"PurchaseOrder\", \"PurchaseOrderExpectedReceiveDate\", \"PurchaseOrderOrderedDate\", \"Total\", \"TaxCodeTaxA\", \"TaxCodeTaxB\", \"NetPrice\" ]);\n\nlet AllPONet = 0; //Declare a temporary variable to hold the running net total for all POs in this list\n \n for (const EachPO of reportData.ayReportData) //Iterate through all the records in the reportData adding the dollar amount of each item to the AllPONet variable\n {\n let ThisPONet = 0; //Declare a temporary variable to hold the running net total for THIS po\n for (const 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 (const 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 (const 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 (const 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 (const 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 AllPODollarTotalRunning = 0; //Declare a temporary variable to hold the running total of all POs in this list\n//let ThisPOTotal = 0; //if declare this at this stage will NOT get correct EachPO.ThisPOTotalofLines\n for (const EachPO of reportData.ayReportData) \n { \n let ThisPOTotal = 0; \n // need to declared let ThisPOTotal = 0; at this stage so then it will reset ThisPOTotal back to 0 before being able to add to EachPO.POsRunningTotalSoFar \n for (const 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 ThisPOTotal += Item.LineTotalViz;\n }\n Item.ThisPORunningTotal=ThisPOTotal;\n } \n EachPO.ThisPOTotalofLines =ThisPOTotal; \n //add a new key to each record in the reportData object named \"EachPO.POsRunningTotalSoFar\" with the running total so far\n EachPO.POsRunningTotalSoFar=ThisPOTotal; \n\n AllPODollarTotalRunning += ThisPOTotal; \n }\n //set the AllPODollarTotalRunning variable to the reportData so the reportData.AllPOTotal can be accessed in the report template outside of the #each \n //- i.e. in a separate footer that displays once at end of report\n reportData.AllPOTotal=AllPODollarTotalRunning; \n \n\n return reportData;\n}","JsHelpers":"\n","RenderType":0,"HeaderTemplate":"<span>&nbsp; </span>","FooterTemplate":"<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>","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"20mm","MarginOptionsRight":"20mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000}