7shifts Integration Time Clock and Sales

Couldnt fit everyone on the page but below is all that it shows and save button.


I clicked Save and it saved settings and closed the settings tabs for Time Clock.

I clicked Time clocking again(at top) and nothing there still.

Ok so click save then go back to time clock button.

I edited my post above lol

Hmm ok try disabeling time clocking
 then renable it. There should be a setting under there for setting last pay period.

Ok I disabled time clock, then enabled it and saved it.

This time I got
image

For testing purposes, what do you think i should choose?

1 Like

Something before this week
 possibly last week. Set it weekly for now. Everything should work now once you get that set.

THERE we go!

So odd, I did exactly what I did before. Wonder why it didnt work then


I dont know lol. 7shifts has been rock solid for me and its simple, powerful tool that makes sense.

Ok now time to test SambaPOS punch in and out.

So ive ensured the Pin code in Samba matches the employee in 7shifts.
Added that extra execture script step in your tutorial.

Added the API key into the script.

But when i try to test the script it gives me an “Expected ‘;’” popup

Hmm might be a typo in the script

Below is the script settings. Just added the API key i was given.

In the CLK Handle clock out rule,

I added the script.


Also ensured the timing was setup on the rule “CLK Clock user In”

Sometimes the import tool messes with it.

Paste the script here minus your key

Should there be anything before the “var” characters?

Like at the very top of the script?

Just did, view the screenshot above

No that parts fine


Ok you have old scripts. One sec I must have not put new file up

1 Like
ar apikey = 'APIPASTED HERE'; 
var method1 = 'time_punches';
var method2 = 'users';
var method3 = 'receipts';

function getlocation() {
  var location = web.PostData('https://api.7shifts.com/v1/locations','',''+apikey+'','');
  var getlocations = JSON.parse(location);
  return getlocations.data[0].location.id;
}

function getuser(pincode) {
  var getusers = web.PostData('https://api.7shifts.com/v1/'+method2+'/','',''+apikey+'','');
  var user = JSON.parse(getusers);
  for(var i=0; i<user.data.length; i++){
   if(user.data[i].user.employee_id == pincode)
   return user.data[i].user.id;
   }  
}

function punch(userpin,pmethod,timein) {
	var loc = getlocation();
	var userid = getuser(userpin);
 	var execpunch = web.PostJson('https://api.7shifts.com/v1/'+method1+'/','{ "time_punch": { "user_id": '+userid+', "location_id": '+loc+', "'+pmethod+'": "'+timein+'"}}',''+apikey+'','');
 	var punchid = JSON.parse(execpunch);
	var punchidresult = punchid.data.time_punch.id;
 	Data.Set('punchid',punchidresult);
 	return punchidresult;
}

function updatepunch(punchid,punchtype,time) {
	var update = web.PutJson('https://api.7shifts.com/v1/'+method1+'/'+punchid+'','{ "time_punch": { "'+punchtype+'": "'+time+'"}}',''+apikey+'','');
	return update;
}

function createReceipt(ttotal,date,tid) {
	var loc = getlocation();
	var create = web.PostJson('https://api.7shifts.com/v1/'+method3+'/','{ "receipt": { "total": '+ttotal+',"open_date": "'+date+'", "location_id": '+loc+', "external_id": '+tid+'}}',''+apikey+'','');
	return create;
}

I had location id hardcoded in that one. It won’t work for you. New one had a function to get your location id.

No wait that’s right one. Hmm let me look closer.