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
  | Quintiq file version 2.0 
 |  #parent: #root 
 |  Method OnOK () id:Method_DialogCreateEditSafetyStock_OnOK 
 |  { 
 |    #keys: '[136682.1.2144769365]' 
 |    Body: 
 |    [* 
 |      //OnOK 
 |      Form.ApplyChanges(); 
 |       
 |      istargetinday := [Boolean]rbgSafetyStock.BoundValue() 
 |      targetindays := ifexpr( istargetinday, ApplicationMacroPlanner.FormatStringToReal( efSafetyStockInDays.Text(),0.0), 0.0 ); 
 |      targetinqty := ifexpr( not istargetinday, ApplicationMacroPlanner.FormatStringToReal( efSafetyStockInQuantity.Text(),0.0 ), 0.0 ); 
 |       
 |      if ( isnull( DataHolderDialogData.Data().WrappedInstance() ) ) 
 |      { 
 |          newsafetystock := SafetyStock::Create( ddlProduct.Data(), 
 |                               ddlStockingPoint.Data(), 
 |                               dsStart.Date(), 
 |                               istargetinday, targetindays, targetinqty,            // Does not have a target in days, the initial targets are 0 
 |                               false, cbOverrideCalculatedSafetyStock.Checked(), false ); 
 |          // Access the form, select the new safety stock 
 |          DataHolderForm.Data().ListSafetyStocks().SelectByKey( newsafetystock.Key() ); 
 |      } 
 |      else 
 |      { 
 |          
 |         SafetyStock::Update( DataHolderDialogDatas.Data(), 
 |                             ddlProduct.Data(), 
 |                             ddlStockingPoint.Data(), 
 |                             dsStart.Date(), 
 |                             istargetinday, targetindays, targetinqty,            // Does not have a target in days, the initial targets are 0 
 |                             false, cbOverrideCalculatedSafetyStock.Checked(), false );      
 |         
 |      } 
 |       
 |      Form.Close(); 
 |    *] 
 |  } 
 |  
  |