| Quintiq file version 2.0 | 
| #parent: #root | 
| Method SetDefaultValue ( | 
|   ProductInStockingPointInPeriod pispip | 
| ) id:Method_DialogCreateEditSalesDemand_SetDefaultValue | 
| { | 
|   #keys: '[107528.0.165496349]' | 
|   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 ); | 
|   *] | 
| } |