Quintiq file version 2.0
#parent: #root
Method EditInventorySupplyCost (
  internal[GUIComponent] parent,
  structured[shadow[InventorySupplyCost]] selection,
  ProductInStockingPoint_MP pisp
) id:Method_DialogCreateEditInventorySupplyCost_EditInventorySupplyCost
{
  #keys: '[124808.1.1623089888]'
  Body:
  [*
    // Edit shadow inventory supply costs
    isbatchedit := selection.Size() > 1;
    data := selection.Element( 0 );
    
    Dialog.Data( data );
    
    // Enable / disable primary keys when batch editing
    Dialog.EnableDisableComponentsForBatchEdit( isbatchedit );
    
    Dialog.SetValueForStringSelections( InventorySupplyCost::GetDefinitionName() );
    
    Dialog.SetHolders( guard( pisp.StockingPoint_MP().Currency_MP(), MacroPlan.BaseCurrency() ),
                       guard( pisp.UnitOfMeasure_MP(), MacroPlan.DefaultUnitOfMeasure() ) );
    
    result := this.DoModal( parent );
    
    if( result > 0 )
    {
      if( not isbatchedit )
      {
        data.Commit();
      }
      else
      {
        Dialog.UpdateShadowCost( selection, data.Cost() );
      }
    }
  *]
}
