hongji.li
2023-11-07 192c736b8ac4b2d84cb823ac71f17e507948a5e8
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
Quintiq file version 2.0
#parent: #root
Method SetDefaultValue (
  ProductInStockingPointInPeriod pispip
) id:Method_DialogCreateEditCustomerOrder_SetDefaultValue
{
  #keys: '[142576.0.84643267]'
  Body:
  [*
    // Set the default value for the fields in the dialog.
    
    //initialises localvars
    data := Dialog.Data();
    salessegment := null( SalesSegment_MP );
    //Set default values on components
    
    owner := null( Product_MP );
    stockingpoint := null( StockingPoint_MP );
    salessegment := null( SalesSegment_MP );
    
    startdate := guard( MacroPlan.StartOfPlanningPeriod().StartDate(), MacroPlan.Start().Date() );
    enddate := guard( MacroPlan.StartOfPlanningPeriod().EndDate(), MacroPlan.End().Date() );
    uom := MacroPlan.DefaultUnitOfMeasure();
    priority := SalesDemandBase::GetDefaultPriority( MacroPlan );
    
    //if pispip not null, set attributes based on pispip, otherwise, use default
    if( not isnull( pispip ) )
    {
      owner := pispip.ProductInStockingPoint_MP().Product_MP();
      stockingpoint := pispip.ProductInStockingPoint_MP().StockingPoint_MP();
      startdate := pispip.Start().Date();
      enddate := pispip.End().Date();
      uom := pispip.ProductInStockingPoint_MP().UnitOfMeasure_MP();
    }
    
    //set default data on dialog
    data.Product_MP( relset, owner );
    data.StockingPoint_MP( relset, stockingpoint );
    data.SalesSegment_MP( relset, salessegment );
    data.StartDate( startdate );
    data.EndDate( enddate );
    data.Currency_MP( relset, MacroPlan.BaseCurrency() );
    data.Priority( relset, priority );
    data.UnitOfMeasure_MP( relset, uom );
  *]
}