Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method CreateOrEditProductInTripFromListTrip ( 
 | 
  internal[GUIComponent] parent, 
 | 
  Trip trip, 
 | 
  ProductInStockingPointInPeriodPlanningLeaf pispip 
 | 
) as ProductInTrip id:Method_DialogCreateEditProductInTrip_CreateOrEditProductInTripFromListTrip 
 | 
{ 
 | 
  #keys: '[113694.0.1674978443]' 
 | 
  Body: 
 | 
  [* 
 | 
    // Create/Edit product in trip from trip list. 
 | 
     
 | 
    productintrip := select( trip, ProductInTrip, pit, 
 | 
                             pit.Product_MP() = pispip.ProductInStockingPoint_MP().Product_MP() ); 
 | 
     
 | 
    data := shadow( productintrip ); 
 | 
     
 | 
    if( isnull( data ) ) 
 | 
    { 
 | 
      data := trip.ProductInTrip( relshadow,  
 | 
                                  Product_MP := pispip.ProductInStockingPoint_MP().Product_MP(), 
 | 
                                  Quantity := trip.GetSuggestedQuantity( pispip ), 
 | 
                                  ArrivalPISPIP := pispip, 
 | 
                                  TripID := trip.ID(), 
 | 
                                  ProductID := guard( pispip.ProductInStockingPoint_MP().Product_MP().ID(), '' ) 
 | 
                                  ); // This is needed to recalculate relations AsArrivalPISPIP 
 | 
    } 
 | 
     
 | 
    Dialog.Data( data ); 
 | 
    Dialog.EnableDisableComponents( false ); 
 | 
     
 | 
    result := this.DoModal( parent ); 
 | 
    pit := data.WrappedInstance(); 
 | 
     
 | 
    if( result > 0 ) 
 | 
    { 
 | 
      pit := ProductInTrip::CreateOrUpdateForTrip( trip, 
 | 
                                                   pispip, 
 | 
                                                   data.Quantity() ); 
 | 
    } 
 | 
     
 | 
    return pit; 
 | 
  *] 
 | 
} 
 |