1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
| Quintiq file version 2.0
| #parent: #root
| StaticMethod GetDateOfFirstRecurrence (
| TimeZone timezone_i,
| Date startOfPeriod_i,
| Duration startTimeOfDay_i,
| Duration endTimeOfDay_i,
| Duration duration_i,
| Date earliestStart_i,
| Number recurrenceInterval_i,
| Boolean isDay_i,
| Number day_i,
| String weekOfMonth_i,
| String dayOfWeek_i
| ) declarative remote as Date
| {
| TextBody:
| [*
| dateOfRecurrence := startOfPeriod_i.StartOfMonth();
|
| // Determine the date, depending on whether it concerns a specific day or a pattern.
| date := LibCal_RecurrencePatternMonthly::GetDateOfNextOccurrence( dateOfRecurrence, dateOfRecurrence, recurrenceInterval_i,
| isDay_i, day_i, weekOfMonth_i, dayOfWeek_i );
|
| // Calculate endOfOccurrence, taking timezone and DSL into account.
| endOfOccurrence := LibCal_Util::CalculateEndTime( timezone_i, date, startTimeOfDay_i, duration_i );
|
| // The occurrence must start after the start of the period.
| // It can however start before the earliesStart, as long as it ends after it.
| while( date < startOfPeriod_i or endOfOccurrence < earliestStart_i.DateTime( timezone_i ) )
| {
| // Get the next applicable occurrence.
| dateOfRecurrence := LibCal_RecurrencePatternMonthly::GetDateOfNextRecurrence( dateOfRecurrence, recurrenceInterval_i );
|
| // Determine the date, depending on whether it concerns a specific day or a pattern.
| date := LibCal_RecurrencePatternMonthly::GetDateOfNextOccurrence( dateOfRecurrence, dateOfRecurrence, recurrenceInterval_i,
| isDay_i, day_i, weekOfMonth_i, dayOfWeek_i );
|
| endOfOccurrence := LibCal_Util::CalculateEndTime( timezone_i, date, startTimeOfDay_i, duration_i );
| }
|
| // Return the start of the month.
| return dateOfRecurrence;
| *]
| }
|
|