Lai,Risheng
2023-11-02 30c02e0c981b16be0918483543f4b812956c45d4
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
Quintiq file version 2.0
#parent: #root
Method NewLaneLegCost (
  internal[GUIComponent] parent,
  shadow[LaneLeg] owner
) id:Method_DialogCreateEditLaneLegCost_NewLaneLegCost_434
{
  #keys: '[124808.1.1621249184]'
  Body:
  [*
    // New lane leg shadow cost
    
    data := owner.LaneLegCost( relnew,
                               ID := MacroPlan.IDHolder().GetLaneLegCostID(),
                               OriginStockingPointID := owner.OriginStockingPointID(),
                               DestinationStockingPointID := owner.DestinationStockingPointID() );
    
    Dialog.Data( data );
    
    // Set default value
    Dialog.SetDefaultValue();
    
    currency := guard( owner.Lane().Unit().Currency_MP(), null( Currency_MP ) );
    unitofmeasure := guard( owner.Lane().Unit().UnitOfMeasure_MP(), null( UnitOfMeasure_MP ) );
    
    Dialog.SetHolders( currency, unitofmeasure );
    
    Dialog.SetValueForStringSelections( LaneLegCost::GetDefinitionName() );
    
    result := Dialog.DoModal( parent );
    
    if( result > 0 )
    {
      data.Commit();
    }
    else
    {
      // If user cancels, delete the instance
      data.Delete();
    }
  *]
}