Quintiq file version 2.0 
 | 
#parent: GanttChartDemandSupplyGroup 
 | 
Response OnClick ( 
 | 
  structured[ProductInStockingPointInPeriodPlanningLeaf] selection 
 | 
) id:Response_GanttChartDemandSupplyGroup_MenuNewTrips_OnClick 
 | 
{ 
 | 
  #keys: '[110880.9.1056298370]' 
 | 
  Body: 
 | 
  [* 
 | 
    // Create new trip for selected pispip 
 | 
    legcounter := 0 
 | 
     
 | 
    if( selection.Size() = 1 )    // Skip counter if more than one pispip is selected. 
 | 
    { 
 | 
      legcounter := counter( selection, Elements.ProductInStockingPoint_MP.LaneLegOutput.LaneLeg, leg, leg.GetIsEnabled() ); 
 | 
    } 
 | 
     
 | 
    // If only 1 pispip is selected and there is more than one leg, prompt the dialog for user to select a leg. 
 | 
    if( legcounter > 1 ) 
 | 
    { 
 | 
      dlg := construct( DialogCreateEditTrip ); 
 | 
      dlg.NewTripWithProduct( this, selection.Element( 0 ) ); 
 | 
    } 
 | 
    else 
 | 
    { 
 | 
      // Create trips with products in trip based on PISPIPs 
 | 
      Trip::CreateWithProductInTrips( selection, null( LaneLeg ) ); 
 | 
    } 
 | 
  *] 
 | 
  CanBindMultiple: false 
 | 
  DefinitionID => /GanttChartDemandSupplyGroup/Responsedef_GanttChartDemandSupplyGroup_Menu_OnClick 
 | 
  Initiator: 'MenuNewTrips' 
 | 
  Precondition: 
 | 
  [* 
 | 
    return Trip::CanCreate( selection, feedback ); 
 | 
  *] 
 | 
} 
 |