Skip to main content
Participant
January 26, 2025
Question

TIME SHEET

  • January 26, 2025
  • 1 reply
  • 524 views

Hello all,

Can somebody help me out.. this is in Excel and I have it all working correcty in excel.. but now I am trying tomake it work the same way using Adobe Acrobat,.. here is the details.

 

Calculated Worked Hours: Total Hours Worked the that Day

Regular Hours: Worked hours for that same day but it will stop at 8 hours then carry over to “OVERTIME”

So for example, Ion Monday, I worked for 10 hours..

Calculated Worked Hours = 10

Regular Time: 8.00

Overtime: 2.00

 

But I want to auto populate the Name Field by entering the “IN” & “OUT” and will also deduct the lunch ”OUT” & “IN”..

 

Here is the example of both files. Hope someone can halp me or share a file that I may use that works the same way.

 

 

 

1 reply

Nesa Nurani
Community Expert
Community Expert
January 26, 2025

Here is a script I did for someone else that calculate regular and overtime hours:

var timeIn = this.getField("Time IN1").valueAsString;
var timeOut = this.getField("Time OUT1").valueAsString;

if (timeIn && timeOut) {
 var timeInParts = timeIn.split(":");
 var timeOutParts = timeOut.split(":");

 var inMinutes = parseInt(timeInParts[0], 10) * 60 + parseInt(timeInParts[1], 10);
 var outMinutes = parseInt(timeOutParts[0], 10) * 60 + parseInt(timeOutParts[1], 10);

 var diffMinutes = outMinutes - inMinutes;
 var totalHours = diffMinutes / 60;
 var regularHours = Math.min(totalHours, 8);
 var overtimeHours = totalHours > 8 ? totalHours - 8 : 0;

  this.getField("Regular Hours1").value = regularHours;
  this.getField("Overtime Hours1").value = overtimeHours > 0 ? overtimeHours : "";} 
else {
 this.getField("Regular Hours1").value = "";
 this.getField("Overtime Hours1").value = "";}
KulitsAuthor
Participant
January 26, 2025

ok so how exactly will this work? i put it in the custom but didnt seem to work. i also followed the name tag of the catagory (timein & timout)

 

KulitsAuthor
Participant
January 26, 2025
test.pdf