Defining Duration Elements

To define duration elements, use the Durations (GP_DURATION) component.

Page Name

Definition Name

Usage

Duration Name Page

GP_PIN

Name the element and define its basic parameters.

Duration - Definition Page

GP_DURATION

Define the number of days, months, or years between two dates.

Set Daily HR Status Criteria Page

GP_DUR_STAT_SEC

Specify time periods for duration calculation, excluding or including them according to HR status codes.

A duration element calculates the time between two dates, by subtracting one date from another. For example, age at Pay Period End Date is calculated as Pay Period End Date minus Birth Date. The resulting value is a duration.

Duration elements always resolve to a number. You can define durations in years, months, or days. If you define duration in days, you can include or exclude certain periods of time based on PeopleSoft HR status codes. You can also include or exclude absence days that have been entered in Global Payroll.

Including or Excluding Absences

The typical use for the include or exclude absences feature is to exclude absence days from a duration. For example, you are calculating a service duration, but you do not want to include sick days. The daily absence formula will be resolved for each day absent between the begin and end dates of the duration. This formula returns a one for each paid sick day; for all others it returns a zero. The duration program will sum up each day's value. If the payee had 15 sick days within this time period and the Include Absence Days check box is deselected, then 15 will be subtracted from the total number of calendar days in the period.

Your formula can call any of the system elements that are designed specifically for absence duration. These elements have the same names as those that are used to generate the absence daily data, but they end with the suffix DU. For example, you can use the system element, ABS END DATE DU, to retrieve an absence end date for a particular absence.

Example 1: Rounding

On the Duration - Definition page, you can define whether the duration is a decimal and how to round the duration. This topic provides an example of how rounding works for decimal durations.

The result (before rounding) is 2 years, 5 months, and 20 days and you want the result in months, without rounding. The result is:

(2 Years * 12) + 5 Months = 29 Months + 20/30 = 29.666667

If the Return Duration With Decimals check box is deselected, the value is 29.

If you select the Return Duration With Decimals check box and Add 1 Month if Days, with a value of 15, the result is:

(2 Years * 12) + 5 Months + 1 Month (because days are > 15) = 30

The small difference in the results can be significant when the duration resolution is used throughout the system.

Example 2: Rounding

In this example, assume that:

The Duration From date is January 1, 1999 and the Duration To date is January 31, 2001.

This table illustrates how various options, used together, affect the value returned by a duration element (the system's standard field size is 12.6, so all values are shown to the full six decimal places):

Return Duration In

Rounding

Add 1 Year If Months >=

Rounding

Add 1 Month If Days >=

Return Duration With Decimals

Value

Years

No

No

Yes

2.083333

Years

No

No

No

2.000000

Years

Yes, 1

No

No

2.000000

Months

No

No

Yes

25.000000

Months

No

Yes, 15

No

25.000000

Days

 

 

Yes

Impossible. An online error message appears.

Days

No

No

No Inclusive = No

761.000000

Days

No

No

No Inclusive = Yes

762.000000

Note: The Duration program uses the PeopleTools utility PTPDTWRK to get the difference between two dates. When the GP Duration option is to return the value in Years, PTPDTWRK is called with the AGE option, which gives a result in years, months, and days. For example, when the dates are April 1, 2003 to April 1, 2004 PTPDTWRK returns 1 year, 0 months, and 0 days. When the end date is March 31, 2004, PTPDTWRK returns 0 years, 11 months, and 30 days. You might think that the decimal difference between these two dates would be calculated as 364/365 = .99726, but this is not what is happening. PTPDTWRK can return the value between dates in days, but to convert this into years would require calculating the number of leap years involved .

Including/Excluding HR Status Days

Using the Set Daily HR Status Criteria page you can include or exclude time periods from the duration calculation, based on HR status codes.

If status Include or Exclude criteria are defined as part of the duration definition:

  • The Date From date cannot be earlier than the first effective-dated PS_JOB row.

    If the Date From date is before the first effective-dated PS_JOB row, the duration calculation uses the earliest effective-dated PS_JOB row for this EmplID/Empl_Rcd combination as the default Date From date. The duration calculation doesn't limit the Date From date based on other fields.

  • The Date To date cannot be after the Calendar Period End Date.

    If the Date To date is after the Period End Date, the duration calculation uses the Period End Date as the default Date To date.

  • Only the maximum effective sequence PS_JOB row is considered, because any non maximum effective sequence PS_JOB rows mean nothing from a status perspective.

  • No warnings or errors are issued if the Date From or Date To dates are modified to be the effective date of the first PS_JOB row or the Period End Date in the above situations.

For example, if the first effective date PS_JOB row is January 7, 1995 but the Date From date is January 1, 1995, the system uses January 7, 1995 because the Date From date cannot be less than the first PS_JOB effective date.

Note: Payment keys are ignored in Status Control Include or Exclude calculations.

Example 1: Including/Excluding HR Status Days

For this example, assume the following:

Date From: January 1, 2000

Date To: January 31, 2000

Unit of measure: Days

Include From and To Date: Selected

Payee Status: Leave effective January 22, 2000

Days Active: 21 Days, Inactive: 10, Result of absence formula: 5

This table shows how the system resolves the duration value, based on various Include/Exclude options:

HR Status

Absence Formula

Duration with Inclusive ON

Duration with Inclusive OFF

Reason

Include-Active

Blank

21 days

21 days

Active days only

Include-Inactive

Blank

10 days

9 days

Leave days only

Include-Active

Include

26 days

26 days

Active Days + Formula Days

Include-Inactive

Include

15 days

14 days

Leave Days + Formula Days

Include-Active

Exclude

16 days

16 days

Active Days - Formula Days

Include-Inactive

Exclude

5 days

4 days

Leave Days - Formula Days

Blank

Include

5 days

5 days

Formula Days only

Blank

Exclude

26 days

25 days

Total Days - Formula Days

Blank

Blank

31 days

30 days

Total Days

Exclude-Active

Blank

10 days

9 days

Leave Days only

Exclude-Inactive

Blank

21 days

21 days

Active Days only

Exclude-Active

Include

15 days

14 days

Leave Days + Formula Days

Exclude-Inactive

Include

26 days

26 days

Active Days + Formula Days

Exclude-Active

Exclude

5 days

4 days

Leave Days - Formula Days

Exclude-Inactive

Exclude

16 days

16 days

Active Days - Formula Days

Example 2: Including/Excluding HR Status Days

Assume that a duration is set up as follows:

  • Date From: June 23, 1999.

  • Date To: September 23, 1999.

A sub-period is defined as follows:

  • Include if status is Active.

  • Sub-period > 5 days.

This table lists a payee's PS_JOB rows:

Status

Effective Date

Active

June 23, 1999

Suspended

July 1, 1999

Active

August 1, 1999

Terminated

August 10, 1999

The duration resolves to eight days (first Active) plus nine days (second Active), meaning a value of 17 days. Both Active periods are included because they are both greater than five days.

Note: Payment keys and fields besides Employee Status aren't considered during the Status inclusion/exclusion calculations.

Only PS_JOB rows that are less than or equal to the period end date are considered. The Date From or Date To dates can be modified to be the effective date of the first PS_JOB row, or the Period End Date, because of the system rule that the Date From date cannot be before the first PS_JOB effective date.

The duration module resolves a duration element by:

  1. Resolving Date From and Date To, if needed.

  2. If there are status entries, validating that the first PS_JOB row isn't less than the Date From and that Date To isn't after the period end date.

  3. Calculating the duration period (years, months, or days) between Date From and Date To.

  4. If there are Human Resource status entries, processing them.

  5. Including or excluding absence days, if applicable.

  6. Applying rounding.

  7. Truncating decimals if Return Duration With Decimals isn't selected.

If you've indicated on the Duration - Definition page that the value should be returned in years and you've selected both the Add 1 Year if Months >= and Add 1 Month if Days >= options, the system evaluates the Add 1 Month if Days >= option and then evaluates and applies the Add 1 Year if Months >= option.

Use the Duration Name page (GP_PIN) to name the element and define its basic parameters.

You name every element and define its basic parameters on an Element Name page. All element components in Global Payroll share the same Element Name page (GP_PIN).

Use the Duration - Definition page (GP_DURATION) to define the number of days, months, or years between two dates.

Image: Duration - Definition page

This example illustrates the fields and controls on the Duration - Definition page.

Duration - Definition page

Field or Control

Definition

Date From Type and Date To Type

Select the type of element that returns the Date From and Date To days. Valid values are: Bracket, Cal Date (calendar date), Date, Formula, System Elem (system element), and Variable.

Date From and Date To

Define the first and last day that the system is to include in the duration calculation.

Select the names of the elements that return the dates.

If the Date From date is the same as or greater than the Date To date, the duration element resolves to zero.

Return Duration in

Select the unit of measure for the returned duration value. Valid values are:

  • Years - Select to return the duration in years. This is the default value.

  • Months - Select to return the duration in months.

  • Days - Select to return the duration in days.

    If you select Days, the Include From and To Date and Include Absence Days check boxes become available.

    Select the Include From and To Date check box to include the from and to dates in the calculation.

    For example, if the date from and date to are February 1, 2006 and February 5, 2006, and you select Include From and To Date, the system counts five days. If you don't select Include From and To Date, the system ignores the last day and returns a count of four. It also ignores the last day when it applies any instructions that you enter for including/excluding absences or including/excluding days based on HR status.

    (The system returns a value of zero when the begin date and end date are the same if you select Days but don't select Include From and To Date. It returns a value of one if you select Include From and To Date.)

Return Duration in Decimals

Select to receive the duration result in decimal form. .

If you select Return Duration in Decimals, the system converts durations to decimals after applying any rounding rules you may have defined.

The system expresses the results as follows, depending on Return Duration in value:

Years: The system returns years and the remaining number of months and days in decimal form. To calculate the decimal amount, the system divides the number of days by 30 and adds the result to the number of months. It then divides the number of months by 12 and adds the result to the number of years. For example, a duration of two years and one month returns a value of 2.08333.

Months: The system returns the number of months plus any additional days (partial month) in decimal form. Days are divided by 30 for calculation of the decimal value.

Days: Invalid.

Note: A month is defined as the period between the first day of one month and the first day of the next month. For example, January 1, 2006 to January 31, 2006 isn't a month—it's 30 days. To make it a month, select Return Duration in Decimals. The system returns 30 days, which equals one month. If you don't select Return Duration in Decimals and you're counting months, the result is zero.

Round months up from N days

Select and enter the number of days to which the system rounds the month.

Round years up from N months

Select and enter the number of the months to which the system rounds the year.

These fields are used to apply rounding rules to the result of your duration calculation. If you do not select a check box, no rounding occurs.

If you select either of these check boxes, and the months or days value is greater than the value that you enter, the calculation adds one year or one month, respectively.

For example, if Return Duration in is Years, and you select Round years up from N monthsand enter 6, the system returns a duration of 3 years and 6 months as a value of 4 years.

Note: The system applies the selected rounding rule before converting durations to decimals. If you select the Return Duration in Decimals check box and a rounding option, the system rounds up the months or years, as applicable, leaving no decimal value.

Field or Control

Definition

Include From and To Date

Select to include the from and to dates in the calculation.

Include Absence Days

Leave this check box deselected to exclude days. For example, if you leave this check box deselected, you can calculate a duration of time minus sick days.

Select the Include Absence Days check box to include absence days in the duration calculation.

This check box becomes available when the Return Date In value is Days.

Note: The system automatically excludes absences if you do not select Include Absence Days and specify a daily absence formula.

Daily Absence Formula

This field becomes available when the Return Date In value is Days.

To include or exclude the days that a payee is absent, select the formula that returns the number of absent days. To include the days that a payee is absent, you select the Include Absence Days check box. To exclude the days that a payee is absent, deselect the Include Absence Days check box; now the number of absent days will be subtracted from the total duration count.

The formula is resolved for every day of absence daily history between the from and to dates (including those dates), and should return a 1 for each absence day it wants to count. The duration program cumulates the formula for each row of absence daily data (GP_RSLT_ABS, which is the output of the Absence Take process) and totals the results of the formula for all of the rows where the absence dates fall within the From and the To dates. (Keep in mind that the first and last day is considered only if the Include From and To Date check box is selected.)

Your formula must specify the take elements that you want to count. For example, you can use the absence type in an IF statement to count only sick time.

Your formula can call any of the system elements that are designed specifically for absence duration. These elements have the same names as those that are used to generate the absence daily data, but they end with the suffix DU. For example, you can use the system element, ABS END DATE DU to retrieve an absence end date for a particular absence.

Set Daily HR Status Criteria

This field becomes available when the Return Date In value is Days.

Click this link to access the Set Daily HR Status Criteria page, where you can include or exclude time periods in the calculation based on HR status codes.

If you enter instructions to include daily absence data and include or exclude days based on status codes, the system performs two separate counts and combines the results. For example, if you include active days (based on HR status) and exclude absence days, the system counts the number of days the payee was active and subtracts the number of days the payee was absent.

Warning! Double counting can occur, depending on the instructions that you enter in the two group boxes. For example, if you include active days and days a payee is out sick, the days on which a payee is both active and sick are counted twice.

Use the Set Daily HR Status Criteria page (GP_DUR_STAT_SEC) to specify time periods for duration calculation, excluding or including them according to HR status codes.

Image: Set Daily HR Status Criteria page

This example illustrates the fields and controls on the Set Daily HR Status Criteria page.

Set Daily HR Status Criteria page

If the unit of measure on the Durations - Definition page is set to Days, you can include or exclude time periods from the duration based on HR status codes. You can also specify minimum and maximum periods to check against.

Field or Control

Definition

Listed Status Should Be

Select Included or Excluded to include or exclude the status combinations that you specify in the List HR Status group box. Including or excluding status combinations has the following implications at processing time:

Include directs the system to include the period with that status combination in the duration.

Exclude directs the system to exclude the period with that status combination in the duration.

The code combinations that you enter are, as a group, either included or excluded, meaning that when you include specific status codes, those that you omit are automatically excluded. If you exclude certain codes, those that you don't exclude are automatically included.

The time period indicated includes the PS_JOB Effective Date.

Additional Period Definitions

Use the following fields to further define the periods that you want to include or exclude from the duration.

Field or Control

Definition

If Each Sub-Period

Select to include or exclude sub-periods of a specified length from the duration. A sub-period is a consecutive number of days that a payee's status remains unchanged.

Whether you can add sub-periods together depends on whether the sub periods are in the same period. Sub-periods are added together if they individually fulfill the criteria. The system calculates period by period; for each period, it checks the criteria that is defined on this page. If the criteria are met, the system considers the period for inclusion or exclusion. If the criteria are not met, the system ignores the period.

Operand

Select from < <=, >, and >= to determine whether the time period is included in or excluded from the duration calculation. The operand is used with the Value and Period fields.

Value

The number of years, months, or days to include or exclude from the duration. This value is used with the operand to determine whether the length of time in the selected status is included in or excluded from the calculation.

Period

The period of time defined in the previous field: Days, Months, or Years.