Regular Expressions at Printer Templates V4

Hello,

I am either have misunderstand or missing something here or a bug should be reported.
I am using SambaPOS4 under Windows 7 Ultimate with Microsoft SQL Server 2012 and I am not able to work with regular expressions at printer templates. Not even “[=2+5]” will work. It will not print a “7”, just ignored.

What I am trying to do is to print to a file using Generic/Text printer a command set that my Fiscal Printer then will read through a windows driver (that is the only way the specific machine is working anyway!) So…

My Printer Template looks like this:

[LAYOUT]
-- General layout
{ORDERS}
CR\0,00\1

[ORDERS]
S\{NAME}\{QUANTITY}\{PRICE}\[=TN('{ORDER TAX RATE:1}')+TN('{ORDER TAX RATE:2')]\{ORDER TAX TEMPLATE NAMES}\(LF + CR)

A line starting with an “S” is fiscal printing a product and requires as parameters the ‘name’ of the product the ‘quantity’ the ‘price’ the ‘fiscal factor’ and a ‘number’ that should be between 1-19 and the end of line command ‘(LF+CR)’, like this:

S’name’‘quantity’‘price’‘fiscal factor’‘number’(LF+CR)

In my case I named The Tax Templates as ‘1’ and ‘2’ so the {ORDER TAX TEMPLATE NAMES} can give me a discrete ‘number’. {ORDER TAX RATE:X} will return the rate if the product belongs to X, 0 otherwise, so the sum of those two cover my case.

Of course I want to know if there is more simple solution possible that I should be aware, but the real problem I can see is that the regular expressions are not working at all.

Missing something here :wink:

TN('{ORDER TAX RATE:2')

Even corrected though, I still can’t get output for the expressions.

TN('{ORDER TAX RATE:2}')

@aklotsonis, This works:

[LAYOUT]
-- General layout
{ORDERS}
<L00>CR\0,00\1

[ORDERS]
<L00>S\{NAME}\{QUANTITY}\{PRICE}\[=TN('{ORDER TAX RATE:1}')+TN('{ORDER TAX RATE:2}')]\{ORDER TAX TEMPLATE NAMES}\(LF + CR)

The difference is the addition of <L00> preceding the lines.

@QMcKay, thanks for your help.

This is a useful observation as it shows a good clue about the code modification that should be done to solve that issue.

Even if I though that your way might do the trick for the regular expressions i actually never try it because it wouldn’t solve my case for now. The remaining question is, what happens to the case of a Raw Printer?

In my case I need an ASCII file that might contain greek characters in it and the only workaround that I found so far is using Raw Printer Type. Using character sets 111, 737, 851, 869 at Ticket Printer Type (for instance) or any other printer Type will not work. Even with the rest of my printers (one EPSON TM-T20II and another OEM) greek characters wouldn’t work with TIcket Printer Type and 737 character set configuration, without configuring at the same time the character set at the corresponding windows driver.

So if somebody could think of or know a solution that would print what I need without a regular expression either have figured out a way of handling the greek characters would save me some time of…

  1. Either using @QMcKay solution and then sending the output to a Dynamic Port Printer to be handled by a bash script before it end up saved to a file.

  2. Or modifying the source in order to cover the Raw Printer case which should be done sooner or later.

For informative purposes, a Dynamic Port Printer Can be created using a driver/software like RedMon.

Thanks in advance,

Any ideas??

@aklotsonis If it is possible can you please give more specific details about what SambaPOS prints and the expected output.

Sorry for the delayed feedback but I was out of the office for some days.

Finally got it to work using “Windows Printer” or “Text” as printer type and character set 737. My omission was to setup the Generic/Text Windows Printer with character set 737.

The only use case uncovered now is a regular expression with a Raw Printer?