Quintiq file version 2.0
#parent: #root
Method InitializeDialog () id:Method_DialogEditGlobalParameter_InitializeDialog
{
  #keys: '[113694.1.1414699377]'
  Body:
  [*
    // Initialize the dialog, set string selection and labels.
    data := Dialog.Data();
    
    Dialog.EnableDisableComponents();
    Dialog.ShowHideComponents();
    Dialog.HideOptimizerSettings();
    
    // Populate selection with all available time units
    StringSelectionPeriodSpecification.Strings( PeriodSpecification_MP::GetExistingPeriodSpecificationID( MacroPlan ) );
    
    // Populate selection with all available disagggregation factor
    StringSelectionDisaggregationRatio.Strings( GlobalParameters_MP::GetAllDisaggregationRatio() );
    
    // Populate seleciton with all available operation lead time calculation options
    StringSelectionOperationLeadTimeLogic.Strings( GlobalParameters_MP::GetAllOperationLeadTimeLogic() );
    
    // Populate seleciton with all available lane lead time calculation options
    StringSelectionLanesLeadTimeLogic.Strings( GlobalParameters_MP::GetAllLaneLeadTimeLogic() );
    
    // Populate selection with all available forecast netting rule options
    StringSelectionForecastNettingRule.Strings( GlobalParameters_MP::GetAllForecastNettingRule() );
    
    // Populate string for all accounts
    if( not isnull( data.WrappedInstance() ) )
    {
    
      accounts := MacroPlan.GetAllAccounts();
      StringSelectionAccountForInventoryHolding.Strings( accounts );
    
      // Set default value for string selection account xxx if it does not have a value
      if( data.DefaultAccountForInventoryHolding() = '' )
      {
        inventoryholdacc := select( MacroPlan, Account_MP, acc,
                                    acc.IsForAccountAssignment(),
                                    acc.DefaultCostDriver() = Translations::MP_AccountAssignmentCostDriverInventoryHolding() );
    
        data.DefaultAccountForInventoryHolding( guard( inventoryholdacc.Name(), '' ) );
      }
    }
  *]
}
