Contents
There are two base interfaces that allow you to adjust the receipt printer module to your own needs:
- IFiscalizationService – it includes all methods participating in communication with the receipt printer. Additionally, it makes it possible to manage methods that prepare data for printing on a receipt printer (e.g. document items, payments, invoicing addresses).
- ItemCustomizationService – it allows you to modify any field that is sent to the receipt printer
An important aspect that needs to be considered when extending the receipt printer module is that the Module class must inherit from the receipt printer module’s Module class, not from Comarch.POS.Presentation.Core. You may then overload additional methods (RegisterServices, TriggerEventBinding, RegisterViewModels, RegisterViews, AddContainerElements).
Modification of Comarch.B2.Printer2 driver
In addition, if it is necessary, you can overload each method by inheriting from the PrinterManager class.
Note that the child class must also inherit from the IPrinterService interface. It stems from the fact that drivers are loaded dynamically, while instantiation is based on an appropriate interface.
public class MyPrinterManager : PrinterManager, IPrinterService { … }
How to print a custom document
The application allows you to print your own document. To do so, use the PrintCustomDocument method from the IDocumentEventService service within a relevant viewModel.
Next, you can either:
- call methods for printing lines in the non-fiscal mode (NonFiscalOpen, NonFiscalLinePrint, NonFiscalClose) as part of the IPrinterService internal instance, inheriting from the FiscalizationService class
or
- override a custom driver (e.g. based on Comarch.B2.Printer2), overload the PrintCustomDocument method and, inheriting from the FiscalizationService class, overload the PrintCustomDocument method
Additional flags
A FiscalParams property has been added in the TradeDocument class; the property stores additional information for the receipt printer module.