How to calculate total work hours?

  • PPTS
    Asked on August 3, 2018 at 6:18 PM

    I've created a payroll time sheet that I'd like to calculate total hours worked for the day as well as total hours worked for the pay period. The calculation I'd like to set up is as follows:

     

    Time in + Time out - Lunch = Total hours worked

    Then another calculation for "Total hours worked" across all days worked at the bottom of the form.

    How can I create this calculation?

    Thank you.

  • Jed_C
    Replied on August 3, 2018 at 7:52 PM

    You can use the time field for time in, time out and lunch. 

    1533340013The Easiest Online Form Builde Screenshot 10

    In my sample screenshot, I've added Lunch Out and Lunch In and the total numbers of hours they took for lunch.

    I've also used form calculation widget to calculate the total of time in and time out + lunch out and lunch in.

    Sample formula:

    1533340218total hours Screenshot 21

    1533340182lunch Screenshot 32

    You can check my sample form here https://form.jotform.com/82148064184962. Feel free to clone it if you want https://www.jotform.com/help/42-How-to-Clone-an-Existing-Form-from-a-URL.

    Let us know if you have any questions or if you need further assistance. 

  • PPTS
    Replied on August 3, 2018 at 8:22 PM

    Thank you. If I have multiple days set up what would be the calculation for adding up the total hours over multiple days.

    For example:

    Day 1 - Total hours worked = 7.5

    Day 2 - Total hours worked = 8

    Day 3 - Total hours worked = 8

    Total hours for the pay period = 23.5 (I need the calculation for this part as well)

    Thank you.

  • Kevin Support Team Lead
    Replied on August 3, 2018 at 10:41 PM

    Yes, you need to simply add a new Form Calculation widget and include all the totals per day, example: 

    Day 1 - Total hours worked = 7.5 + Day 2 - Total hours worked = 8 + Day 3 - Total hours worked = 8

    That would be the formula you would need to use, now, note that you need to also add the set of fields per day and sum the number of hours per day, you will just need to repeat the example my colleague provided. 

  • PPTS
    Replied on August 5, 2018 at 9:18 PM

    Ok, I think I got it. Now the issue I'm having is that the total hours field is pre-populating 12 hours when no data is entered. I'm not sure why this is happening and I've check all the widget and form settings to ensure fields don't populate data. Please advise.

    Thank you.

  • PPTS
    Replied on August 5, 2018 at 9:50 PM

    Update: I figured out why the form was populating data. I had checked off for the form to only show AM for the first field. When I checked off both AM and PM in the widget it corrected the problem. I'm not sure why the widget functions this way though. Is there a way I can have AM pre-selected for the "time in" field without the form automatically generating 12 hours for the total hours?

  • Kiran Support Team Lead
    Replied on August 6, 2018 at 2:48 AM

    I have cloned your JotForm and tried changing the Time In field with AM option and it seems to be working fine at my end. The 12 value will be displayed only when the Time out field is set to PM which is the difference from AM to PM. 

    Please check again and let us know if you need any further assistance. We will be happy to assist. 

  • PPTS
    Replied on August 6, 2018 at 4:41 AM

    All of my time in and time out fields are set at both AM/PM and not restricted to AM or PM only. The view from the build screen shows the Time out field defaulted to AM however in the preview screen it defaults to PM and thus I get populated data. 

    The other thing to note is that I'm able to get the form to stop pre-populating data when I disable the setting "continue form later" however I want this setting enabled so it can be completed on a daily basis rather than all at once at the end of each pay period. Are you able to take a screen shot of the settings I should be using so that I can keep the form enabled to continue later and not have pre-populated data?

    Thank you.

  • Kiran Support Team Lead
    Replied on August 6, 2018 at 6:22 AM

    I have checked your JotForm at my end and see that the time is being displayed correctly. This is due to I have not changed the form options at my end while the 'Auto-fill' feature is enabled. You may have tried filling the form at your end which is why the form is still populating the previously selected options. The options should be displayed normally when you open the form in a private/incognito browser or a separate browser. 


    Please note that the auto-fill feature allows saving the form filled information in the browser storage. So, the data can be accessed only when the form is opened on the same computer and same browser. Also, if the browser storage/cache is cleared, the form data will be lost.


    If you want to have the form data to be displayed on any PC/browser, you may consider using session parameter method. However, it is required to be a multi-page form. Please check the following guide that can help you with this.


    https://www.jotform.com/help/97-How-to-Save-Forms-and-Continue-Later

    Please give it a try and let us know if you need any further assistance. 


  • PPTS
    Replied on August 6, 2018 at 7:14 AM

    Thank you. That did it. You all have been so helpful and very responsive.

    Thank you.