TBL: DATERULE - Date Rule
Overview
Each entry in this table is a rule about how to calculate a past date or estimate a future date for an employee.
A date-rule specifies how to work with calendar dates, hours or days worked or dollars earned. The date-rule defines counter names, dates, hours required.
Many of these are specified as expressions based on information about the employee. For example, employees in different unions might required different number of hours worked.
USAGE
Date-rules are used to determine probation dates, grade advancement dates, evaluation dates, etc.
RULES: DEFINITION + ENGINE
The various rule DEFINITIONS are stored here in the DATERULE table (in TBL).
To APPLY a rule to a specific person to obtain a date, use the DateRuleVal() function.
(This is similar to the way you use counters. You store the definition and the evaluated it with the TcntVal() function)
THE RULE ENGINE
The rule engine takes
- A rule definition (here), and
- Employee dossier information (PERS & JOBHIST), and
- Gross pay (TIMEDT) information and determines a target date, which may be past or future. If it is a future date, it might be a fixed date or an estimated date based on the hours the employee will end up working.
The rule engine invoked with the function DateRuleVal(), which can be used in alarms and elsewhere.
HOW IT WORKS
The rules engine has 3 steps
Calculate a fixed date (DtCalc). Example: HireDate + 3 months.
Determine the number of hours the employee worked, based on a counter. This number is used to determine when the employee reached the required number (past) or to estimate when he will reach it. (DtCompl)
You alternatively specify a number of days worked. In addition you can specify an amount earned required.
- Combine the results above (DtCalc and DtCompl), and possibly add or round or take the larger or smaller, to obtain the final result date.
Supplementary Info :
TBLC1
CATEGORY : Drop-down list of standard categories
TBLC2
Use-When SELECTION
Standard selection specifying which employees this rule applies to. You might have several PROBDT rules, for example, applying to different employees. See Use-when conditions
- Once you have selected the specific RULE (TBLID), this field is no longer looked at. (It is not used in the date calculation.) It is used with the DateRuleVal() function with the /BYCAT switch.
TBLC3
ADDITIONAL (SELECTION) CRITERIA
Like TBLC2, but allows you to specify an additional PERS filter condition. In combination with TBLC2 (SELECTION) this allows you to filter which employees this date-rule applies to. See Use-when conditions
- Once you have selected the specific RULE (TBLID), this field is no longer looked at. (It is not used in the date calculation.) It is used with the DateRuleVal() function with the /BYCAT switch.
TBLC4
STEP 1 - CALCULATED DATE (DtCalc)
This is the first part of the calculation. It calculates a fixed date: DtCalc.
This step is option. To skip it, either don't enter an expression or have your expression return an empty date.
Enter an expression here which returns (gives) a date. It must be a fixed date based on info in the employee file. It may not be dependent on the number of hours the employee worked (TIMEDT info).
- EXAMPLE: AddDays(pers.E_ORIGHIRE, 90)
TBLC5
COUNTER NAME for HOURS (STEP 2a)
Select a counter ID used to count hours worked. If there is no requirement on hours worked, you don't need a counter.
TBLC6
COUNTER NAME for DOLLARS (STEP 2b)
Select a counter to use to count dollars. If it is the same as the HOURS-COUNTER (above), then leave this field empty.
TBLC7
NUMBER OF HOURS REQUIRED (expression for step 2a)
The required number of hours the employee must work, according to the HOURS counter (see TBL6). The DATERULE engine counts hours worked by the employee, according to the hours counter specified.
In fact, what you enter is numeric expression for the hours required. It can return a value dependent on the employee status.
- For example:
iif(pers.E_PSTAT="MGR", 2080, 1040)
For AVECH (Grade advancement) rules, you can use the variable: lnHoursRequired which is filled from the GRADE table for the target grade.
(This can alternatively be a number of days. See 2nd tab.)
TBLC8
AMOUNT IN DOLLARS REQUIRED (expression for step 2b)
You can also specify a dollar amount to be earned, based on the dollars-counter (if specified) or the hours counter.
In fact, what you enter is numeric expression. It can, for example, return a value dependent on the employee status.
The hours-worked / dollars-earned condition is considered to be satisified once EITHER target is reached.
TBLM1
COUNTER START DATE (expression for step 2)
This expression determines the date to start counting from. It is typically the employee's original hire date (pers.E_ORIGHIRE), or rehire date (pers.E_LASTHIRE).
However, it could be something else, such as the first day of the current year, the date the employee reached puberty (LOL), the date they became permanent, etc.
TBLM2
STEP 3 - FINAL RESULT DATE
This expression combines the result of step 1 (DtCalc = the fixed date) and step 2 (DtCompl) to give a final result.
The expression gives you a way to combine the results of steps 1 and 2 and do some additional tweaking or rounding.
EXAMPLES
The earlier date: MINDATE (DtCalc, DtComp)
The later date: MAX (DtCalc, DtComp)
Jan 1 following the later date: ANNIV("0101", MAX(DtCalc, DtComp))
Employee's next birthday on or after the Step-2 date: ANNIV(pers.E_BIRTHDT, DtComp)
© Carver Technologies, 2024 • Updated: 08/21/22