| Quintiq file version 2.0 | 
| #parent: #root | 
| Method New ( | 
|   structured[LaneLeg] laneLegs, | 
|   FormTransportationCosts formTransportationCosts, | 
|   Account_MP account | 
| ) id:Method_DialogCreateEditTransportationCost_New | 
| { | 
|   #keys: '[145730.1.919718821]' | 
|   Body: | 
|   [* | 
|     // Open create dialog | 
|     if( isnull( laneLegs ) ) | 
|     { | 
|       laneLegs := Form.SetLaneLeg( DataHolderLaneLeg.Data().First() ); | 
|     } | 
|     DataHolderFormLaneLeg.Data( laneLegs.Copy() ); | 
|      | 
|     if( isnull( account ) ) | 
|     { | 
|       if( DataHolderSelectedAccounts.Data().Size() > 0 ) | 
|       { | 
|         account := DataHolderSelectedAccounts.Data().Element( 0 ); | 
|       } | 
|       else | 
|       { | 
|         allowAccounts := construct( Account_MPs ); | 
|         allowCostDrivers := construct( Strings ); | 
|         MacroPlan.GetAccounts( Form.GetCostType(), &allowAccounts, &allowCostDrivers ); | 
|         account := select( allowAccounts, Elements, e, | 
|                            not e.IsTime()  | 
|                            and e.Name().LikeUserLocale( Translations::MP_AccountAssignmentTransportation() ) ); | 
|       } | 
|     } | 
|      | 
|     this.New( laneLegs.First(), formTransportationCosts, account ); | 
|   *] | 
| } |