The following script looks to see if an employee is within 15 minutes of 40 hours. If yes, it rounds the total hours in a week to 40 and shows an alert on the time card to show how it rounded.
This script goes in the PayRateScript Rule
if(reportingdate.hourstodate >= 39.75 and reportingdate.hourstodate <= 40.25 and reportingdate.weekhours >= 39.75 and reportingdate.weekhours <= 40.25 and islasttoday){ $b = 40 - reportingdate.hourstodate; $c = hours + $b; if($b < 0){ addalert(cstr("Hours rounded from " + hours + " hours to " + $c + " hours to make the total hours 40.")); hours = $c; } else{ addalert(cstr("Hours rounded from " + hours + " hours to " + $c + " hours to make the total hours 40.")); hours = $c; } }
What the script actually does is, on the last punch of the week, changes the hours to a value that makes the week total 40. | |