yypsybs
2023-10-10 550ebcf02217f8a0c6fe9001fcfa8e42e9cd6b83
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
Quintiq file version 2.0
#parent: #root
Method OnOK () id:Method_DialogCreateEditServiceLevel_OnOK
{
  #keys: '[146140.0.1162682032]'
  Body:
  [*
    // When the user click OK, we either create or edit a service level
    
    data := DataHolderDialogData.Data();
    selection := DataHolderServicesLevel.Data();
    isbatchedit := selection.Size() > 1;
    
    // New
    if( isnull( data.WrappedInstance() ) )
    {
      ServiceLevel::Create( MacroPlan,
                            '', // Automaticaly generated
                            true, // isEnable
                            EditFieldName.Text(),
                            DropDownListProduct.Data(),
                            DropDownListStockingPoint.Data(),
                            data.SalesSegment_MP(),
                            ApplicationMacroPlanner.FormatStringToReal( EditFieldTargetPercentage.Text() ),
                            DateSelectorStart.Date(),
                            DateSelectorEnd.Date(), 
                            true,
                            false,
                            false );
    }
    else
    {
      if( isbatchedit ) // Btach Edit
      {
        if( CheckBoxBatchEditTargetPercentage.Checked() )
        {
          ServiceLevel::Update( selection,
                                ApplicationMacroPlanner.FormatStringToReal( EditFieldTargetPercentage.Text() ) );
        }
      }
      else
      {
        data.WrappedInstance().Update( data.IsEnabled(),
                                       EditFieldName.Text(),
                                       DropDownListProduct.Data(),
                                       DropDownListStockingPoint.Data(),
                                       data.SalesSegment_MP(),
                                       ApplicationMacroPlanner.FormatStringToReal( EditFieldTargetPercentage.Text() ),
                                       DateSelectorStart.Date(),
                                       DateSelectorEnd.Date(),
                                       true,
                                       false,
                                       false );
      }
    }
    Form.Close();
  *]
}