Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod Create ( 
 | 
  ProductInStockingPoint_MP owner, 
 | 
  Period_MP period, 
 | 
  Boolean isleaf 
 | 
) as ProductInStockingPointInPeriod 
 | 
{ 
 | 
  Description: 'Create product in stocking point in period' 
 | 
  TextBody: 
 | 
  [* 
 | 
    pispip:= null( ProductInStockingPointInPeriod ) 
 | 
     
 | 
    // Create ProductInStockingPointInPeriod depending on whether the period IsPlanning( isleaf or not ) and IsBase 
 | 
    if( period.IsPlanning() ) 
 | 
    { 
 | 
      if( isleaf ) 
 | 
      { 
 | 
        // Create ProductInStockingPointInPeriod as ProductInStockingPointInPeriodPlanningLeaf type 
 | 
        pispip:= owner.ProductInStockingPointInPeriod( relnew, ProductInStockingPointInPeriodPlanningLeaf ); 
 | 
      } 
 | 
      else 
 | 
      { 
 | 
        // Create ProductInStockingPointInPeriod as ProductInStockingPointInPeriodPlanningNonLeaf type 
 | 
        pispip:= owner.ProductInStockingPointInPeriod( relnew, ProductInStockingPointInPeriodPlanningNonLeaf ); 
 | 
      } 
 | 
    } 
 | 
    else 
 | 
    { 
 | 
      if( period.IsBase() ) 
 | 
      { 
 | 
        // Create ProductInStockingPointInPeriod as ProductInStockingPointInPeriodNonPlanningBase type 
 | 
        pispip := owner.ProductInStockingPointInPeriod( relnew, ProductInStockingPointInPeriodNonPlanningBase ); 
 | 
      } 
 | 
      else 
 | 
      { 
 | 
        // Create ProductInStockingPointInPeriod as ProductInStockingPointInPeriodNonPlanningNonBase type 
 | 
        pispip := owner.ProductInStockingPointInPeriod( relnew, ProductInStockingPointInPeriodNonPlanningNonBase ); 
 | 
      } 
 | 
    } 
 | 
     
 | 
    // Check if PISPIP is created, if it is created, update relations/attributes 
 | 
    if( not isnull( pispip ) ) 
 | 
    { 
 | 
      pispip.Period_MP( relset, period ); 
 | 
      pispip.Start( period.Start() ); 
 | 
      pispip.End( period.End() ); 
 | 
    } 
 | 
     
 | 
    return pispip; 
 | 
  *] 
 | 
} 
 |