Urgent ... Weird behaviour when incrementing system variable

database when you first install SambaPOS

Local program settings work fine, I used them for logging last bill for my print last receipt (copy) button.
If you dont trust local program settings just use global (SQL stored) program settings and prefix with terminal name which I have also done in the past. ie
Bar1_LastBillId
In fact thinking about it I probably do that anyway so maybe I dont use local settings only termianl prefixed global program settings. Which isnt a bad thing as you can use SQL manager to check the settings values and update the query to refresh.

Did you change it to use the +1 formula Q showed you as have never used increase only the formula on update like Q showed.

Hi JTRTech, that is exactly what I want. However watching the ProgramSettingsValue table, I see that:
While it seems to work with {GLOBAL SETTING:SerialNumber} - I can see that the ticket is tagged with the database value,
it does not seem the case for IsLocal : false because SerialNumber variable is not - always/immediately - SQL stored.

Now I already ask how terminal works and how I should setup the local settings for each windows user (each SambaPOSPresentation.exe instance) but I had no answer.

My understanding would be terminal is like a supermarket with lots of cashiers. 1 terminal = 1 cashier and related workperiod. Is it the case?
My setup is 1 computer with

  • 4 users - waiters that start their windows session and in that session open their SambaPOS, they start their session with RDP. each waiter is a cashier (takes money)
  • I don’t have terminal setup except the default one : server
  • I have 1 working period per day
  • Each waiter has their money report based on PU (what they settled)

Example of Celia SambaPOS user running under Celia windows session.

Do I have to have terminal defined for each waiters or can each waiter work on the same terminal (server)?
Do each terminal have its own working period?

My rule is:

  • Action Create Sunat Number (see picture) and update db (if this is what IsLocal:False does)
  • Action Tag the ticket with SerialNumber from DB ({GLOBAL SETTING:SerialNumber})
  • Action Print Bill

Look my report below:

The first line is a SQL report that takes the value of SerialNumber in the ProgramSettingValues Table in SambaPOS5 db.
It is : 160031

The next lines are the serialnumber tagged to the tickets

These numbers are bigger that the DB serialnumber, so somehow that value is kept somewhere but not (always) in the database
That (always) is my problem, I cannot reproduce the problem, it just happens, I am here watching that number since the morning. Before settling a tickent the waitress come in my office and we do it together watching that number in the DB.
I haven’t written SambaPOS I don’t know how it works, I can just imagine not more.

In my experience ive always defined terminals for each individual tablet.
E.g.
Server(main server machine)
Tab1
Tab2
Tab3
Pos2(of another wired terminal is there)

And ive checked ticket number increments and its never skipped. Its also useful to check which tab was used by which user when checking if there is an issue on a ticket.

Maybe you can take a copy of your database. Bring it over to your own laptop or test machine or something. Run the database on a seperate network so your live system(this can even be done at home using your home modem/router) take maybe after evening where ur done for the day both tablets home, link em up to your network, define a terminal for each tab, then test your serial number to see if it affects it or to see if its corrected. If its corrected then do it on your live machine and monitor it like youve been doing.

Thanks shivan,

I’ll give it a try because it’s a bit weird to have all users on 1 terminal.

Now before I do stupid things, making a terminal it is just to give him a name?
Is the workperiod dependant of each terminal or 1 workperiod for all terminals?

Right now it does not matter if X uses Y terminal until they login in SambaPOS with their usernames (X or Y), reports are based on PU SambaPOS users.

Ok I created terminal as you did but not helping … still double numbers.

Oh well. Sorry mate i tried. It was worth a go to test anyway

The fact that they are all duplicated to be makes me think its config issue rather than clashing requests as that would more likely be sporadic.

I suggest you to try your Serial Number set up on fresh default database. So, you don’t have to keep posting/looking at the same old places over and over if the new set up working.

And ^ Q suggestion to look at rule debugger. Everyone convinced it is your configuration issue. But you just want to blame Global Setting not working.

Is that report ordering by serial?
Thinking outloud but are you 100% using global and not local?
Ordering by serial makes it hard to tell.
You could do with adding terminal and time into the report to see how the number is progressing in relation to tickets…
What im getting at is if its ordered by serial you would stuggle to tell if there is actually two sequences running in tandem rather than duplicated/not increasing. if that makes sence.

Instead of having the actions in the same rule try creating the serial number and then trigger an execute automation command action and put the tag action in a separate rule. Actions in rules don’t always trigger sequentially based on order inside rule.

Yes, here is how it looks like when ordered by time (settled time):

(don’t look at the waiters, these are TU, not PU)

Yes Kendash, I was thinking of that or even changing the order of the action in my rule, like:

  • Tag ticket
  • Print
  • SerialNumber++

That might change this erratic behaviour, I might have less double but I’ll never be sure that it works the way I expect.

That’s quite a thing. I’ll make a try.

???

Sorting Rules works. It can be important in some cases that some Rules are fired before others. That is what the Sort Rules feature is designed for.


Well, yes they do. That is why it is importatnt to put Actions in the correct order, depending on what you are trying to achieve.


Good idea and something I would definitely try. However, I don’t think that will solve the issue here. Something else is getting in the way or executing out-of-order.

Hold on, so your running sambapos twice on the same machine?
I thought you were meaning two terminals…

These are on two users so is this an RDP type setup?

RDP on tablet, wifi,
I personally am on a PC wired

Both SambaPOS run in their own memory space.
Global/local vocabulary applies to 1 instance of SambaPOS, there is no such thing as “global variable” between 2 instances of a program, there is communication instead (pipes, database, …) that’s why I prefer when @QMcKay talks about “SQL Stored”.

If you look at the “time” report above it really looks like that each instance works independently and that for unknown reason the SerialNumber has not updated the database.


I added terminal name on my report, right now all ok but the second waiter clocks in in 2 hours.
The lines without SerialNumbers are the “open tables”.

You havent edited actions while in use in a rule have you?
Your actions are all defined in action not rule, just thinking maybe if you have edited action and not removed, save and added back in to rule it hasnt refreshed the action parameters causing a flow which isnt doing what you think it is.
This is why I generally use [:xxx] for all action values I need and set in rule as updating/changing is easier and you can see all your peramiters within the rule rather than keep switching between rule and actions to see whats happening.

1 Like

I know I did take the actions out and back again but I am not 100 % sure I did it for all actions, I do it know, disconnect all terminal, restart the server.

ok I did it.

Still doubles + SerialNumber not updated in DB.

Interesting

Looks like SerialNumber (on DB) is now only updated by Celia (new clocked-in waiter)
Nope … not the case.

TKarina = terminal Karina
TCelia = terminal Celia

13:11

13:15