Constraint based on Work Period

Is there a way to read if Work Period has been started or not. I need to be able to constrain a rule from firing an action based on if a Work Period has been started or not.

1 Like

I agree. I am looking for the same thing. It would be nice to have a flag (or Date) indicating the Last Work Period available, and be able to determine whether it is open or not.

Also, for my purposes, I would like to be able to catch a WorkPeriod Ending, and based on some arbitrary condition, follow through with Closing the WorkPeriod, or back out (Abort WorkPeriod End).

The way I currently determine the State of the Workperiod is by the DB, but that is in extraneous code; inside of SambaPOS, I don’t think we have access to any of the WorkPeriod Table data.

use [SambaPOS4]

-- get latest OPEN WorkPeriod or
-- determine if there is one currently OPEN
-- if this returns NULL, there is NO OPEN WorkPeriod
SELECT MAX(Id) FROM [WorkPeriods] WHERE [StartDate]=[EndDate]

-- get latest CLOSED WorkPeriod
SELECT MAX(Id) FROM [WorkPeriods] WHERE [StartDate]!=[EndDate]

We have work period start & end rules so you can make a setting (eg. {:IWPO}) 0 and 1. Same thing also can be done for the date.

1 Like

I like that. I never thought of doing this. That’s brilliant.

Great idea @emre

But I still need the following, if possible:

I tried WorkPeriod Ending and Before Work Period Ends Events in a Rule, checked a constraint, and tried to execute display of Ticket or Entity screen, hoping that would stop the WorkPeriod End, but alas, it did not.

To me it makes sense that you would need a close work period action for what you are doing. And maybe a Mark Work Period closed action…

1 Like

Is there a way to action end of work period from a rule?

No, not yet. I have it in a request for V5, @emre :stuck_out_tongue_winking_eye: