Hi.
Firstly a little introduction …
Here in Thailand we use up to 5 languages in the restaurant: Thai, Khmer, Burmese, Lao and English.
SambaPOS is the only system I found which can handle our special needs and provide us the flexibility we need. Thanks to all the forum members who have shared such a lot of useful information, and especially Emre for making this amazing software!
right now am struggling to get some automation logic working.
I’m slowly getting familiar with using Automation Commands, Rules, and Actions and have set up an Accounting system which models our operation. It’s starting to come together … but have run into an awkward problem handling some custom accounting operations which we need to do after a new Work Period starts and before a Work Period is closed.
I am wanting to keep one set of accounts which tracks the cash going in and out of the cashier’s Cash Drawer during that staff’s work shift (i have called these “Cashier WP Accounts”) and another set of accounts which keep track of money kept in the Cashier’s safe (called “Cashier Safe Accounts”). The safe is where we keep spare change money, cashier Deposits together with their cash reports, and the Float remaining from the previous shift during the night.
After a Work Period is started in the morning, I transfer the amount in the Float (a Cashier Safe Account) to the Cashier Cashbox account using a “Create Account Transaction Document” with a Document Type called “Cashier WP Start”. This works fine using [:Balance] as the Default Amount field in the Document.
In the morning, the cashier presses a “Start Work Period” button which runs a rule called “WP Start (Cashier)” which contains a sequence of actions …
- “ac Start WP” to start the Work Period.
- “ac Create Start WP Txn using Float balance (Cashier)” moves the Float to the Cashbox
- Allow cashier to either confirm or back out of the operation causing the WP to close (not yet working properly)
- Open the Cashier Accounts
actually i had to remove step 4 because it seems that Actions don’t wait until data entry has been completed, so the Navigate Module action (which come later) switches to another screen thus preventing the user to enter any Amount.
The End WP workflow contains similar logic but in reverse order … the cashier makes a Deposit Transaction (which moves money from Cashbox to Deposit a/c) then the “Cashier End WP” Account Transaction Doc is created for moving the remaining balance back to Float (in Safe a/cs) then finally the WP is ended.
This example here is a simplification of the actual logic i wanted which allows the cashier to back out of the whole deal, and also needs to handle the case when the Owner opens his accounts screen to do Bank Deposits, pay Suppliers, pay Salaries or whatever and that operation could occur during an existing WP started by the cashier (an easy case) , or it might happen after the close of business for the day. In this case I want a WP to start automatically (if needed) when opening the Owner Accounts and end that WP again (but only if is was previously opened.)
I attempted to keep track of the WP state by using a ProgramSetting called WPState but found that when it was read back using {:WPState}, the value often didn’t reflect the most recently value written. So i decided to keep a local copy called WPStateLocal, and then i updated both copies whenever setting the state.
After getting very confused by rule behavior I added in a bunch of debugging Show messages to show both these state values to try and understand what was happening. I also inserted conditional messages to show cases when the 2 copies of my WPState were being read as different values.
For that i used an action Constraint such as {:WPState}<>{:WPStateLocal} and inside the Show message action i displayed the 2 values …
WPState={:WPState}\r
WPStateLocal={:WPStateLocal}
Then i was amazed to see the 2 values showing the same but inside an action having a Constraint expression which i thought would only be TRUE if the 2 values were different!
I also tried quoting the values in the Constraint expression like this…
‘{:WPState}’<>’{:WPStateLocal}’
but i continued to get erratic results. (So far this was using version 5.1.59)
I started to think there was some uncertainly about reading a SETTING and it had something to do with data caching. Could the evaluation of a Constraint expression, cause the data to change? something like a ‘heisenberg’ effect on the cached data? or is my syntax completely wrong or what?
I felt like start pulling my hair at this point … if i had any left that is …lol
After upgrading to 5160 I was excited to start using the new {GLOBAL SETTING:X} and {LOCAL SETTING:X} features but everything broke and I got even more confused.
I am struggling to implement some basic workflow using Rules and Actions.
Constraint expressions using numbers seems to work as expected, but when checking if 2 strings are equal there seems to be ambiguity relating to using quotes or not.
Which of the following Constraint expressions would be valid if i want an action to execute only if a work period is closed? …
- {:ISCURRENTWORKPERIODOPEN}==FALSE
- ‘{:ISCURRENTWORKPERIODOPEN}’==‘FALSE’
- !{:ISCURRENTWORKPERIODOPEN}
- {:ISCURRENTWORKPERIODOPEN}<>'TRUE
- ‘{:ISCURRENTWORKPERIODOPEN}’<>‘TRUE’
and what about …
[={:ISCURRENTWORKPERIODOPEN} && {LOCAL SETTING:X}]
There are many possibilities here but i didn’t yet see a clear definition of how these expressions are evaluated. I am using the quoted syntax like #2 and #5 but still get erratic results.
What am i doing wrong?
Thanks in advance!