Anda di halaman 1dari 73

PROTOCOL AND COMMANDS

MANUAL FOR FISCAL PRINTERS


The Factory HKA

Rev 1.2
14/09/2011

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL
PRINTERS
The Factory HKA

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

INDICE
1.

COMMUNICATION PROTOCOL OVERVIEW ................................................................ 5


1.1.

Setup ............................................................................................................................. 5

1.2.

Handshaking and protocol frame ............................................................................... 5

1.2.1.

Control Characters............................................................................................... 5

1.2.2.

Sequence of Communication Commands ........................................................... 7

1.2.3.

COMMANDS DESCRIPTION .......................................................................... 10

2.

SOFTWARE INTEGRATION & ISSUANCE OF DOCUMENTS .................................. 11

3.

COMMANDS TO PROGRAMMING PRINTER PARAMETERS ................................... 12


3.1.

Cashier........................................................................................................................ 12

3.2.

Means of payment...................................................................................................... 13

3.3.

Time ............................................................................................................................ 13

3.4.

Date............................................................................................................................. 14

3.5.

Tax Rates .................................................................................................................... 14

3.5.1.

Registration Tax Rates in Fiscal Memory ........................................................ 14

3.5.2.

Header and footer............................................................................................... 15

3.6.
4.

Flags ........................................................................................................................... 16

COMMANDS TO THE ISSUANCE OF AN INVOICE ................................................... 19


4.1.

Cashiers ...................................................................................................................... 20

4.1.1.

Login of Cashier ................................................................................................. 20

4.1.2.

Logout of Cashier ............................................................................................... 20

4.2.

Register of Customer ................................................................................................. 21

4.3.

Social Reason of Customer ........................................................................................ 21

4.4.

Additional information of Customer ........................................................................ 21

4.5.

Comment .................................................................................................................... 22

4.6.

Register of a Product ................................................................................................. 22

4.7.

Product Correction ..................................................................................................... 24

4.8.

Subtotal ...................................................................................................................... 24

4.9.

Discount ...................................................................................................................... 25

4.10.

Invoice Cancellation............................................................................................... 26

4.10.1.

Cancellation of an Item in the invoice .............................................................. 26

4.10.2.

Cancellation of an invoice .................................................................................. 27

4.11.

Means of payment .................................................................................................. 27


2

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
4.11.1.

Direct Mean of Payment .................................................................................... 27

4.11.2.

Partial Mean of Payment................................................................................... 28

4.12.
5.

Rev 1.2
14/09/2011

Barcode Command ................................................................................................. 29

COMMANDS TO ISSUANCE OF CREDIT NOTE......................................................... 29


5.1. Register of Client............................................................................................................ 31

6.

7.

8.

9.

5.1.

Social Reason of Client .............................................................................................. 31

5.2.

Number of related receipt ......................................................................................... 31

5.3.

Additional information of client................................................................................ 32

5.4.

Comment .................................................................................................................... 32

5.5.

Register a Product in a Credit Note ......................................................................... 33

5.6.

Cancellation of an Item ............................................................................................. 34

5.7.

Closure ........................................................................................................................ 34

Debit Notes Commands ..................................................................................................... 36


6.1.

Register of Client ....................................................................................................... 37

6.2.

Social Reason of Client .............................................................................................. 37

6.3.

Number of related receipt ......................................................................................... 37

6.4.

Additional information of client................................................................................ 38

6.5.

Comment .................................................................................................................... 38

6.6.

Register a Product in a Debit Note........................................................................... 39

6.7.

Cancellation of an Item ............................................................................................. 40

6.8.

Closure of the Debit Note .......................................................................................... 41

COMMANDS TO ISSUANCE OF NON FISCAL DOCUMENTS ................................. 42


7.1.

Text in a Non-Fiscal Document ................................................................................ 43

7.2.

Opening of Cash Desk ............................................................................................... 43

7.3.

To withdraw and fund of cash-drawer...................................................................... 44

7.4.

Closure of Outcome / Income Cash Report (Fund of drawer) ................................. 44

7.5.

Printing Fiscal Printer programming ...................................................................... 45

COMMANDS TO HANDLE THE DISPLAY ................................................................... 46


8.1.

Show Time and Date ................................................................................................. 46

8.2.

Show Commercial Message ....................................................................................... 46

8.3.

Show Message ............................................................................................................ 47

8.4.

Programming of Commercial Messages on Display ................................................ 47

COMMANDS TO READ FISCAL PRINTER STATUS ................................................... 48

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

9.1.

Status S1 .................................................................................................................... 48

9.2.

Status S2 .................................................................................................................... 50

9.3.

Status S3 .................................................................................................................... 51

9.4.

Status S4 .................................................................................................................... 52

9.5.

Status S5 .................................................................................................................... 53

9.6.

Status S6 .................................................................................................................... 54

9.7.

Status S7 .................................................................................................................... 55

10.

COMMANDS FOR THE ISSUANCE OF REPORTS ................................................. 56

10.1.

X & Z Report ........................................................................................................... 57

10.2.

Fiscal Memory Reports .......................................................................................... 57

10.2.1.

Fiscal Memory Report by Dates ........................................................................ 57

10.2.2.

Fiscal Memory Reports by Z number................................................................ 58

10.3.

11.

10.3.1.

Reprint Documents command ........................................................................... 61

10.3.2.

Re-printing documents by number of CIP........................................................ 62

10.3.3.

Printing Electronic Journal Status................................................................... 63

COMMANDS FOR THE ISSUANCE OF CHECKS ................................................... 63

11.1.

Check ...................................................................................................................... 65

11.1.1.

Slip Mode ............................................................................................................ 65

11.1.2.

Check Format (Frontal Part) ............................................................................ 65

11.1.3.

Check Format (Endorsement) ........................................................................... 66

11.1.4.

Print Endorsement............................................................................................. 67

11.2.

Validation Commands............................................................................................ 69

11.2.1.

Validation Mode.................................................................................................. 69

11.2.2.

Print Validation .................................................................................................. 69

11.2.3.

MICR Reading .................................................................................................... 69

11.3.

12.

Electronic Journal Documents & Status .............................................................. 60

Gift Certificate and POS note: .............................................................................. 70

11.3.1.

On and Off of the Slip: ....................................................................................... 70

11.3.2.

Lines of Information .......................................................................................... 71

11.3.3.

Gif certifcate and POS note: ............................................................................. 71

ERROR LIST ................................................................................................................. 72

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

1. COMMUNICATION PROTOCOL OVERVIEW

1.1. Setup
The communication process is through the printer RS232 port as follows:

The Host (PC) activate CTS signal

The fiscal printer activate DTR signal as answer to indicate that it is


possible to receive.
Parameters to configuration of Serial Port
Data Transmission
Serial, Asynchrony
Baud Rate
9600 bps
Data Bits
8 bits
Parity
Even
Stop Bits
1

1.2. Handshaking and protocol frame

1.2.1. Control Characters


STX
ENQ
ETX
EOT
ACK
NAK
ETB
LRC

02h
05h
03h
04h
06h ( Acknowledgement)
15h (No Acknowledgement)
17h
(XOR) from data beginning (not including STX) to ETX,
(not including ETX).

 Send ACK: Indicates that following conditions are accomplished


LRC and Data are right.
5

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

The command is acceptable in the current condition of the machine.




Send NAK: Indicates that following conditions are accomplished

LRC is not right.

 Frame description:

 Examples:
 Command S1:

Command in Ascii Format:

STX

S1

ETX

LRC

03h

61h

XOR
LRC: Result of XOR calculation

Command in Hexadecimal Format:

02h

53h 31h
53h XOR 31h
Result: 62h

62h XOR 03h


Result: 61h

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

 Closure report command: I0X

Command in Ascii Format:

STX

I0X

ETX

LRC

03h

22h

XOR
LRC: Result of XOR calculation

Command in Hexadecimal Format:

02h

49h 30h 58h


49h XOR 30h
Result: 79h
79h XOR 58h
Result: 21h

21h XOR 03h


Result: 22h

1.2.2. Sequence of Communication Commands


 Status Read

PC
ENQ



Fiscal Printer
STX-STATUS-ETX-LRC

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

STATUS response has the following structure:

STS1

01x x x x x 1
01 x x x x 1 x
01 x x x 1 x x
01 x x 1 x x x
01 x 1 x x x x
01 1 x x x x x

In Fiscal Transaction
In Non Fiscal Transaction
Buffer Full
Memory Full
Fiscal Memory Near Full
Fiscal Mode

For example STS1 value is:


0x61: The printer is in Fiscal Mode and Fiscal Transaction.
0x60: The printer is in Fiscal Mode.
0x42: The printer is in Non Fiscal Transaction.
0x44: The printer is Busy.

STS2

011100xx
011011xx
011001xx
011000xx
010111xx
010110xx
010101xx
010100xx
01xxxx1x
01xxxxx1
01000000

Not Assigned Date


Fiscal Memory Full
Fiscal Memory Error
Fiscal Error
Invalid Command
Not Assigned Cashier
Invalid command tax
Invalid Value
Printer / Display Error
Paper Error
No Error

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

 Single Command
PC

Fiscal Printer

(Normal Execution ACK)


STX-CMD-DATA-ETX-LRC
(Execution with Error
NAK)
STX-CMD-DATA-ETX-LRC
(Busy printer NAK)
STX-CMD-DATA-ETX-LRC







ACK

NAK
(communication error)

DTR off

The return of a NAK indicates that the command was not valid.
In case a command is sent while the printer is busy, it doesnt return any
value. This condition can be checked with DTR signal of the printer.

 Read Command
PC
STX-CMD-DATA-ETX-LRC

Fiscal Printer



ACK



STX-CMD-DATA-ETX-LRC

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

The ENQ or NAK answer must be send to the printer if a Communications


error was detected in the host (PC).

 Upload information command:


PC
STX-CMD1-DATA-ETX-LRC

Fiscal Printer



ACK



ACK

STX- DATA0-ETB-LCR

STX- DATAn-ETB-LCR


EOT

1.2.3. COMMANDS DESCRIPTION


The fields in the command frame must have a specified length according of
each command.

Command structure in direct protocol


Command structure using the DLL

STX

DATA

10

ETX

LRC

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

2. SOFTWARE INTEGRATION & ISSUANCE OF DOCUMENTS


The Factory HKA fiscal printers have an universal integration, it means that
a software integration made for a printer would be functional with other fiscal
printer models, this is because the fiscal printers are programmed to communicate
with a standard proprietary protocol.
Some features of the printers may vary about (Printing check, Electronic
Journal, Type of paper, and so on).
Fiscal printer can issue 11 different types of documents:

Document with Fiscal Printer Parameters

Invoice

Credit Note

Debit Note

Non Fiscal Document

X Report

X2 Report

Z Report (Daily Report)

Z2 Report

Fiscal Memory Report

Reprint Documents (Only on fiscal printers with Electronic Journal)


The issue of the documents quoted before can be executed independently.

11

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

3. COMMANDS TO PROGRAMMING PRINTER PARAMETERS

Fiscal Printer use parameters to define its operation and behavior, some of
this parameters can be modified without prerequisites but in other cases, are
necessary some previous procedures.

3.1. Cashier
This command allows defining the information related to a cashier. This
command must be executed before use the command Start Cashier. The frequent
use of this command can cause damage in the work memory therefore use it only
when necessary.
Characters position in
1
2 3
the command line
Structure of the
STX P C
Command

6 ~ 10

11 ~ 26

27

28

Password

Name of Cashier

ETX

LRC

CLK #

12

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
Description
Number of cashier
Description
Cashier password
Description
Name of Cashier

Rev 1.2
14/09/2011

CLK# (ASCII)
00 31
Secret code (ASCII)
5 Digits
Name of Cashier (ASCII)
16 Characters

3.2. Means of payment


This command allows defining the description for every mean of payment,
for example: Cash, Credit card, etc. The printer supports maximum 16 means of
payment.

Characters position in
1
2 3
4
5
the command line
Structure of the Command STX P E # Mean
Description
Mean of payment number
Description
Mean of payment description

6 ~ 19

20

21

Mean of payment description

ETX

LRC

Type (ASCII)
01 16
Name of mean of payment (ASCII)
14 Characters

3.3. Time
This command is used for programming the printer time. This command only
is allowed when sales has not been executed since last daily report (Z Report).
This command has a daily report (Z Report) as prerequisite.
Characters position in the command line
Structure of the Command

1
2 3
STX P F

13

4 5
HH

6 7
MM

8 9
SS

10
11
ETX LRC

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

3.4. Date
This command is used for programming the printer Date. This command only
is allowed when sales has not been executed since last daily report (Z Report).
Date cannot be set in a previous last Daily Report date. This command has a daily
report (Z Report) as prerequisite.

Characters position in the command line 1


2 3 4 5
Structure of the Command
STX P G DD

6 7
MM

8 9
YY

10
11
ETX LRC

3.5. Tax Rates


This command has a daily report (Z Report) as prerequisite.
Characters
1
2 3
4
5 6 7
position in the
Rate 1
command line
STX P T
Structure of the
Value
Type
Command

10 11 12 13
Rate 2

14

15 16 17 18
Rate 3

Type

Value

Type

Value

Description
Extern (item price = taxable base), Excluded Tax
Description
The Value must be 2 integers and 2 fixed decimals

19

ETX LRC

Type (ASCII)
0,1 (any of these)
Value (ASCII)
4 Digits

3.5.1. Registration Tax Rates in Fiscal Memory


This command is used to confirm proper registration of tax rates in RAM and
to record this value on fiscal memory.
All the tax changes are registered at fiscal memory for safety reasons,
14

20

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

because of this, the command can only be executed 64 times as maximum.

Characters position in the command line 1


2 3
4
5
Structure of the Command
STX P t ETX LRC

3.5.2. Header and footer


This command allows defining the messages showed in the header and
footer of the documents.

Characters position in the


1
command line
Structure of the Command STX

Description
Header
Footer
Description
Text to show at Display (See
Note*)

5
LN

6 ~ 45
Message

46

47

ETX LRC

LN (ASCII)
01 08
91 98
Message (ASCII)
40 Characters

Note: You can change header and footer right after issuing a daily report (Z
report)

15

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

3.6. Flags
This command allows defining the value of the flags used in the machine.

Characters position in the command line 1


2 3
Structure of the Command
STX P J

5
Flag

Description
Number of flag to define

# Flag

0
1
2
4
5
6
7
8
9
10

11

12

6
7
Flag Value

Flag(ASCII)
00 50

Flag Value (ASCII)

00 = Do not print error messages, just show them in display


01 = Print error messages
Continuous printing:
00 = prints documents at the end of commands reception
01 = prints line to line
00 = Printer has cutter
01 = Manual cutting
00 = Small Font for text of PLU
01 = Large font for text of PLU
00 = Small font for text of PLU
01 = Large font for text of PLU
00 = Only subtotals are printed int reports
01 = Details for every rate are printed in reports
Price shown on display:
00 = without tax (taxable amount)
01 = with tax (includes ITBMS)
00 = Price of PLU are rounded (5/4 rounding)
01 = Price of PLU are not rounded
00 = Total amount of receipts are rounded (5/4 rounding)
01 = Total amount of receipts are not rounded
00 = in Z report, amounts of tax for every rate are not rounded
01 = In Z report, amounts of tax for every rate are rounded
00 = Maximum value per PLU 99 million
01 = Maximum value per PLU 99 thousand
02 = Maximum value per PLU 9 thousand
03 = Maximum value per PLU 999
00 = Maximum value per closure of receipt, per accumulated of rate 999 million
01 = Maximum value per closure of receipt, per accumulated of rate 9 million
16

8
9
ETX LRC

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

13

14
15
16
17
18
19
20
23
24
25
26
27
28

29

30
31
32

Rev 1.2
14/09/2011

02 = Maximum value per closure of receipt, per accumulated of rate 999 thousand
03 = Maximum value per closure of receipt, per accumulated of rate 99 thousand
00 = Maximum value per Report, accumulated amounts, rates, credit notes and debit notes 999
millions
01 = Maximum value per Report, accumulated amounts, rates, credit notes and debit notes 9
millions
02 = Maximum value per Report, accumulated amounts, rates, credit notes and debit notes 999
thousand
03 = Maximum value per Report, accumulated amounts, rates, credit notes and debit notes 9
thousand
00 = The payment method which chargess the change (again) is the means 1 (cash)
01.. 16 = Assigns the number of the payment to which charge the change
00 = Amount of credit and debit notes are assigned according to the mean of payment used
01.. 16 = Assigns the number of the main of payment in which are charged amounts of credit
notes and debit notes
00 = Amount of funds are added to the mean of payment used
01.. 16 = Assigns the number of the main of payment in which are charged amounts of funds
00 = Amount of withdraws are added to the mean of payment used
01.. 16 = Assigns the number of the main of payment in which are charged amounts of withdraws
00 = In display is shown "The Factory HKA"
01 = In display is shown commercial message settled by client
00 = Commercial message rotates in display
01 = Commercial message is shown static in display

Internal use
00 = After an electric failure, printer continues with a receipt if it is open
01 = After an electric failure, a receipt is annulated if it is open
00 = Open automatically the cash-drawer when a receipt is payed
01 = Doesnt open automatically the cash-drawer when a receipt is payed
00 = If the change is zero, is not shown at display
01 = Always shows the change at display
00 = Currency is " b/. "
01 = Currency is "$ "
Internal Use
00 = Doesnt show number of items in receipts
01 = Shows quantity of printed lines as PLU, without taking in count quantity
02 = Shows quantity of items as integers
03 = Shows quantity of items as decimals
00 = Restart the display for every transaction and shows amounts of PLU and discounts or surcharges
01 = Doesnt restart the display for every transaction and it shows amounts of PLU, discounts and
surcharges
02 = Restart the display for every transaction and doesnt show amounts of PLU and discounts or
surcharges
03 = Doesnt restart the display for every transaction and doesnt show amounts of PLU and discounts
or surcharges
00 = Prints barcode without related number
01 = Prints the barcode with the related number below of the code
00 = S2 command returns values related to the actual sale
01 = S2 command returns values related to accumulated sales of the day (X)
Internal Use

17

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
33

34

35
36
37
38
39
40
41
42
43

Rev 1.2
14/09/2011

00 = Doesnt print Z2 report after Z report


01 = Prints a Z2 report after a Z Report
00 = Doesnt print logo
01 = Prints the logo in all documents
02 = Prints logo only in DNF
03 = Prints logo only in receipts
04 = Prints the logo only in fiscal documents
05 = Prints logo in all documents, except Z reports and reports of fiscal memory
00 = RTS or CTS (del PC)  UART2_RTS = UART2_CTS | Com2.cRTS_out
01 = RTS always in ON
02 = UART2_RTS = Com2.cRTS_out;
Internal use
00 = Doesnt Ignore the near-end sensor (paper sensor)
01 = Ignores the near-end sensor (paper sensor)
Internal use
Internal use
Internal use
Internal use
Internal use
00 = Type of barcode is "EAN 13" (accept only 12 digits)
01 = Type of barcode is "ITF" ( accept 1 to 32 digits)
02 = Type of barcode is "Code 128" ( accept 1 to 32 characters)

Note**: The frequent use of this command can cause damage in the work
memory therefore use it only when necessary.

18

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
4. COMMANDS TO THE ISSUANCE OF AN INVOICE
General diagram to the issuance of an invoice
Start of Cashier (*)
Section 4.1.1

Customer Info. (**)


Section 4.2

Comment (**)
Section 4.3

Product Registration
Section 4.4

PLU Correction
Section 4.5

Yes

No
SubTotal
Section 4.6

Yes

No
Surcharge
Discount
Section 4.7

Yes

No
Register
another
PLU

Yes

No
Notes:
Void Item
Section
4.8.1

*These commands are used at


the beginning of the workday or
changing
cashier.
These
commands are optional.
**These
optional.

commands

No

are

Void Invoice
Section 4.8.2

Barcode
Section 4.10

Yes

Means of payment
Section 4.6

End of cashier (*)


Section 4.1.2

19

Yes

Void of document

Rev 1.2
14/09/2011

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

4.1. Cashiers

4.1.1. Login of Cashier


This command allows certifying a cashier. This command cannot be used if
the printer is in a transaction.

Characters position in the command line


Structure of the Command

1
STX

3~7
# Password

2
5

8
9
ETX LRC

# Password (ASCII)
00000 - 99999

Description
Password of cashier (ASCII)

4.1.2. Logout of Cashier


This command reestablish cashier #1 as the active cashier. This command
cannot be used if the printer is in a transaction. It is not necessary to execute this
command in order to reassign a cashier.

Characters position in the command line


Structure of the Command

20

1
STX

2
6

3
4
ETX LRC

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

4.2. Register of Customer


This command allows input RUC of the client

Characters position in the


command line
Structure of the Command

4 ~ 25

STX

RUC

Description

45

46

ETX LRC

Data (ASCII)
Maximum 20 characters

RUC

4.3. Social Reason of Customer


This command allows to input social reason of customer in a receipt,
credit note or debit note.
Characters position in the
command line
Structure of the Command

4 ~ 25

STX

sCmd ETX LRC

Description

26

27

Data (ASCII)
40 characters fixed

sCmd

4.4. Additional information of Customer


This command allows input additional lines of information of customer
in a receipt, credit note or debit note.

21

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
Characters position in the
command line
Structure of the Command
Description
sCmd0
1-9

4 ~ 44

STX

SCmd0

Rev 1.2
14/09/2011

45

46

Datos ETX LRC

Data (ASCII)
Lines of additional information of client in
header  maximum of 40 characters

4.5. Comment

This command allows printing commercial messages, necessary for


description of a product.

Characters position in the command line


Structure of the Command

Description
Message on Invoice

1
STX

2
@

3 ~ 22
Message

23
ETX

24
LRC

Message (ASCII)
20 Characters

Example:
|Coke
|##On Sale##

B/. 1,50 |
|

4.6. Register of a Product


The register of a product can only be possible if the rate which is related is
registered already.
It is possible to register until ($ B/.) 9999999.99 per transaction.

22

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

It is possible to register until ($ B/.) 9999999.99 per day.

Note: When limit amount is exceeded, the command to register a product is


rejected.
If the maximum amount that the printer can accumulate is exceeded the
printer reject all the sale commands, in this case it is necessary to issue a Z report
to continue sales operations.

Characters position
in the command
1
2
line
Structure of the
STX CMD
Command

3 ~ 12

13 ~ 20

Price

Quantity

Description
Tax Free Item (20h) / (32)
Tax Rate 1 Item (21h) / (33)
Tax Rate 2 Item (22h) / (34)
Tax Rate 3 Item (23h) / (35)
Description
The price: 8 Integers and 2 fixed Decimals
Description
The quantity: 5 Integers and 3 fixed Decimals (See Note*)
Description
Description of Product (See Note**)

21 ~ 137

138

139

Description ETX LRC

CMD (ASCII)
Space Character
!

#
Price (ASCII)
10 Digits
Quantity (ASCII)
8 Digits
Description (ASCII)
116 Characters

Note*: Maximum value for quantity is 99999.999


Note**: 116 characters for description in three lines (two lines with 40
characters and one line with 37 characters),

23

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

4.7. Product Correction


This command cancels the last input of an item or a discount.
Characters position in the command line
Structure of the Command

|COKE
|CORREC
|COKE

1
STX

2
k

3
4
ETX LRC

B/. 1,50 |
|
- B/. 1,50 |

4.8. Subtotal
This command allows print or show in the display the subtotal amount of the
sales. This command must be executed before doing a discount of the subtotal.

Characters position in the command line


Structure of the Command
Description
Printed Subtotal
Shows subtotal at Display

1
2
3
4
STX CMD ETX LRC
CMD (ASCII)
3
4

Printed Subtotal
|COKE
|HAMBURGUER
|SUBTOTAL

B/. 1.50 |
B/. 1.50 |
B/. 3.00 |

24

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

4.9. Discount
This command executes a discount over last item registered or over
subtotal. To make a discount over subtotal, the command Subtotal must be
executed previously, and the amount of discount applies proportionally over all the
products. Discounts can be applied in two modes, by percentage or by amount.

Percentage or surcharge discount:

Characters position in the


command line
Structure of the Command

4 ~7

STX

CMD

Sign

Percentage

Description
Descriptor for discount or surcharge
Description
Discount
Description
The Percentage: 2 Integers and 2 Decimals

Item tax 1
Bs 1.50
Item tax 2
Bs 3.50
---------------------------------------------------SUBTOTAL
Bs 5.00
Discount (10,00%)
- Bs 0.50

The discount must be calculated as follow:

1.35  (1.50*(100-10)/100)
3.15  (3.50*(100-10)/100)

25

ETX LRC

CMD (ASCII)
p
Sign (ASCII)
-
Percentage (ASCII)
4 Digits

Example of discount over subtotal:

Item tax 1
Item tax 2

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

Discount by amount:

Characters position in the command


line
Structure of the Command

1
STX

CMD Sign

Description
Descriptor for discount and surcharges
Description
Discount
Description
Quantity: 7 Integers and 2 Decimals

4.10.

4 ~ 12

13

14

Quantity

ETX

LRC

CMD (ASCII)
q
Sign (ASCII)
-
Percentage (ASCII)
9 Digits

Invoice Cancellation

4.10.1.

Cancellation of an Item in the invoice

This command allows void a product previously registered in the invoice.

Characters position
1
2
3 ~ 12
in the command line
Structure of the
STX CMD
Price
Command
Description
Tax-Free Item (A0h) (Note*)
Rate 1 Item (A1h)
Rate 2 Item (A2h)
Rate 3 Item (A3h)
Description
The price is 8 Integers and 2 Fixed Decimals
Description

26

13 ~ 20
Quantity

21 ~ 137

138

139

Description ETX LRC

CMD (ASCII)
Space Character (A0h)

Price (ASCII)
10 Digits
Quantity (ASCII)

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
The quantity is 5 Integers and 3 fixed Decimals (Note*)
Description
Description of the Product (Note***)

Rev 1.2
14/09/2011

8 Digits
Description (ASCII)
116 Characters

Note*: The character for devolution of an item with Tax-Free rate is (A0h),
that can be printed as a space character, but mentioned character is totally
different to the space character (20h), which is used to register a product with
Tax-Free rate.
Note**: The maximum value for quantity is 99999.999
Note***: 116 characters for description in three lines (two lines with 40
characters and one line with 37 characters),

4.10.2.

Cancellation of an invoice

This command allows cancel an invoice. This command can be used before
send total or partial payment.

Characters position in the command line


Structure of the Command

4.11.

1
STX

2
7

3
3
ETX LRC

Means of payment

4.11.1.

Direct Mean of Payment

This command allows close an invoice and assigns the total amount to a
mean of payment. Executing this command will open the drawer of money.
27

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Characters position in the command line


Structure of the Command

1
STX

2
1

Description
Number of the mean of payment

3
4
# Mean

Rev 1.2
14/09/2011

5
6
ETX LRC

# Mean (ASCII)
01 16

The descriptors default programmed for the mean of payments are


as follow:

Efectivo
Cheque
Tarjeta
Ticket

4.11.2.

01-04
05-08
09-12
13-16

Partial Mean of Payment

This command allows assign part of the total amount of an invoice to a


partial mean of payment. If the input amount is greater or equal to the total amount,
the invoice will be closed and the drawer of money will be opened. This command
is useful when the customer pays for example, with credit card and cash.
Characters position in the
1
2
command line
Structure of the Command STX 2

# Mean

Description
Number of Mean of Payment
Description
The amount of payment is 10 Integers and 2 Decimals

28

4 ~ 16

17

18

Mean of Payment

ETX

LRC

# Mean (ASCII)
01 16
Amount of Payment (ASCII)
12 Digits

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

4.12.

Rev 1.2
14/09/2011

Barcode Command

This command allows print a barcode as a reference product inside invoice


and in the invoice foot.
Characters position in the
command line
Structure of the Command

3 ~ 14

15

16

STX

CMD

Code

ETX

LRC

Description
Barcode is printed in the invoice as description of the product
Barcode is printed in the footer of the invoice
Description
Number code associated with barcode

CMD (ASCII)
Y
y
Code (ASCII)
32 Characters

The type of barcode for fiscal printer is chosen with the Flag 43 by the next
values:
Value
00
01
02

Features
EAN 13 (12 Numeric Characters)
ITF (1 to 32 Numeric Characters)
CODE 128 (1 to 32 Alphanumeric Characters)

The code number associated with barcode is shown in receipt under the
barcode if Flag 30 is programmed with 01 value.

5. COMMANDS TO ISSUANCE OF CREDIT NOTE

29

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

The following is a general diagram to issuance a Credit Note; it shows all the
possible operations for building this document.

30

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

5.1. Register of Client


This command allows input RUC (Register Number of Contributor) of the
client; It is mandatory to send this information if this document has to be issued.

Characters position in the


command line
Structure of the Command

4 ~ 23

24

25

STX

RUC

ETX

LRC

Description

Data (ASCII)
Maximum 20 characters

RUC

5.1. Social Reason of Client


This command allows input Social Reason of the client in the Credit Note; It is
mandatory to send this information if this document has to be issued.

Characters position in
1
the command line
Structure of the Command STX

4 ~ 23

24

25

sCmd

ETX

LRC

Description

Data (ASCII)
40 characters fixed

sCmd

5.2. Number of related receipt


This command allows input number of receipt to which is doing de Credit
Note. It is mandatory send this information in order to issue the document.

31

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
Characters position in
1
the command line
Structure of the Command STX

Description

Rev 1.2
14/09/2011

4 ~ 25

26

27

sCmd

ETX

LRC

Data (ASCII)
22 characters fixed
Example: AABBCC1234567-00000001

sCmd

5.3. Additional information of client


This command allows input additional lines of information of client in a Credit
Note.
Characters position in
1
the command line
Structure of the Command STX

Description
sCmd0
1-9

4 ~ 44

45

46

SCmd0

Data

ETX

LRC

Data (ASCII)
Lines of additional information of client in
header  Maximum 40 characters

5.4. Comment
This command allows input additional commercial messages in description of
a product.
Characters position in
1
the command line
Structure of the Command STX

3 ~22

23

24

Message

ETX

LRC

Description

Data (ASCII)

Indicator of Message in receipt

20 characters

32

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
Example:
|Coke
|##On Sale##

Rev 1.2
14/09/2011

B/. 1,50 |
|

5.5. Register a Product in a Credit Note


This command allows register products in a Credit Note. With the register of
the first product the next words will be printed in the ticket:

NOTA DE CREDITO
It is possible to register until ($ B/.) 9999999.99 by transaction.
It is possible to register until ($ B/.) 9999999.99 by day.
When limit amount is exceeded, the command to register a product is
rejected.
If the maximum amount that the printer can accumulate is exceeded the
printer reject all the sale commands, in this case it is necessary to issue a Z report
to continue sales operations.
Characters position in
the command line
Structure of the
Command

4 ~ 13

14 ~ 21

STX

Tax

Price

Quantity

Description

22 ~ 138

33

140

Description ETX LRC

Rate (ASCII)
0
1
2
3

Free tax Item


Tax rate 1 Item
Tax rate 2 Item
Tax rate 3 Item

139

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
Description
The price is 8 Integers y 2 fixed Decimals
Description
The quantity is 5 Integers y 3 fixed Decimals
Description
Description of the Product

Rev 1.2
14/09/2011

Price (ASCII)
10 Digits
Quantity (ASCII)
8 Digits
Quantity (ASCII)
116 Characters

5.6. Cancellation of an Item


Using this command, a registered item in a credit note can be voided.
Characters position
in the command
1
line
Structure of the
STX
Command

4 ~ 13

14 ~ 21

22 ~ 138

Tax rate

Price

Quantity

Description

Description
Free tax Item
Tax rate 1 Item
Tax rate 2 Item
Tax rate 3 Item
Description
The price is 8 Integers y 2 fixed Decimals
Description
The quantity is 5 Integers y 3 fixed Decimals
Description
Description of the Product

139

140

ETX LRC

Rate (ASCII)
0
1
2
3
Price (ASCII)
10 Digits
Quantity (ASCII)
8 Digits
Quantity (ASCII)
116 Characters

5.7. Closure

Direct Payment
This command allows assign a total amount of devolution for one mean of

payment. When this command is executer, the cash-drawer is opened


automatically.
34

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
Characters position in the
command line
Structure of the Command

STX f

3 ~4

# Mean of payment

ETX

LRC

Description
Number of mean of Payment

Rev 1.2
14/09/2011

# Mean (ASCII)
01 16

Partial payment

This command allows put some of the total devolution amount by different
means of payment. When the document is totally paid, then drawer is opened
automatically.

Characters position in the


command line
Structure of the Command

STX 2

# Mean

5 ~ 16
Amount of payment

Description
Indicator del Partial Method of Payment
Description
The amount of payment is de 10 Integers and 2 Decimals

17

18

ETX LRC

# Mean (ASCII)
01 16
Amount of Payment (ASCII)
12 Digits

Note: Another mode of close a Credit Note is using Direct Means of


Payment.

35

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
6. Debit Notes Commands

36

Rev 1.2
14/09/2011

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

6.1. Register of Client


This command allows input RUC (Register Number of Contributor) of the
client; It is mandatory to send this information if this document has to be issued.

Characters position in the


command line
Structure of the Command

4 ~ 23

24

25

STX

RUC

ETX

LRC

Description

Data (ASCII)
Maximum 20 characters

RUC

6.2. Social Reason of Client


This command allows input Social Reason of the client in the Debit Note; It is
mandatory to send this information if this document has to be issued.

Characters position in
1
the command line
Structure of the Command STX

4 ~ 23

24

25

sCmd

ETX

LRC

Description

Data (ASCII)
40 characters fixed

sCmd

6.3. Number of related receipt


This command allows input number of receipt to which is doing de Debit Note.
It is mandatory send this information in order to issue the document.

37

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Characters position in
1
the command line
Structure of the Command STX

Description

Rev 1.2
14/09/2011

4 ~ 25

26

27

sCmd

ETX

LRC

Data (ASCII)
22 characters fixed
Example: AABBCC1234567-00000001

sCmd

6.4. Additional information of client


This command allows input additional lines of information of client in a Debit
Note.
Characters position in
1
the command line
Structure of the Command STX

Description
sCmd0
1-9

4 ~ 43

44

45

SCmd0

Data

ETX

LRC

Data (ASCII)
Lines of additional information of client in
header  Maximum 40 characters

6.5. Comment
This command allows input additional commercial messages in description of
a product.
Characters position in
1
the command line
Structure of the Command STX

3 ~22

23

24

Message

ETX

LRC

Description

Data (ASCII)

Indicator of Message in receipt

20 characters

38

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
Example:
|Coke
|##On Sale##

Rev 1.2
14/09/2011

B/. 1,50 |
|

6.6. Register a Product in a Debit Note


This command allows register products in a Debit Note. With the register of
the first product the next words will be printed in the ticket:

NOTA DE DEBITO
It is possible to register until ($ B/.) 9999999.99 by transaction.
It is possible to register until ($ B/.) 9999999.99 by day.
When limit amount is exceeded, the command to register a product is
rejected.
If the maximum amount that the printer can accumulate is exceeded the
printer reject all the sale commands, in this case it is necessary to issue a Z report
to continue sales operations.

Characters position in
1
2
3 4 ~ 13 14 ~ 21 22 ~ 138 139 140
the command line
Structure of the
STX 0x60 Tax Price Quantity Description ETX LRC
Command

Description

Rate (ASCII)
0
1

Free tax Item


Tax rate 1 Item

39

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
Tax rate 2 Item
Tax rate 3 Item

Rev 1.2
14/09/2011

2
3
Price (ASCII)
10 Digits
Quantity (ASCII)
8 Digits
Quantity (ASCII)
116 Characters

Description
The price is 8 Integers y 2 fixed Decimals
Description
The quantity is 5 Integers y 3 fixed Decimals
Description
Description of the Product

6.7. Cancellation of an Item


Using this command, a registered item in a credit note can be voided.
Characters position
in the command
1
2
3
4 ~ 13
line
Structure of the
STX 0xE0 Tax rate Price
Command

Description
Free tax Item
Tax rate 1 Item
Tax rate 2 Item
Tax rate 3 Item
Description
The price is 8 Integers y 2 fixed Decimals
Description
The quantity is 5 Integers y 3 fixed Decimals
Description
Description of the Product

40

14 ~ 21

22 ~ 138

Quantity

Description

139

140

ETX LRC

Rate (ASCII)
0
1
2
3
Price (ASCII)
10 Digits
Quantity (ASCII)
8 Digits
Quantity (ASCII)
116 Characters

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

6.8. Closure of the Debit Note

Direct Payment

This command allows assign a total amount of Debit Note for one mean of
payment. When this command is executed, the cash-drawer is opened
automatically.
Characters position in the
command line
Structure of the Command

STX f

3 ~4

# Mean of payment

ETX

LRC

Description
Number of mean of Payment

# Mean (ASCII)
01 16

Partial payment

This command allows put some of the total amount of credit note by different
means of payment. When the document is totally paid, then drawer is opened
automatically.
Characters position in the
command line
Structure of the Command

STX 2

# Mean

5 ~ 16
Amount of payment

Description
Indicator del Partial Method of Payment
Description
The amount of payment is de 10 Integers and 2 Decimals

41

17

18

ETX LRC

# Mean (ASCII)
01 16
Amount of Payment (ASCII)
12 Digits

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

7. COMMANDS TO ISSUANCE OF NON FISCAL DOCUMENTS


The following is the general diagram for issuing any Non-Fiscal Document. It
shows all the possible operations for making this document.

42

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

7.1. Text in a Non-Fiscal Document

This command allows print reports and notes as non-fiscal documents. In a


non-fiscal document it prints automatically every four lines the word NO FISCAL
(non-fiscal) as follow:

N O F I S C A L

Characters position in the


command line
Structure of the Command

STX

STS1 STS2

5 ~ 44

45

46

Message

ETX

LRC

Description
Prints a line with text Normal and waits for another command
Prints a line with bold text and waits for another command (**)
Prints a line with expanded text and waits for another command (**)
Prints a line with double and bold text and waits for another command (**)
Prints a line with text centered and waits for another command (**)
Prints a line with text centered and bold and waits for another command (**)
Cierra el Documento No Fiscal (Corta el papel si tiene esa funcin la impresora)
Description
Text

STS 1
STS 2
(ASCII)
(ASCII)
0
0
0
*
0
>
0
$
0
!
0

1
0
Message (ASCII)
40 Characters

7.2. Opening of Cash Desk


This command allows opening the cash desk. This command prints a nonfiscal document with the title:
A P E R T U R A (Opening)

43

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
Characters position in the command line 1
Structure of the Command
STX

Rev 1.2
14/09/2011

2
3
4
CMD ETX LRC

Description
Prints a non-fiscal document, with the message Opening
Allows the opening of the cash desk (invoice must have 1 product registered)

CMD (ASCII)
0
w

7.3. To withdraw and fund of cash-drawer

This command allows report funds and withdraws of cash or another mean
of payment in the cash desk.
Characters position in the
command line
Structure of the Command

STX 9 PR

# Mean

6 ~ 17

18

19

Amount of payment

ETX

LRC

Description
To withdraw
Fund of cash
Description
Number of Mean of payment
Description
The amount of payments is 10 Integers y 2 Decimals

PR (ASCII)
0
1
# Mean (ASCII)
01 - 16
Amount (ASCII)
12 Digits

7.4. Closure of Outcome / Income Cash Report (Fund of drawer)


This command performs the closure of the report of outcome / income of a
mean of payment. When this command is executed, it closes the report and it
opens the cash drawer..

44

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

Characters position in the command line 1


2
3
4
STX t ETX LRC
Structure of the Command

7.5. Printing Fiscal Printer programming


This command prints a document with the values stored for the following
parameters:

Taxes rates

Name of cashiers

Means of Payment Description

System Flags

Symbols

Messages

Characters position in the command line


Structure of the Command

45

STX D ETX LRC

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

8. COMMANDS TO HANDLE THE DISPLAY

The following is the general diagram to handle the fiscal printer display.

Fiscal Printer

Show Time
and Date
(Section 8.1)

Display Handle

Show
Commercial
Message
(Section 8.2)

Show
Message
(Section 8.3)

Program of
Commercial
Messages
(Section 8.4)

8.1. Show Time and Date


This command shows the time and date in the display. It is not possible to
execute this command during a transaction.

Characters position in the command line 1


2
3
4
Structure of the Command
STX a ETX LRC

8.2. Show Commercial Message

Show at the top of display the commercial message. It is not possible to


execute this command during transaction.
46

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

Characters position in the command line 1


2
3
4
Structure of the Command
STX b ETX LRC

8.3. Show Message


This command shows a message on the display.

Characters position in the


command line
Structure of the Command

STX c

Description
Upper line of Display
Lower Line of Display
Description
Message on Display

4 ~ 23

Line

Message

24

25

ETX LRC

Line (ASCII)
U
L
Message (ASCII)
20 Characters

8.4. Programming of Commercial Messages on Display


This command allows programming the commercial message that shows
the display.

Characters position in
1
2 3
the command line
Structure of the Command STX P I
Description
Commercial message on Display

4 ~ 53

54

55

Message

ETX

LRC

Message (ASCII)
50 Characters

47

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

9. COMMANDS TO READ FISCAL PRINTER STATUS


The following is a general diagram to request and read status from the fiscal
printer.
Note: Separator (0Ah) is present in the response from fiscal printer when is
used the Direct Protocol. The TFHKAs DLL eliminates the separator (0Ah) in the
answer.

Fiscal Printer

S1
Printer
Parameters
(Section 9.1)

S2
Current
Invoice
Status
(Section 9.2)

Status Report

S3
Tax Rate and
flags
programming
(Section 9.3)

S4
Mean of
payment
description
(Section 9.4)

S5
Electronic
Journal
Status
(Section 9.5)

S6
Indicator of
Paper
(See Note*)
(Section 9.6)

S7
MICR
characters
(See Note*)
(Section 9.7)

Note*: Available only for fiscal printer HSP700

9.1. Status S1
This command allows read from host (PC) the status of the fiscal printer,
related to parameters of the printer like serial number, tax identification number
and invoice information. This command can be executed in any condition.
Characters position in the command line 1
2 3
4
5
Structure of the Command
STX S 1 ETX LRC

48

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
Response from the fiscal printer

Characters position
Structure of the Command

1
STX

100
Data

101 102
ETX LRC

Detail of the printer response:

Since Until Length


2
3
2
4
5
2
6
6
1
7
23
17
24
24
1
25
32
8
33
33
1
34
38
5
39
39
1
40
47
8
48
48
1
49
53
5
54
54
1
55
62
8
63
63
1
64
68
5
69
69
1
70
77
8
78
78
1
79
83
5
84
84
1
85
88
4
89
89
1
90
93
4
94
94
1
95
114
20
115
115
1
116
117
2
118
118
1
119
131
13
132
132
1
133
138
6
139
139
1
140
145
6

Type
ASCII
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII

ITEM
Command S1
Number of assigned cashier
Separator
Total of daily sales(17 bytes)
Separator
Number of last invoice
Separator
Quantity of invoices during day
Separator
Number of last credit note
Separator
Quantity of credit notes during day
Separator
Number of last debit note
Separator
Quantity of debit notes during day
Separator
Number of non-fiscal document
Separator
Quantity of non-fiscal documents
Separator
Daily closure counter
Separator
Fiscal memory reports counter
Separator
RUC
Separator
DV
Separator
Serial number of the machine.
Separator
Actual time in the printer
Separator
Actual date in the printer

49

Rev 1.2
14/09/2011

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

9.2. Status S2
This command allows read from host (PC) the status of the invoice in
transaction. If this command is executed without an invoice open the obtained
values will be zero.
Characters position in the command line 1
2 3
4
5
Structure of the Command
STX S 2 ETX LRC

Response from the fiscal printer

Characters position
Structure of the Command

1
79
2
77 78
STX Data ETX LRC

Detail of the printer response:

Since Until Length


2
3
2
4
4
1
5
17
13
18
18
1
19
19
1
20
32
13
33
33
1
34
34
1
35
47
13
48
48
1
49
54
6
55
55
1
56
56
1
57
69
13
70
70
1
71
74
4
75
75
1

76

76

77

77

Type
ITEM
ASCII Command S2
20h
Separator (space)
ASCII Taxable bases Sub-Total (13 bytes)
0Ah
Separator
20h (space character)
ASCII Tax Subtotal
0Ah
Separator
20h
(space character)
ASCII Data Dummy
0Ah
Separator
20h
**See Note S2**
ASCII Separator
0Ah
Separator (space)
ASCII Amount payable
0Ah
Separator
ASCII Number of realized payments
0Ah
Separator
Condition
0 = No transaction
ASCII 1 = In invoice payment
2 = Credit Note
3 = Debit Note
0Ah
Separator

50

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

Note: Depending of value programmed in the flag 28, this data have
different meanings. If flag 28 value is 0, this data in the report is data dummy.
Otherwise flag 28 value is 1, this data is the quantity of products of the invoice in
transaction. For further information please read the fiscal printer flag manual.

9.3. Status S3
This command allows reading from host (PC) the status of the fiscal printer,
related to taxes rates and status flag. This command can be executed in any
condition.
Characters position in the command line 1
2 3
4
5
Structure of the Command
STX S 3 ETX LRC

Response from fiscal printer

Characters position
Structure of the Command

1
STX

122
Data

123 124
ETX LRC

Detail of the printer response:

Since
2
4
5
9
10
11
15
16
17
21
22
122

Until
3
4
8
9
10
14
15
16
20
21
121
122

Length
2
1
4
1
1
4
1
1
4
1
100
1

Type
ASCII
ASCII
ASCII
0Ah
ASCII
ASCII
0Ah
ASCII
ASCII
0Ah
ASCII
0Ah

ITEM
Command
Rate type 1
Rate value 1
Separator
Rate type 2
Rate value 2
Separator
Rate type 3
Rate value 3
Separator
System Flags 1-50 (Every Flag has 2 characters)
Separator

51

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

9.4. Status S4

This command allows reading from host (PC) the status of the fiscal printer,
related to the mean of Payment. It is possible to execute this command in any
condition.

Characters position in the command line 1


2 3
4
5
Structure of the Command
STX S 4 ETX LRC

Response from fiscal printer


Characters position
Structure of the Command

1
STX

178
Data

Detail of the printer response:

Since Until Length


2
3
2
4
13
10
14
14
1
15
24
10
25
25
1
26
35
10
36
36
1
37
46
10
47
47
1
48
57
10
58
58
1
59
68
10
69
69
1
70
79
10
80
80
1
81
90
10
91
91
1
92
101
10
102
102
1
103
112
10

Type
ASCII
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII

ITEM
Command S4
Mean of Payment 1
Separator
Mean of Payment 2
Separator
Mean of Payment 3
Separator
Mean of Payment 4
Separator
Mean of Payment 5
Separator
Mean of Payment 6
Separator
Mean of Payment 7
Separator
Mean of Payment 8
Separator
Mean of Payment 9
Separator
Mean of Payment 10

52

179 180
ETX LRC

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
Since Until Length
113
113
1
114
123
10
124
124
1
125
134
10
135
135
1
136
145
10
146
146
1
147
156
10
157
157
1
158
166
10
167
167
1
168
177
10
178
178
1

Type
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah

Rev 1.2
14/09/2011

ITEM
Separator
Mean of Payment 11
Separator
Mean of Payment 12
Separator
Mean of Payment 13
Separator
Mean of Payment 14
Separator
Mean of Payment 15
Separator
Mean of Payment 16
Separator

9.5. Status S5
This command allows read from host (PC) the status of the fiscal printer,
related to the status of the Electronic Journal. This command can be executed in
any condition.

Characters position in the command line 1


2 3
4
5
Structure of the Command
STX S 5 ETX LRC

Response from fiscal printer

Characters position
Structure of the Command

1
STX

53

47
Data

48
49
ETX LRC

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

Detail of the printer response:

Since Until Length


2
3
2
4
14
20
24
24
1
25
26
2
27
27
1
28
25
13
41
41
1
42
45
4
46
46
1
47
50
4
51
51
1
52
55
4
56
56
1
57
63
6

Type
ASCII
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII

ITEM
"S5"
RUC
separator 0x0A
DV
Separator 0x0A
Serial
separator 0x0A
Number of Electronic Journal
separator 0x0A
Memory Capacity (MB)
separator 0x0A
Free Memory Space (MB)
separator 0x0A
Quantity of registered documents.

9.6. Status S6

This command makes a request for Status S6 information; indicating if there


is paper in each of the 3 printing devices (Billing, Slip/Check Printer, and
Validation). This command is valid for fiscal printer Star HSP7000

Characters position in the command line


1
Structure of the Command
STX

2
S

3
6

4
ETX

5
LRC

Detail of the answer:


From
0
2
3
4

To
1
2
3
4

SIZE
2
1
1
1

Type
ASCII
ASCII
ASCII
ASCII

ITEM
"S6"
Indicator of paper in Print Device for Billing
Indicator of paper in Print Device for Slip/Check Printer
Indicator of paper in Print Device for Validation

54

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

9.7. Status S7

This command makes a request for status S7 information, which contains


MICR characters. This command is valid for fiscal printer Star HSP7000

Characters position in the command line 1


2 3
Structure of the Command
STX S 7

From

To

0
2

1
38

SIZE
2
39

Type
ASCII
ASCII

4
ETX

ITEM

"S7"
MICR Characters

55

5
LRC

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

10. COMMANDS FOR THE ISSUANCE OF REPORTS

The following is the general diagram for requesting reports from the fiscal
printer.
This is the sequence for requesting and reading X Report and Z Report.
PC

Fiscal Printer

STX+U++ETX+LRC



ENQ

ACK



STX- DATAn-ETB-LCR

ACK



EOT

General Structure of Fiscal Printer Reports:

Fiscal Printer
Report

Daily Report
(Section 9.1)

Fiscal Memory
Report
(Section 9.2)

Print of
documents from
Electronic
Journal
(Section 9.3)

X Report

Z Report

Report by Date

Report by
Number

56

- Invoice
- Credit Note
- Non Fiscal Documents.
- Reports

Memory Status

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
10.1.

Rev 1.2
14/09/2011

X & Z Report

This command allows generate daily reports with non-fiscal value (X), and
daily reports with fiscal value (Z). The information of the daily report (Z Report) is
stored in the fiscal memory in the time of printing.
The accumulated values can be used to do weekly sale reports, monthly,
etc.

Characters position in the command line


Structure of the Command

1
2
3
4
5
6
STX CMD Type Mode ETX LRC

Description
Indicator to print specified report
Indicator to erase specified report
Indicator to send report to PC
Description
Report of Transaction of the day
Report of accumulated Total (X2 Z2 according to
the case)
Description
Partial cut of the daily sales
Daily closure of operations

10.2.

CMD (ASCII)
I
X
U
Type (ASCII)
0
1
Mode (ASCII)
X
Z

Fiscal Memory Reports

10.2.1.

Fiscal Memory Report by Dates

This command allows print an Audit report that is defined between two dates

5
10
Characters position
1
2
3
4
in the command line
Start Date
Structure of the
STX CMD 2 Mode Day Month Year
Command

57

11
16
Final Date
Day

Month Year

17

18

ETX LRC

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
Description
Issue a printed report
Send information report to PC
Description
Includes all the information of the reports
Is a summary of reports
Is a monthly summary of the reports

10.2.2.

Rev 1.2
14/09/2011

CMD (ASCII)
I
U
Mode (ASCII)
A
S
M

Fiscal Memory Reports by Z number

This command allows print an Audit Report that is defined between two
numbers of daily reports (Z Report).

Characters
position in the
command line
Structure of the
Command

STX CMD 3 Mode 0 0

10

11

12

13

Z counter
(Start)

Z counter
(Final)

Description
Issue a printed report
Send information report to PC
Description
Includes all the information of the reports
Is a summary of reports
Is a monthly summary of the reports

16

17

ETX LRC

CMD (ASCII)
I
U
Mode (ASCII)
A
S
M

Format of response from fiscal printer


Characters position
Structure of the Command

1
STX

58

143
Data

18

144 145
ETX LRC

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
Detail of answer from the printer:

Since Until Length


2
5
4
6
6
1
7
12
6
13
13
1
14
17
4
18
18
1
19
28
10
29
29
1
30
39
10
40
40
1
41
50
10
51
51
1
52
61
10
62
62
1
63
72
10
73
73
1
74
83
10
84
84
1
85
94
10
95
95
1
96
103
8
104
104
1
105
110
6
111
111
1
112
115
4
116
116
1
117
124
8
125
125
1
126
133
8
134
134
1
135
143
8

Type
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
ASCII
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII
0Ah
ASCII

ITEM
Number of last Z Report
separator 0x0A
Date of last Z Report
separator 0x0A
Time of last Z report
separator 0x0A
Free-Taxes Accumulated
separator 0x0A
Amount of Tax Rate1 Accumulated
separator 0x0A
Amount of Tax Rate 2 Accumulated
separator 0x0A
Amount of Tax Rate 3 Accumulated
separator 0x0A
Total Sales (without tax)
separator 0x0A
Total amount of Credit Note (without tax)
separator 0x0A
Total amount of Debit Note (without tax)
separator 0x0A
Number of last invoice
separator 0x0A
Date of last invoice
separator 0x0A
Time of last invoice
separator 0x0A
Number of last credit note
separator 0x0A
Number of last debit note
separator 0x0A
Number of last Non fiscal document

59

Rev 1.2
14/09/2011

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

Sequence of Fiscal Reading

PC
STX+U++ETX+LRC

Printer


ACK



ENQ

ACK



STX- DATAn-ETB-LCR
(See Note)



EOT

Note: The indicated segment will be repeated (n-1) times, where n means
the value of quantity of reports to be loaded in the machine. For example, if there
are ten Z reports, the segment will be repeated 9 times and then will follow the
shown scheme.

10.3.

Electronic Journal Documents & Status

This command is supported by printers with electronic journal only. In the


electronic journal are stored all the documents that were printed.

60

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
10.3.1.

Rev 1.2
14/09/2011

Reprint Documents command

This command allows re-print documents stored in the Electronic Journal.


The general form of this command is as follow:

Characters position in the


1
2
3
command line
Structure of the Command STX R Mode

10
Start

11

17

End

18

19

ETX

LRC

The field Mode is related to type of document, when this field is indicated
with a capital letter the request is by range of number and when the fields is
indicated with a minuscule letter, the request is by range of dates. The range will
be indicated by Start and End.

For a request by range of number, Mode may be:


Description
For invoices stored in Electronic Journal
For credit notes stored in Electronic Journal
For debit notes stored in Electronic Journal
For all non fiscal documents
X Report
For Z reports stored in Electronic Journal
RAM CLEAR
Copies
Receipts, credit notes and debit notes
All documents except copies and blocking errors
Non fiscal documents except RAM CLEAR, copies and X report
All documents (including RAM CLEAR, copies and X report

Mode (ASCII)
F
C
D
T
X
Z
Y
E
S
A
N
*

For a request by range of date (format 0YYMMDD both for start and for
end), Mode may be:

61

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
Description
For invoices stored in Electronic Journal
For credit notes stored in Electronic Journal
For debit notes stored in Electronic Journal
For all non fiscal documents
X Report
For Z reports stored in Electronic Journal
For reports of reading of fiscal memory, stored in Electronic Journal
Hardware error
RAM CLEAR
Copies
Receipts, credit notes and debit notes
All documents except copies and blocking errors
Non fiscal documents except RAM CLEAR, copies and X report
All documents (including RAM CLEAR, copies and X report)

Rev 1.2
14/09/2011

Mode (ASCII)
f
c
d
t
x
z
r
w
y
e
s
a
n
@

Note: For the special case of printing last document stored in Electronic
Journal, Mode will be U and both Start and End will be 0000000, as follow:

Characters position
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
19
in the command line
Structure of the
STX R U 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ETX LRC
Command

10.3.2.

Re-printing documents by number of CIP

Para reimprimir documentos por el nmero de cdula del cliente se debe


enviar el nmero de cdula hasta un mximo de 20 caracteres, del mismo modo
que en el comando de registro del cliente (Seccin Error! No se encuentra el
origen de la referencia.). La forma general del comando es la siguiente:

Characters
position in the command line
Characters position
in the command
1
2
3
4 24
line

62

25

26

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
Structure of the Command

STX R K

CIP

DATO

VALOR

DESCRIPCION

CIP

STRING

Number of CIP

10.3.3.

ETX

Rev 1.2
14/09/2011

LRC

Printing Electronic Journal Status

Characters position in the command line 1


2
3
4
Structure of the Command
STX E ETX LRC

With this command the printer generates a ticket with the following
information corresponding to the general status of the Electronic Journal:

Number of Electronic Journal

Total capacity of the Electronic Journal

Available space of the Electronic Journal

Number of stored documents in the Electronic Journal

11. COMMANDS FOR THE ISSUANCE OF CHECKS


The following commands are for exclusive use for fiscal printers with check
printing capabilities as the STAR HSP7000.

63

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

64

Rev 1.2
14/09/2011

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
11.1.

Rev 1.2
14/09/2011

Check

11.1.1.

Slip Mode

This command enables slip printer functions. This is the first command
required for any of the following functions
.
Characters position in the command line 1
2 3
4
5
Structure of the Command
STX : ST ETX LRC

Description
Slip activation
Slip deactivation

11.1.2.

ST
1
0

Check Format (Frontal Part)

This command sends to the slip printer data that will be printed in the
check.

Characters position
1
2 3 4 5 6 7 8
19 20
69 70
119 120 121
in the command line
Structure of the
Client
STX < F1 F2 F3 F4 F5 Quantity
Date Data EXT LRC
Command
Data

F1
F2
F3
F4
F5

Description
(Number of Lines between Check Top and Quantity)
(Number of Lines between Quantity and No Endosable)
(Number of Lines between No Endosable and Name)
(Number of Lines between Name and Quantity)
(Number of Lines between Quantity and Date)

65

F1 -> F5 (ASCII)
0 -> 9
0 -> 9
0 -> 9
0 -> 9
0 -> 9

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
Description
Quantity (8 Integers y 2 Decimals) E.g.: 12.345.678,90
Client Data
Date Data

11.1.3.

Rev 1.2
14/09/2011

(ASCII)
10 Characters
50 Characters
50 Characters

Check Format (Endorsement)

Characters position in the command line


Structure of the Command

STX = F1

66

33
Line

34

35

ETX

LRC

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
Description
F1 (Number of Line sent for each command)
Description
Line 1 (Account Number), ------> N:
Line 2 (Payee Name), ----> De:
Line 3 (Payee Name continuation)
Line 4 (Bank Name), -------> En el banco:
Line 5 (Additional Line) **optional
Line 6 (Additional Line) **optional
Line 7 (Additional Line) **optional
Line 8 (Additional Line) **optional
Line 9 (Additional Line) **optional

Rev 1.2
14/09/2011

F1 (ASCII)
1 -> 9
(ASCII)
30 Characters
30 Characters
30 Characters
30 Characters
30 Characters
30 Characters
30 Characters
30 Characters
30 Characters

Note: Text in quotes for the previous command description line is written
automatically by the fiscal printer. Every Command Line must have 30 characters,
if it is necessary, blank space characters can be used to complete this quantity of
characters.

11.1.4.

Print Endorsement

Characters position in the command line 1


2 3 4
5
Structure of the Command
STX [ F1 ETX LRC

Description
F1 (Number of Lines between Top and N: )

F1 (ASCII)
0 -> 9

Note: This command always must be sent after all the endorsement
commands. (See 10.1.3- Check Format (Endorsement))

67

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

NOTE: While fiscal printer is issuing an invoice, it is possible to use check printer.

68

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
11.2.

Rev 1.2
14/09/2011

Validation Commands

11.2.1.

Validation Mode

Characters position in the command line 1


2 3
4
5
Structure of the Command
STX ; ST ETX LRC

Description
Activate Validation
Deactivate Validation

11.2.2.

ST
1
0

Print Validation
Characters position in the

command line
Structure of the Command

STX >

Description

52
Text

53

54

ETX LRC

(ASCII)
50 Characters

Text

11.2.3.

MICR Reading

This command read information from Magnetic Characters printed in the


bottom of the check and stores this information in the printer buffer for later reading
from pc.

69

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
Characters position in the command line 1
2
3
4
Structure of the Command
STX ? ETX LRC

11.3.

Gift Certificate and POS note:

11.3.1.

On and Off of the Slip:

Character position (s) in the Command


1
2 3
4
5
Line
Command Structure
STX : ST ETX LRC

Description
Activate Validation
Disabling Validation

ST
1
0

70

Rev 1.2
14/09/2011

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA
11.3.2.

Rev 1.2
14/09/2011

Lines of Information

Character position (s) in the Command Line


Command Structure

1
2
STX =

33

34
ETX

Line

Description

(ASCII)
30 Characters
30 Characters
30 Characters
30 Characters
Line Between 4 and 5 are automatically set a dividing line
Line 5 (Line Additional) **optional
30 Characters
Line 6 (Line Additional) **optional
30 Characters
Line 7 (Line Additional) **optional
30 Characters
Line 8 (Line Additional) **optional
30 Characters
Line 9 (Line Additional) **optional
30 Characters
Line 1
Line 2
Line 3
Line 4

11.3.3.

Gif certifcate and POS note:

Character position (s) in the


1
2
Command Line
Command Structure
STX [
Description

Type

Y ETX LRC
Type
R
N

Gift coupon
POS Note
Description
Number of Lines added to left margin
Description
Number of Lines added to up margin

71

X (ASCII)
0 -> 9
Y (ASCII)
0 -> 9

35
LRC

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

12. ERROR LIST

# ERROR

Name

ERROR_I2C

3
4
5

ERROR_COM2
ERROR_COM3
ERROR_CRC

ERROR_COMANDO

ERROR_JOB

ERROR_BUFFER_VA

ERROR_FECHA
ERROR_NO_PLU_DA
TA

10
11

ERROR_ESTADO

12
13

15

ERROR_RESET
ERROR_RAM_CLEAR
ERROR_FM_LECTUR
A
ERROR_FM_NUEVA

16

ERROR_TOTALES

14

17
# ERROR
18
19

ERROR_TASA
Nombre
ERROR_EJ_CRC
ERROR_EJ

20

ERROR_WORK_V

21

ERROR_WORK_C

Description
Writing or Reading error of fiscal memory or
work memory
Communication Error or timeout with COM2
Communication Error or timeout with COM3
Wrong CRC
When a command has a wrong format (out of
range, command doesnt exist, or any error
during fiscalization)
Internal Error of the printer
Error in printer buffer
Date error
PLU or discount wasnt found
Printer in its state cant receive actual
command
Error during execution of RESET
Error during RAM CLEAR
Fiscal Memory read only
Fiscal Memory new
Max Amounts allowed for receipts or
accumulators for daily report (Z report) have
been exceeded
Tax rate error
Descripcin
EJ Reading memory
EJ Error
Work Memory error to read data related to
sales of day (data error or failure in work
memory)
Work memory error to read data related to
system settings, because of wrong data or
72

PROTOCOL AND COMMANDS


MANUAL FOR FISCAL PRINTERS
The Factory HKA

Rev 1.2
14/09/2011

failures in work memory

Work Memory Error in order to read or save


data related to actual document

22

ERROR_WORK_D

23
24

ERROR_RAM
ERROR_EJ_REG
ERROR_EJ_NO_CAR
D

Work Memory Error


Register error in EJ
EJ is not connected

26

ERROR_INDICEZ

Daily report Index Error

27
28
29
30
31

ERROR_FM_G
ERROR_FM_C
ERROR_FM_B
ERROR_FM_FULL
ERROR_FM

Fiscal Memory Error


Fiscal Memory Error
Fiscal Memory Error
Fiscal Memory Full
Fiscal Memory Error

25

73

Anda mungkin juga menyukai