Template description

Credit receipt template

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

Advance receipt example

Basic receipt template structure:

{
    "margin_left": 0,
    "margin_right": 10,
    "variables": {
      "type_advance": "Credit"
    },
    "header":[  ],
    "positions":[  ],
    "position_totals":[  ],
    "payments":[  ],
    "footer":[  ]
}

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 ("*").

Text variables:

  • "type_advance": "Credit" - Text of the doc.type variable in a credit receipt

The template then contains the following sections:

1. header - Receipt template header.

May contain information about the shift, cashier, cash register, and sale date.

Example of the header section:

"header": [
    {
      "text": "",
      "font": "",
      "interval": 10,
      "img_src": "1",
      "alignment": 1,
      "img_width": 200,
      "img_height": 159
    },
    {
      "text": "<company.name> ",
      "font": "Lucida Console, 8pt, style=bold",
      "interval": -10,
      "alignment": 1
    }
]

The following variables are available in this section:

  • doc.code - Document code
  • doc.date - Receipt registration date
  • doc.time - Receipt registration time
  • doc.session - Cash register shift in which the receipt is registered
  • doc.cashier_name - Cashier name
  • doc.cash_id - Cash register ID
  • doc.type - Document type. Its value is taken from the variables at the beginning of the template
  • doc.fiscal_sign - Receipt fiscal signature
  • doc.terminal_id - Fiscal module ID
  • doc.sn - REGOS: VCR serial number
  • doc.qr_code - QR code
  • doc.total_recieved - Total payments received
  • doc.duplicate - Receipt duplicate number. This variable is not displayed when the receipt is printed for the first time
  • company.inn - Company TIN
  • company.name - Company name
  • company.address - Retail outlet or company address
  • company.phone - Contact phone number

This section supports custom variables passed directly in the receipt. The variable name uses the following format:
custom., where name is the value of the name field in custom_variables

Image block

If a text block in this 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 of an image block:

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

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 of a barcode block:

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

2. positions - List of items.

Contains the list of items, their quantities, and prices.

Example of the positions section:

"positions":[
    {
      "text": "<pos.n>. <pos.name> [<pos.unit>]",
      "font": "Lucida Console, 7pt",
      "interval": 15,
      "alignment": 0
    },
    {
      "text": "Sh.k: <pos.barcode>",
      "font": "Lucida Console, 7pt",
      "interval": 15,
      "alignment": 0
    }
]

The following variables are available in this section:

  • pos.n - Item line number
  • pos.name - Item name
  • pos.code - Item code
  • pos.articul - Item SKU
  • pos.unit - Item quantity unit of measure
  • pos.unit2 - Item quantity unit of measure with KDT
  • pos.kdt - Item quantity with KDT
  • pos.size - Item size
  • pos.color - Item color
  • pos.brand - Item brand
  • pos.producer - Item manufacturer
  • pos.country - Item country of manufacture
  • pos.department - Item department
  • pos.group - Item group
  • pos.quantity - Item quantity
  • pos.price - Item price
  • pos.amount - Item amount (pos.quantity * pos.price)
  • pos.vat_value - VAT rates
  • pos.vat_amount - VAT amount
  • pos.discount - Discount percentage
  • pos.amount_discount - Discount amount
  • pos.icps - ICPS. Note: place this field in a separate block
  • pos.label - Marking code. Note: place this field in a separate block
  • pos.owner_type - Item origin
  • pos.barcode - Barcode digits
  • pos.inn - Commission agent TIN

3. position_totals - Item totals.

Contains the total amount and discount amount.

Example of the position_totals section:

"position_totals":[
    {
      "text": "<DF>",
      "font": "Lucida Console, 8pt",
      "interval": -10,
      "alignment": 1
    },
    {
      "text": "Jami:<SF><pos.total_amount>",
      "font": "Lucida Console, 8pt",
      "interval": -10,
      "alignment": 0
    }
]

The following variables are available in this section:

  • pos.total_amount - Total receipt amount including the discount
  • pos.total.discount - Discount amount
  • pos.total_recieved - Total payments received
  • payment.total_other - Total paid using other payment methods (not currently used)
  • pos.total_price - Amount due
  • pos.total_vat - VAT amount

4. payments - List of payments.

Contains the list of payments, the amount of each payment, and its type.

Example of the payments section:

"payments":[
    {
      "text": "<payment.type_name><SF><payment.value>",
      "font": "Lucida Console, 8pt",
      "interval": -10,
      "alignment": 0
    }
]

The following variables are available in this section:

  • payment.type_name - Payment type name
  • payment.value - Payment type value

Contains additional information.

Example of the footer section:

"footer":[
    {
      "text": "FB:<doc.fiscal_sign>",
      "font": "Lucida Console, 8pt",
      "interval": -10,
      "alignment": 0
    },
    {
      "text": "FM chek raqami:<doc.id>",
      "font": "Lucida Console, 8pt",
      "interval": -10,
      "alignment": 0
    }
]

The same variables as in the header block are available in this section.

Sale (refund) receipt example