INP File Interface

The INP file interface provides a file-based communication method for fiscal operations. The driver monitors a specified directory for each "INP-compatible" fiscal device. When a command file is placed in this directory, the driver processes it and generates a corresponding result file.

Setup and Configuration

To enable INP file processing for a fiscal device:

  1. In the FisCool UI, select your fiscal device configuration
  2. Enable "INP Compatibility" checkbox
  3. Specify an "INP Directory" (e.g., C:\FisCool\INP)
  4. The driver will begin monitoring this folder for new files

File Structure and Processing

The driver monitors the INP directory for files with extensions .bon, .inp, or .txt.

Input File Format

INP files are text files with comma-separated commands, one command per line. Each command follows the format:

Command,1,______,_,__;parameters

Where the header ,1,______,_,__; is standard for all commands and the parameters vary by command type.

Example INP File

S,1,______,_,__;Coffee;2.50;1.000;1;1;1;0;0;buc
T,1,______,_,__;0;2.50;;;;

File Processing Lifecycle

Understanding the complete file processing lifecycle helps with troubleshooting and integration:

1. File Detection
  • Driver monitors INP directory for files with extensions: .bon, .inp, .txt
  • Files are detected using filesystem watching (immediate detection)
  • 100ms delay is applied to ensure file writing is complete
2. File Claiming
  • File is renamed from command.inp to command.inp.processing
  • This prevents other processes from interfering with the file
  • If rename fails, file is skipped (likely being processed by another instance)
3. Content Parsing
  • File content is read and parsed line by line
  • Commands are validated for correct format and parameters
  • Parse errors generate immediate BonERR response with error details appended
4. Operation Execution
  • Parsed operation is sent to the fiscal device
  • Device communication and business logic validation occurs
  • Execution errors generate BonERR response with runtime error details
5. Success Response
  • Processing file is moved to BonOK/command.inp (original content preserved)
  • Answer file is created as BonANSWER/command.ans with operation results
  • Both files serve as audit trail and integration response
6. Error Response
  • Original content + error details are written to BonERR/command.inp
  • Processing file is cleaned up/removed
  • No answer file is created for failed operations

Output Directory Structure

After processing, files are moved to subdirectories:

  • <INP Directory>\BonOK\: Successfully processed input files (moved intact for audit trail)
  • <INP Directory>\BonERR\: Input files that resulted in errors (with error details appended)
  • <INP Directory>\BonANSWER\: Response files (.ans extension) containing operation results

Response File Format

Response files are created in BonANSWER directory with .ans extension and follow INI format:

Receipt Operation Response
[Answer]
SlipNumber=12345
Daily Report Response
[Answer]
nRep=42
TaxA=125.50
TaxB=67.80
TaxC=0.00
TaxD=0.00
TaxE=0.00
Cash Operation Response
[Answer]
TotalCash=1250.75
Generic Success Response
[Answer]
Status=0

Error Response Format

Error files are created in BonERR directory with original content plus error information appended:

# Original INP content
S;Produs Test;10.50;kg;1.5;2

# Error details appended by system
#Linia 1 | S;Produs Test;10.50;kg;1.5;2
#ErrorCode (-112207) : Valoare incorrectă a parametrului departament.

Command Reference

The following commands are supported in INP files. Commands are case-sensitive and use comma (,) as field separator with a standard header format.

S Sell Item

Adds a product line to the current fiscal receipt.

Syntax: S,1,______,_,__;description;price;quantity;department;ignored;vat_code;ignored;ignored;unit
Parameter Type Required Description
description String Yes Product name or description (max 72 characters, semicolon not allowed)
price Number Yes Unit price in local currency (decimal with max 2 decimals, dot separator)
quantity Number Yes Quantity sold (max 3 decimals, e.g., 1.000)
department Number Yes Department code (max 99, 0 for no department)
ignored - No Ignored parameter (can be empty)
vat_code Number/String Yes VAT code: 1=A, 2=B, 3=C, 4=D, 5=E (tax exempt) or percentage like "9%"
ignored - No Ignored parameter (can be empty)
ignored - No Ignored parameter (can be empty)
unit String Optional Unit of measure (max 6 characters, defaults to "buc")
Examples:
S,1,______,_,__;Coffee Espresso;2.50;1.000;1;1;1;0;0;buc
S,1,______,_,__;Bread 500g;1.20;1.000;1;1;2;0;0;buc
S,1,______,_,__;Fuel Premium;1.45;25.500;3;1;1;0;0;l

Notes:

  • Price and quantity use dot (.) as decimal separator
  • Semicolon character (;) is not allowed in product description
  • For non-VAT payers, driver automatically sends products to VAT group E
  • Percentage character (%) in description is filtered to prevent device reset

T Payment

Adds a payment method to the current receipt. If payment type is 4, acts as subtotal command.

Syntax: T,1,______,_,__;payment_type;amount;;;;
Parameter Type Required Description
payment_type Number Yes Payment method: 0=Cash, 1=Card, 2=Credit, 3=Meal Tickets, 4=Subtotal, 5=Voucher, 6=Modern Payment, 7=Card+Cash Advance, 8=Other Methods, 9=Foreign Currency
amount Number Yes Payment amount in local currency (if empty and no T commands, auto-fills with cash)
Examples:
T,1,______,_,__;0;20.00;;;;
T,1,______,_,__;1;15.50;;;;
T,1,______,_,__;4;;;;;  

Payment Notes:

  • If no T command sent, receipt auto-closes with full amount as cash
  • Multiple T commands allowed for mixed payments
  • If payment total < receipt total, remainder auto-filled with cash
  • If payment total > receipt total, change printed as cash rest
  • Method 7 (Card + Cash Advance) requires amount > receipt total

C Discount/Surcharge

Applies a discount or surcharge. Must be sent immediately after an S (item) command or subtotal.

Syntax: C,1,______,_,__;discount_type;value;;;;
Parameter Type Required Description
discount_type Number Yes 0=Surcharge %, 1=Discount %, 2=Surcharge value, 3=Discount value
value Number Yes Discount/surcharge value (0.00-100.00 for percentage, amount for value)
Examples:
C,1,______,_,__;1;5.00;;;;  
C,1,______,_,__;3;2.50;;;;  
C,1,______,_,__;0;10.00;;;; 

P Free Text

Prints non-fiscal text on the receipt.

Syntax: P,1,______,_,__;line1;line2;line3;;;
Parameter Type Required Description
line1 String Optional First line of text (max 42 characters)
line2 String Optional Second line of text (max 42 characters)
line3 String Optional Third line of text (max 42 characters)
Examples:
P,1,______,_,__;Thank you;for your visit;Welcome back;;;

K Customer CUI

Opens a fiscal receipt with customer VAT number. Must be the first command in the file.

Syntax: K,1,______,_,__;cui_number;
Parameter Type Required Description
cui_number String Yes Customer fiscal ID (e.g., RO12345678)
Examples:
K,1,______,_,__;RO22352741;

I Cash In/Out

Performs cash deposit or withdrawal. Must be the only command in the file.

Syntax: I,1,______,_,__;operation_type;amount;;;;
Parameter Type Required Description
operation_type Number Yes 0=Deposit money, 1=Withdraw money
amount Number Yes Amount to deposit or withdraw
Examples:
I,1,______,_,__;0;100.00;;;;  
I,1,______,_,__;1;50.00;;;;   

Z or A Fiscal Reports

Prints fiscal reports (X or Z). Must be the only command in the file.

Z Version: Z,1,______,_,__;report_type;
A Version: A,1,______,_,__;;;report_type;;;
Parameter Type Required Description
report_type Number/String Yes Z version: 0=X Report, 1=Z Report, 2=X Summary, 3=X Departments
A version: 'X'=X Report, 'Z'=Z Report
Examples:
Z,1,______,_,__;0;    
Z,1,______,_,__;1;    
A,1,______,_,__;;;X;;;

L Subtotal

Prints subtotal (alternative to T with type 4).

Syntax: L,1,______,_,__;;;;;
Example:
L,1,______,_,__;;;;;

DS Open Drawer

Opens the cash drawer connected to the fiscal device.

Syntax: DS,1,______,_,__;pulse_duration_ms;;;;
ParameterPositionTypeRequiredDescription
pulse_duration_ms 1 number No Duration of drawer opening pulse in milliseconds (default: 100). Note: Ignored by Tremol devices.
Examples:
DS,1,______,_,__;;;;; 
DS,1,______,_,__;200;;;; 
DS,1,______,_,__;150;;;; 

Complete INP File Examples

Simple Cash Sale

S,1,______,_,__;Coffee;2.50;1.000;1;1;1;0;0;buc
S,1,______,_,__;Croissant;1.80;1.000;1;1;2;0;0;buc
T,1,______,_,__;0;4.30;;;;

Sale with Discount and Card Payment

S,1,______,_,__;Laptop Computer;899.99;1.000;2;1;1;0;0;buc
S,1,______,_,__;Mouse Wireless;25.50;1.000;2;1;1;0;0;buc
C,1,______,_,__;1;5.00;;;;
T,1,______,_,__;1;878.74;;;;

Mixed Payment Methods

S,1,______,_,__;Fuel Premium;1.45;40.000;3;1;1;0;0;l
T,1,______,_,__;0;50.00;;;;
T,1,______,_,__;1;8.00;;;;

Receipt with Customer CUI

K,1,______,_,__;RO22352741;
S,1,______,_,__;Professional Service;150.00;1.000;1;1;1;0;0;buc
T,1,______,_,__;1;150.00;;;;

Receipt with Free Text

S,1,______,_,__;Product A;10.00;1.000;1;1;1;0;0;buc
P,1,______,_,__;Thank you for;your purchase;Welcome back;;;
T,1,______,_,__;0;10.00;;;;

Cash Deposit

I,1,______,_,__;0;100.00;;;;

X Report

Z,1,______,_,__;0;

Z Report

Z,1,______,_,__;1;

Error Handling

When INP file processing fails, the input file is moved to BonERR directory with error details appended as comments. No separate error file is created in BonANSWER for failed operations.

Error File Process Flow

  1. INP file is renamed to .processing during execution
  2. On parse error: Original content + error details are written to BonERR/
  3. On execution error: Original content + execution error details are written to BonERR/
  4. Processing file is removed/cleaned up

Error File Content Format

Error files contain the original INP content followed by error details as comments:

# Original INP file content (unchanged)
S;Produs Test;10.50;kg;1.5;99

# Error information appended by driver
#Linia 1 | S;Produs Test;10.50;kg;1.5;99
#ErrorCode (-112207) : Valoare incorrectă a parametrului departament.

For execution errors (not parse errors):

# Original INP file content (unchanged)
S;Produs Test;10.50;kg;1.5;2

# Execution error information
#Linia 0 | Execution Error
#ErrorCode (-201003) : Dispozitivul fiscal nu este conectat sau nu răspunde

Best Practices

  • File Naming: Use unique, sequential file names to avoid processing conflicts
  • Result Monitoring: Check the BonOK, BonERR, and BonANSWER directories regularly for processing results
  • Encoding: Use UTF-8 encoding for INP files to support international characters
  • Line Endings: Windows line endings (CRLF) are recommended but not required
  • Command Format: Always use semicolon (;) as separator and follow proper parameter order
  • Character Restrictions: Avoid semicolon (;) in product descriptions as it's used as field separator
  • Single Monitor: Only one application should monitor each INP directory to prevent race conditions

Performance Considerations

  • The driver processes files sequentially for each device to maintain fiscal compliance
  • Files are temporarily renamed to .processing during execution to prevent conflicts
  • Large numbers of simultaneous files may cause delays due to sequential processing
  • Consider implementing a queue mechanism for high-volume scenarios
  • Monitor disk space in INP directories, especially BonOK and BonANSWER which accumulate over time
  • The driver waits 100ms after file detection to ensure complete writing before processing
  • Failed files are moved to BonERR with error details appended, not removed

Integration Notes

The INP file interface is ideal for:

  • Legacy System Integration: Systems that cannot use HTTP/WebSocket APIs
  • Batch Processing: Processing multiple receipts from queued transactions
  • Reliability: File-based operations provide natural persistence and recovery
  • Debugging: INP files and responses provide clear audit trails

Important: Only the commands documented above are supported by FisCool driver. The syntax follows comma-separated format with standard header ,1,______,_,__;. Advanced commands like 54 (formatted text) and 84 (barcodes) may be supported but are not guaranteed across all device types.