PDF timesheet calculation
Hi guys!
I am a beginner at this and have searched a lot for anwers but haven´t found any that fits my problem.
I have a PDF form timesheet that uses four time inputs. ex. time1in:07:00, time1out:11:00, time2in:12:00, time2out:16:00. Now I want to sum this up in a total hours field and need help with the script to perform this correctly.
I have found a script that works to sum up the total hours of time1in and time1out but I do not know how to extend the script to also add time2in and time2out to the total sum.
The script I have is:
// start
var start = this.getField("8").value;
var startArr = start.split(":");
// finish
var finish = this.getField("9").value;
var finishArr = finish.split(":");
// difference
var hourDiff = Math.abs(finishArr[0] - startArr[0]);
var minDiff = Math.floor((Math.abs(finishArr[1] - startArr[1]) / 60)*100);
if (minDiff.toString().length == 1)
minDiff = '0' + minDiff;
var output = hourDiff + "." + minDiff;
event.value = output;
Is there someone who might be able to help me on this one?

