Quintiq file version 2.0
#parent: #root
Method EditActualPISPIP (
  internal[GUIComponent] parent,
  structured[ActualProductInStockingPointInPeriod] actualpispips
) id:Method_DialogCreateEditActualPISPIP_EditActualPISPIP
{
  #keys: '[137118.0.320362755]'
  Body:
  [*
    // Create/Edit from actual pispip list
    
    actualpispip := actualpispips.Element( 0 );
    pispip := actualpispip.ProductInStockingPointInPeriod();
    DataHolderPISPIP.Data( pispip );
    
    isbatchedit := actualpispips.Size() > 1;
    
    data := shadow( actualpispip );
    
    Dialog.Data( data );
    
    ValueHolderIsBatchEdit.Value( [String] isbatchedit );
    Dialog.ShowHideComponents( [Boolean] ValueHolderIsBatchEdit.Value() );
    
    result := this.DoModal( parent );
    
    if( result > 0 )
    {
      if( isbatchedit )
      {
        ActualProductInStockingPointInPeriod::Update( actualpispips,
                                                      CheckBoxBatchEditInventoryLevelEnd.Checked(),
                                                      data.ActualInventoryLevelEnd(),
                                                      CheckBoxBatchEditDescription.Checked(),
                                                      data.Description(),
                                                      false );
      }
      else
      {
        //if manufactured date is hidden due to functionality restriction (Simple UI), the component's Enabled status will still be TRUE, therefore we need the second line.
        manufactureddate := ifexpr( GUIDateSelectorManufacturedDate.Enabled(), GUIDateSelectorManufacturedDate.DateTime().Date(), Date::MinDate() );
        manufactureddate := this.GetManufacturedDateWithUIRestriction( manufactureddate, data.ManufacturedDate() );
        
        actualpispip.Update( SelectionProduct.Data(),
                             SelectionStockingPoint.Data(),
                             GUIDateTimeSelectorDate.DateTime().Date(),
                             manufactureddate,
                             ApplicationLibMacroPlanner.FormatStringToReal( EditorInventoryLevelEnd.Text() ),
                             EditorDescription.Text(),
                             false
                           );
      }
    }
  *]
}
