From 384365af8bc557871be0c7e33902f418a1c6d559 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 4 Nov 2021 23:52:28 +0000 Subject: [PATCH] --- .vscode/launch.json | 2 +- server/AyaNova/biz/CustomerBiz.cs | 4 ++-- server/AyaNova/biz/UnitBiz.cs | 6 +++--- server/AyaNova/models/Customer.cs | 4 ++-- server/AyaNova/models/Unit.cs | 6 +++--- ...xample Inventory Reconciliation Form Grouped By Tag.ayrt | 1 + ...ts grouped by Tags with optional filter by contains.ayrt | 1 + .../stock-report-templates/Example Units Per Customer .ayrt | 2 +- ...nits Per Customer using built in Helper and Prepare.ayrt | 1 + ...its with API method to get additional customer data.ayrt | 1 + server/AyaNova/util/AyaNovaVersion.cs | 2 +- 11 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 server/AyaNova/resource/rpt/stock-report-templates/Example Inventory Reconciliation Form Grouped By Tag.ayrt create mode 100644 server/AyaNova/resource/rpt/stock-report-templates/Example Parts grouped by Tags with optional filter by contains.ayrt create mode 100644 server/AyaNova/resource/rpt/stock-report-templates/Example Units Per Customer using built in Helper and Prepare.ayrt create mode 100644 server/AyaNova/resource/rpt/stock-report-templates/Sample Units with API method to get additional customer data.ayrt diff --git a/.vscode/launch.json b/.vscode/launch.json index dde42e99..924c5283 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -55,7 +55,7 @@ "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", "AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles", "AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles", - "AYANOVA_SERVER_TEST_MODE": "false", + "AYANOVA_SERVER_TEST_MODE": "true", "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small", "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7", "AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin\\" diff --git a/server/AyaNova/biz/CustomerBiz.cs b/server/AyaNova/biz/CustomerBiz.cs index 934826bb..a8758b61 100644 --- a/server/AyaNova/biz/CustomerBiz.cs +++ b/server/AyaNova/biz/CustomerBiz.cs @@ -387,8 +387,8 @@ namespace AyaNova.Biz using (var dr = await command.ExecuteReaderAsync()) if (await dr.ReadAsync()) { - o.LastCompletedWorkOrderViz = dr.GetInt64(0); - o.LastCompletedServiceDateViz = dr.GetDateTime(1); + o.LastWorkOrderViz = dr.GetInt64(0); + o.LastServiceDateViz = dr.GetDateTime(1); } await ct.Database.CloseConnectionAsync(); diff --git a/server/AyaNova/biz/UnitBiz.cs b/server/AyaNova/biz/UnitBiz.cs index e8d6321b..f0d4af3b 100644 --- a/server/AyaNova/biz/UnitBiz.cs +++ b/server/AyaNova/biz/UnitBiz.cs @@ -291,7 +291,7 @@ namespace AyaNova.Biz { o.CustomerViz = await ct.Customer.AsNoTracking().Where(x => x.Id == o.CustomerId).Select(x => x.Name).FirstOrDefaultAsync(); if (o.UnitModelId != null) - o.UnitModelViz = await ct.UnitModel.AsNoTracking().Where(x => x.Id == o.UnitModelId).Select(x => x.Name).FirstOrDefaultAsync(); + o.UnitModelNameViz = await ct.UnitModel.AsNoTracking().Where(x => x.Id == o.UnitModelId).Select(x => x.Name).FirstOrDefaultAsync(); if (o.ParentUnitId != null) o.ParentUnitViz = await ct.Unit.AsNoTracking().Where(x => x.Id == o.ParentUnitId).Select(x => x.Serial).FirstOrDefaultAsync(); @@ -335,8 +335,8 @@ namespace AyaNova.Biz using (var dr = await command.ExecuteReaderAsync()) if (await dr.ReadAsync()) { - o.LastCompletedWorkOrderViz = dr.GetInt64(0); - o.LastCompletedServiceDateViz = dr.GetDateTime(1); + o.LastWorkOrderViz = dr.GetInt64(0); + o.LastServiceDateViz = dr.GetDateTime(1); } await ct.Database.CloseConnectionAsync(); diff --git a/server/AyaNova/models/Customer.cs b/server/AyaNova/models/Customer.cs index 58d3f308..fa4344fa 100644 --- a/server/AyaNova/models/Customer.cs +++ b/server/AyaNova/models/Customer.cs @@ -40,9 +40,9 @@ namespace AyaNova.Models public string ContractViz { get; set; } public DateTime? ContractExpires { get; set; } [NotMapped] - public long? LastCompletedWorkOrderViz { get; set; } + public long? LastWorkOrderViz { get; set; } [NotMapped] - public DateTime? LastCompletedServiceDateViz { get; set; } + public DateTime? LastServiceDateViz { get; set; } public string Phone1 { get; set; } public string Phone2 { get; set; } public string Phone3 { get; set; } diff --git a/server/AyaNova/models/Unit.cs b/server/AyaNova/models/Unit.cs index 33469818..dfded60f 100644 --- a/server/AyaNova/models/Unit.cs +++ b/server/AyaNova/models/Unit.cs @@ -32,7 +32,7 @@ namespace AyaNova.Models public string ParentUnitViz { get; set; } public long? UnitModelId { get; set; } [NotMapped] - public string UnitModelViz { get; set; } + public string UnitModelNameViz { get; set; } public bool UnitHasOwnAddress { get; set; } public bool BoughtHere { get; set; } public long? PurchasedFromVendorId { get; set; } @@ -60,9 +60,9 @@ namespace AyaNova.Models public DateTime? LastMeterDateViz { get; set; } [NotMapped] - public long? LastCompletedWorkOrderViz { get; set; } + public long? LastWorkOrderViz { get; set; } [NotMapped] - public DateTime? LastCompletedServiceDateViz { get; set; } + public DateTime? LastServiceDateViz { get; set; } [NotMapped] public string LastMeterNotesViz { get; set; } diff --git a/server/AyaNova/resource/rpt/stock-report-templates/Example Inventory Reconciliation Form Grouped By Tag.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/Example Inventory Reconciliation Form Grouped By Tag.ayrt new file mode 100644 index 00000000..2c275dab --- /dev/null +++ b/server/AyaNova/resource/rpt/stock-report-templates/Example Inventory Reconciliation Form Grouped By Tag.ayrt @@ -0,0 +1 @@ +{"Name":"Example Inventory Reconciliation Form Grouped By Tag","Active":true,"Notes":"Example custom Prepare that groups by the Tags - nothing shows if no tags\nRecommended to use datalist Filter \"Contains\" to first filter by the Tag(s) desired","Roles":49258,"AType":90,"IncludeWoItemDescendants":false,"Template":"\n\n\t
\t \n\t\t \n \t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t \n \t\t\n\n\t\t\t \n\t\t\t\t{{#each ayReportData}} \n\t\t\t\t \n\t\t\t \t\t\n\t\t\t \t\t\n \t\t\n\t\t\t\t \t\t{{#each items}}\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t{{/each}}\n\t\t\t\t\n\t\t\t \t\n \t\t\n\t\t\t\t{{/each}}\n\t\t\t \n\n\t\t\t \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t \n \n\t\n\n","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 table-layout: fixed;\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: 14pt; \n text-align: center;\n} \n\n.bodyhead {\n border-style: solid;\n border-width: 1pt;\n border-color: #e8e5e5; \n margin: 10pt;\n background-color: #e8e5e5;\n font-size: 11pt; \n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\ntbody tr:nth-child(even) {\n font-size: 9pt;\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: 9pt;\n background-color: lightgoldenrodyellow; /* MUST checkmark Print background in PDF Options for this to show */\n height: 50px;\n} \n\n\ntfoot {\n /* display: table-footer-group; uncomment to print the table-footer on all pages, not just last page - */\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 \n bottom: 0;\n width: 100%;\n border-top: 1px solid black; \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(ayData) {\n\n\n //Group by all tags no filter\n ayData.ayReportData = ayGroupByTag(ayData.ayReportData);\n\n //Group by filtered tags that contain 'zone'\n //ayData.ayReportData = ayGroupByTag(ayData.ayReportData, 'zone');\n\n return ayData;\n}\n\nfunction ayGroupByTag(reportDataArray, tagContains) {\n //array to hold grouped data\n const ret = [];\n const containsQuery = tagContains != null && tagContains != '';\n\n//NOTE that tags are referred to as PartTags so this custom Prepare must reference PartTags, not Tags\n\n //iterate through the raw reprot data \n for (let i = 0; i < reportDataArray.length; i++) {\n //get a reference to each object to save typing\n let o = reportDataArray[i];\n //don't bother with any that don't have tags at all\n if (o.PartTags && o.PartTags.length) {\n //loop through all tags for this record\n o.PartTags.forEach(t => {//t=each tag\n //if not a contains query just process it, if it is a contains query then only process if tag contains tagContains\n if (!containsQuery || t.includes(tagContains)) {\n let groupObject = ret.find(z => z.group == t);\n if (groupObject != undefined) {\n //there is already a matching group in the return array so just push this raw report data record into it\n groupObject.items.push(o);\n //update the count for this group's items\n groupObject.count++;\n } else {\n //No group yet, so start a new one in the ret array and push this raw report data record\n ret.push({ group: t, items: [o], count: 1 });\n }\n }\n })\n }\n }\n\n //Sort based on the group name in a locale aware manner\n ret.sort(function (a, b) {\n return a.group.localeCompare(b.group);\n });\n return ret;\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":"    (set in report template's PDF Options) Printed date: ","FooterTemplate":"  (set in report template's PDF Options showing x of ALL pages printed)  Page  of ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"10mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/Example Parts grouped by Tags with optional filter by contains.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/Example Parts grouped by Tags with optional filter by contains.ayrt new file mode 100644 index 00000000..6d9c80c4 --- /dev/null +++ b/server/AyaNova/resource/rpt/stock-report-templates/Example Parts grouped by Tags with optional filter by contains.ayrt @@ -0,0 +1 @@ +{"Name":"Example Parts grouped by Tags with optional filter by contains","Active":true,"Notes":"Example custom Prepare that groups by the Tags - nothing shows if no tags\nRecommended to use datalist Filter \"Contains\" to first filter by the Tag(s) desired","Roles":124927,"AType":20,"IncludeWoItemDescendants":false,"Template":"\n\n\t
\t \n\t\t
 
My Company NameInventory Reconciliation Form
 
WarehouseCategoryPart Number and NameRetailOn HandActual CountDifference + / (-)
Parts tagged with: {{group}}# of parts for {{group}}: {{count}}
{{PartWarehouseName}}{{PartTags}} {{PartNumber}} {{PartName}}{{ayCurrency PartRetail}}{{OnHandQty}}
 
 
Count By:__________________________________________Count Date:__________________________________________
 
 
Signature:__________________________________________
\n \t\t\n\n \n \n \n \n \t\n \n \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t \n \n \n \t\t\n \t\n \t\t\n \n \n {{#each ayReportData}}\n \n \n\t\t\t \n\t\t\t \n \n\t\t {{#each items}}\n\t\t \n\t\t\t \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t \n \n\t\t\t{{/each}}\n\t\t\t\n\t\t\t \n \n \t {{/each}}\n \n
Parts by Tag
 
TagPartNumberNameManufacturerVizCostRetail
 
{{group}}# of parts for {{group}}: {{count}}
 {{PartNumber}}{{Name}}{{ManufacturerViz}}{{ayCurrency Cost}}{{ayCurrency Retail}}
 
\n\n\n \n\t
\n\n","Style":".singlePage\r\n{\r\npage-break-after: always;\r\n}\r\n\r\ntable { \r\n font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;\r\n border-collapse: collapse;\r\n white-space: pre-wrap;\r\n width: 100%;\r\n table-layout: fixed;\r\n }\r\n\r\nthead {\r\n display: table-header-group; /* so as to print the table-header on all subsequent pages */\r\n}\r\n\r\n.heading {\r\n border-style: solid;\r\n border-width: 1pt;\r\n border-color: #e8e5e5; \r\n margin: 10pt;\r\n background-color: #e8e5e5;\r\n padding: 5pt; \r\n font-size: 14pt; \r\n text-align: center;\r\n} \r\n\r\n.bodyhead {\r\n border-style: solid;\r\n border-width: 1pt;\r\n border-color: #e8e5e5; \r\n margin: 10pt;\r\n background-color: #e8e5e5;\r\n font-size: 12pt; \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}\r\ntbody tr:nth-child(even) {\r\n font-size: 9pt;\r\n background-color: lightgray; /* MUST checkmark Print background in PDF Options for this to show */\r\n height: 50px;\r\n overflow-wrap: break-word;\r\n} \r\ntbody tr:nth-child(odd) {\r\n font-size: 9pt;\r\n background-color: lightgoldenrodyellow; /* MUST checkmark Print background in PDF Options for this to show */\r\n height: 50px;\r\n overflow-wrap: break-word;\r\n} \r\n\r\n\r\ntfoot {\r\n /* display: table-footer-group; uncomment to print the table-footer on all pages, not just last page - */\r\n page-break-inside: avoid;\r\n /* position: fixed; uncommenting position: will force footer to bottom BUT then leftlean and rightlean don't work AND tbody overwrites */\r\n \r\n bottom: 0;\r\n width: 100%;\r\n border-top: 1px solid black; \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","JsPrerender":"async function ayPrepareData(ayData) {\n\n\n //Group by all tags no filter\n ayData.ayReportData = ayGroupByTag(ayData.ayReportData);\n\n //Group by filtered tags that contain 'zone'\n //ayData.ayReportData = ayGroupByTag(ayData.ayReportData, 'zone');\n\n return ayData;\n}\n\nfunction ayGroupByTag(reportDataArray, tagContains) {\n //array to hold grouped data\n const ret = [];\n const containsQuery = tagContains != null && tagContains != '';\n\n //iterate through the raw reprot data \n for (let i = 0; i < reportDataArray.length; i++) {\n //get a reference to each object to save typing\n let o = reportDataArray[i];\n //don't bother with any that don't have tags at all\n if (o.Tags && o.Tags.length) {\n //loop through all tags for this record\n o.Tags.forEach(t => {//t=each tag\n //if not a contains query just process it, if it is a contains query then only process if tag contains tagContains\n if (!containsQuery || t.includes(tagContains)) {\n let groupObject = ret.find(z => z.group == t);\n if (groupObject != undefined) {\n //there is already a matching group in the return array so just push this raw report data record into it\n groupObject.items.push(o);\n //update the count for this group's items\n groupObject.count++;\n } else {\n //No group yet, so start a new one in the ret array and push this raw report data record\n ret.push({ group: t, items: [o], count: 1 });\n }\n }\n })\n }\n }\n\n //Sort based on the group name in a locale aware manner\n ret.sort(function (a, b) {\n return a.group.localeCompare(b.group);\n });\n return ret;\n}","JsHelpers":"","RenderType":0,"HeaderTemplate":"    (set in report template's PDF Options) Printed date: ","FooterTemplate":"  (set in report template's PDF Options showing x of ALL pages printed)  Page  of ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"10mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/Example Units Per Customer .ayrt b/server/AyaNova/resource/rpt/stock-report-templates/Example Units Per Customer .ayrt index 65205246..f0b60ef6 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/Example Units Per Customer .ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/Example Units Per Customer .ayrt @@ -1 +1 @@ -{"Name":"Example Units Per Customer ","Active":true,"Notes":"Uses built in Helper ayGroupByKey ","Roles":50554,"AType":31,"IncludeWoItemDescendants":false,"Template":"\n\n\t
\t \n\t\t \n \t\t\n\n \n \n \n \n \t\n \n \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t \n \n \n \t\t\n \t\n \t\t\n \n \n {{#each ayReportData}}\n \n \n\t\t\t \n\t\t\t \n \n\t\t {{#each items}}\n\t\t \n\t\t\t \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t \n \n\t\t\t{{/each}}\n\t\t\t\n\t\t\t \n \n \t {{/each}}\n \n
Units per Customer
 
CustomerSerial NumberUnit ModelLast Closed Service DateLast Closed WONotes
 
{{group}}# of units for {{group}}: {{count}}
 {{Serial}}{{UnitModelViz}}{{ayDate LastCompletedServiceDateViz}}{{LastCompletedWorkOrderViz}}{{Notes}}
 
\n\n\n \n\t
\n\n","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 table-layout: fixed;\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: 14pt; \n text-align: center;\n} \n\n.bodyhead {\n border-style: solid;\n border-width: 1pt;\n border-color: #e8e5e5; \n margin: 10pt;\n background-color: #e8e5e5;\n font-size: 12pt; \n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\ntbody tr:nth-child(even) {\n font-size: 9pt;\n background-color: lightgray; /* MUST checkmark Print background in PDF Options for this to show */\n height: 50px;\n overflow-wrap: break-word;\n} \ntbody tr:nth-child(odd) {\n font-size: 9pt;\n background-color: lightgoldenrodyellow; /* MUST checkmark Print background in PDF Options for this to show */\n height: 50px;\n overflow-wrap: break-word;\n} \n\n\ntfoot {\n /* display: table-footer-group; uncomment to print the table-footer on all pages, not just last page - */\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 \n bottom: 0;\n width: 100%;\n border-top: 1px solid black; \n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData) {\n\n //send the raw report data to the groupByKey function which will return a new array grouped by the key name provided\n reportData.ayReportData = ayGroupByKey(reportData.ayReportData, 'CustomerViz')\n\n //return the data into the pipeline to send to the report template\n return reportData;\n}\n\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":"    (set in report template's PDF Options) Printed date: ","FooterTemplate":"  (set in report template's PDF Options showing x of ALL pages printed)  Page  of ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"10mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file +{"Name":"Example Units Per Customer ","Active":true,"Notes":"Uses built in Helper ayGroupByKey ","Roles":50554,"AType":31,"IncludeWoItemDescendants":false,"Template":"\n\n\t
\t \n\t\t \n \t\t\n\n \n \n \n \n \t\n \n \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t \n \n \n \t\t\n \t\n \t\t\n \n \n {{#each ayReportData}}\n \n \n\t\t\t \n\t\t\t \n \n\t\t {{#each items}}\n\t\t \n\t\t\t \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t \n \n\t\t\t{{/each}}\n\t\t\t\n\t\t\t \n \n \t {{/each}}\n \n
Units per Customer
 
CustomerSerial NumberUnit ModelLast Closed Service DateLast Closed WONotes
 
{{group}}# of units for {{group}}: {{count}}
 {{Serial}}{{UnitModelNameViz}}{{ayDate LastServiceDateViz}}{{LastWorkOrderViz}}{{Notes}}
 
\n\n\n \n\t
\n\n","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 table-layout: fixed;\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: 14pt; \n text-align: center;\n} \n\n.bodyhead {\n border-style: solid;\n border-width: 1pt;\n border-color: #e8e5e5; \n margin: 10pt;\n background-color: #e8e5e5;\n font-size: 12pt; \n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\ntbody tr:nth-child(even) {\n font-size: 9pt;\n background-color: lightgray; /* MUST checkmark Print background in PDF Options for this to show */\n height: 50px;\n overflow-wrap: break-word;\n} \ntbody tr:nth-child(odd) {\n font-size: 9pt;\n background-color: lightgoldenrodyellow; /* MUST checkmark Print background in PDF Options for this to show */\n height: 50px;\n overflow-wrap: break-word;\n} \n\n\ntfoot {\n /* display: table-footer-group; uncomment to print the table-footer on all pages, not just last page - */\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 \n bottom: 0;\n width: 100%;\n border-top: 1px solid black; \n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData) {\n\n //send the raw report data to the groupByKey function which will return a new array grouped by the key name provided\n reportData.ayReportData = ayGroupByKey(reportData.ayReportData, 'CustomerViz')\n\n //return the data into the pipeline to send to the report template\n return reportData;\n}\n\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":"    (set in report template's PDF Options) Printed date: ","FooterTemplate":"  (set in report template's PDF Options showing x of ALL pages printed)  Page  of ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"10mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/Example Units Per Customer using built in Helper and Prepare.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/Example Units Per Customer using built in Helper and Prepare.ayrt new file mode 100644 index 00000000..37eb5cf9 --- /dev/null +++ b/server/AyaNova/resource/rpt/stock-report-templates/Example Units Per Customer using built in Helper and Prepare.ayrt @@ -0,0 +1 @@ +{"Name":"Example Units Per Customer using built in Helper and Prepare","Active":true,"Notes":"Uses built in Helper ayGroupByKey via the Prepare to group Units by the same customer","Roles":50554,"AType":31,"IncludeWoItemDescendants":false,"Template":"\n\n\t
\t \n\t\t \n \t\t\n\n \n \n \n \n \t\n \n \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t \n \n \n \t\t\n \t\n \t\t\n \n \n {{#each ayReportData}}\n \n \n\t\t\t \n\t\t\t \n \n\t\t {{#each items}}\n\t\t \n\t\t\t \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t \n \n\t\t\t{{/each}}\n\t\t\t\n\t\t\t \n \n \t {{/each}}\n \n
Units per Customer
 
CustomerSerial NumberUnit ModelLast Closed Service DateLast Closed WONotes
 
{{group}}# of units for {{group}}: {{count}}
 {{Serial}}{{UnitModelNameViz}}{{ayDate LastServiceDateViz}}{{LastWorkOrderViz}}{{Notes}}
 
\n\n\n \n\t
\n\n","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 table-layout: fixed;\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: 14pt; \n text-align: center;\n} \n\n.bodyhead {\n border-style: solid;\n border-width: 1pt;\n border-color: #e8e5e5; \n margin: 10pt;\n background-color: #e8e5e5;\n font-size: 12pt; \n}\n\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\ntbody tr:nth-child(even) {\n font-size: 9pt;\n background-color: lightgray; /* MUST checkmark Print background in PDF Options for this to show */\n height: 50px;\n overflow-wrap: break-word;\n} \ntbody tr:nth-child(odd) {\n font-size: 9pt;\n background-color: lightgoldenrodyellow; /* MUST checkmark Print background in PDF Options for this to show */\n height: 50px;\n overflow-wrap: break-word;\n} \n\n\ntfoot {\n /* display: table-footer-group; uncomment to print the table-footer on all pages, not just last page - */\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 \n bottom: 0;\n width: 100%;\n border-top: 1px solid black; \n}\n\n\n.fontgreen {\n color: green;\n}\n.fontblue {\n color: blue;\n}\n.fontred {\n color:red;\n}\n\n","JsPrerender":"async function ayPrepareData(reportData) {\n\n //send the raw report data to the groupByKey function which will return a new array grouped by the key name provided\n reportData.ayReportData = ayGroupByKey(reportData.ayReportData, 'CustomerViz')\n\n //return the data into the pipeline to send to the report template\n return reportData;\n}\n\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":"    (set in report template's PDF Options) Printed date: ","FooterTemplate":"  (set in report template's PDF Options showing x of ALL pages printed)  Page  of ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"10mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/Sample Units with API method to get additional customer data.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/Sample Units with API method to get additional customer data.ayrt new file mode 100644 index 00000000..c899dd88 --- /dev/null +++ b/server/AyaNova/resource/rpt/stock-report-templates/Sample Units with API method to get additional customer data.ayrt @@ -0,0 +1 @@ +{"Name":"Sample Units with API method to get additional customer data","Active":true,"Notes":"Shows example of using Prepare to obtain additional data via the CustomerId\nNOTE: NEEDS UPDATING presently using 135 alpha key for Last WO and Last Service Date","Roles":124927,"AType":31,"IncludeWoItemDescendants":false,"Template":"\n \n\t
\t\n \n \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n \n\t\t\t\t\n \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n \n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t \n \t\t\n\t\t\t \n\t\t\t\t {{#each ayReportData}} \n \n\t\t\t\t\t\n \n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t \n\t\t\t\t {{/each}}\n\t\t\t \n
 
{{ ayLogo \"small\" }} 
Report using API method to obtain additional data about Customer
SerialUnit ModelCustomerLast WOLast Service DateCustomer Phone via APIUnit Notes
{{Serial}}{{UnitModelNameViz}}{{CustomerViz}}{{LastWorkOrderViz}}{{ayDate LastServiceDateViz}}{{myCustomerInfo.phone1}}{{Notes}}
\n\n \n {{#each ayReportData}}\n \n \n \n \n \n\t\t\t \n \n \n {{/each}}\n
This is a printout of the data returned from the Custom Prepare that this report now uses for each unit in the datalist. To display any of the Customer data ported over, just identify in mustaches myCustomerInfo.xxxx where xxx is the key as in CustomerInfo.phone1
{{ayJSON this}}
\n\n
\n\n","Style":".singlePage\r\n{\r\npage-break-after: always;\r\n}\r\n\r\ntable { \r\n font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;\r\n border-collapse: collapse;\r\n white-space: pre-wrap;\r\n width: 100%;\r\n table-layout: fixed;\r\n }\r\n\r\nthead {\r\n display: table-header-group; /* so as to print the table-header on all subsequent pages */\r\n}\r\n\r\n.heading {\r\n border-style: solid;\r\n border-width: 1pt;\r\n border-color: #e8e5e5; \r\n margin: 10pt;\r\n background-color: #e8e5e5;\r\n padding: 5pt; \r\n font-size: 14pt; \r\n text-align: center;\r\n} \r\n\r\n.bodyhead {\r\n border-style: solid;\r\n border-width: 1pt;\r\n border-color: #e8e5e5; \r\n margin: 10pt;\r\n background-color: #e8e5e5;\r\n font-size: 12pt; \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}\r\ntbody tr:nth-child(even) {\r\n font-size: 9pt;\r\n background-color: lightgray; /* MUST checkmark Print background in PDF Options for this to show */\r\n height: 50px;\r\n overflow-wrap: break-word;\r\n} \r\ntbody tr:nth-child(odd) {\r\n font-size: 9pt;\r\n background-color: lightgoldenrodyellow; /* MUST checkmark Print background in PDF Options for this to show */\r\n height: 50px;\r\n overflow-wrap: break-word;\r\n} \r\n\r\n\r\ntfoot {\r\n /* display: table-footer-group; uncomment to print the table-footer on all pages, not just last page - */\r\n page-break-inside: avoid;\r\n /* position: fixed; uncommenting position: will force footer to bottom BUT then leftlean and rightlean don't work AND tbody overwrites */\r\n \r\n bottom: 0;\r\n width: 100%;\r\n border-top: 1px solid black; \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","JsPrerender":"async function ayPrepareData(ayData) {\n\n //Loop through all the records in the raw report data\n for (let i = 0; i < ayData.ayReportData.length; i++) {\n //set a temporary variable to each record to save typing it all out\n let item = ayData.ayReportData[i];\n\n //call into the AyaNova API and get the customer record for this report data's customer id\n const apiResult = await ayGetFromAPI(`customer/${item.CustomerId}`);\n\n //if a result comes back, insert it into the report data so it's available to the template\n if (apiResult) {\n //put the return data customer record on a key in each record called 'myCustomerInfo' (you can call it anything as long as it doesn't conflict with an existing key)\n item.myCustomerInfo = apiResult.data\n }\n }\n return ayData;\n}","JsHelpers":"","RenderType":0,"HeaderTemplate":"    (set in report template's PDF Options) Printed date: ","FooterTemplate":"  (set in report template's PDF Options showing x of ALL pages printed)  Page  of ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":true,"MarginOptionsBottom":"10mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"10mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.00000} \ No newline at end of file diff --git a/server/AyaNova/util/AyaNovaVersion.cs b/server/AyaNova/util/AyaNovaVersion.cs index b175da99..ea4137d4 100644 --- a/server/AyaNova/util/AyaNovaVersion.cs +++ b/server/AyaNova/util/AyaNovaVersion.cs @@ -5,7 +5,7 @@ namespace AyaNova.Util /// internal static class AyaNovaVersion { - public const string VersionString = "8.0.0-alpha.135"; + public const string VersionString = "8.0.0-alpha.137"; public const string FullNameAndVersion = "AyaNova server " + VersionString; }//eoc }//eons \ No newline at end of file