| Quintiq file version 2.0 | 
| #parent: #root | 
| Method EnableDisableComponent ( | 
|   Boolean isbatchedit, | 
|   Product_MP productselection | 
| ) id:Method_DialogCreateEditSalesDemand_EnableDisableComponent | 
| { | 
|   #keys: '[136682.1.803278990]' | 
|   Body: | 
|   [* | 
|     // Enable disable components | 
|      | 
|     DropDownListSalesSegment.Enabled( not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DropDownListSalesSegment ), " " ); | 
|     DropDownListStockingPoint.Enabled( not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DropDownListStockingPoint ),"" ); | 
|     DropDownListUnitOfMeasurement.Enabled( not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DropDownListUnitOfMeasurement ), "" ); | 
|     DropDownListProduct.Enabled( not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DropDownListProduct ), "" ); | 
|     DateSelectorStart.Enabled( not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DateSelectorStart ), "" ); | 
|     DateSelectorEnd.Enabled( not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DateSelectorEnd ), "" ); | 
|     DropDownListCurrency.Enabled( not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DropDownListCurrency ), "" ); | 
|     EditFieldQuantityUom.Enabled( not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( EditFieldQuantityUom ), "" ); | 
|     EditFieldPrice.Enabled( not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( EditFieldPrice ), "" ); | 
|     isexcludedfrmfulfillmentkpifrmproduct := guard( productselection.IsDerivedExcludeFromFulfillmentKPI(), false ); | 
|      | 
|     CheckBoxIsExcludedFromFulfillmentKPI.Enabled( ( not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( CheckBoxIsExcludedFromFulfillmentKPI ) )  | 
|                                                     and not isexcludedfrmfulfillmentkpifrmproduct, | 
|                                                     ifexpr(  isexcludedfrmfulfillmentkpifrmproduct,  | 
|                                                              Translations::MP_Designer_DialogSalesDemand_DisableCheckBoxIsExcludedFromFulfillmentKPI(),  | 
|                                                              "" ) ); | 
|      | 
|     isenabledpriority := false; | 
|     isenableduncertaintypct := false; | 
|     if( Form.CheckBoxIsExcludedFromFulfillmentKPI().Checked() ) | 
|     { | 
|       Form.DropDownListPriority().Data( null( Priority ) ); | 
|       Form.EditFieldDemandUncertaintyPercentage().Text( ApplicationMacroPlanner.FormatRealToString( 0.0 ) ); | 
|     } | 
|     else | 
|     { | 
|       isenabledpriority := not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DropDownListPriority ); | 
|       isenableduncertaintypct := not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( EditFieldDemandUncertaintyPercentage ); | 
|        | 
|       if( isenabledpriority and isnull( DropDownListPriority.Data() ) ) | 
|       { | 
|         Form.DropDownListPriority().Data( SalesDemandBase::GetDefaultPriority( MacroPlan ) ); | 
|       } | 
|     } | 
|     Form.DropDownListPriority().Enabled( isenabledpriority, "" ); | 
|     Form.EditFieldDemandUncertaintyPercentage().Enabled( isenableduncertaintypct, "" ); | 
|   *] | 
| } |