admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 );
  *]
}