From f9af8c939c1a26f89bf4c8e297c9885e688fb924 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 14 Sep 2020 23:36:04 +0000 Subject: [PATCH] --- devdocs/specs/core-reporting.txt | 17 ++++++ docs/8.0/ayanova/docs/form-ay-report-edit.md | 63 +++++++++++++++++--- 2 files changed, 72 insertions(+), 8 deletions(-) diff --git a/devdocs/specs/core-reporting.txt b/devdocs/specs/core-reporting.txt index 652930a5..abb3d3b1 100644 --- a/devdocs/specs/core-reporting.txt +++ b/devdocs/specs/core-reporting.txt @@ -134,3 +134,20 @@ Render outputs PDF: https://jsreport.net/learn/pdf-recipes Outputs 5 different pdf converters because they all support different feature sets which is ominous + + +BAR CODE STUFF + Bar codes: https://github.com/metafloor/bwip-js + https://stackoverflow.com/questions/19017512/use-canvas-inside-a-handlebars-template + https://github.com/metafloor/bwip-js#browser-usage + https://www.scandit.com/blog/types-barcodes-choosing-right-barcode/ + https://github.com/metafloor/bwip-js/wiki/BWIPP-Barcode-Types + + let opt = { + bcid: "code128", // Barcode type + text: "0123456789", // Text to encode + scale: 3, // 3x scaling factor + height: 10, // Bar height, in millimeters + includetext: true, // Show human-readable text + textxalign: "center" // Always good to set this + }; diff --git a/docs/8.0/ayanova/docs/form-ay-report-edit.md b/docs/8.0/ayanova/docs/form-ay-report-edit.md index 667cac52..1fe3c0b9 100644 --- a/docs/8.0/ayanova/docs/form-ay-report-edit.md +++ b/docs/8.0/ayanova/docs/form-ay-report-edit.md @@ -36,6 +36,8 @@ The main HTML / Handlebars template. This is where the report is defined and is In order to get up to speed quickly with report design we recommend looking over the stock reports provided as well as referring to the [Handlebars documentation](https://handlebarsjs.com/guide/#what-is-handlebars) + + ### CSS This section is provided to define the HTML Cascading Style Sheet for the report document. This section is optional. @@ -99,6 +101,29 @@ For example if you are reporting off a Customer you would design a report that c The data provided to the report consists of the same fields visible in the user interface when editing that record and in addition, where appropriate, extra fields to bring in commonly required data from other objects that are linked. +#### Custom fields + +In AyaNova an object can have up to 16 customizable fields of extra data. In the `SAMPLE DATA` area of the reported editor interface you can see the custom field data, for example: + +``` +"CustomFields": { + "c1": "2019-11-02T00:28:03.3193287Z", + "c2": "Aperiam sequi dolores consequatur temporibus ducimus rerum.", + "c3": 81510873, + "c4": false, + "c5": 0.119726536851249 + }, +``` + +In the above example you can see that there are four custom fields containing data. To access this data in your report template use dot notation to drill down to the custom field desired, for example {{ CustomFields.c1 }} in the template would return the date and time stamp in the above example. + +To format that data into local time zone and display format you would use a date time helper exactly as with non custom fields: {{ ayDT CustomFields.c1 }} would format the time stamp correctly for the user's browser settings. + +Empty or non existent custom fields reference will simply result in nothing being returned for that value, so if your template had {{ CustomFields.c6 }} using the above record would simply return nothing / empty string. + +The if the custom field definitions are changed for an object then the reports would need to also be changed to match, so for example if the c1 value was turned into a text field instead of a datetime field then the reports would need to be changed to match (for example removing the ayDT helper as it would now be a text field). + + #### Localization Localization, the display of Dates, Times, Numbers and AyaNova translated text is a *Client* responsibility in AyaNova. @@ -160,6 +185,30 @@ ayServerMetaData: Several helpers are pre-defined for use with reports: +### ayBC + +Bar code helper used to render any of over 100 types of bar codes on reports. + +This helper uses the [bwip-js](https://github.com/metafloor/bwip-js) open source bar code library to generate the bar codes. + +The helper is coded to accept two parameters, the data object template field name first and the options to pass to the bar code generator as a string of JSON encoded text corresponding to the [options](https://github.com/metafloor/bwip-js#working-with-bwip-js-methods) property of the bar code writer. + +`bcid` is the only *required* part of the option parameter that must be provided and identifies which type of bar code will be rendered, there are [many bar code types](https://github.com/metafloor/bwip-js/wiki/BWIPP-Barcode-Types) available. + +In AyaNova the `text` option of the `options` property is automatically set to the report template field data for you. + +#### Gotchas + +* Quotes: Be careful how you specify quotation marks around the options property, use full quotes for the inner field and property values and single quotes to enclose the whole string of JSON as in this example: + +```{{ ayBC ReportFieldName '{ "bcid": "code128"}' }}``` + +* Validity: certain bar codes (such as UPC) have a built in checksum validity check and will not render if the value is not valid. So, for example, you cannot use any random number as a UPC code, it *must* contain valid checksum characters. Or for example an EAN-13 code *must* contain 13 characters or it will not be valid either. + +If you are using bar codes only for internal purposes there are many forgiving options available such as Code39 barcodes (or Code 3 of 9) which do not require a check digit and can store up to 39 digits or QR Code or PDF417 '2d' bar codes which can store alphanumeric and ad-hoc data suitable for scanning with camera devices. + +For full details please refer to the examples and direct links to the open source documentation above on each type of bar code specifically and advanced options usage. + ### ayCaps Format value as all capitals: @@ -225,14 +274,6 @@ For example: Will render the small sized logo as an image tag set to the correct API Url. Note that if you do not upload a logo then this will display a broken image icon instead. -### ayMarkdown - -Format a Markdown formatted field such as a Wiki field on an object into HTML in a similar manner to how they are displayed in the AyaNova user interface WIKI fields: - -```{{ ayMarkdown wiki }}``` - -This is what you use to display a Wiki (or any Markdown formatted text) in a report. AyaNova uses the [Marked](https://marked.js.org/) library to turn Markdown into HTML for display both in the user interface and in reports. - ### ayT Translates an AyaNova translation key into the language indicated by the current logged in user or the server default: @@ -248,7 +289,13 @@ Formats a raw DateTime stamp into a short time only (no date) in the locale form ```{{ ayTime startDate }}``` +### ayWiki +Format a Wiki Markdown formatted field such as a Wiki field on an object into HTML in a similar manner to how they are displayed in the AyaNova user interface WIKI fields: + +```{{ ayMarkdown wiki }}``` + +This is what you use to display a Wiki (or any Markdown formatted text) in a report. AyaNova uses the [Marked](https://marked.js.org/) library to turn Markdown into HTML for display both in the user interface and in reports. ## API Usage