Copy link to clipboard
Copied
I have been playing around with a time sheet for about a week now. I have the basic calculations worked out. Worker works 40 hours x rate of pay = Pay. No problem. But now, I've come to the overtime calculation. Worker works 40 hours but anything over that the worker would be paid one and half times the rate of pay.
I have two rows, one row for the regular hours and one row for the overtime hours. Each row has a field that shows the total hours for each row. I don't know how to have the overtime hours figure into the rateofPay field when there's overtime hours showing in the overtime fields. But, calculate regularly when no overtime hours. But calculates when there's overtime hours showing in the overtime fields.
Can someone help me out with how to calculate these fields? Yes, I've gone thru all the tutorials and have searched the forums for help. I think I've exhausted my options so here I am asking for help. Just one small favor, please no technical explanations. I don't understand the jargon but I can follow by example. Thanks guys.
Copy link to clipboard
Copied
The situation is not very clear... If you have separate fields for normal hours and overtime hours then it's a very simple calculation:
NormalHours + (1.5 * OvertimeHours)
If you have one field for all the hours and you want to divide it automatically into normal hours (up to 40) and overtime hours (everything above that), then it's a bit more complicated.
The calculation will be something like:
if (TotalHours<=40) {
NormalHours = TotalHours
OvertimeHours = 0
} else {
NormalHours = 40
OvertimeHours = TotalHours-NormalHours
}
Copy link to clipboard
Copied
I got the first script to work by placing it in Simplified field Notation. But I couldn't get the second script to work. I tried placing it in several different places. Could you direct me as to where the correct place to put that script? I'd like to see it working so I can gage it if I can use it or not. But, thanks for the help.
If you can, would you take a look at this other question I posted a little while ago. It's kinda related to what I'm doing.
Copy link to clipboard
Copied
What I provided is more like pseudo-code, not the actual script. You can probably use the former as the Simple Field Notation calculation of the TotalHours field but you'll need to convert the latter into actual code.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now