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

Yes sorry I failed to mention that. I will correct the tutorial to show that. Thank you for pointing that out!

In fact what was supposed to happen is you should comment that out and it will default to Active user. I just forgot to put my comments back in. This way you do not have to set specific User_ID for each script… just comment that line out by putting the // before ‘user_id’ => 1, It should work… if it does not let me know.

I was using ‘user_id’ => # when testing out logging in as admin and switching to that user from admin… Never could get it to work so I commented it out… i just forgot to put the comments back in the right spot when I uploaded the scripts and screenshots… very sorry.

Added … but now it fails… should I be putting in 1 or leaving it to 3?

1 Like

Hmm I will investigate it… for now just put the actual users Id in there. I may have truncated some code when I was taking the Admin Switch user function out of the script.

Ok great… Good work by the way!.. Really nice how it all works when the user_id is set right!

1 Like

You might like to read the other thread I made showing an alternative setup within SambaPOS for this. For me I am using the alternative setup it feels smoother.

TimeTrex is very powerful complete Enterprise ready payroll software. But you can also just use it for partial use like just the Time Clock.

I prefer it even if its just used as a Time Clock because of the API and how it works. Might be more difficult to setup this way vs just a simple TimeClock app but I love the API and how it is designed to work.

I would prefer to keep most discussions about SambaPOS however. These tutorials were mostly to show how it is possible not to discuss the Third Party software.

I definetly agree. Great powerful software… now that I got the timetrex stuff down what I am thinking about doing is having a seperate entity screen just for employees to clock in and out from a terminal in the back… im just trying to think of how i would be able to do it… I would like for there to be Two buttons… one to clock in and one to clock out… When they click clock In is there a way for samba to check to see if the user has pressed the clock in button yet and if not ask them before it runs the vbs file if they would like to clock in. Then if it sees that they are already clocked in it will say you are already clocked in for the day. Then I would like to have the Clock out button confirm that they want to be clocked out before it runs the vbs and also reset the state of them pressing the clock in button. That way when someone has a split shift when they clock back in it lets them know they are clocking in for the day or something like that. Any ideas on how i should go about doing that… Ive tried a few things but its all still new to me.

What you are describing was already included in my tutorial. I just used an automated approach. Instead of it checking based on button press its checking based on user login to Samba. It is storing a value in the database when a user first logs in to Samba which is also when they clock in… Clock in is required to even log into Samba… IF that value is a 1 it does nothing and allows them to just log in to Samba… if the Value is 0 it forces the ask question action making them choose clock in or exit… if they exit it will not let them log into samba.

You can probably design a system similar with buttons instead of @ log in. Instead of storing the value with User Log In you store it at button press. It would disable the button once it stores the value and the user will be forced to use a different button… and vice versa.

Yea I was tyring that but it seemed like the reset user status at clock out was not working. So i would clock out then log back in and it was not telling me to clock in again. Shouldnt it tell me to clock in.

The way I designed it… to actually clock out the user has to press a Clock out button. This is for the simple fact that I may have multiple SambaPOS logins through a work day… I did not want it clocking them out just by logging out of samba. So I designed it so it stores the value at log in… but it does not reset it until you press clock out button. Preventing it from making them clock in again just by logging into samba… this prevented multiple punches to TimeTrex.

Simply put I wanted the user to have the ability to log out of samba and log back in without it punching timetrex again. The only time I wanted a punch sent to timetrex was FIRST samba log in for their day… and when they pressed the Clock Out button.

So if they do press Clock Out button… the next time they log in to SambaPOS it will prompt for the TImeTrex punch again. This allows split shifts… but also allows them to log in and out of samba without recording punches once they are on the clock.

Yes, thats what I mean. When I press the clock out button it does not reset the user state… Basically unless i close the work period and open it again it does not prompt for log in. Shouldnt it ask after I click the clock out button?

The way it should work and the way i wrote the tutorial… if they press the clock out button (Not the same as Log Out in Samba its a Automation Command button I made) it will record the punch in timetrex and then reset their value so the next log in to Samba triggers the clock in question again. If it is not behaving this way then you must have missed a step in tutorial.

Let me look over it and make sure I didnt miss anything.

I think this is where my issue might be… do i need to use [:user] or just the username? or is there another variable i need…

You use [:User] so you can define the actual username in the rule this is so you do not need to make multiple actions for each user. [:User] is just a variable making the action check the rule for the actual value of that field

The rule is using {CURRENT USER} so it looks at who is currently logged in and it puts that name into the action as User

I think if i remember right we modified it a little to make the loop work. I think it actualy puts it in as TC_User.

PS I double checked my tutorial and it is 100% accurate… go through it and make sure you did not skip ANYTHING.

Expected behavior is when you press the Clock Out automation command button which the tutorial placed in a Entity Screen… it records a punch in TImeTrex and resets the users status in Samba back to 0

Ok I will have to go back and look. I think I need to get rid of all the rules and actions and start over. Is there a good place you can point me to so that I can better understand how the rules and actions and automation stuff works in the system. Like a wiki or something.

Best place is Documentation portion of forum and just read ALL of the tutorials you can even if they are not stuff you want in your system… They will show multiple ways to use Rules/actions and give you a better understanding.

PS: If you follow my tutorial EXACT and do not CHANGE anything unless it specifically tells you too then it will work. Only exception being the user issue we found in the script. The only thing you would be changing is specific instances of Username that would be in the scripts and .bats… the rules and actions all use variables and syntax like {CURRENT USER} You should not be inserting a single actual username into any action or rule. If it shows {:USERNAME} then you should type {:USERNAME}

Ok, im going to give it a go… ill share my setup if i have any issues or questions… or if I get lucky and I figure this whole thing out my first try haha!

I have it working now where I have a TimeClock Entity Screen… With Two Buttons… One for Clock In and one for Clock out… When I press Clock In it punches as it should and displays a message you are now clocked in. When I press No it switches back to the dining room entity screen. What I would like to do is have it also check to see if the clock in button was previously pressed and have it either disable the clock in button after it has been enabled or display a message saying that you are already clocked in and have it not run the vbs file. It would be nice to have the clock out button greyed out only to be enabled when the user state in samba changes to clocked in… any ideas how I could do this?

Might need a little support from @emre to get it to behave like that… Right now the only validation is {CURRENT USER} and {CURRENT ROLE} that I Know of. Unless you can enter other Validations into the Widget Command button and I am unaware of them.

Now triggering an ask question action is something you can do using same Loop method.

EDIT: I think it would be worth exploring to build an optional setup that uses just buttons vs Samba Login. THe reason I did not build a Clock In button is because I am needing it to pull user tied to Log-In so that user HAS to log in anyway… to reduce steps instead of looking for a button after logging in… I just used Samba Login as the punch. So employee does not have to log in and then click clock in… they simply just log in. This was a more natural less confusing and less redundant approach.

The scenerio I can see where you would need a Clock In button is if you use ONE Samba Log In for everyone but you select an Employee Entity for the Time Clock functions… So the entire thing would need to be redone to work with Entities instead of USers. This is possible and might be worth exploring. The only kicker would be how to create the method of selecting the Employee entity when they press Clock In. You could possibly do that by creating a Entity Log In question when the Time Clock Entity Screen is loaded.

I am not sure if the Rule for Aplication Screen Changed can read specific entity screens or not. @emre may need to help with that.

@emre is ready for your service…
Input question []

2 Likes