Files
raven/server/AyaNova/resource/rpt/stock-report-templates/112 EXAMPLE WO single line PROFIT_LOSS on net parts labors.ayrt
2021-07-09 17:33:09 +00:00

1 line
17 KiB
Plaintext

{"Name":"112 EXAMPLE WO single line PROFIT/LOSS on net parts labors","Active":true,"Notes":"Example single line per WO showing net labor charges and costs and its profit/loss; net parts charges and costs and its profit/loss; and derived WO profit/loss (via Prepare)\nTotalling up all wo's net labor charges and costs and profit/loss, all wo's net parts charges and costs and profit/loss, and derived all wos total profit/loss\nPDF Options example header & footer; CSS tbody tr:nth-child striped rows","Roles":124927,"AType":34,"IncludeWoItemDescendants":false,"Template":"<html>\n<body>\n\t<div >\t \n <h1>Nets for each WO in report </h1>\n\t\t<table > \n \t\t<thead>\n <tr>\n <td class=\"heading\">WO#:</td>\n\t\t\t <td class=\"heading\">Customer:</td>\n <td class=\"heading\">Service Date:</td>\n <td class=\"heading\">ThisWOAllLaborsNetViz:</td>\n <td class=\"heading\">ThisWOAllLaborsCost:</td>\n <td class=\"heading\">ThisWOAllLaborsProfit:</td>\n <td class=\"heading\">ThisWOAllPartsNetViz:</td> \n <td class=\"heading\">ThisWOAllPartsCost:</td>\n <td class=\"heading\">ThisWOAllPartsProfit:</td> \n <td class=\"heading\">ThisWOTotalProfit:</td> \n </tr> \n \t</thead> \n <tbody>\n {{#each ayReportData}}\n <tr>\n <td class=\"centerlean\">{{Serial}}</td>\n\t\t\t <td class=\"centerlean\" >{{CustomerViz}}</td>\n {{#if ServiceDate }}<td class=\"centerlean\" >{{ayDate ServiceDate}}</td>{{else}} <td class=\"centerlean \">no Service Date specified</td>{{/if}}\n\t\t\t \n {{#if ThisWOAllLaborsNetViz }}<td class=\"centerlean fontblue\">{{ayCurrency ThisWOAllLaborsNetViz}}</td> {{else}} <td class=\"centerlean \">no billable labor</td>{{/if}} \n {{#if ThisWOAllLaborsCost }}<td class=\"centerlean fontpurple\">{{ayCurrency ThisWOAllLaborsCost}}</td> {{else}} <td class=\"centerlean \">no labor costs</td>{{/if}} \n <!-- {{#if ThisWOAllLaborsProfit }}<td class=\"centerlean fontblue\">{{ayCurrency ThisWOAllLaborsProfit}}</td> {{else}} <td class=\"centerlean fontred\">{{ayCurrency ThisWOAllLaborsProfit}}</td>{{/if}} -->\n {{#if ThisWOAllLaborsLoss }}<td class=\"centerlean fontred\">({{ayCurrency ThisWOAllLaborsLoss}})</td> {{else}} <td class=\"centerlean fontgreen\">{{ayCurrency ThisWOAllLaborsProfit}}</td>{{/if}}\n \n {{#if ThisWOAllPartsNetViz }}<td class=\"centerlean fontblue\">{{ayCurrency ThisWOAllPartsNetViz}}</td> {{else}} <td class=\"centerlean \">no billable parts</td>{{/if}} \n {{#if ThisWOAllPartsCost }}<td class=\"centerlean fontpurple\">{{ayCurrency ThisWOAllPartsCost}}</td> {{else}} <td class=\"centerlean \">no parts costs</td>{{/if}} \n <!-- {{#if ThisWOAllPartsProfit }} <td class=\"centerlean fontblue\">{{ayCurrency ThisWOAllPartsProfit}}</td>{{else}} <td class=\"centerlean fontred \">{{ayCurrency ThisWOAllPartsProfit}}</td>{{/if}} -->\n {{#if ThisWOAllPartsLoss }} <td class=\"centerlean fontred\">({{ayCurrency ThisWOAllPartsLoss}})</td>{{else}} <td class=\"centerlean fontgreen \">{{ayCurrency ThisWOAllPartsProfit}}</td>{{/if}}\n \n <!-- {{#if ThisWOTotalProfit }}<td class=\"centerlean fontblue\">{{ayCurrency ThisWOTotalProfit}}</td> {{else}} <td class=\"centerlean fontred \">{{ayCurrency ThisWOTotalProfit}}</td>{{/if}} -->\n {{#if ThisWOTotalLoss }}<td class=\"centerlean fontred\">({{ayCurrency ThisWOTotalLoss}})</td> {{else}} <td class=\"centerlean fontgreen \">{{ayCurrency ThisWOTotalProfit}}</td>{{/if}}\n </tr>\n {{/each}}\n </tbody>\n \n </table>\n\n <table> <!-- tfoot in its own table so it ONLY shows on last page of report -->\n <tfoot>\n \n <tr>\n <td colspan=\"3\" class=\"heading\">Totals for all listed workorders</td> \n\n <td class=\" heading\"> AllWOLaborsNetViz</td>\n <td class=\" heading\">AllWOLaborsCost </td>\n <td class=\" heading\">AllWOLaborsProfit</td>\n\n <td class=\" heading\">AllWOPartsNetViz</td>\n <td class=\" heading\">AllWOPartsCost</td>\n <td class=\" heading\">AllWOPartsProfit</td>\n\n <td class=\" heading\">AllWOTotalProfit</td>\n </tr>\n <tr> <!-- note no #each encompasses here - the data below is from Prepare's reportData.xxxx as in reportData.AllWOLaborNetViz -->\n <td colspan=\"3\" class=\"heading\"></td> \n\n {{#if AllWOLaborsNetViz}} <td class=\"fontblue heading\">{{ ayCurrency AllWOLaborsNetViz}}</td> {{else}} <td class=\" heading\">no billable labor</td> {{/if}}\n {{#if AllWOLaborsCost}} <td class=\"fontpurple heading\">{{ ayCurrency AllWOLaborsCost}}</td> {{else}} <td class=\" fontpurple heading\">no labor costs</td> {{/if}}\n \n {{#if AllWOLaborsLoss}} <td class=\"fontred heading\">({{ ayCurrency AllWOLaborsLoss}})</td> {{else}} <td class=\" fontgreen heading\"> {{ ayCurrency AllWOLaborsProfit }}</td> {{/if}}\n\n {{#if AllWOPartsNetViz}} <td class=\"fontblue heading\">{{ ayCurrency AllWOPartsNetViz}}</td> {{else}} <td class=\" heading\">no billable parts</td> {{/if}}\n {{#if AllWOPartsCost}} <td class=\"fontpurple heading\">{{ ayCurrency AllWOPartsCost}}</td> {{else}} <td class=\" heading\">no parts cost</td> {{/if}}\n \n {{#if AllWOPartsLoss}} <td class=\"fontred heading\">({{ ayCurrency AllWOPartsLoss}})</td> {{else}} <td class=\"fontgreen heading\"> {{ ayCurrency AllWOPartsProfit }}</td> {{/if}}\n\n \n {{#if AllWOTotalLoss}} <td class=\"fontred heading\">({{ ayCurrency AllWOTotalLoss}})</td> {{else}} <td class=\"fontgreen heading\">{{ ayCurrency AllWOTotalProfit}}</td> {{/if}} \n </tr>\n </tfoot>\n </table>\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 width: 100%;\n \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: 5pt;\n background-color: #e8e5e5;\n padding: 5pt; \n font-size: 9pt; \n text-align: center;\n} \n\ntbody tr:nth-child(even) {\n font-size: 7pt;\n background-color: lightgray; /* MUST checkmark Print background in PDF Options for this to show */\n height: 50px;\n} \ntbody tr:nth-child(odd) {\n font-size: 7pt;\n background-color: lightgoldenrodyellow; /* MUST checkmark Print background in PDF Options for this to show */\n height: 50px;\n} \n\n\ntfoot {\n border-top: 2px solid black;\n}\n\n\n.fontblue {\n color: blue;\n}\n.fontpurple {\n color: purple;\n}\n\n.fontgreen {\n color: green;\n}\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 //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\n//********************//NOTE if you customize this report template and do NOT need a function or key identified below, remove to increase report performance\n\n//below declares a key on the entire wo to hold all Labor nets, costs, profit/loss (nets - costs),from all workorders so it exists and a key to hold all Labor Net Costs\nreportData.AllWOLaborsNetViz = 0;\nreportData.AllWOLaborsCost = 0;\nreportData.AllWOLaborsProfit = 0;\nreportData.AllWOLaborsLoss = 0;\n\n\n//below declares a key on the entire wo to hold all Part Net, costs, profit/loss (nets - costs), from all workorders so it exists and a key to hold all Part Net Costs\nreportData.AllWOPartsNetViz = 0;\nreportData.AllWOPartsCost = 0;\nreportData.AllWOPartsProfit = 0;\nreportData.AllWOPartsLoss = 0;\n\n\n//below declares a key to hold all Nets, hold all Costs, profit/loss (nets - costs), from all workorders in this list so it exists\nreportData.AllWOTotalNets = 0;\nreportData.AllWOTotalCost = 0;\nreportData.AllWOTotalProfit = 0;\nreportData.AllWOTotalLoss = 0;\n\n\n\n\n\n\nfor (EachWO of reportData.ayReportData) \n\t{\n\t//below declares a key on the entire wo to hold all Labor nets, costs, profit/loss (nets - costs) from all Items in this wo so it exists\n\tEachWO.ThisWOAllLaborsNetViz = 0;\n\tEachWO.ThisWOAllLaborsCost = 0;\n\tEachWO.ThisWOAllLaborsProfit = 0;\n\tEachWO.ThisWOAllLaborsLoss = 0;\n\n\t//below declares a key on the entire wo to hold all Part Net, costs, profit/loss (nets - costs), from all Items in this wo so it exists\n\tEachWO.ThisWOAllPartsNetViz = 0;\n\tEachWO.ThisWOAllPartsCost = 0;\n\tEachWO.ThisWOAllPartsProfit = 0; \n\tEachWO.ThisWOAllPartsLoss = 0; \n\t\n\n\t//below declares a key on the entire wo to hold ALL of THIS workorder's Nets , costs, profit/loss (nets - costs) so it exists\n\tEachWO.ThisWOTotalNets = 0;\n\tEachWO.ThisWOTotalCost = 0;\n\tEachWO.ThisWOTotalProfit = 0;\n\tEachWO.ThisWOTotalLoss = 0;\n\t\n\n\t//below is to Iterate through each item of the wo's Items\n\tfor (Item of EachWO.Items)\n\t\t{\n\t\t\tItem.ThisItemAllLaborsNetViz = 0; //declare a key on the Item to hold all of this item's labor nets and set it initially to 0 \n\t\t\tItem.ThisItemAllLaborsCost = 0; //declare a key on the Item to hold all of this item's labor costs and set it initially to 0\n\t\t\tItem.ThisItemAllLaborsProfit = 0; //declare a key on the Item to hold all of this item's labor profit/loss (nets - costs) and set it initially to 0 \n\t\t\t\n\t\t\t//below is to Iterate through each labor record of the wo's Item\n\t\t\tfor (Labor of Item.Labors)\n\t\t\t{\n\t\t\t//make sure it has a value before attempting to add it to the running total\n \tif (Labor.NetViz != null) \n \t \t{\n \t \tItem.ThisItemAllLaborsNetViz += Labor.NetViz; //this IS where the actual adding to running total for this WOItem's Net Labors\n\t\t\t\t\t\tEachWO.ThisWOAllLaborsNetViz += Labor.NetViz; //this IS where the actual adding to the running total for this entire WO's Net Labors\n\t\t\t\t\t\tEachWO.ThisWOTotalNets += Labor.NetViz; //this IS where the actual adding to the running total for ALL NETS for THIS workorders in this report data\n\t\t\t\t\t\treportData.AllWOLaborsNetViz += Labor.NetViz;\t//this IS where the actual adding to the running total for all labor for ALL workorders in this report data\t\t\t\n\t\t\t\t\t\treportData.AllWOTotalNets += Labor.NetViz; //this is where the actual adding to the running total for ALL workorders Nets in this report data\t\n\n\t\t\t\t\t\tLabor.NetCost = (Labor.CostViz * Labor.ServiceRateQuantity);\n\t\t\t\t\t\tItem.ThisItemAllLaborsCost += Labor.NetCost; //this IS where the actual adding to running total for this WOItem's Labors Cost\n\t\t\t\t\t\tEachWO.ThisWOAllLaborsCost += Labor.NetCost; //this IS where the actual adding to the running total for this entire WO's Labors costs\n\t\t\t\t\t\tEachWO.ThisWOTotalCost += Labor.NetCost; //this IS where the actual adding to the running total for ALL costs for THIS workorders in this report data\n\t\t\t\t\t\treportData.AllWOLaborsCost += Labor.NetCost;\t//this IS where the actual adding to the running total for all labor costs for ALL workorders in this report data\t\t\t\n\t\t\t\t\t\treportData.AllWOTotalCost += Labor.NetCost; //this is where the actual adding to the running total for ALL workorders costs in this report data\n\n\t\t\t\t\t\tif (Labor.NetCost != null) \n\t\t\t\t\t\t{\n\n\t\t\t\t\t\tLabor.NetProfit = (Labor.NetViz - Labor.NetCost)\n\t\t\t\t\t\tItem.ThisItemAllLaborsProfit += Labor.NetProfit; //this NOT USED \n\t\t\t\t\t\tEachWO.ThisWOAllLaborsProfit += Labor.NetProfit; //this works\n\t\t\t\t\t\tEachWO.ThisWOTotalProfit += Labor.NetProfit; //this works\n\t\t\t\t\t\treportData.AllWOLaborsProfit += Labor.NetProfit; //this works\n\t\t\t\t\t\treportData.AllWOTotalProfit += Labor.NetProfit; //this works\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\n \t \t\t}\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\t\n\t\t\t}\n\n\t\t\t\n\t\t\tItem.ThisItemAllPartsNetViz = 0; //declare a key on the Item to hold all of this item's parts nets and set it initially to 0 \n\t\t\tItem.ThisItemAllPartsCost = 0; //declare a key on the Item to hold all of this item's parts costs and set it initially to 0 \n\t\t\tItem.ThisItemAllPartsProfit = 0; //declare a key on the Item to hold all of this item's part profit/loss (nets - costs) and set it initially to 0 \n\t\t\t\n\t\t\t\n\t\t\t//below is to Iterate through each Part record of the wo's Item\n\t\t\tfor (Part of Item.Parts)\n\t\t\t{\n\t\t\t//make sure it has a value before attempting to add it to the running total\n \tif (Part.NetViz != null) \n \t \t{\n \t \tItem.ThisItemAllPartsNetViz += Part.NetViz; //this IS where the actual adding to running total for this WOItem's Net Parts\n\t\t\t\t\t\tEachWO.ThisWOAllPartsNetViz += Part.NetViz;//this IS where the actual adding to the running total for this entire WO's Net Parts\n\t\t\t\t\t\tEachWO.ThisWOTotalNets += Part.NetViz; //this IS where the actual adding to the running total for ALL NETS for THIS workorders in this report data\t\t\t\t\t\t\n\t\t\t\t\t\treportData.AllWOPartsNetViz += Part.NetViz; //this IS where the actual adding to the running total for all Parts for all workorders in this report data\t\n\t\t\t\t\t\treportData.AllWOTotalNets += Part.NetViz; //this is where the actual adding to the running total for all workorder Nets in this report data\n\n\t\t\t\t\t\tPart.NetCost = (Part.Cost * Part.Quantity);\t\t\t\t\t\t\n\t\t\t\t\t\tItem.ThisItemAllPartsCost += Part.NetCost;\n\t\t\t\t\t\tEachWO.ThisWOAllPartsCost += Part.NetCost;\n\t\t\t\t\t\tEachWO.ThisWOTotalCost += Part.NetCost;\n\t\t\t\t\t\treportData.AllWOPartsCost += Part.NetCost;\n\t\t\t\t\t\treportData.AllWOTotalCost += Part.NetCost;\n\n\t\t\t\t\t\tif (Part.NetViz != null) \n\t\t\t\t\t\t{\n\t\t\t\t\t\tPart.NetProfit = (Part.NetViz - Part.Cost)\n\t\t\t\t\t\tItem.ThisItemAllPartsProfit += Part.NetProfit; //this NOT USED \n\t\t\t\t\t\tEachWO.ThisWOAllPartsProfit += Part.NetProfit; //this works\n\t\t\t\t\t\tEachWO.ThisWOTotalProfit += Part.NetProfit; //this works\n\t\t\t\t\t\treportData.AllWOPartsProfit += Part.NetProfit; //this works\n\t\t\t\t\t\treportData.AllWOTotalProfit += Part.NetProfit; //this works\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\n\n \t \t\t}\t\t\t\t//NOTE if you customize this report template and do NOT need a key above, remove it to increase report performance\t\n\t\t\t}\n\n\t\t\t\n\t\t}\n\n\n\t\tif (EachWO.ThisWOAllLaborsProfit <= 0) {\n\t\t\t\tEachWO.ThisWOAllLaborsLoss = EachWO.ThisWOAllLaborsProfit;\n\t\t\t\tEachWO.ThisWOAllLaborsProfit = 0;\n\t\t\t}\n\n\t\tif (EachWO.ThisWOAllPartsProfit <= 0) {\n\t\t\t\tEachWO.ThisWOAllPartsLoss = EachWO.ThisWOAllPartsProfit;\n\t\t\t\tEachWO.ThisWOAllPartsProfit = 0;\n\t\t\t}\n\n\t\tif (EachWO.ThisWOTotalProfit <= 0) {\n\t\t\t\tEachWO.ThisWOTotalLoss = EachWO.ThisWOTotalProfit;\n\t\t\t\tEachWO.ThisWOTotalProfit = 0;\n\t\t\t}\n\n\t}\n\n\nif (reportData.AllWOLaborsProfit <= 0) {\n\t\treportData.AllWOLaborsLoss = reportData.AllWOLaborsProfit;\n\t\treportData.AllWOLaborsProfit = 0;\n\t}\n\nif (reportData.AllWOPartsProfit <= 0) {\n\t\treportData.AllWOPartsProfit = reportData.AllWOPartsProfit;\n\t\treportData.AllWOPartsProfit = 0;\n\t}\n\nif (reportData.AllWOTotalProfit <= 0) {\n\t\treportData.AllWOTotalLoss = reportData.AllWOTotalProfit;\n\t\treportData.AllWOTotalProfit = 0;\n\t}\t\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; \">&nbsp;&nbsp;&nbsp;&nbsp;Todays date:&nbsp; <span class=\"date\"></span>&nbsp; set in PDF Options</span>","FooterTemplate":"<span style=\"font-size:6pt;width: 94%; text-align: right; \">&nbsp; set in PDF Options&nbsp;&nbsp;Page&nbsp;<span class=\"pageNumber\"></span>&nbsp;of&nbsp;<span class=\"totalPages\"></span>&nbsp;&nbsp;&nbsp;&nbsp;</span>","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"10mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000}