Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Employee time recording - possible with nuBuilder?

Questions related to using nuBuilder Forte.
Olikun
Posts: 68
Joined: Tue Mar 09, 2021 6:45 pm

Employee time recording - possible with nuBuilder?

Unread post by Olikun »

Hello,

does anyone know if it is possible to do employee time tracking with nuBuilder?


Employee comes to work and logs in => date and time is saved

When the work is over, the employee logs out => date and time are saved


No matter how. I am grateful for every idea.

I only have 2 employees

It can be a separate form with all the names of the employees and each employee clicks on his name at login / logout


Many greetings

:)
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Employee time recording - possible with nuBuilder?

Unread post by kev1n »

Hi,

You can define data type TIMESTAMP and set default value to CURRENT_TIMESTAMP. So when the record is saved for the first time, the start date/time is set automatically.
When the form is saved the 2nd time, a AS PHP script can set the end daate/time using an Update statement.

Code: Select all

UPDATE `table_name`SET end_time = now() WHERE table_name_id = '#RECORD_ID'
You can also use separate start and end button and show/hide them accordingly .
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

Re: Employee time recording - possible with nuBuilder?

Unread post by Janusz »

Hi Olikun,
I prepared short example/demo how to implement time recording with nuBuilder.
And some calculation example on the form - for the spices calculation :)
You can find video with explanation on youtube:
https://youtu.be/LJmKrOQ-AP8

This demo is available on our server:
https://test.nubuilder.cloud/

you can log with:
login: test
psw: nutest

This is in demo mode so you can have access to the used code - but if you implement some changes it will not be finally saved.

If you would have some questions please let me know.
If you like nuBuilder, please leave a review on SourceForge
Dalkeith
Posts: 40
Joined: Thu Jun 23, 2016 10:33 am
Location: Edinburgh
Contact:

Re: Employee time recording - possible with nuBuilder?

Unread post by Dalkeith »

Janusz's solution is better - I would probably do it through the default setting of the field in the database as well but implementing a field that is updated with the date everytime it is edited was my first step into understanding how Nubuilder worked..

Here's some Javascript that can be used widely to update a field to show when a record was updated. It could be adapted to include the time...

To be placed
Forms / Form of choice / Custom Code / Javascript

Code: Select all

function GetTodayDate() {
    var tdate = new Date();
    var dd = tdate.getDate(); //yields day
    var MM = tdate.getMonth(); //yields month
    var yyyy = tdate.getFullYear(); //yields year
    var currdate = dd + "-" + MM + "-" + yyyy;
 
    return currdate;
}
Function to update field called “DateUpdated” on edit- to be used with the GetTodayDate() function

Code: Select all

function nuOnSave() {
if (nuFORM.edited == true)
    {
        $( "#DateUpdated" ).val( GetTodayDate() );
    }
    return true; 
 
}
and from Stack overflow here is a Javascipt version that does time = its useful to compare the function that I have and the function listed on stack overflow.

Code: Select all

function timeNow(i) {
  var d = new Date(),
    h = (d.getHours()<10?'0':'') + d.getHours(),
    m = (d.getMinutes()<10?'0':'') + d.getMinutes();
  i.value = h + ':' + m;
}
Last edited by Dalkeith on Sun Mar 14, 2021 9:26 am, edited 1 time in total.
My Blog - cloudydatablog.net https://cloudydatablog.net/
Dalkeith
Posts: 40
Joined: Thu Jun 23, 2016 10:33 am
Location: Edinburgh
Contact:

Re: Employee time recording - possible with nuBuilder?

Unread post by Dalkeith »

Also I once built a timing system in MS Access and hooked it up to an RFID antennae so I could pick up the times from the box and then do all the calculations for the racers

The core SQL was this - This was MS Access SQL no idea whether it would work in MYSQL but expect it would just need some tweaks.

Code: Select all

SELECT T1.*
FROM MyTable T1
WHERE EXISTS
(SELECT T2.*
 FROM MyTable T2
 WHERE T2.RFIDtag = T1.RFIDtag
 AND T2.ID   <  T1.ID
 AND T2.Time <= T1.Time
 AND T2.Time >= T1.Time - TimeSerial(0, 0, 20));
And an explanation of the above. https://cloudydatablog.net/?p=519

and here is a wider view

https://cloudydatablog.net/?p=156
My Blog - cloudydatablog.net https://cloudydatablog.net/
apmuthu
Posts: 249
Joined: Sun Dec 06, 2020 6:50 am
Location: Chennai, India, Singapore

Re: Employee time recording - possible with nuBuilder?

Unread post by apmuthu »

There appears to be some error in function GetTodayDate() for the computation of the value of twoDigitMonth.
Olikun
Posts: 68
Joined: Tue Mar 09, 2021 6:45 pm

Re: Employee time recording - possible with nuBuilder?

Unread post by Olikun »

Janusz wrote:Hi Olikun,
I prepared short example/demo how to implement time recording with nuBuilder.
And some calculation example on the form - for the spices calculation :)
You can find video with explanation on youtube:
https://youtu.be/LJmKrOQ-AP8

This demo is available on our server:
https://test.nubuilder.cloud/

you can log with:
login: test
psw: nutest

This is in demo mode so you can have access to the used code - but if you implement some changes it will not be finally saved.

If you would have some questions please let me know.
Hello Janusz,

thank you so much, you are great.

I'm trying the spice tool right now.
I left you an answer in the original post.

https://forums.nubuilder.cloud/viewtopic.php?f=19&t=10890

It works, but unfortunately I cannot save it.


I'll try the time tool later :)
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

Re: Employee time recording - possible with nuBuilder?

Unread post by Janusz »

You are welcome,
You can try as well how it looks like when employee will log - just use:
log: guest
psw: nuguest

and here the download link to that test DB - so you can test with save on your computer directly (ver 2.2).
https://drive.google.com/file/d/10wu_u- ... sp=sharing
If you like nuBuilder, please leave a review on SourceForge
Dalkeith
Posts: 40
Joined: Thu Jun 23, 2016 10:33 am
Location: Edinburgh
Contact:

Re: Employee time recording - possible with nuBuilder?

Unread post by Dalkeith »

apmuthu wrote:There appears to be some error in function GetTodayDate() for the computation of the value of twoDigitMonth.
Thanks apmuthu I've edited and removed that whole variable.
My Blog - cloudydatablog.net https://cloudydatablog.net/
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

Re: Employee time recording - possible with nuBuilder?

Unread post by Janusz »

Please note that saving mode is now allowed for the Spices form:
https://test.nubuilder.cloud/

you can log with (globeadmin type account).
login: test
psw: nutest

(standard user type account)
log: guest
psw: nuguest

(browser restart might be needed if you have previous version opened recently)
If you like nuBuilder, please leave a review on SourceForge
Post Reply