Kevin Kok Khah Whey
2023-09-25 34d29be6a3eb0c025da50b77f2107c4ad259c6c0
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
41
42
43
44
45
46
47
48
49
50
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, "" );
  *]
}