Quintiq file version 2.0
#parent: #root
Method PopulateScenarioComparisonData () id:Method_ApplicationMacroPlanner_PopulateScenarioComparisonData_549
{
  #keys: '[138546.0.75259420]'
  Body:
  [*
    // Populate scenario comparison data
    macroPlans := DataHolderMacroPlansForScenarioComparison.Data();
    
    if( macroPlans.Size() > 0 )
    {
      // Retrive nav panel data
      activePeriods := selectset( DataHolderPeriods.Data(), Elements, p, not p.IsHistorical() );
      products := DataHolderProduct.Data();
      units := DataHolderUnit.Data();
      sps := DataHolderStockingPoint.Data();
      salessegments := DataHolderSalesSegment.Data();
      
      // Cost data 
      traverse( DataHolderOpenedForms.Data(), Elements, webform )
      {
        if( webform.istype( FormScenarioComparisonCosts ) )
        {
          webform.astype( FormScenarioComparisonCosts ).PopulateScenarioComparisonAccountsData( macroPlans, activePeriods, units, sps, products );
        }
        // Sales demands
        if( webform.istype( FormScenarioComparisonDemandFulfillment ) )
        {
          webform.astype( FormScenarioComparisonDemandFulfillment ).PopulatScenarioComparisonSalesDemands( macroPlans, activePeriods, products, sps, salessegments );
        }
        // Unit periods
        if( webform.istype( FormScenarioComparisonUnitCapacity ) )
        {
          webform.astype( FormScenarioComparisonUnitCapacity ).PopulateScenarioComparisonUnitPeriods( macroPlans, activePeriods, units );
        }
        // SPIPs
        if( webform.istype( FormScenarioComparisonStockingPointCapacity ) )
        {
          webform.astype( FormScenarioComparisonStockingPointCapacity ).PopulateScenarioComparisonStockingPointInPeriods( macroPlans, activePeriods, sps );
        }
        // Inventory levels
        if( webform.istype( FormScenarioComparisonInventoryLevels ) )
        {
          webform.astype( FormScenarioComparisonInventoryLevels ).PopulateScenarioComparisonPISPIPs( macroPlans, activePeriods, products, sps )
        }
        // Trips
        if( webform.istype( FormScenarioComparisonTrips ) )
        {
          webform.astype( FormScenarioComparisonTrips ).PopulateScenarioComparisonTrips( macroPlans, activePeriods, units );
        }
        // New supplies
        if( webform.istype( FormScenarioComparisonProductOutput ) )
        {
          webform.astype( FormScenarioComparisonProductOutput ).PopulateScenarioComparisonNewSupplies( macroPlans, activePeriods, units, sps, products );
        }
      }
    }
  *]
}
