Kevin Kok Khah Whey
2023-11-07 5ae534ab606e6f2ba5ea60914224d665b0447d5a
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
Quintiq file version 2.0
#parent: #root
Method New (
  structured[LaneLeg] laneLegs,
  FormTransportationCosts formTransportationCosts,
  Account_MP account
) id:Method_DialogCreateEditTransportationCost_New
{
  #keys: '[145730.1.919718821]'
  Body:
  [*
    // Open create dialog
    if( isnull( laneLegs ) )
    {
      laneLegs := Form.SetLaneLeg( DataHolderLaneLeg.Data().First() );
    }
    DataHolderFormLaneLeg.Data( laneLegs.Copy() );
    
    if( isnull( account ) )
    {
      if( DataHolderSelectedAccounts.Data().Size() > 0 )
      {
        account := DataHolderSelectedAccounts.Data().Element( 0 );
      }
      else
      {
        allowAccounts := construct( Account_MPs );
        allowCostDrivers := construct( Strings );
        MacroPlan.GetAccounts( Form.GetCostType(), &allowAccounts, &allowCostDrivers );
        account := select( allowAccounts, Elements, e,
                           not e.IsTime() 
                           and e.Name().LikeUserLocale( Translations::MP_AccountAssignmentTransportation() ) );
      }
    }
    
    this.New( laneLegs.First(), formTransportationCosts, account );
  *]
}