| Quintiq file version 2.0 | 
| #parent: #root | 
| Method EditStockingPointCapacityFromListStockingPointInPeriod ( | 
|   internal[GUIComponent] parent, | 
|   structured[StockingPointInPeriod] selection | 
| ) id:Method_DialogCreateEditStockingPointCapacity_EditStockingPointCapacityFromListStockingPointInPeriod | 
| { | 
|   #keys: '[107528.0.125967414]' | 
|   Body: | 
|   [* | 
|     // Edit the capacity of the selection stocking point periods from periods list | 
|      | 
|     Dialog.EnableDisableComponent( true ); | 
|      | 
|     spip := selection.Element( 0 ); | 
|     // Need this for excluding itself in pre-condition primary keys checking. | 
|     data := shadow( spip.StockingPointCapacity() ); | 
|     stockingpoint := spip.StockingPoint_MP(); | 
|      | 
|     // In case selection.Element( 0 ) doesn't bind to any stocking point capacity, calling SetDefaultValue method will return null error. | 
|     // Check start in case of editing from SPIP later than the existing SC, the Start date will be off if we pass in existing SC | 
|     if( isnull( data ) | 
|         or data.Start() <> spip.Start().Date() ) | 
|     { | 
|       data := spip.StockingPoint_MP().StockingPointCapacity( relshadow, StockingPointID := stockingpoint.ID(), Start := spip.Start().Date() ); | 
|     } | 
|      | 
|     Dialog.Data( data ); | 
|      | 
|     // Need this so that when the spip doesn't not have a stocking point capacity, the fields in this Dialog will not be blank. | 
|     Dialog.SetDefaultValue( spip ); | 
|      | 
|     result := this.DoModal( parent ); | 
|      | 
|     if ( result > 0 ) | 
|     { | 
|       StockingPointCapacity::CreateOrUpdateForStockingPointInPeriods( selection, | 
|                                                                       data.MaxCapacity(), | 
|                                                                       CheckBoxThisPeriodOnwards.Checked() ); | 
|     } | 
|   *] | 
| } |