Accrue Down Scripts

Accrue Down scripts are necessary in an accrual policy to deduct time from an employee's paid leave bucket. In this article, we provide a few examples of these deduction scripts and explain how they work. 

All the scripts shown in this article go in the AccrueDown Script Rule.

The AccrueDown Script box is found in the Processing Rules under the "Accruals" category.

Topical Index

Basic Accrue Down Script

AccrueDown scripts look for Punch Categories on the time card that correlate to an accrual bucket and withdraw the hours from the employee's balance. Here is an example of a common AccrueDown script:

if(category = "Vacation"){
     $shortfall = accruedown("Vacation", hours, 0);

You could use this script for any category of paid leave. Just replace "Vacation" with the bucket name you want to use.

How It Works

The script begins by checking to see if there are any entries on the time card with the category of "Vacation". Once it finds one, it executes the AccrueDown command contained within the {...}

accruedown takes three arguments: bucket/category, amount and limit:
accruedown("Vacation", hours, 0);

In this case, the accruedown command says, "Reduce the "Vacation" bucket by however many hours are contained on the time card. Also, only deduct from the employee's balance until it gets to 0 -- do not let the employee Vacation balance go negative.
What is $shortfall?
$shortfall's purpose is to handle situations where the hours on the time card exceed the available balance in the bucket. After accruedown runs, it will take any remaining hours beyond the deduction limit (which in this case is 0) and store the value in a variable called $shortfall. On the last line of the script, the value of $shortfall is unpaid which shows on the time card like this:

The employee's vacation request exceeded their available balance by 0.60 hours and was unpaid.

Withdraw from Multiple Accrual Categories

The following script addresses a scenario where
  • A policy contains multiple accrual categories (or buckets)
  • If the employee doesn't have enough balance in one bucket, they can withdraw the remainder from a second bucket.
For example if the employee accrues both Sick and Vacation, and the employee uses up all their accrued Vacation time with a request, we can use an script to pull the remaining balance from Sick.

if( >= "2014-01-02" and category = "Vacation"){
   $shortfall = accruedown("Vacation", hours, 0);
   $shortfall = accruedown("Sick", $shortfall, 0);

An example of an Accrual Ledger Report showing that the remainder of the employee's Vacation request was withdrawn from the Sick bucket.

How It Works

In this script, we've added a start date condition. This is a way of saying, "Don't start this script until a certain date." So in addition to the script checking for "Vacation", it's also checking if the time card date is greater than or equal to the start of the accrual policy, in this case 1/2/2014:
if( >= "2014-01-02" and category = "Vacation"){

If the above condition is true, accrue down the hours till it hits 0 (zero) and store any overdraft in $shortfall:
$shortfall = accruedown("Vacation", hours, 0);

If it does hit 0 (zero) then start accruing down "Sick" hours till it hits 0 (zero):
$shortfall = accruedown("Sick", $shortfall, 0);

If "Sick" hits 0 (zero) allow them to take time off as "unpaid" time off:

Forcing an Employee to Use Vacation in 4 or 8 Hour Increments

Here is a variation of the script that forces hours to be spent in four-hour increments. If the request is less than a 4 hour increment, the hours will be rounded up to the nearest 4 hour increment. It will also withdraw from Personal if the employee exceeds their balance in Vacation.

if (category = "Vacation") {
   $spenthours = RoundUp(hours / 4) * 4;

The end result, as shown in the image below, is that if an employee requests 3 hours off, it will appear as 3 hours on the time card, but in the Accrual Ledger Detail Report, the actual deduction is 4 hours.

The Accrual Report (outlined in red), shows the deduction is 4 hours for a 3 hour request.
Can I Use Other Increments?
Yes, for example,by replacing "4" with "8", you could modify this script to force an employee to use 8 hour increments.

Allowing Employees to Carry a Negative Accrual Balance

Some employers allow employees to go into the negative with their accrued time. To allow for this you would enter in the negative number with quotations around it in your accrue down script. 

Here is an example of a completed script that allows an employee to get paid for Vacation up to 40 hours into the negative. It includes a "$shortfall" line for unpaying any hours in excess of that -40 limit.

if( >= "2014-08-03" and category = "Vacation"){
  $shortfall = accruedown(category, hours, "-40");

This states that if the current date is 8/30/2014 or greater allow "Vacation" to accrue down (when they take time off) to a negative 40 hours balance. After this all time will be unpaid.

Did you find this article helpful?