Quintiq file version 2.0
#parent: #root
Method SetDefaultValue () id:Method_DialogCreateEditSalesDemand_SetDefaultValue
{
  #keys: '[136682.1.803196472]'
  Body:
  [*
    // Set the default value for the fields in the dialog.
    
    data := DataHolderDialogData.Data();
    owner := data.Product_MP(); 
    startdate := guard( MacroPlan.StartOfPlanningPeriod().StartDate(), MacroPlan.Start().Date() );
    enddate := guard( MacroPlan.StartOfPlanningPeriod().EndDate(), MacroPlan.End().Date() );
    uom := guard( owner.UnitOfMeasure_MP(), MacroPlan.DefaultUnitOfMeasure() );
    defaultdemand := guard( MacroPlan.GlobalParameters_MP().DefaultDemandUncertainty(), 0.0 );
    
    //set default data on dialog
    data.StartDate( startdate );
    data.EndDate( enddate );
    data.Currency_MP( relset, MacroPlan.BaseCurrency() );
    data.Priority( relset, SalesDemandBase::GetDefaultPriority( MacroPlan ) );
    data.UnitOfMeasure_MP( relset, uom );
    data.DemandUncertaintyPercentage( defaultdemand );
    data.IsExcludedFromFulfillmentKPI( owner.IsDerivedExcludeFromFulfillmentKPI() );
  *]
}
