| Quintiq file version 2.0 | 
| #parent: #root | 
| Method OnOK () derived id:Method_DialogCreateEditCustomerOrder_OnOK | 
| { | 
|   #keys: '[136682.1.803177914]' | 
|   BaseType => //DialogCreateEditSalesDemand/Method_DialogCreateEditSalesDemand_OnOK | 
|   Body: | 
|   [* | 
|     Form.ApplyChanges(); | 
|     this.SetAttributeAfterApplyData(); | 
|      | 
|     data := DataHolderDialogData.Data(); | 
|     selection := DataHolderSalesDemands.Data().Copy(); | 
|     isbatchedit := selection.Size() > 1;  | 
|      | 
|      | 
|     if( isnull( data.WrappedInstance() ) ) | 
|     { | 
|       data.ID( MacroPlan.IDHolder().GetSalesDemandID( "User_", "" ) ); | 
|       CustomerOrder::Create( data.ID(), | 
|                              DropDownListProduct.Data(), | 
|                              DropDownListStockingPoint.Data(), | 
|                              data.StartDate(), | 
|                              data.Quantity(), | 
|                              data.Price(), | 
|                              data.Priority(), | 
|                              data.SalesSegment_MP(), | 
|                              data.Currency_MP(), | 
|                              data.UnitOfMeasure_MP(), | 
|                              false, | 
|                              true, | 
|                              data.IsExcludedFromFulfillmentKPI(), | 
|                              data.CustomerName(), | 
|                              data.CustomerID(), | 
|                              data.OrderID(), | 
|                              data.OrderLineID(), | 
|                              data.IsEligibleForNetting(), | 
|                              data.IsFirmed(),   | 
|                              false  | 
|                            ); | 
|     } | 
|      | 
|     else | 
|     { | 
|       quantity := ApplicationMacroPlanner.FormatStringToReal( EditFieldQuantityUom.Text(), 0.0 ); | 
|        | 
|       customerorders := selectset( selection, Elements.astype( CustomerOrder ), f, true, true ); | 
|       CustomerOrder::Update( customerorders, | 
|                              not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DropDownListProduct ), | 
|                              DropDownListProduct.Data(), | 
|                              not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DropDownListStockingPoint ), | 
|                              DropDownListStockingPoint.Data(), | 
|                              not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DateSelectorStart ), | 
|                              data.StartDate(), | 
|                              not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( EditFieldQuantityUom ), | 
|                              quantity, | 
|                              not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( EditFieldPrice ), | 
|                              data.Price(), | 
|                              not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DropDownListPriority ) or ApplicationMacroPlanner.IsActionLinkEnabledEdit( CheckBoxIsExcludedFromFulfillmentKPI ), | 
|                              data.Priority(), | 
|                              not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DropDownListSalesSegment ), | 
|                              data.SalesSegment_MP(), | 
|                              not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DropDownListCurrency ), | 
|                              data.Currency_MP(), | 
|                              not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DropDownListUnitOfMeasurement ), | 
|                              data.UnitOfMeasure_MP(), | 
|                              not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( CheckBoxIsExcludedFromFulfillmentKPI ), | 
|                              ifexpr( CheckBoxIsExcludedFromFulfillmentKPI.Enabled(),  | 
|                                      CheckBoxIsExcludedFromFulfillmentKPI.Checked(), | 
|                                      data.IsExcludedFromFulfillmentKPIUser() ), | 
|                              not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( EditFieldCustomerName ), | 
|                              data.CustomerName(), | 
|                              not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( EditFieldCustomerID ), | 
|                              data.CustomerID(), | 
|                              not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( EditFieldOrderID ), | 
|                              data.OrderID(), | 
|                              not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( EditFieldOrderLineID ), | 
|                              data.OrderLineID(), | 
|                              not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( CheckboxIsForNetting ), | 
|                              data.IsEligibleForNetting(), | 
|                              not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( CheckboxIsFirmed ), | 
|                              data.IsFirmed(), | 
|                              true );   | 
|     } | 
|      | 
|     Form.Close(); | 
|   *] | 
| } |