Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method GetLatestPISPIPInScope ( 
 | 
  const LibOpt_Scope scope 
 | 
) const as const ProductInStockingPointInPeriodPlanningLeaf 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    // pre condition: 'this' itself is not in scope 
 | 
    // returns:  1st pispip < current pispip that is in scope 
 | 
    value := constnull( ProductInStockingPointInPeriodPlanningLeaf ); 
 | 
    pisp := this.ProductInStockingPoint_MP();  
 | 
    latestpispip := pisp.LatestPISPIPInScope();  
 | 
    assert( scope.Contains( this.StockingPointInPeriod().SPIPInOptimizerRun() ), 'SPIP not in scope while calling for latest pispip in scope' );  
 | 
    if ( not isnull( latestpispip )  
 | 
         and latestpispip.Start() < this.Start() ) // scopes have no gaps wrt pispips - so if the latest pispip is after 'this' and 'this itself is not in scope the entire block in scope is after 'this'  
 | 
    {                                              // so in that case there is nothing in scope before 'this' 
 | 
      value := latestpispip.astype( ProductInStockingPointInPeriodPlanningLeaf );  
 | 
    } 
 | 
    return value; 
 | 
  *] 
 | 
  InterfaceProperties { Accessibility: 'Module' } 
 | 
} 
 |