Quintiq file version 2.0
#parent: #root
Method NewTransportCapacity (
  internal[GUIComponent] parent,
  Unit unit
) as TransportCapacity id:Method_DialogCreateEditTransportCapacity_NewTransportCapacity
{
  #keys: '[131962.0.9568821]'
  Body:
  [*
    // New transport capacity
    
    Dialog.ShowHideComponentForBatchEdit( false, true, false );
    
    data := unit.TransportCapacity( relshadow, UnitID := unit.ID(), Start := MacroPlan.StartOfPlanning() );
    
    Dialog.Data( data );
    Dialog.SetDefaultValue( null( UnitPeriodTransportQuantity ) );
    
    result := Dialog.DoModal( parent );
    newobj := null( TransportCapacity );
    
    if( result > 0 )
    {
      newobj := TransportCapacity::Create( data.Unit(),
                                           data.Start(),
                                           data.TimeUnit(),
                                           data.MinimumCapacity(),
                                           data.MaximumCapacity(),
                                           data.LotSize(),
                                           data.HasSecondaryCapacity(),
                                           data.SecondaryLotSize(),
                                           data.SecondaryMaximumCapacity(),
                                           data.SecondaryMinimumCapacity(),
                                           data.SecondaryUnitOfMeasureName(),
                                           false );                                       
    
    }
    
    return newobj;
  *]
}
