- last edited on: 2018-05-31
Managing of the fiscal devices with your own code
It is permitted in Bulgaria to write the management of the fiscal devices for the software you are developing. You can always receive the fiscal device communication protocol from the manufacturer. It is considered that you can’t damage the device through a command, i.e. it is protected from malicious use.
The main reason developers prefer this option is the lack of faith in available SDKs. Another frequently cited reason is the uncertainty in the speed and even quality of support. Sometimes the available SDKs do not match the specific needs of developers or developing environment, or in the case of specific operating systems, are lacking entirely. In such a scenario the only right thing for developers to do is to take care of the management and communication with the fiscal devices by themselves.
However, this approach has its disadvantages. Here are several:
- The country doesn’t have a common standard for fiscal device protocols while standards like OPOS aren’t widely applied and maintained. In practice, if your software isn’t custom-made for a specific fiscal device model specified by your customer, it is entirely possible you might have to write the management of over a hundred different models. Unfortunately, even different models of the same given manufacturer have differences in their protocols;
- Fiscal law isn’t static and takes new technologies into account. It’s entirely possible for new requirements to appear as new laws are created and for this to lead to changes in device protocols (for example, a method that used to return information for the accumulated amounts in four tax groups may now have to return information for eight tax groups and the sum of refused receipts). Since your software will be device-dependent, you might find yourself having to update it in an unexpected and usually inconvenient time;
- If your firm has no prior experience in the usage of fiscal devices, the whole concept of using this approach is truly wrong. You will most likely have to:
- Set aside additional time for training a programmer on the topic;
- Hope that they managed to learn everything and applied it properly. Including all the little details that come with experience;
- Pray they don’t leave you right when you need them most(but this is a general problem for every kind of technology);
If you have been lucky enough with the developers of the software module for managing fiscal devices and have absolute confidence in them, forget my remarks in this area. However, if you have the slightest doubt, I do advise you not to try this approach. Your developed might be highly skilled in a given area, but if they have never developed anything for fiscal devices, and you insist on this method, find and hire professionals in the area, which will do it for far less time and, indeed, with higher quality. The source code will be yours and in case such a need arises you will be able to service it in terms of updates and removing errors.
I’ll introduce you to a real case from my experience, one which I’ve come across in many different forms (unfortunately, more than once).
An example of an "unpleasant" scenario
You have a programmer who has developed software related to different kinds of references from databases all their career and is really good at it. You are most satisfied with them and since you’re now entering a market where your software must print sales not on a regular ESC/POS printer (network/laser/inkjet), you task them with developing software for managing this kind of hardware. It doesn’t sound that illogical. The truth is over the years I’ve found that in about 30% of cases mistakes occur, some of which highly unpleasant for all the involved parties. The most common mistake programmers without experience working with fiscal devices make is perceiving a fiscal printer as just a printer. Despite all the advice and explanations, not enough attention is given to device status during development. What could go wrong?
The answer is a lot of things can go wrong. Fiscal devices are complicated not only in terms of hardware but in terms of management logic. Actually, they’re not that complicated, they are just more specific. Some commands are not allowed if the condition of the device (physical or logical) doesn’t permit it.
Here’s an example of the so-called “bad” scenario:
- The paper has run out in the middle of printing a receipt;
- While the company employee has replaced the paper, the customer has paid them in cash and left;
- If the software doesn’t monitor the device’s condition or doesn’t even monitor its reply when executing commands, the recipe for disaster is set;
- Usually, with the next client, the client contacts maintenance, informing them something isn’t working right, or that even the whole system has jammed;
- Since we’re usually talking about a point of sell, your customer has already started to take losses;
- The software company states that most likely there’s nothing wrong with its software and that the cause of the issue is probably the printer;
- The end customer calls their repair shop and in the best-case scenario, the technician arrives in an hour or two to check whether there’s a problem with the fiscal device;
- It turns out the printer is fully operational - opening a new fiscal receipt is impossible while the old one remains open (i.e., due to a logical reason the requested operation cannot be executed at that moment);
- The client has to pay the service technician for a visit outside the maintenance contract terms;
- Highly agitated (and rightly so) they again call maintenance, who contact the developers, who in turn write to the manufacturer of the fiscal device;
- If everyone is lucky, available and sufficiently competent, the issue is usually resolved over the course of a few hours.
Unfortunately I’ve been witness to such cases, the solving of which took days and even weeks.
To help resolve such ridiculous situations, fiscal device manufacturers offer free programmes for analysing and solving emergency situations. The reason is that the end customer shouldn’t have to suffer losses because of faulty software. This, however, leads to an absurd opinion in the customer that this model “jams” too often and is low-quality, which usually ends in completely unnecessary hardware replacements and service maintenance. It leads to a loss of time, nerves, and money.
Another unpleasant situation is when you don’t have sufficient knowledge on what a tax band is, why certain items should be classified under a specific tax band and some in another one, etc. Don’t forget that cash registers and fiscal printers are tools through which the state monitors your clients’ revenue and with the assistance of which it collects taxes from them. If the programmer is not careful or is even careless this may lead to fines and losses.
Opinion
Actually, developing a control and operation module for a fiscal device (cash register or printer) by yourself is neither overly complicated nor exceedingly difficult. It is just truly a responsible task. I hope that I have warned you enough that you may go about developing your program with extra attention and care. In following chapters I will give you some basic recommendations and outlines which will (hopefully) save you time and make you rethink your approach again.
- Countries which use fiscal devices;
- Introduction (Fiscal devices in Bulgaria);
- Limitations and requirements stipulated by law in Bulgaria;
- Managing of the fiscal devices with your own code;
- A program - permanently connected to the fiscal device;
- Low level protocol description;
- Algorithms For Rounding In Fiscal Devices In Bulgaria;
If the data or something else in this article is incorrect - please email me to correct the article.

