Good morning,
As from august 1st, I need to move to electronic billing (UBL 2.0) which means that I will have to send every ticket to the tax institution in real time or at night when closing the working period.
The tax institution provide us with a freesoftware named SFS (a jar file + jre 1.8).
Screenshot of SFS.
SFS does the following:
- takes as input the ticket data
- validates the ticket data (against xsd files)
- creates and digitally signs the corresponding XML files
- sends these XML files to the tax institution
- receives an answer (accepted, rejected w/ error code, system unavailable)
So I would like that SambaPOS gives the input (ticket data) to SFS.
The way SFS reads the input (ticket data) is browsing a defined directory (DATA) where one (or more) file(s) corresponds to ONE ticket.
Screenshot of the DATA directory.
The input files format for SFS can be ANY of these 3 formats:
- TXT files (2)
xxxx.CAB: (CAB = cabeza = header, CAB is not a windows zip file) a text file containing the basic data of the ticket separated by the pipe caracter “|”. 21 columns, like:
01|2018-07-11|12:25:23|-|1|1|40708627|De La Cruz|PEN|-||||24.00|24.00||||24.00|2,1|2.0|
xxxx.DET: a text file containing the detail of the orders of that ticket. (32 columns) - JSON file (1)
xxxx.JSON: containing the ticket data + the list of the orders - XML file (1)
xxxx.XML: I’ll not use it.
Now there are many ways to do it:
- making actions that create the file(s) when the ticket is printed
- making working period reports that lists all tickets/orders and then an additional program/script that processes these reports to create the TXT or JSON files for each ticket (
sed
andawk
are perfect for text manipulation and I know them, but that means relying on an *nix machine). On top of that SambaPOS + SFS + an external script/program, it starts to be a lot (of problems) - other solutions I am not faniliar with (javascript within SambaPOS?) which is the purpouse of this post. If you can show me the way, I should be able to follow the tracks.
Some considerations (that you don’t need to read to show me the way):
Note:
- 2 types of bills: BOLETA y FACTURA, the last one contains information of the buyer and is valid for tax purpouse.
- Each type has its own serial numbering. B001-xxx for BOLETA; F001-yyy for FACTURA, xxx and yyy are independant series. These will be kept in Ticket TAG.
- I’ll not use 2 ticket types (one for BOLETA and one for FACTURA) because I don’t know beforehands if the customer will ask for a BOLETA or for a FACTURA. And once the ticket is created, you cannot switch from one type to the other.
- When a ticket with a serial number (e.g. B001-35) is rejected by SFS, that serial number cannot be used anymore. This implies manual work - with SFS resending the ticket with a new serial number and update the serial number in SambaPOS.
SFS is a free software that is provided, but it can be bypassed and it’s possible to send the ticket information directly with SOAP methods and XML files. However that would also means managing everything from SambaPOS, like:
- sending the bills (ok)
- managing the cancelation of the bills
- validating the bills
- …
which is too much for me now.
Here is the file format if you are curious: