Russian government approved new layout of fiscal invoice. You can use MSRS channel to design documents with rich formatting in case of modern versions of iScala (starting from iScala 2.3 SR2 and SQL server 2008). And what if you have Scala 5.1, for example? Last week I talked to a client who needs to change the invoice form for this version. I looked at how it was done and shed a few tears. It was deigned to use MS Word and macros formatting the original text document in a beautiful table view when printing invoices. I remembered the anecdote of the early 90’s about the new Russian, who comes to the park with his son, sees the artist who paints oil painting, and exclaims: «Look, son, how people without a polaroid are tortured». However, the task itself interested me. Even at the very beginning of my work with Scala, I considered the possibility of designing DDF documents in HTML format but the impracticability of the mission was that the HEAD section in the document is repeated when printing, if you have a sales order, for example, with many lines. Then I was not familiar with XSLT transformations. And now familiar because of Epicor Service Connect 🙂
Since I was intersted, I «took from the shelf» a virtual machine with Scala 5.1, «shook off the dust from it» and began to experiment. And I did it 🙂
This I will share with you.
I configure the DDF file (with OEM-866 encoding as you probably remember):
After that, set up a special printer. Using the .bat file, it copies the header and the printed file to a new file with the .xml extension and calls Internet Explorer, passing the resulting file.
In fact, in the resulting file only data, no formatting:
Strangely enough, this is exactly what we need. After all, bringing this into the required form is a matter of technique. To do this, we need XSLT transformation that I wrote about above:
We add a link to the transformation into the source file and now when the invoice is printed from Scala, the browser opens and the form of the invoice appears in it:
Is this method suitable, for example, for iScala 2.2? Yes. The only question is to create the correct .bat file 🙂