Time Clock & Punch Editor - Custom Navigation Flow: Uses Employee Entities not Users


#195

If you view it on the punch editor screen does it do that?


#196

The format word is likely in the SQL script. Not all versions of SQL have support for the “format” function.

What version of SQL are you running?


#197

I am using Microsoft SQL Server 2008 R2


#198

That is an older version and likely the reason. You should upgrade to SQL express 2014.


#199

ok Thanks @Jesse :slight_smile:


#200

Hello Everybody,

Is there a way to get a wage report per employee weekly (mon-sun)?

if somebody can point me in the right direction i would be really grateful!
Regards
Claudio


#202

hi kendash really love this function i just have some few questions.
Is it possible to deny waiters to enter someone else there table(like the “can display other waiters tickets” option in user role list) and is it possible to change the tables waiter?
again thx for the great work allready

EDIT:
found solution for waiter change(created button that allows me to select waiter/employee) but for the deny function im still in the dark of how to create that:s i was also thinking if that option wasnt possible maybe there could be a work around like instead of asking pin on pos button to ask it when they select table and if it isnt there table it would deny them acces also that way table screen could stay open and save some time(dont know if this is even possible, its just me thinking out loud :s)


#203

Hi I have configured using https://gist.github.com/kendash/35688644368ef581dc2d/raw/ and managed to add employees, but how the employees clock in & clock out ?


#204

This is what i get on reports,where the employees can clock in clock out


#205

When you click pos button. You type the pin and it will ask to clock in. Or press time clock button.


#206

Just got off the phone with time trex. Very impressed with their software. I love their phone app. Do you plan on spending some time improving your integration with them? Definitely will myself soon as I can.

If I used your setup for a client that uses server banking, do you think it would be hard to get the report to show after they clock out for that last clocked out session? So the waitress would need to see her basic cash & credit card sales for her shift.


#207

I have already made lots of improvement that are not documented on the forum. Yes you can do anything with it. I use the free open source community version.


#208

Would definetely love to see your improvements if you ever find the free time to document it. :slight_smile:
Ill have some free time this weekend to implement and play with it myself. I signed up for the professional edition trial so I will be able to test out the system and mobile app. I love the idea of employees being able to request schedule changes directly within the app. In my opinion its worth the extra monthly fee.


#209

Thats all i get after downloading.cannot see any time clock or anything


#210

I have added a employee

but when when login with the pass it doesn’t log in.

not sure what happened.

Is there anything else i need to do apart from downloading from your link ?


#211

To add employees you do not manually edit them. You run the config task again to add employees. You run the task each time you add an employee. If you manually added employees it wont add the required scripts etc. The config task will ask you to input the required pin for each employee.

You also need to enable the Custom Navigation Screen option. The buttons are custom nav buttons.


#212

How to enable the custom Navi screen option ? please

How i add employees was




Then i go to POS screen


#213

Hey where would I start with learning time trex integration? I see the v4 detailed tutorial on the forum but confused to what changes you have made since then. Are those changes important? Should I just wait for your new tutorial?

Thanks


#214

I am basically not using any of that tutorial. Most of my new progress was in discussions in beta forum. I use serverside scripts and I feed data into them via the API using jscript like this:

function punch(name,status){
    var u = 'http://localhost:8085/api/json/report.php?user='+name;
    var data = web.Download(u);
    var result = JSON.parse(data);
    var userid = result.id;

    if (status == 'PunchIn'){
        var status = 10;
    }
    else if (status == 'PunchOut'){
        var status = 20;
    }

    var url = 'http://localhost:8085/api/soap/punch.php?user='+userid+'&status='+status;
    web.Download(url);
}

Basically if you setup the serverside scripts correctly you can punch by typing http://localhost:8085/api/soap/punch.php?user=John&status=10 in a web browser. status=10 tells it to clock user John in. 20 is out. I use jscript to feed that from SambaPOS into a url and then use web.Download() helper to execute it.

You can use other serverside scripts the same way to do just about anything in TimeTrex. For example I built a script that will add users to the system including setting pay rate etc. I built a screen in sambapos that has form boxes to fill in all of this data about a user and when I hit accept it creates that user in TimeTrex and also creates the required entity in SambaPOS.

You could even use a rasbery pi and some basic scripting to create a punch station.

Here is a sshot of my TimeTrex api folder that stores my serverside scripts I use with SambaPOS.

This is my Punch Script:

<?php
    require_once('../../classes/modules/api/client/TimeTrexClientAPI.class.php');
    /*
     Global variables
    */
    $TIMETREX_URL = 'http://localhost:8085/api/soap/api.php';
    $TIMETREX_USERNAME = 'ADMIN';
    $TIMETREX_PASSWORD = 'PASSWORD';

    $api_session = new TimeTrexClientAPI();
    $api_session->Login( $TIMETREX_USERNAME, $TIMETREX_PASSWORD );
    if ( $TIMETREX_SESSION_ID == FALSE ) {
       echo "Login Failed!
    \n";
       exit;
    }
    echo "Session ID: $TIMETREX_SESSION_ID
    \n";

    $punch_obj = new TimeTrexClientAPI( 'Punch' );

    $punch_data = array(
            'user_id'  => $_GET["user"],
            'station_id' => 1,
            'type_id' => 10,
            'status_id' => $_GET["status"], //PunchIn=10 PunchOut=20
            'created_by_id' => $_GET["user"],
            'time_stamp' => time()

    );
    try{
    $result = $punch_obj->setPunch( $punch_data );
    if ( $result->isValid() === TRUE ) {
       echo "Punch added successfully.
    \n";
       $insert_id = $result->getResult(); //Get punch new ID on success.
    } else {
       echo "Punch save failed.
    \n";
       print $result; //Show error messages
    }
    }catch(Exception $e){
       echo $e->getMessage();
    }

    ?>

The crucial part of that script to make this work is the $punch_data array I use $_GET to allow input.
I added my own comments in the script to help me remember what it all does.


#215

Here is my Create User script:

<?php
require_once('../../classes/modules/api/client/TimeTrexClientAPI.class.php');

/*
 Global variables
*/
$TIMETREX_URL = 'http://localhost:8085/api/soap/api.php';
$TIMETREX_USERNAME = 'ADMIN';
$TIMETREX_PASSWORD = 'PASSWORD';

$api_session = new TimeTrexClientAPI();
$api_session->Login( $TIMETREX_USERNAME, $TIMETREX_PASSWORD );
if ( $TIMETREX_SESSION_ID == FALSE ) {
    echo "Login Failed!<br>\n";
    exit;
}
    echo "Session ID: $TIMETREX_SESSION_ID
    \n";

$user_obj = new TimeTrexClientAPI( 'User' );

$user_data = array(
                    'status_id' => 10, //Active
                    'policy_group_id' => 2,
                    'sex_id' => $_GET["sex_id"], //Male=10 Female=20
                    'permission_control_id' => 3,
                    'province' => AR,
                    'country' => US,
                    'work_phone' => 8707993980,
                    'hire_date' => $_GET["hire_date"], //dd-mm-yyyy format
                    'pay_period_schedule_id' => 2,
                    'currency_id' => 2, //USD
                    'employee_number' => $_GET["employee_number"],
                    'first_name' => $_GET["firstname"],
                    'last_name' => $_GET["lastname"],
                    'user_name' => $_GET["username"],
                    'password' => $_GET["password"],
                    'address1' => $_GET["address"],
                    'city' => $_GET["city"],
                    'postal_code' => $_GET["zipcode"],
                    'home_phone' => $_GET["homephone"],
                    'mobile_phone' => $_GET["mobilephone"],
                    'home_email' => $_GET["email"],
                    'birth_date' => $_GET["birthdate"], // dd-mm-yyyy format
                    'sin' => $_GET["SSN"]
                    );

$result = $user_obj->setUser( $user_data );
if ( $result->isValid() === TRUE ) {
    echo "Employee added successfully.<br>\n";
    $insert_id = $result->getResult(); //Get employees new ID on success.
} else {
    echo "Employee save failed.<br>\n";
    print $result; //Show error messages
}


?>

Here is my Set Wage script:

<?php
require_once('../../classes/modules/api/client/TimeTrexClientAPI.class.php');

/*
 Global variables
*/
$TIMETREX_URL = 'http://localhost:8085/api/soap/api.php';
$TIMETREX_USERNAME = 'ADMIN';
$TIMETREX_PASSWORD = 'PASSWORD';

$api_session = new TimeTrexClientAPI();
$api_session->Login( $TIMETREX_USERNAME, $TIMETREX_PASSWORD );
if ( $TIMETREX_SESSION_ID == FALSE ) {
	echo "Login Failed!<br>\n";
	exit;
}
    echo "Session ID: $TIMETREX_SESSION_ID
    \n";
$user_obj = new TimeTrexclientAPI( 'UserWage' );
$user_data = array(
					'user_id' => $_GET["user"],
					'effective_date' => $_GET["edate"],
					'wage' => $_GET["rate"],
					'type_id' => 10, //hourly=10
					);
$result = $user_obj->setUserWage( $user_data );
if ( $result->isValid() === TRUE ) {
	echo "Employee added successfully.<br>\n";
	$insert_id = $result->getResult(); //Get employees wage new ID on success.
} else {
	echo "Employee save failed.<br>\n";
	print $result; //Show error messages
}


?>

I wrote all of these scripts myself after inspecting the API example.

Here is my Set Schedule script (Still working on this)

<?php
require_once('../../classes/modules/api/client/TimeTrexClientAPI.class.php');

/*
 Global variables
*/
$TIMETREX_URL = 'http://localhost:8085/api/soap/api.php';
$TIMETREX_USERNAME = 'ADMIN';
$TIMETREX_PASSWORD = 'PASSWORD';

$api_session = new TimeTrexClientAPI();
$api_session->Login( $TIMETREX_USERNAME, $TIMETREX_PASSWORD );
if ( $TIMETREX_SESSION_ID == FALSE ) {
	echo "Login Failed!<br>\n";
	exit;
}
    echo "Session ID: $TIMETREX_SESSION_ID
    \n";
$user_obj = new TimeTrexclientAPI( 'Schedule' );
$user_data = array(
					'user_id' => $_GET["user"],
					'pay_period_id' => $_GET["payperiod"],
					'start_time' => $_GET["stime"], //must be formatted as yyyy-mm-dd hh:mm:ss-05, 05 is timezone
					'end_time' => $_GET["etime"]  //must be formatted as yyyy-mm-dd hh:mm:ss-05, 05 is timezone
					);
$result = $user_obj->setSchedule( $user_data );
if ( $result->isValid() === TRUE ) {
	echo "Employee schedule added successfully.<br>\n";
	$insert_id = $result->getResult(); //Get employee schedule ID on success.
} else {
	echo "Employee save failed.<br>\n";
	print $result; //Show error messages
}


?>