chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
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
Quintiq file version 2.0
#parent: #root
Method Initialize () id:Method_DialogCreateEditTransportationCost_Initialize
{
  #keys: '[145730.1.918138893]'
  Body:
  [*
    // Initialize dialog
    
    // Populate allowed accounts
    allowedAccounts := construct( Account_MPs );
    allowedCostDrivers := construct( Strings );
    
    MacroPlan.GetAccounts( LaneLegCost::GetDefinitionName(), &allowedAccounts, &allowedCostDrivers ); // 2 output as prevent double query of MacroPlan.GetAllowedCostDrivers
    
    // Remove time
    time := Translations::MP_AccountAssignmentCostDriverTime();
    allowedCostDrivers := selectvalues( allowedCostDrivers, Elements, e, e <> time, e );
    allowedAccounts := selectset( allowedAccounts, Elements, e, e.DefaultCostDriver() <> time );
    
    // Populate dropdown with allowed cost drivers & accounts
    costdrivers := allowedCostDrivers.ToString( ';' );
    this.DropDownStringListCostDriver().Strings( costdrivers );
    this.DataHolderAllowedAccounts().Data( &allowedAccounts );
    
    // Populate dropdown with all time units
    // Note: Although time cost driver is excluded, we keep the components
    //       in case we want to use it in future
    this.DropDownStringListTimeUnit().Strings( PeriodSpecification_MP::GetAllTimeUnit() );
    
    ApplicationMacroPlanner.ShowFormModal( this );
  *]
}