Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method SetEndOfPeriod () id:Method_LibCal_dlgEvent_SetEndOfPeriod 
 | 
{ 
 | 
  #keys: '[131092.1.1284157]' 
 | 
  Body: 
 | 
  [* 
 | 
    // When this method is called from response dsStartOfPeriod.OnChanged() because the value is set during 
 | 
    // InitializeRecurrencePeriod(), the value of ckbEndOfPeriod.Checked() is *always* 'false', even when it is 
 | 
    // explicitly set to 'true' during the initialization. This seems to be a bug in the Software. 
 | 
    // As a workaround, the value of lblWorkaround.Text() is set to "initialized" when the value of ckbEndOfPeriod.Checked() is set. 
 | 
    // When this method is called during initialization, the value of the label is still "" (which is WRONG, it should have been set!). 
 | 
    // This can be used to let this method not be executed with a value of ckbEndOfPeriod.Checked() that is not 
 | 
    // properly initialized. 
 | 
    if( lblWorkaround.Text() <> "" ) 
 | 
    { 
 | 
      if( this.ValuesRecurrenceOK() ) 
 | 
      { 
 | 
        if( btnOnce.IsPressed() ) 
 | 
        { 
 | 
          dsEndOfPeriod.Date( dsStartOfPeriod.Date() ); 
 | 
        } 
 | 
        else 
 | 
        { 
 | 
          // Set the end of the period based on the start of the period and the #occurrences 
 | 
          // IFF the end of the period is not manually set. 
 | 
          if( not ckbEndBy.Checked() ) 
 | 
          { 
 | 
            endDate := this.DetermineEndDate( dsStartOfPeriod.Date(), [Number]edtNrOfOccurrences.Text() ); 
 | 
            dsEndOfPeriod.Date( endDate ); 
 | 
          } 
 | 
        } 
 | 
      } 
 | 
       
 | 
      // else keep the value as it is, setting it to MinDate looks 'strange'. 
 | 
       
 | 
      Form.UpdateTextualInfo(); 
 | 
    } 
 | 
  *] 
 | 
} 
 |