| Quintiq file version 2.0 | 
| #parent: #root | 
| Function CalcCumulativeShiftPatternDuration | 
| { | 
|   TextBody: | 
|   [* | 
|     // By default, set the total duration of the current shift pattern on the unit as the duration of this period. | 
|     value := this.Duration(); | 
|      | 
|     previous := this.PreviousPlanningUnitPeriod(); | 
|     // If the previous unit period was already using the same shift pattern, add its value to the total. | 
|     if( not isnull( previous ) and previous.astype( UnitPeriodTime ).ShiftPattern() = this.ShiftPattern() ) | 
|     { | 
|       value := value + previous.astype( UnitPeriodTime ).CumulativeShiftPatternDuration(); | 
|     } | 
|      | 
|     this.CumulativeShiftPatternDuration( value ); | 
|   *] | 
| } |