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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Quintiq file version 2.0
#parent: #root
Method NewStockingPoint (
  internal[GUIComponent] parent,
  Unit parentunit,
  Group group,
  Number x,
  Number y
) as StockingPoint_MP id:Method_DialogCreateEditStockingPoint_NewStockingPoint
{
  #keys: '[11660.0.15276813]'
  Body:
  [*
    // New stocking point
    
    data := MacroPlan.StockingPoint_MP( relshadow,
                                        ID := '',
                                        Unit := parentunit,
                                        Currency_MP := MacroPlan.BaseCurrency(),
                                        IsPlannedInfinite := true,
                                        Start := Date::MinDate(),
                                        End := Date::MaxDate(),
                                        Group := group,
                                        UnitOfMeasure_MP := MacroPlan.DefaultUnitOfMeasure() );
    
    CheckBoxBelongsTo.Checked( not isnull( parentunit ) );
    
    Dialog.Data( data );
    
    Dialog.SetImage();
    
    result := this.DoModal( parent );
    
    if ( result > 0 )
    {
      gridx := 0;
      gridy := 0;
      view := DataHolderView.Data();
      Node::NearestGridPoint( x, y, gridx, gridy, view.GridPointDistance() );
    
      data.DefaultGridX( gridx );
      data.DefaultGridY( gridy );
    
      unitid := '';
      if( CheckBoxBelongsTo.Checked() )
      {
        unitid := SelectionBelongsTo.Data().ID();
      }            
      data.UnitID( unitid );
    
      // The validity of the stocking point.
      if( CheckBoxHasStart.Checked() )
      {
        data.Start( GUIDateTimeSelectorStart.DateTime().Date() );
      }
      if( CheckBoxHasEnd.Checked() )
      {
        data.End( GUIDateTimeSelectorEnd.DateTime().Date() );
      }
    
      data.Commit();
    }
    
    return data.WrappedInstance();
  *]
}