Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method OnCostDriverChanged ( 
 | 
  String costdriver 
 | 
) id:Method_DialogCreateEditAccountStructure_OnCostDriverChanged 
 | 
{ 
 | 
  #keys: '[139394.0.458440668]' 
 | 
  Body: 
 | 
  [* 
 | 
    // On cost driver changed 
 | 
    feedback := ''; 
 | 
    iscostvisible := Account::CanCreateCost( feedback, costdriver );    // Label cost is only visible for certain cost drivers 
 | 
     
 | 
    if( not iscostvisible ) 
 | 
    { 
 | 
      EditFieldCost.Text( '0' ); // Reset cost edit field 
 | 
    } 
 | 
    EditFieldCost.Visible( iscostvisible ); 
 | 
    istimeunitvisible := iscostvisible and AccountAssignment::GetTimeUnitVisibility( costdriver );  // Time unit is only visible for certain cost drivers 
 | 
    DropDownStringListTimeUnit.Visible( istimeunitvisible ); 
 | 
    EditFieldLengthOfTime.Visible( istimeunitvisible ); 
 | 
     
 | 
    // Reset dropdownlist if not related to time, preselect first element when related to time 
 | 
    if( not istimeunitvisible ) 
 | 
    { 
 | 
      DropDownStringListTimeUnit.Text( '*' ); 
 | 
      EditFieldLengthOfTime.Text( '1' ); 
 | 
    } 
 | 
    else 
 | 
    { 
 | 
      defaultTimeUnit := DataHolderDialogData.Data().DefaultTimeUnit(); 
 | 
      // Set to first available time unit when no time-unit is found 
 | 
      if( defaultTimeUnit = '*' ) 
 | 
      { 
 | 
        DropDownStringListTimeUnit.SetSelectedElement( 0 ); 
 | 
      } 
 | 
      else if( defaultTimeUnit <> '' ) 
 | 
      { 
 | 
        DropDownStringListTimeUnit.SetSelectedElementFromString( defaultTimeUnit ); 
 | 
      } 
 | 
    } 
 | 
  *] 
 | 
} 
 |