Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod GetDurationBasedOnQuantity ( 
 | 
  Operation operation, 
 | 
  Real defaultminqty, 
 | 
  Real defaultmaxqty, 
 | 
  Boolean hasinputminquantity, 
 | 
  Boolean hasinputmaxquantity 
 | 
) declarative remote as Duration 
 | 
{ 
 | 
  Description: 'Returns the default duration of the transition type in the GC in case the transition is based on min/max Quantity' 
 | 
  TextBody: 
 | 
  [* 
 | 
    duration := Duration::Zero(); 
 | 
    if( ( hasinputminquantity or hasinputmaxquantity ) and not isnull( operation ) ) 
 | 
    { 
 | 
      operationthroughput := operation.Throughput(); 
 | 
      quantity := 0.0; 
 | 
      if( hasinputminquantity ) 
 | 
      { 
 | 
        quantity := defaultminqty; 
 | 
      } 
 | 
      else if( hasinputmaxquantity ) 
 | 
      { 
 | 
        quantity := defaultmaxqty; 
 | 
      } 
 | 
      duration := guard( Duration::Days( quantity / operationthroughput ) / 24, Duration::Zero() ); 
 | 
    } 
 | 
    return duration; 
 | 
  *] 
 | 
} 
 |