| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod GetUoMText ( | 
|   Number lengthOfTime, | 
|   String timeUnit, | 
|   String currencyId, | 
|   String uom, | 
|   String costDriver | 
| ) declarative remote as String | 
| { | 
|   Description: 'Set account UoM according to different cost driver' | 
|   TextBody: | 
|   [* | 
|     // Omit length of time if equal 1, as we will use later for displaying e.g. uom / month, uom / 2 month | 
|     length := ifexpr( lengthOfTime >= 2, lengthOfTime.AsQUILL() + ' ', '' ); | 
|     period := length + timeUnit; | 
|     currency := currencyId; | 
|     costDriver := costDriver.TrimBoth(); | 
|      | 
|     // Default text | 
|     text := currency; | 
|      | 
|     // 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(); | 
|       } | 
|      | 
|       if( AccountAssignment::GetTimeUnitVisibility( costDriver ) ) | 
|       { | 
|         text := currency + '/' + period | 
|       } | 
|       else if( costDriver = Translations::MP_AccountAssignmentCostDriverInventoryHolding() ) | 
|       { | 
|         text := currency + '/' + '(' + uom + '*' + Translations::MP_GlobalParameters_Year() + ')'; | 
|       } | 
|       else  | 
|       { | 
|         text := currency + '/' + uom; | 
|       } | 
|     } | 
|     return text; | 
|   *] | 
| } |