Quintiq file version 2.0
#parent: #root
Method EnableDisableComponent (
  Boolean isbatchedit
) id:Method_DialogCreateEditSalesDemand_EnableDisableComponent
{
  #keys: '[107528.0.165695004]'
  Body:
  [*
    // Enable disable components
    
    SelectionSalesSegment.Enabled( not isbatchedit or CheckBoxBatchEditSalesSegment.Checked() );
    LabelSalesSegment.Enabled( not isbatchedit or CheckBoxBatchEditSalesSegment.Checked() );
    
    SelectionStockingPoint.Enabled( not isbatchedit or CheckBoxBatchEditStockingPoint.Checked() );
    LabelStockingPoint.Enabled( not isbatchedit or CheckBoxBatchEditStockingPoint.Checked() );
    
    SelectionUnitOfMeasure.Enabled( not isbatchedit or CheckBoxBatchEditUnitOfMeasure.Checked() );
    LabelUnitOfMeasure.Enabled( not isbatchedit or CheckBoxBatchEditUnitOfMeasure.Checked() );
    
    SelectionProduct.Enabled( not isbatchedit or CheckBoxBatchEditProduct.Checked() );
    LabelProduct.Enabled( not isbatchedit or CheckBoxBatchEditProduct.Checked() );
    
    GUIDateTimeSelectorStart.Enabled( not isbatchedit or CheckBoxBatchEditStart.Checked() );
    LabelStart.Enabled( not isbatchedit or CheckBoxBatchEditStart.Checked() );
    
    GUIDateTimeSelectorEnd.Enabled( not isbatchedit or CheckBoxBatchEditEnd.Checked() );
    LabelEnd.Enabled( not isbatchedit or CheckBoxBatchEditEnd.Checked() );
    
    SelectionCurrency.Enabled( not isbatchedit or CheckBoxBatchEditCurrency.Checked() );
    LabelCurrency.Enabled( not isbatchedit or CheckBoxBatchEditCurrency.Checked() );
    
    EditorQuantity.Enabled( not isbatchedit or CheckBoxBatchEditQuantity.Checked() );
    LabelQuantity.Enabled( not isbatchedit or CheckBoxBatchEditQuantity.Checked() );
    
    EditorPrice.Enabled( not isbatchedit or CheckBoxBatchEditPrice.Checked() );
    LabelPrice.Enabled( not isbatchedit or CheckBoxBatchEditPrice.Checked() );
    
    CheckBoxIsExcludedFromFulfillmentKPI.Enabled( not isbatchedit or CheckBoxBatchEditIsExcludedFromFulfillmentKPI.Checked() );
    
    isenabledpriority := false;
    isenableduncertaintypct := false;
    if( CheckBoxIsExcludedFromFulfillmentKPI.Checked() )
    {
      SelectionPriority.Data( null( Priority ));
      EditorDemandUncertaintyPercentage.Text( ApplicationLibMacroPlanner.FormatRealToString( 0.0 ) );
    }
    else
    {
      isenabledpriority := not isbatchedit or CheckBoxBatchEditPriority.Checked();
      isenableduncertaintypct := not isbatchedit or CheckBoxBatchEditDemandUncertaintyPercentage.Checked();
      
      if( isnull( SelectionPriority.Data() ) )
      {
        SelectionPriority.Data( SalesDemandBase::GetDefaultPriority( MacroPlan ) );
      }
    }
    SelectionPriority.Enabled( isenabledpriority );
    LabelPriority.Enabled( isenabledpriority );
    
    EditorDemandUncertaintyPercentage.Enabled( isenableduncertaintypct );
    LabelDemandUncertaintyPercentage.Enabled( isenableduncertaintypct );
  *]
}
