Quintiq file version 2.0
#parent: #root
Method EditCustomerOrder (
  structured[CustomerOrder] selection,
  internal[GUIComponent] parent
) id:Method_DialogCreateEditCustomerOrder_EditCustomerOrder
{
  #keys: '[142576.0.84643255]'
  Body:
  [*
    // Edit sales demands
    
    isbatchedit := selection.Size() > 1;
    Dialog.ShowHideComponentForBatchEdit( isbatchedit );
    salesdemand := selection.Element( 0 );
    data := shadow( salesdemand );
    Dialog.Data( data );
    
    result := this.DoModal( parent );
    
    if( result > 0 )
    {                  
      quantity := ApplicationLibMacroPlanner.FormatStringToReal( EditorQuantity.Text(), 0.0 );
           
      CustomerOrder::Update( selection,
                             not isbatchedit or CheckBoxBatchEditProduct.Checked(),
                             SelectionProduct.Data(),                         
                             not isbatchedit or CheckBoxBatchEditStockingPoint.Checked(),
                             SelectionStockingPoint.Data(),                         
                             not isbatchedit or CheckBoxBatchEditOrderDate.Checked(),
                             data.StartDate(),                         
                             not isbatchedit or CheckBoxBatchEditQuantity.Checked(),
                             quantity,                         
                             not isbatchedit or CheckBoxBatchEditPrice.Checked(),
                             data.Price(),                         
                             not isbatchedit or CheckBoxBatchEditPriority.Checked() or CheckBoxBatchEditIsExcludedFromFulfillmentKPI.Checked(),
                             data.Priority(),
                             not isbatchedit or CheckBoxBatchEditSalesSegment.Checked(),
                             data.SalesSegment_MP(),                         
                             not isbatchedit or CheckBoxBatchEditCurrency.Checked(),
                             data.Currency_MP(),                         
                             not isbatchedit or CheckBoxBatchEditUnitOfMeasure.Checked(),
                             data.UnitOfMeasure_MP(),                         
                             not isbatchedit or CheckBoxBatchEditIsExcludedFromFulfillmentKPI.Checked(),
                             ifexpr( CheckBoxIsExcludedFromFulfillmentKPI.Enabled(),
                                     CheckBoxIsExcludedFromFulfillmentKPI.Checked(),
                                     data.IsExcludedFromFulfillmentKPIUser() ),
                             not isbatchedit or CheckBoxBatchEditCustomerName.Checked(),
                             data.CustomerName(),                         
                             not isbatchedit or CheckBoxBatchEditCustomerID.Checked(),
                             data.CustomerID(),                         
                             not isbatchedit or CheckBoxBatchEditOrderID.Checked(),
                             data.OrderID(),                         
                             not isbatchedit or CheckBoxBatchEditOrderLineID.Checked(),
                             data.OrderLineID(),                         
                             not isbatchedit or CheckBoxBatchEditIsEligibleForNetting.Checked(),
                             data.IsEligibleForNetting(),                         
                             not isbatchedit or CheckBoxBatchEditIsFirmed.Checked(),
                             data.IsFirmed(),                         
                             true );
    }
  *]
}
