yanweiyuan3
2023-10-27 d1d15b61dfcf7fd0f800b32359f082cf580ed556
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
51
52
53
54
55
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 );
  *]
}