| Quintiq file version 2.0 | 
| #parent: #root | 
| Method SetLabelCost () id:Method_DialogCreateEditAccountCost_SetLabelCost | 
| { | 
|   #keys: '[110704.0.644305810]' | 
|   Body: | 
|   [* | 
|     // Set label cost when time unit / length of time of particular cost changes. | 
|     lengthoftime := ApplicationLibMacroPlanner.FormatStringToReal( EditorLengthOfTime.Text(), 0.0 ); | 
|     period := ApplicationLibMacroPlanner.FormatRealToString( lengthoftime ) + ' ' + StringSelectionTimeUnit.BoundValue().ToLower(); | 
|     currency := ValueHolderCurrency.Value(); | 
|     uom := ValueHolderUnitOfMeasure.Value();                                                           | 
|     costdriver := StringSelectionCostDriver.BoundValue(); | 
|      | 
|     isinventoryholdingcost := costdriver.TrimBoth() = Translations::MP_AccountAssignmentCostDriverInventoryHolding(); | 
|      | 
|     text := Translations::MP_Designer_DialogAccountCost_LabelCost(); | 
|      | 
|     // Cost drivers where the '(Currency per UoM)' does not need to be added to the label | 
|     displayCostOnly := costdriver = Translations::MP_AccountAssignmentCostDriverOneTime() | 
|                        or costdriver = Translations::MP_AccountAssignmentCostDriverInvestment(); | 
|      | 
|     if( not displayCostOnly ) | 
|     { | 
|       if( costdriver = Translations::MP_AccountAssignmentCostDriverStaffing() ) | 
|       { | 
|         uom := Translations::MP_GlobalParameters_Hour(); | 
|       } | 
|       else if( costdriver = Translations::MP_AccountAssignmentCostDriverLot() ) | 
|       { | 
|         uom := Translations::MP_AccountAssignmentCostDriverLot(); | 
|       } | 
|       else if ( costdriver = Translations::MP_AccountAssignmentCostDriverChangeover() ) | 
|       { | 
|         uom := Translations::MP_AccountAssignmentCostDriverChangeover(); | 
|       }  | 
|        | 
|       text := Translations::MP_Designer_DialogAccountCost_SetLabelCostPerUoM( currency, uom ); | 
|        | 
|       if( AccountAssignment::GetTimeUnitVisibility( costdriver ) ) | 
|       { | 
|         text:= Translations::MP_Designer_DialogAccountCost_SetLabelCostWithTimeUnit( currency, period ); | 
|        | 
|       } | 
|        | 
|       if ( isinventoryholdingcost ) | 
|       { | 
|         period := Translations::MP_GlobalParameters_Year(); | 
|         text := Translations::MP_Designer_DialogAccountCost_SetLabelCostWithUOMTimeUnit( currency, uom, period ); | 
|       } | 
|     } | 
|      | 
|     LabelCost.Text( text ); | 
|   *] | 
| } |