Template description

Z-report opening receipt template

The template has a strictly defined but extensible structure. The receipt template is described in JSON format and contains required variables.

Z-report opening receipt example

Basic receipt template structure:

{
  "margin_left": 0,
  "margin_right": 10,
  "body":[  ]
}
Variables that control data display:
  • "margin_left" - Left margin in pixels;
  • "margin_right" - Right margin in pixels;
  • "alignment" - Text alignment: 0 - left, 1 - center, 2 - right;
  • - Fill with spaces (" ");
  • - Fill with dashes ("-");
  • - Fill with underscores ("_");
  • - Fill with equals signs ("=");
  • - Fill with plus signs ("+");
  • - Fill with asterisks ("*").

The template structure contains one section:

body - Receipt template body.

Contains information about the Z-report, its opening date, and other details.

"body":[
    {
      "text" : "ОТКРЫТИЕ ZReport",
      "font" : "Lucida Console, 8pt, style=bold",
      "interval" : 3,
      "alignment": 1
    },
    {
      "text" : "#<zreport.start_datetime>",
      "font" : "Lucida Console, 8pt, style=bold",
      "interval" : 3,
      "alignment": 1
    },
    {
      "text" : "<AF>",
      "font" : "Lucida Console, 8pt",
      "interval" : 3,
      "alignment": 1
    },
  ]

The following variables are available in this section:

  • company.inn - Company TIN
  • company.name - Company name
  • company.address - Retail outlet or company address
  • company.phone - Contact phone number
  • zreport.terminal_id - Fiscal module ID
  • zreport.id - Z-report number
  • zreport.start_datetime - Z-report opening date

If a text block in the section contains the following tags, its text content is ignored and the specified image is displayed instead:

  • "img_src":"\Cheque\regos.png" - Image path
  • "img_width":180 - Image width in pixels
  • "img_height":180 - Image height in pixels

Example:

    {
      "text" : "",
      "font" : "",
      "interval" : 30,
      "alignment": 1,
      "img_src":"\\Cheque\\regos.png",
      "img_width":180,
      "img_height":180
    },

If a text block in this section contains the following tags, its text content is encoded as the specified barcode type and displayed in the block:

  • "barcode_height":50 - Barcode height in pixels
  • "barcode_module":2 - Barcode size, expressed as a scale factor. The minimum value is 1.
  • "barcode_show_text":(true, false) - Display text below the barcode
  • "barcode_type":1 - Barcode type: 1 - Code128, 2 - EAN13, 3 - QRCode

Example:

{
      "font" : "Lucida Console, 8pt",
      "text" : "<company.name>",
      "barcode_height":50,
      "barcode_module":2,
      "barcode_show_text":false,
      "barcode_type":1,
      "interval" : 30,
      "alignment": 1
    },

Z-report opening receipt example