Skip to main content
Participant
November 26, 2023
Question

2 x 24hr time entry fields calc to X.5 or .0 only

  • November 26, 2023
  • 1 reply
  • 173 views

Hey guys, im quite fresh off the boat when it comes to managing pdf files and java script. With that said i do know a little bit, and i have a decent understanding of protocols and such withing computers. 

But im looking for help from this seemingly very friendly community.  I have browsed a lot of solutions, but I cant find one to make this work for me, Im hoping one of you kind folks will help a guy out with a script or 2. 

 

Heres the rub...

I have a Daily timesheet I'm trying to upgrade so us wrench monkeys can submit time cards that are in fact legible... XD

-Each Job line of the sheet has Start time, Stop time, and Hours total ("Start Time.0" , "Stop Time0", "Hours.0" specifically, field ranges of ____.0 to ____.13 see attached image). Example: Start - 0600, Stop - 1030, Hours - 4.5 // or // 0930 to 1430 = 5.0.

*And yes... i forgot to run the decimal on the Stop Time field name*

-Company policy and procedures dicate that it must be filled using 24hr time. Personally I prefer NOT using colons, so I'd be quite fine leaving them out entirely.  

-Each page/sheet has a Cumulative time worked field ( "Total Hours Worked" )

-Time entries will only EVER be XX.0 or XX.5, no .25's or .4's oir any other odd ducks. Daily max hours is never more than 24.

-This PDF needs to work on IPhone, Android and Desktop apps. 

-We have night shift folks who work 1800 to 0600, and day shift 0600-1800 that all use the same sheet

 

1) im having troubles selecting a format within the time field options that will allow both 0600 and 1600, the 0 gets removed, or it errors out. I've tried HH:MM, HHMM, HH:\MM, HM, HHM, HHm, Hmm, HMM.

2) How can i get java to recognize 30 mins as 0.5h? Do i need to leave it 

3) Night shift... if i format the fields to a number based calc, then how can i make it recognize that 1800 is less than 0600?

4) Cumulative time fields calc ( "- or ignore" 0.5 lunch). We have to enter our Lunch break as a dedicated and chronologically correct job line (ALWAYS 0.5hr), and I have 2x mutually exclusive radio buttons to indicate if lunch break was taken, by default i have yes marked on sheet. So when I get a script to compile the hour fields into the total field, what script can I use to have it check the value ( " Lunch " -Yes/no ), and then either subract or add the 0.5hr implied value to  "Total Hours worked" field?

5) Lastly (I hope), I am trying to find a way of preventing this file from saving over itself and having to delete all the fields and resave. Is there a way to lock this form from being overwritten? or perhaps only allowing "Save As" function?

5A) is there a way of using the data from the " Date " field to auto-populate the file name? or reference the filename from previously saved timesheets? IE: auto populate a Save as name - John Doe Timecard - dd mmm yyyy ?

 

 

Thank you very much for your time and assistance!

 

Cheers,

Kevin

 

This topic has been closed for replies.

1 reply

Nesa Nurani
Community Expert
Community Expert
November 26, 2023

JavaScript is very limited to some basic functions on mobile devices.