xiaoding721
2023-11-13 e4edcfd0b987b239526f5375881b919789782dad
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
Quintiq file version 2.0
#parent: #root
Method Copy (
  internal[GUIComponent] parent,
  FulfillmentRestriction fr
) as FulfillmentRestriction id:Method_DialogCreateEditFulfillmentRestriction_Copy
{
  #keys: '[116826.1.12686015]'
  Body:
  [*
    // New fulfillment restriction
    
    // Get a default sales segment so we can relshadow fulfillment restriction and bind to dialog
    // Follow the expression filter defined in data extractor for dropdown
    product := fr.Product_MP();
    salessegment := fr.SalesSegment_MP();
    
    data := salessegment.FulfillmentRestriction( relshadow, ProductID := product.ID(), SalesSegmentName := "", StartDate := fr.StartDate() );
    data.Product_MP( relset, product );
    
    // Set default data
    data.EndDate( fr.EndDate() );
    
    CheckBoxHasStart.Checked( data.StartDate().IsFinite() );
    CheckBoxHasEnd.Checked( data.EndDate().IsFinite() );
    
    Dialog.Data( data );
    
    fulfillmentrestriction := null( FulfillmentRestriction );
    
    if ( Dialog.DoModal( parent ) > 0 )
    {
      fulfillmentrestriction := FulfillmentRestriction::Create( SelectionSalesSegment.Data(), 
                                                                SelectionProduct.Data().ID(), 
                                                                GUIDateTimeSelectorStartDate.DateTime().Date(),
                                                                GUIDateTimeSelectorEndDate.DateTime().Date() );  
    }
    
    return fulfillmentrestriction;
  *]
}