Quintiq file version 2.0
#parent: #root
Method New (
  structured[SalesSegment_MP] salessegments
) id:Method_DialogCreateEditFulfillmentTarget_New
{
  #keys: '[139394.0.1862541002]'
  Body:
  [*
    // New fulfillment target
    salessegment := guard( salessegments.Element(0), null(  SalesSegment_MP ) );
    product := select( DataHolderProduct.Data(), Elements, e, not e.IsSystem() );
    
    stockingpoint := select( DataHolderStockingPoint.Data(), Elements, e, not e.IsSystem() );
    
    data := MacroPlan.FulfillmentTarget( relshadow,
                                         ID := MacroPlan.IDHolder().GetServiceLevelID(),
                                         IsEnabled := true, // always enabled in web
                                         SalesSegment_MP := salessegment,
                                         Product_MP := product,
                                         StockingPoint_MP := stockingpoint,
                                         Start := MacroPlan.Start().Date(),
                                         End := MacroPlan.End().Date() );
    
    DataHolderDialogData.Data( &data );
    
    ApplicationMacroPlanner.ShowFormModal( this );
  *]
}
