Timeclock Implementation Requirements - Discussion

Continuing the discussion from TimeTrex Community Edition Integration: How to integrate third party Payroll/Time Clock software into SambaPOS:

@emre, are you suggesting we could implement a rudimentary Time Clock in SambaPOS now, using Entity State Minutes, without 3rd party?

I know this is Requested often from many users and I just wanted to ask if it’s possible now, or with a few features added, could it be possible without a lot of effort?

To be able to implement a time clock we need to store entity state change events for reporting.

If we discuss what information we need to receive from SambaPOS we can understand what we need to store.

@QMcKay I have implemented a basic State system with Employee entities and it works great. It will also show duration clocked in using {ENTITY STATE MINUTES} but like @emre said it does not store any information so there is no way to determine what day those hours occurred on etc.

I can see how this would be possible if we could store that data. All we would need is the ability to timestamp with date the entity changes… and we could define what type of change it is with constraints. It would also need to store what Entity it was. It could easily be done with a system that operates like tickets… obviously we would not want a ticket… but technically I think I could make this work using Tickets and a Time Clock ticket type and ticket tags…

It would be fairly crazy setup… ticket tags triggered on entity state change… the entity state changes would have to happen within a ticket… I can keep going but I do not think this would be practical at all to use tickets just to allow reporting on Employee entities lol.

@emre With the recent changes I think if we could specify when we create Entities if specific data is stored… or maybe specify when we create the States to store the information… THe way I see it this is the data that would need to be stored.

  1. Entity Name = Already stored
  2. Entity States:Clocked In, Clocked Out = Already stored
  3. Entity State Status Changes:Clocked In:TCStatus, Clocked Out:TCStatus
  4. Date and Time of Entity State Status Change: Clocked In:TCStatus, Clocked Out TCStatus

Thinking about it all we need is to store 1 main event which would be Punch… we would need to define a system to label the punches as In, Out, Break, Lunch Out, Lunch In etc. That punch would be timestamped with date/time. So if we have this information… we can design a way to label and determine what that Punch is. So I am thinking just State Change can be Punch… we just need to design a way to label each punch… maybe a system that can detect First punch for Work Period

Someone with more experience than myself regarding managing employees needs to chime in on this.

In my small operation, I only have 4 employees and they write their Start and Stop Time on a paper Timesheet that I created. This does not include breaks or anything else. Twice per month I go through each line/day and calculate the hours for that day, sum them all up and pay for the hours worked (actually, I transfer the times into an Excel Spreadsheet and it does all the math for me).

I am getting tired of doing this manual labor :stuck_out_tongue_winking_eye: and want to implement something “automatic” - let them clock in and clock out with the press of a button. I don’t really care about schedules or day-off requests at this time - just something simple to start with.

I could try TimeTrex, or build my own in PHP while storing information in the SambaPOS DB, but if there is a possibility to create simple time-tracking within SambaPOS already, it would at least be a start to something that could be expanded over time.

I’m planning to create a Log State Change action so we can configure what states we need to log.

However the table structure really depends on how we’ll use that data. Other than employee states we can also log customer states, or table states to generate some useful data (eg. how much time x table stayed in Available state or how many times a customer orders in a month).

1 Like

I will examine my TimeTrex time clock table structure I can let you know some ideas from that.

1 Like

… also it will be awesome if we can see a sample time clock report for employees.

Here is Punch from TimeTrex obviously its more involved than what we need but you can get idea of structure. Also point out this is Postgresql I will post a lot of stuff even if it may not pertain to us… it might inspire you with something…

Here is Punch Control:

Getting some more info…

This is my Excel Spreadsheet… I have a sheet for each Employee, and the sheet is broken into Months. The Salaries (or hourly pay) is transferred from another sheet and is shown at the top row. It has provisions for overtime and increased rate for working on a Holiday.

The thing we need to decide is how basic we want it… and how do we want to calculate overtime etc. Do we want to do that manually our self or do we want it to do that with reports.

if we did it with reports… we just define specific TimeStamps for what constitutes overtime and what doesnt… then when we display the report it needs to have Worked Time, Over Time, Regular Time etc.

I know I am getting into it more advanced than you were asking @QMcKay I am bringing up all sorts of points in the chance it might spark some ideas.

Timetrex is using a user_ID and it is using just punch… it is then determining a Status_id for what type of punch it is… Status_id can be our command button for punch. Each punch is timestamped.

Very basic functionality would just track days and hours that we could report on to give us a running Total.

Going further: Salaries (Entity Custom Data), overtime, double pay, etc would be extremely useful to reduce the amount of extra labor for pay calculations.

I agree, it’s good to keep in mind future additions so the structure can be expanded instead of re-written. So even at a basic level we should think carefully about initial implementation.

This is case-in-point. If implemented properly, it need not be just about Employees; it could apply to any type of Entity. That said, an Employee really is quite a special type of Entity.


Just looking through this. I can easily see how this might be possible now. We could start with basics and maybe introduce some advanced functions through a paid module or something? Similar to how Advanced Ticket options Free module works. Just throwing out ideas.

Another view of some more structure to maybe spark some ideas.

Here is a Punch report in TimeTrex. This is not from mine but from a demo so it would have more information to look at.

It looks like it is just listing Punch Status on left… and then Date as a column and the TimeStamp for each state.

I am not suggesting we try and design a TimeTrex. I do however think its good to get ideas from a working open source system.

1 Like

Quite similar to my spreadsheet, pivoted to have days as columns instead of rows.

+1 Agreed

Notice its determining Lunch or break with the same timestamp for Punch… by just pending the L on it so Out Status becomes Lunch Out etc. The M2 is an exception code. This particular person has a missing Out Punch.

If a person Punches in/out 50 times in a day, does the report grow vertically? That sounds crazy… look at all the In/Out rows already. Anyway, not important - we can develop the report to show whatever we like.

If you allow that yes… timetrex lets you restrict it. If person tries to clock in and out multiple times… the next in punch it will not allow, it does this through policies and they are quite expansive. But yeah not important :stuck_out_tongue: Everything can become an idea however :stuck_out_tongue:

If there is anything else you would like to see I can paste it here. Just looking through this and thinking of how Entity States work in Samba I can see how this would be very possible.

Something else that would be good for future… a scheduling system for Entities. It could just be a front end for entering Custom Entity data for Employee Entities… Or maybe other Entities for other applications not just entering schedules. heck this may be possible now… in a hacked up round about way.

I an envisioning a calendar… with entities… Click on Entity then a date on calendar and type a time in… it would assign that Date/Time as a Schedule Entity Data field and store it on that calendar… Maybe I am getting too far ahead of this thing lol

1 Like

Not at all. All of these ideas are exactly what is required to implement this successfully and it’s why I decided to start the Topic.

No typing! :wink: A pick-list would be good - have an option for either with pop-up keyboard.

I think @emre has already left the building to start building :stuck_out_tongue_winking_eye: lol

1 Like

Good idea. We may need a way to designate specific span of days as a Work week for pay period designation. Of course this can probably be done with reports.

The two systems combined would allow some of the more advanced things like determining if an entity worked longer than scheduled… can view overtime, as related to sales to see if your spending the wage hours wisely etc… some really cool stuff.

Heck thinking deeper about it … this would open up a good avenue for some of the KPI stuff brought up a few times this past month. So just getting a basic foundation set now would be huge for future functions.

I am also thinking about possible integrations with the recent HTML Widget improvements. The fact we can pass values to and from it with scripts and read values as command values… Someone could develop all sorts of cool things… I am thinking of the online ordering stuff… employees being able to view/request days off from home… all sorts of things. Reserve tables from a website at home or your phone… etc

1 Like