Fiscal Printer Integration
Who should be reading this document?
The target audience for this document is intended for partners who are willing to undertake source code modification under license from CitiXsys to pursue customisations.
This document provides a complete overview of hardware devices integrated with iVend and their integration methodology in iVend Retail. This serves as a guide to implementing a new hardware device in iVend Retail.
What is a Fiscal Printer?
A Fiscal Printer is an electronic device used by governments to control tax revenues. The devices are usually shipped in sealed (tamper proof) packages and conform strictly to the government specifications. When a sale transaction is made at the POS (cash register) an exact record is also created (or logged) in the configured Fiscal Printer containing details of the sale transaction including sales tax components.
Sample Code
Please refer to the link in the footer of this article for an attachment to obtain the code samples for integrating a new Fiscal Printer with iVend POS – iVend Fiscal Printer Project.
Fiscal Printer Integration in iVend Retail
Fiscal Printer integration follows the hardware integration philosophy and exists in the same CXS.Hardware namespace.
Since fiscal printer implementations follow the strict specifications of bodies governing the tax laws of countries, they are specialised further in order to adhere to the application regulations. Hence, fiscal printer integration in iVend is found in the CXS.Hardware.FiscalPrinter namespace.
iVend Retail has the following Four fiscal printers integrated in the product:
· Bematech (FI32)
· Datec FP300 and
· Epson
· Aclas
Note: For a complete reference to the code layout and object references please go through the Hardware Integration documentation.
Fiscal Printer Implementation Code Overview
The following sections describe the fiscal printer code structure in the ‘CXS.Hardware’ namespace.
Add a New Folder under the Fiscal Printer Project
To add a new fiscal printer, create a new folder structure under the existing namespace CXS.Hardware.FiscalPrinter
Use a vendor specific logical name to identify the folder as used in the illustration e.g. Bematech.
Use the existing Code Structure
Copy the existing classes and control from the available code:
The following table lists the existing Bematech fiscal printer integration implementation classes that are recommended to be followed for implementing a new fiscal printer integration:
Class Name | Description |
BemaFI32 | Implementation class for the Bematech provided fiscal printer containing constants, functions and message mapping routines specific to the Bematech compliant fiscal printers. |
ConfigInfo | Contains configuration information for globalised messages. |
FiscalPrinter | Class that implements the IFiscalPrinter interface members for providing inbuilt functionality for fiscal printer implementation. |
SetupControl | View (user control) implementation that inherits from ‘BaseOPOSHardwareSetupView’ class to provide the user interface elements to the fiscal printer in the product. |
Add an XML Node for the Fiscal Printer – FiscalPrinter.global.xml
Create a node in the XML file with the same namespace as the one used in the Setup control implementation.
The ‘Message’ and the ‘Payment Message’ values for the m_RowMessage and m_RowPaymentMessage tags are mapped to the row properties of the ‘Setup’ control as well as implemented in the ‘ConfigInfo’ class. Other tags under this node represent the rows of the grid in the user control and the names must be exactly the same.
Components of the FiscalPrinter Class
The FiscalPrinter class uses the standard structure for a typical fiscal printer defined in the CXS.Hardware.FiscalPrinterHelper code file. This file standardises the structure under different classes as shown below:
The same classes are invoked in the specific fiscal printer class implementation i.e. FiscalPrinter with the required logic and data implementation.
Context to the iVend POS Code
The Hardware library is initialised and subsequently used in the iVend POS code as shown below
Hence, as long as the fiscal printer implementation implements from the IFiscalPrinter interface, it will be automatically invoked and consumed in the POS as a registered hardware type.
The 'CXS.Subsystem.Printing.PrintManager' class uses the FiscalReceiptResponse class internally to get the complete payload from the fiscal printer and print the contents as required.
Build and Test
Fiscal printer integration is just a specialisation of the hardware integration code in iVend. The configuration and testing of the fiscal printer is similar to the hardware integration.
Please refer to the Hardware Integration documentation for more details.