Mileage and Mileage Reimbursement Scripting - TWP

Clock prompts can be used to collect mileage from employees at the clock or through an edit made on the time card. However, if your client has a mileage reimbursement rate that they also want calculated on the time card, this article will explain how to do it in TimeWorksPlus.

Suppose 1 mile equals $0.50 in reimbursement. This article will instruct you on how to do that.

If you prefer, you can also watch this video that explains the process:

Set Up Clock Prompts

Doing this will require using two numeric clock prompts. These would be either the I,J, K or Web Only (Numeric) prompts.

If your client is using a physical clock and wants the employee to enter the data at the clock, at least one of these prompts will need to be I, J, or K. These are usually used to calculate tips but we will use these prompts to create two more columns on the employee time card for mileage and mileage reimbursement.

Set the first prompt for collecting mileage with the following configuration:
  • Data Collection Mode: Collect on Clock OUT if entered by employee, Show Online if entered by managment
  • Name of field?: Mileage (This can be anything the client desires) 
  • Column Header: MILEAGE This can be anything the client desires 
  • Question to be displayed on clocks: Enter Mileage
  • Color Restriciton: Depends on if the employee is entering the value at a physical clock and your client does not want all employees asked to enter mileage. If yes, you can use this to restrict the prompt to the alternate IN/OU buttons. Please see Alternate Clock Prompts for more information. If the employee is not entering the value at the clock or this is being entered through the web clock, no change is needed here.
  • Visible/Editable: Visible and editable 
  • What type of numbers should we collect?: Depends on the client and how they are calculating the mileage with or without decimals. If they are using decimals, the value will display with a "$", so they should be told of that ahead of time.
Save the changes to this prompt.

The second prompt will be used for calculating the mileage and needs the following settings:
  • Data Collection Mode: Show online, but do not collect anything
  • Field Name: MileageReimb
  • Column Header: M Reimbursement
  • Question to be displayed: leave blank since we actually won't be asking the employee for this at the clock, we are instead putting the reimbursement amount that is calculated in this field.\
  • Color Restriction: No Restriction
  • Visible/Editable: Visible, Not Editable Setting it to Not Editable prevents unintentional edits that change the employees reimbursement.
  • What type of numbers: Decimal Point
Save the changes for this prompt.

Write the Script

Now we write a script. Each mile entered will equal $.50 in reimbursement.

This can go in the PayRate script box.

if (Mileage >= 1){
    MileageReimb = val(Mileage) * 0.50;}

This means that if the Mileage is greater or equal to 1 mile then the MileageReimb should equal I times $.50.

The employee's time card will have two category columns one named Mileage which will be the mileage the employee enters at the prompt and one named Mileage Reimb. which will show our calculation off of the script or mileage times $.50.

Did you find this article helpful?