Functional Description
Purpose
This function is used to retrieve the next or previous working day from a given day, or a specific
date based on a given date and a number of workdays to add to the given date. The function uses the
calendar and the workday rule specified by the user to calculate the appropriate date that should be
returned.
Setup Notes and Prerequisites
The value of the calendar to use (MMCU) parameter must be passed to this function. A valid initial
date (DATE01) must also be passed (this is the date the calculations are based on), along with the
workday rule (WKDY) to be used. If the workday rule is equal to '1' then the number of days to add (DADD)
to the initial date must also be passed.
Special Logic
If the workday rule is equal to '1' (Working Days), the function will use the calendar and the
initial date to advance as many working days as the mnDaysToAdd variable indicates. If the workday rule is
equal to '2' (Actual Days, Next Work Day), the function will use the calendar and the initial date to
advance to the next workday. If the workday rule is equal to '3' (Actual Days, Previous Work Day), the
function will use the calendar and the initial date to advance to the previous workday.
Technical Specification
Parameters
Item DescriptionI/OReq?Notes
MMCUszCalendarToUseIYThe calendar to use.
DATE01jdDateI/OYThe date that calculations should be based on.
WKDYcWorkDayRuleIYThe workday rule. Valid values are '1' for 'Working
Days', '2' for 'Actual Days, Next Work Day', and '3' for 'Actual Days, Previous Work Day'.
DADDmnDaysToAddINRequired only if the workday rule is equal to '1'.
Related Tables
F0007Work Day Calendar
Related Functions
None.
Processing
Perform Initializations.
If (WorkDayRule is not equal to
Open table F0007.
If open table F0007 call failed,
Set error.
Else,
Retrieve calendar information.
If retrieval was successful,
If (WorkDayRule is equal to '1'),
Execute ActualDays.
Else If (WorkDayRule is equal to '2'),
Execute GoForward.
Else,
Execute GoBackwards.
Endif.
Else,
Set error.
Endif.
Endif.
Endif.
Perform function cleanup.
ActualDays
Perform Initializations.
While (Not finished adding days),
Fetch next day.
If next day is a workday,
Subtract a day from remaining days to add.
Endif.
End While.
GoForward
Perform Initializations.
While (NextDay is not a workday),
Fetch NextDay.
End While.
GoBackwards
Perform Initializations.
While (PreviousDay is not a workday),
Fetch PreviousDay.
End While.
D0000150 - Advance Work Days
Parameter Name | Data Item | Data Type | Req/Opt | I/O/Both |
---|---|---|---|---|
szCalendarToUse | MMCU | char | NONE | INPUT |
A code that represents a high-level business unit. Use this code to refer to a branch or plant that might have departments or jobs, which
| ||||
jdDate | DATE01 | JDEDATE | NONE | BOTH |
Event point for JDE Date. | ||||
cWorkDayRule | WKDY | char | NONE | INPUT |
A code that specifies whether to include nonworking days in the due date calculation and whether to change the due date if it is on a
| ||||
mnDaysToAdd | DADD | MATH_NUMERIC | NONE | INPUT |
The number of days that the system adds to or subtracts from, if you specify negative days, the date specified in the Based on Date field
| ||||
cShiftCode | SHFT | char | OPT | INPUT |
A user defined code (00/SH) that identifies daily work shifts.
In payroll systems, you can use a shift code to add a percentage or amount to
| ||||
szWorkDayCalendarType | WDCT | char | OPT | INPUT |
A user defined code (42/WD) that specifies how the calendar is used. For example, the calendar might be specific to an industry such as
| ||||
szWorkDayCalendarKey | WDCK | char | OPT | INPUT |
A code used to classify values within a calendar type. For example, if the calendar type is ROUTE, you can enter a code that specifies a
|
None |
F0007 Workday Calendar |