yypsybs
2023-10-10 550ebcf02217f8a0c6fe9001fcfa8e42e9cd6b83
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Quintiq file version 2.0
#parent: #root
Method InitializeDataHolders (
  Boolean ishome
) id:Method_ApplicationMacroPlanner_InitializeDataHolders
{
  #keys: '[138546.0.807200038]'
  Body:
  [*
    // Reset nav panel selection
    // Switching scenario now clear selection, this will affect DHActiveScenario.OnDataChanged & Sales > Sales Segment button.OnClick
    this.ClearNavigationPanelDataHolder();
    
    if( not isnull( ScenarioManager ) and not isnull( MacroPlan ) )
    {
      // Set dropdown to the active scenario
      activescenario := select( ScenarioManager, ScenarioMP, sce, sce.DatasetMDSID() = MacroPlan.MDSID() );
      DropDownListScenario.Data( activescenario );  
      
      if( not ishome )  // Accounts initialization should not be triggered during navigation panel home
      {
        // Select inventory holding cost account by default
        accounts := selectsortedset( MacroPlan, Account_MP, acc, acc.IsForAccountAssignment() and acc.Value() > 0, acc.Name() );
        periodspec := select( MacroPlan, PeriodSpecification_MP, pspec, pspec.IsDummyPlanningPeriod() );
        if( accounts.Size() > 0 )
        {
          DataHolderScenarioAnalysisAccount.Data( accounts.Element( 0 ) );
          DataHolderScenarioComparisonAccount.Data( accounts.Element( 0 ) );  
        }
        DataHolderPeriodSpec.Data( periodspec );
        // Don't auto select scenario if we home
        DataHolderFocusedScenario.Data().Flush();
        DataHolderFocusedScenario.Data().Add( activescenario );
      }
    }
    
    // Update to the user specific view
    ApplicationMacroPlanner.SupplyChainDiagramSetSupplyChainView( MacroPlan );
  *]
}