Skip to main content

Receipt Layout

Receipt-Poland

Layout

For printing a fiscal transaction, the data has to be formatted, which is done using the HTML templating engine PUG (former JADE). Language details can be found on pugjs.org.

For Italian fiscal printers, the item description and additional text lines may be formatted freely, but referring amounts are created by the printer in a fixed format.

The following rules occur for fiscal receipts:

  • one transaction specific barcode may be printed in the footer
  • paper is cut after print completion For details of layout commands see chapter 4 PUG Layout.

You can start Layout editor on page kontrola in section PugEdit for layout configuration, it works as a WYSIWYG editor. Actual printout may differ due to limitations of the fiscal printer compared to HTML.

Besides fiscal.pug different non-fiscal layout files can be provided on directory /EFR/rn/def/cfg, the file name is derived from the DT or NF tag: NF="Login" => "login.pug" (filename lowercase).

For non-fiscal printouts:

  • the whole print line width (46 characters) can be used
  • lines can be formatted emphazised (<em>) or double height (<h3>)

Transaction Time

The fiscal printer itself has a clock. Date and time printed on the receipt are printer time; transaction date ESR.D is not used.

Printing of Payments

This chapter does not apply to the new FP-T88FVA Online printer. Due to Polish fiscal regulations the payment procedure is considered as optional – it is not required to record payments. It is only allowed to print predefined texts for payments on the printer, and amounts are printed right-aligned. To use one of these texts please send Pay.PayG with one of the following values:

AWpłacono
CKaucja
DWypłata kaucji
EGotówka
FCzek
GKarta kredytowa
HVoucher
KKredyt lokalny
UWartość Voucher
VZapłacono Voucher
WWaluta wartość
aPłatność
iZaliczka
tKarta

Example:

<PayA>
<Pay Dsc="EUR" Amt="10.00" PayG="C"/>
</PayA>

This would print the line: Kaucja 10.00

It is only allowed to print parameterized predefined texts in the footer, parameters are printed right-aligned. To use these, the lines have to start with one of the following predefined texts:

Predefined textParameter type ExorigoParameter type POSNET
Reszta4
linia bez słowa kluczowego1
Bez narzutu1
Numer14
Przebieg km1
Waluta14
Stan licznika1
Nr transakcji14
Numer kierowcy1
podpis-
Przelicznik44
Kasjer24
Przedpłata do paragonu1
Przedpłata do faktury1
Uwzględniono rabat1
Do zapłaty1
Do wypłaty1
pusta linia (spacje)-
Wypłata zaliczki1
Udzielony rabat14
Punkty – bonus14
Punkty – paragon14
Razem punktów14
Numer karty14
Zyskałeś1
Przyznano pkt1
Stan konta1
Dziękujemy za lojalność-
Typ karty14
Ważnado14
Numer kasy1
Numer zmiany1
Nr pracownika14
Nazw. pracownika2
Konto przed tr.14
Przyznano14
Wykorzystano14
Kontopotr.14
Klient stały14
Ilość sprzed. tow.14
Kod44
Nazwa44
Opis44
Liczba44
Nazwisko44
Nr zamówienia44
Numer rej4
Nazwa. kasjera4
Zaliczka4
Voucher4
Wartość Voucher4
Zapłata Voucher4
Numer pracownika4

Parameter Types

Type 1 Parameter is a string that contains digits, special characters, blanks (ASCII code 0x20), and maximum 3 different letters or characters. The length of the string is from 1 to 24 characters.

Type 2 Parameter is a string that contains letters, special characters, blanks (ASCII code 0x20), and maximum 3 different digits. The length of the string is from 1 to 24 characters.

Type 4 Wide range of characters, footers do not contain LF characters. The length of the string is from 1 to 40 characters.

PUG Editor

Workflow:

  • start http://localhost:5618/peri/pugedit with a browser
  • [open] e.g. file /EFR/rn/[your-client-id]/cfg/fiscal.pug
  • copy your sample transaction data into the textbox at the left side (JSON only)
  • the right side box shows the transaction data transformed to HTML
  • modifications in PUG code (center box) are shown immediately
  • when finished [download] e.g. as fiscal.pug and copy it to
    /EFR/rn/[your-client-id]/cfg/

EFR now transforms every transaction into HTML and renders to the line printer. By their nature fiscal printers provide only very limited formatting functionality. At the moment the editor implementation is basic, but it is going to be evolved as base technique for transaction rendering and print layout.

Layout Example

/EFR/app/PL/cfg/fiscal.pug.template:

//- fiscal.pug - Layout for Fiscal Transactions

-
function fDec(dec) { return dec.replace(/\./,',') }
function fQty(Qty) { if (Qty || Qty===0) return fDec(Qty.toString()) }
function fAmt(Amt) { if (Amt || Amt===0) return fDec(Amt.replace?Amt:Amt.toFixed(2))
}
function fPrc(Prc) { return fDec((Prc+'%').replace(/%%$/,'%')) }
function fD(D) { return D.substr(8,2)+'-'+D.substr(5,2)+'-'+D.substr(2,2) }
function fTime(D) { return D.substr(11,8).replace(/^0/,'') }

mixin row(arr)
if arr
hr
each e in arr
div(class=e._)
if e.Qty
.Lin
.Dsc2= ' ' + fQty(e.Qty) + ' ' + (e.QtyU||'') + ' x ' + fAmt(e.Pri)
if e.TaxG
if e._!='Tax'
.Dsc= e.Dsc
else
.DscTax
.Prc= fPrc(e.Prc)
.Net= fAmt(e.Net)
.TAmt= fAmt(e.TAmt)
.TaxG= e.TaxG
else if e.Dsc
.Dsc2= e.Dsc
if !/^-*$/.test(e.LAmt)
.Amt= fAmt(e.LAmt||e.Amt)
else
.Amt
hr
mixin txt(arr)
if arr
br
each e in arr
.Txt= 'string'===typeof e ? e : 'Txt'===e._ ? e.value : unknown

html
head
title= ESR.DT||ESR.NF||'Receipt'
style(type='text/css').
body { font-family:Courier; width:46ch }
.Txt { text-align:center; white-space:pre }
.Pos,.Mod,.Lin,.Tot,.Pay,.Tax
{ display:grid; grid-template-columns:35ch 1ch 8ch }
.Dsc { grid-column:1 }
.TaxG { }
.Dsc2 { grid-column:1/span2 }
.DscTax { width:90%; display:grid; grid-template-columns:4fr 10fr 10fr }
.Prc { }
.Net, .TAmt { text-align:right }
.Amt { text-align:right; grid-column:3 }
@media fiscal {
.Txt,.Tax,.Tot { display:none }}
body
if Sto
.Txt= Sto.Name + ' ' + Sto.Add1
.Txt= Sto.Zip + ' ' + Sto.City + ' TaxId: ' + Sto.VatR
+txt(ESR.Head)
+row(ESR.PosA)
+row([{ _: 'Tot', Dsc: 'TOTAL', Amt: ESR.T }])
+row(ESR.PayA)
+row(ESR.TaxA)
+txt(ESR.Foot)
hr
.Txt= 'Terminal: ' + ESR.TL + '/' + ESR.TT + ' ' + (ESR.NF||'Receipt') + ': ' +
ESR.TN
.Txt= fD(ESR.D) + ' ' + fTime(ESR.D)

Restrictions

The fiscal printer allows only layout of item text, amounts are formatted by the printer. Although transaction data usually is provided with UTF-8 encoding, only CP852 characters can be printed.

Barcode

To add a barcode to a fiscal or non-fiscal layout enter:

div
img(data-barcode="type=ean13" data-value="123456789012" style="width:30ch;height:3ch")

The data-barcode attribute defines barcode parameters, data-value the content. Style (local or CSS) is used for dimensioning. On fiscal layouts, barcodes are only allowed in the footer of the receipt and only 1 barcode can be printed per position. By defining pos in the data-barcode attribute, barcodes can be positioned before (pos=1) or after the footer (pos=2):

div
img(data-barcode="type=qr;pos=1" data-value="123456789012")

data-barcode

typecharacter set (as regular expression)
upc-aA[0-9]{11,12}
ean13C[0-9]{12,13}
ean8D[0-9]{7,8}
code39E[0-9A-Z $%*+-./]{1,34}
itfF[0-9]{2,62}
codabarG[0-9A-Da-d$+-.&/:]{1,47}
code93H[\u0000-\u007f^{
code128-a73[\u0000-\u007f^{
code128-b74[\u0000-\u007f^{
code128-c91[\u0000-\u007f^{
qrR.*

data-value

For EAN types an eventually missing check digit is computed by EFR.

The data-value can be set programmatically:

div
- var x = ESR.TL + ("0" + ESR.TT).slice(-2) + ("00000" + ESR.TN).slice(-6)
img(data-value=x style="width:30ch;height:3ch")

Example Response

XML Response

XML Response:

<TraC SQ="3803">
<Result RC="OK"/>
<Fis D="10-09-18 14:36" FN="25" ZI="5" ID="CCO1800000739"/>
</TraC>

JSON Response

JSON Response:

{
"TraC":{"SQ":3800,
"Result":{"RC":"OK"},
"Fis":{"D":"10-09-18 14:34","FN":22,"ZI":5,"ID":"CCO1800000739"}}}

Response Fis fields:

ElementDescription
Dfiscal printer Date and time
FNreceipt Fiscal Number
ZIZ report Index
IDfiscal printer ID