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


#257

mmm still having the same problem :disappointed_relieved:



#258

You do have internet? Firewall maybe?


#259

So what does the error log say?


#260

HI kendash
I was able to download your time clock looks grate btw
is it posible to create entry hours and exist times for employees?
also I would like to know:


#261

I’m putting the cart before the horse, but I’m also working on TimeTrex in advance to eventually interfacing it with SambaPOS using the scripts you’ve created here as a reference.

I setup TimeTrex and made a couple of users. Made a schedule, etc. I used the punch.php above and whenever I try to call the script with:

http://localhost:8085/api/soap/punch.php?user=2&status=10 I get the following back:

Session ID: e483e22a7d85612ca707ab567bd986e67368d55f Punch save failed. =====================================
Function: setPunch()
Args: 1

Returned:
IsValid: NO
Code: VALIDATION
Description: INVALID DATA
Details:
Row: 0
–Field: user
----Message: Invalid User
----Message: Invalid User
–Field: user_id
----Message: Employee is invalid
–Field: date_stamp
----Message: Date/Time is incorrect, or pay period does not exist for this date. Please create a pay period schedule and assign this employee to it if you have not done so already

I have a valid user, and I can manually punch them in and out in TimeTrex. They have a pay period and schedule.

I feel like this may be an authentication issue - either needing the users name and password somewhere, or else something in the quick punch fields? But I don’t see where to pass that information. I definitely have a User #2.

It’s either that or there have been API changes since you were using the above.

Just wondered if you’ve encountered this or have any ideas.


#262

It still works and nothing changed. It’s probably something small and simple you missed.


#263

Probably. I’ll keep poking around. :slight_smile:


#264

I struggled with similar issue. After poking around with it I figured it out. It usually was a configuration issue. Small but I kept overlooking. It’s been a while since I set this up so I can’t remember all the quirks I had to work out. I use it daily though so I can promise you it works.


#265

I was just worried they changed something in the latest community version to make it more difficult. :slight_smile:

I feel like it’s something with authentication. I know it accepts the admin user and password because if I change that it returns a different response.

If you have a user and password available for each employee, it seems like it would want some sort of authentication other than user_id 2 when you did a punch. It doesn’t seem to alllow you to leave them blank.


#266

Check the users permissions policy I know I had to give specific permission in the policy to allow them to manually punch.


#267

I figured out the issue. I was assuming that employee number and user_id was the same thing.

What’s strange is that when I added my first user, it was added as user_id 5. When I added a second user, it made user_id 19. The employee numbers are 1 and 2.

The only downside is that other than the URL showing the user_id mixed in with the various employee screens in TimeTrex, that field doesn’t really appear anywhere else.

I wonder if there would be a way to have it assign user_id numbers sequentially like the employee numbers, or else be able to reference the employee number in a script for punches.

Some of this might be treading into TimeTrex forum questions.


#268

If you look at my tutorial I use a script that automatically matches user_id based on employee name it then inserts the Id into punch script. That way I don’t have to care about the Id it will automatically match it.

I used a report api to match user_id using employee name.


#269

I’ll check it out. I read a few of those tutorials but I missed that part. Some I think we’re from v4 where there was a batch file and other files for each user.


#270

Yes the v4 batch file one is old do not read that one. I will link the script here one moment.

The first part of this script is where it uses name to link it to userid. For this to work the name that is called into the script needs to be exact user name in TimeTrex or it wont match.

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);
}

So it takes user and gets the user_id with this section of the script. User is the username in TimeTrex. So I typically make the TimeTrex username the exact same as their Username in SambaPOS and I feed {:CURRENTUSER} into the scrip for name.

    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;

Basically if you do this then all you have to do is be sure Username is the same for TimeTrex and SambaPOS and that is it. It will just work no additional coding required and it wont matter what order it generates user_id in the database. I wouldnt want to mess with how it generates user_id anyway because TimeTrex is very complex it has a lot of inner workings with the database fields. For example it handles payroll and active, inactive, terminated, etc for each user_id.


#271

Hi Kendash How were you able to create your navigation screen to look like this i have tried quiet a few things but i cannot seem to get it to look like yours witch is the best i have seen can you please point me in the right direction please … thank you


#272

ps . how do you change the size of your custom nav icon’s


#273

Keep getting this error when I add a user. Seems to be still adding the entity and report however.

Its working fine on my test system but not on the live database.

-----------------------------

[General Info]

Application: SambaPOS
Version: 5.1.62
Region: en
DB: SQ
Machine: IEKEM-DT03-0715
Date: 05/12/2017
Time: 14:54

User Explanation:

Pat said “”

[Exception Info 1]

Top-level Exception
Type: System.ArgumentNullException
Message: Value cannot be null.
Parameter name: path
Source: mscorlib
Stack Trace: at System.IO.File.Delete(String path)
at Samba.Infrastructure.SambaFile.Delete(String path)
at Samba.Modules.DatabaseModule.ExportHelper.ExecuteTask(AutoConfigurationTask task, Dictionary2 keys) at Samba.Modules.DatabaseModule.AutoConfig.AutoConfigurationViewModel.OnExecuteTask(AutoConfigurationTask task) at Microsoft.Practices.Prism.Commands.DelegateCommand1.<>c__DisplayClass6.<.ctor>b__2(Object o)
at Microsoft.Practices.Prism.Commands.DelegateCommandBase.Execute(Object parameter)
at Microsoft.Practices.Prism.Commands.DelegateCommandBase.System.Windows.Input.ICommand.Execute(Object parameter)
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
at System.Windows.Documents.Hyperlink.OnClick()
at System.Windows.Documents.Hyperlink.DispatchNavigation(Object sender)
at System.Windows.Documents.Hyperlink.DoUserInitiatedNavigation(Object sender)
at System.Windows.Documents.Hyperlink.OnMouseLeftButtonUp(Object sender, MouseButtonEventArgs e)
at System.Windows.Documents.Hyperlink.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.ContentElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.ContentElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)


[Assembly Info]

mscorlib, Version=4.0.0.0
Samba.Services, Version=1.0.0.0
Samba.Domain, Version=1.0.0.0
Samba.Infrastructure.Data, Version=1.0.0.0
System.ComponentModel.Composition, Version=4.0.0.0
Samba.Presentation.Services, Version=1.0.0.0
System.Core, Version=4.0.0.0
PresentationCore, Version=4.0.0.0
DevExpress.Xpf.LayoutControl.v14.1, Version=14.1.13.0
System.Xml, Version=4.0.0.0
DevExpress.Xpf.Grid.v14.1, Version=14.1.13.0
System, Version=4.0.0.0
DevExpress.Xpf.Grid.v14.1.Core, Version=14.1.13.0
WindowsBase, Version=4.0.0.0
System.Xaml, Version=4.0.0.0
PresentationFramework, Version=4.0.0.0
Samba.Infrastructure, Version=1.0.0.0
Microsoft.Practices.Prism, Version=4.0.0.0
System.Runtime.Serialization, Version=4.0.0.0
Microsoft.Practices.Prism.MefExtensions, Version=4.0.0.0
DevExpress.Xpf.Core.v14.1, Version=14.1.13.0
System.Windows.Forms, Version=4.0.0.0
System.Drawing, Version=4.0.0.0
Samba.Persistance, Version=1.0.0.0
Stateless, Version=1.0.0.0
PropertyTools, Version=2012.4.14.1
Samba.Localization, Version=1.0.0.0
ReachFramework, Version=4.0.0.0
EntityFramework, Version=6.0.0.0
FluentValidation, Version=3.4.0.0
Microsoft.CSharp, Version=4.0.0.0
Omu.ValueInjecter, Version=2.3.0.0
Microsoft.Practices.ServiceLocation, Version=1.0.0.0

Any ideas what could be causing this?


#274

Hello I am really enjoying all of the expert advice and tutorials found here. I need the answer to this question also “SambaPOS by default as “User Sales” on the end of work period report. Obviously with this set up all sales are done under one User e.g. Administrator.
Does anyone (@Jesse lol) know the correct syntax I would need to use in custom reports to show total sales per employee entity? Tried messing around for the last 2 hours and couldn’t get anything.” Thanks


#275

Haven’t used this setup but I’m pretty sure you would need to generate a list of employees entity names on an @ expression using something like report entity details where entity type = employees.
Then report ticket detail values wanted - presumeably ticket total.sum with a constraint of say TEN.Employee=$1

This as with default report would count whole tickets based on the selected entity rather than an order level sales count if you allow multiple staff to add orders. If you needed order level reporting you would need to add some order level factor such as state or tag. As I’ve not done user entities Im not sure how aplicable/posible that would be anyway.


#276

Thanks for the reply JTR Tech. I am a newbie to the software programming. Could you send an example of what you are reffering to? I want to see what the employees sales are, not the logged in user sales. This time clock feature is great for my application, but I really need to incorporate the work period reporting. Thanks for any help or detailed suggestions.