Quintiq file version 2.0
#parent: #root
Method Initialize () id:Method_DialogCreateEditTransportationCost_Initialize
{
  #keys: '[145730.1.918138893]'
  Body:
  [*
    // Initialize dialog
    
    // Populate allowed accounts
    allowedAccounts := construct( Account_MPs );
    allowedCostDrivers := construct( Strings );
    
    MacroPlan.GetAccounts( LaneLegCost::GetDefinitionName(), &allowedAccounts, &allowedCostDrivers ); // 2 output as prevent double query of MacroPlan.GetAllowedCostDrivers
    
    // Remove time
    time := Translations::MP_AccountAssignmentCostDriverTime();
    allowedCostDrivers := selectvalues( allowedCostDrivers, Elements, e, e <> time, e );
    allowedAccounts := selectset( allowedAccounts, Elements, e, e.DefaultCostDriver() <> time );
    
    // Populate dropdown with allowed cost drivers & accounts
    costdrivers := allowedCostDrivers.ToString( ';' );
    this.DropDownStringListCostDriver().Strings( costdrivers );
    this.DataHolderAllowedAccounts().Data( &allowedAccounts );
    
    // Populate dropdown with all time units
    // Note: Although time cost driver is excluded, we keep the components
    //       in case we want to use it in future
    this.DropDownStringListTimeUnit().Strings( PeriodSpecification_MP::GetAllTimeUnit() );
    
    ApplicationMacroPlanner.ShowFormModal( this );
  *]
}
