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
  | Quintiq file version 2.0 
 |  #parent: #root 
 |  Method Copy ( 
 |    Lane owner 
 |  ) as LaneLeg 
 |  { 
 |    Description: 'Makes a duplicate of legs with a different owner' 
 |    TextBody: 
 |    [* 
 |      // ju jinn May-8-2014 (created) 
 |       
 |      idholder := owner.Unit().MacroPlan().IDHolder(); 
 |       
 |      // duplicate lane leg 
 |      laneleg := LaneLeg::Create( owner, 
 |                                  this.AsOriginStockingPointLeg(), 
 |                                  this.AsDestinationStockingPointLeg(), 
 |                                  this.IsEnabled(), 
 |                                  this.Start(), 
 |                                  this.End(), 
 |                                  this.HasUserLeadTime(), 
 |                                  this.UserLeadTime(), 
 |                                  this.HasStandardDeviationLeadTimeLaneLeg(), 
 |                                  this.StandardDeviationLeadTimeLaneLeg(), 
 |                                  this.CO2Emission() ); 
 |      // duplicate costs 
 |      traverse( this, LaneLegCost, cost ) 
 |      { 
 |        accountassignment := select( owner.Unit(), UnitAccount, ua, 
 |                                     ua.Account_MP() = cost.AccountAssignment().Account_MP() 
 |                                     and ua.CostDriver() = cost.AccountAssignment().CostDriver() ); 
 |       
 |        if( not isnull( accountassignment ) ) 
 |        { 
 |          LaneLegCost::Create( idholder.GetLaneLegCostID(), 
 |                               laneleg, 
 |                               accountassignment.Account_MP(), 
 |                               accountassignment.CostDriver(), 
 |                               cost.Start(), 
 |                               cost.TimeUnit(), 
 |                               cost.LengthOfTime(), 
 |                               cost.Cost(), 
 |                               false ); 
 |        } 
 |      } 
 |       
 |      return laneleg; 
 |    *] 
 |  } 
 |  
  |