Home      Ask a Question      My Stuff      Help   
  
Scripting - Adding Up to a Fixed Amount of Hours in a Week
This article outlines adding to an employees hours of work in a week if they work LESS than a fixed weekly amount.

What is required is a numeric clock prompt and a script under Settings Menu > Processing Rules > PayRateScript:

Below is an example of paying up to 40 hours in a week:

When creating the numeric prompt you will want to name it (in the Field Name box) "addedHours".

Below is the scripting:

weekhrs = 40;

if(category = "Regular" and reportingdate.totalweek("addedHours") = 0 and reportingdate.weekhours < weekhrs){
$diff = weekhrs - reportingdate.weekhours;
hours = hours + $diff;
addedHours = 1;
}

You can make the weekly adjustment by just adjusting the below line from 40 to any weekly total you would like:

weekhrs = 40;


In some cases there could be a requirement as far as a minimum amount of hours worked required before the fixed amount would apply. For example if the employee had to work at least 30 hours for that week before they were allowed the fixed 40. With that we could add another identifier for the minimum hours called "minhours".

Here is a script using our 30 hours example:

minhours = 30;
weekhrs = 40;

if(category = "Regular" and reportingdate.totalweek("addedHours") = 0 and reportingdate.weekhours >= minhours and reportingdate.weekhours < weekhrs){
$diff = weekhrs - reportingdate.weekhours;
hours = hours + $diff;
addedHours = 1;
}

You can make the weekly minimum by just adjusting the below line from 30 to the minimum weekly total you would like:

minhours = 30;
ID
1585
Category
>Support
  Scripting
Date Created
7/23/2015 2:58:39 PM
Date Updated
9/11/2015 7:34:59 AM
Back to Search Results