Advise on how to save my ticket in XML


I am now issuying my tickets on an epson matricial ticket printer.

This paper ticket is the legal document for the tax office.
It is a 3 paper roll:

  • a witness copy kept in the printer
  • 1 or 2 copy for the customer

As from August, the 1st, I have to enter the electronic-billing system, which mainly consists of:

  • sending all the tickets in XML format to the tax office at the end of the day
  • printing a simple ticket (termal printer) containing the information for the customer to see (QR code + web) or to receive (email) his electronic bill

Before starting this (big) work, I would like to ask you some advise on you would do, mainly for the XML conversion.

To have an idea of the XML format, it’d be worth to have a look on this link (Pag. 18:there is an exemple)

This is the xml format for one type of bill, it’s just one part of the work.

Some ideas/question/doubt before starting

  • I am used to Unix, so unaware of windows programming
  • I can do script (sed, awk), standard C, some other.
  • I struggle with OO (classes, etc , although I know xml-classes could be easilly integrated)
  • I have never programmed on windows however that’s where SambaPOS runs, so …
  • I like simple tasks (windows) OS version independant.
  • I am lost in big IDE like eclipse, …
  • Is there already existing module that can be reused
  • Integration with/in SambaPOS or Separate program that takes the daily ticket text file as input to produce and send xml


Take a look at my PMS ingergration, I have a script which generates json string itemised by orders grouped by tickets for passing sales data to our PMS. It wouldn’t be hard to generate xml instead.
If I went back and did it again I’d build an array and json stringify instead of handling strings but was less experianced when initially made.
Pretty sure there is a xml equivalent to stringify.
Also I took data direct from SQL but now with gql it would probably be better to use that to call info.


Just curious what country are you in? Your country seems pretty serious about tax even for smaller vendors like restaurants.


Yes … it’s still a very informal country and they want to be more catolic than the Pope …
It’s Peru.


Can you tell me where I can find it ?

Thx, Marc


It’s a long topic, kendashs and q helped me allot as before this had never used jscript/Java and only ever have minimal SQL experience.

With the addition of graphql there are likely improvements removing the need to the SQL queries and improvements but been almost 2 years since we went live with it and other than the odd update for PMS API changes or minor tweaks to account for unforseen events.