lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
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
Quintiq file version 2.0
#parent: #root
Function CalcStartTime
{
  TextBody:
  [*
    value := this.OptCampaignUnitSubPeriod().StartTime();
    if( this.IsFirstElementTypeInCombi() )
    {
      ////////////////////////////////////////////////////////////////////////////////////////////
      //If this is the first element type in the combi then take the combi start time
      ////////////////////////////////////////////////////////////////////////////////////////////
      value := this.OptCampaignCombi().StartTimeFirstElement();  
    }
    else if( not isnull( this.PreviousCombiElement() ) 
             and ( not this.PreviousCombiElement().IsFirstElementTypeInCombi() ) 
           )
    {
      ////////////////////////////////////////////////////////////////////////////////////////////
      //The second element type in the combi will start at the start of the period as that would 
      //make sure we add all possible combinations in the last subperiod will be generated. Subsequent
      //elements will start at the min end time of the previous element.
      ////////////////////////////////////////////////////////////////////////////////////////////
      value := this.PreviousCombiElement().MinEndTime();
    }
    
    this.StartTime( value );
  *]
}