Quintiq file version 2.0
#parent: #root
Method OpenViewAndFocusButton (
  String view
) id:Method_ApplicationMacroPlanner_OpenViewAndFocusButton
{
  #keys: '[136682.3.1544734671]'
  Body:
  [*
    //Open view and focus on actionbar button
    focusbutton := null( WebButton );
    togglebutton := null( WebButton );
    
    if ( view = SanityCheckGroup::GetWebProductsView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonProducts();
    }
    else if ( view = SanityCheckGroup::GetWebAccountView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonAccounts();
    }
    else if ( view = SanityCheckGroup::GetWebUnitTimeCapacitiesView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonCapacities();
    }
    else if ( view = SanityCheckGroup::GetWebActualInventoryView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonActualInventories();
    }
    else if ( view = SanityCheckGroup::GetWebCampaignPlanningView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonCampaign();
    }
    else if ( view = SanityCheckGroup::GetWebCampaignTypeAndTransitionTypeView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonProcesses();
    }
    else if ( view = SanityCheckGroup::GetWebFeedbacksView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonFeedback();  
    }
    else if ( view = SanityCheckGroup::GetWebUnitOfMeasurementsView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonParameters();
    }
    else if ( view = SanityCheckGroup::GetWebCurrencyView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonParameters();
    }
    else if ( view = SanityCheckGroup::GetWebPeggingView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonAllocation();
    }
    else if ( view = SanityCheckGroup::GetWebSupplyChainPlanningView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonSupplyPlanning();
    }
    else if ( view = SanityCheckGroup::GetWebFulfillmentRestrictionView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonSalesSalesSegments();
      togglebutton := ApplicationMacroPlanner.ButtonFulfillmentRestrictions();
    }
    else if ( view = SanityCheckGroup::GetWebRecipesView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonProducts();
    }
    else if ( view = SanityCheckGroup::GetWebInventoryValueView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonDataFinances();
    }
    else if ( view = SanityCheckGroup::GetWebInventoryTargetView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonInventoryTargets();  
    }
    else if ( view = SanityCheckGroup::GetWebInventorySuppliesView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonExternalSupplies();
    }
    else if ( view = SanityCheckGroup::GetWebInventorySupplyCostView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonDataFinances();  
    }
    else if ( view = SanityCheckGroup::GetWebLanesView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonProcesses();  
    }
    else if ( view = SanityCheckGroup::GetWebRoutingsView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonProcesses();  
    }
    else if ( view = SanityCheckGroup::GetWebTransportationCostView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonDataFinances();
    }
    else if ( view = SanityCheckGroup::GetWebOperationCostView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonDataFinances();
    }
    else if ( view = SanityCheckGroup::GetWebPeriodsView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonParameters();  
    }
    else if ( view = SanityCheckGroup::GetWebPostponementSpecificationView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonSalesSalesSegments();
      togglebutton := ApplicationMacroPlanner.ButtonPostponementSettings();
    }
    else if ( view = SanityCheckGroup::GetWebPrioritiesView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonSalesForecasts();
      togglebutton := ApplicationMacroPlanner.ButtonPriorities();
    }
    else if ( view = SanityCheckGroup::GetWebSafetyStocksView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonSafetyStock();  
    }
    else if ( view = SanityCheckGroup::GetWebEntitiesView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonEntities();  
    }
    else if (view = SanityCheckGroup::GetWebStockingPointCapacitiesView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonCapacities();
    }
    else if ( view = SanityCheckGroup::GetWebStockingPointCostsView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonDataFinances();  
    }
    else if ( view = SanityCheckGroup::GetWebSupplyTargetsView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonCapacities();
    }
    else if ( view = SanityCheckGroup::GetWebCalendarView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonCapacities();  
    }
    else if ( view = SanityCheckGroup::GetWebUnitCostView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonDataFinances();
    }
    else if ( view = SanityCheckGroup::GetWebTransportCapacitiesView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonCapacities();  
    }
    else if ( view = SanityCheckGroup::GetWebServiceLevelsView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonSafetyStock();
      togglebutton := ApplicationMacroPlanner.ButtonServiceLevel();  
    }
    else if ( view = SanityCheckGroup::GetWebFulfillmentTargetsView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonSalesSalesSegments();
      togglebutton := ApplicationMacroPlanner.ButtonFulfillmentTargets();
    }
    else if ( view = SanityCheckGroup::GetWebUnitQuantityView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonCapacities();  
    }
    else if ( view = SanityCheckGroup::GetWebForecastView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonSalesForecasts();  
    }
    else if ( view = SanityCheckGroup::GetWebSalesSegmentView() )
    {
      focusbutton := ApplicationMacroPlanner.ButtonSalesSalesSegments();  
    }
    
    ApplicationMacroPlanner.OpenView( view, focusbutton );
    focusbutton.Focus();
    if( not isnull( togglebutton ) )
    {
      ApplicationMacroPlanner.ToggleSettingsForm( togglebutton );
    }
  *]
}
