| Quintiq file version 2.0 | 
| #parent: MatrixEditorProductPlanning | 
| Response OnEndEdit ( | 
|   structured[ProductInStockingPointInPeriod] cell, | 
|   structured[internal[MatrixEditorCell]] newvalue | 
| ) id:Response_FormProductPlanningMatrix_MatrixEditorProductPlanning_OnEndEdit | 
| { | 
|   #keys: '[132448.0.56969954]' | 
|   Body: | 
|   [* | 
|     //Smart plan with user qty | 
|     pispipPlannings := selectset( cell, Elements.astype( ProductInStockingPointInPeriodPlanning ), pispipPlanning, true )                               | 
|     Form.UpdatePISPIPValues( pispipPlannings, newvalue ); | 
|      | 
|     ApplicationLibMacroPlanner.RefreshFormSupplyPlanWebClient(); | 
|     this.EndEdit( false ); | 
|   *] | 
|   CanBindMultiple: false | 
|   DefinitionID: 'Responsedef_MatrixEditor_OnEndEdit' | 
|   Precondition: | 
|   [* | 
|     //Check 2 conditions: | 
|     //1 - whether the selected attribute can be edited | 
|     //2 - whether the params and profiles are there | 
|     //3 - if editing supply qty, check if optimizer can be executed | 
|     attributes := selectvalues( newvalue, Elements, e, true, e.AttributePath() ); | 
|     isSupply_o := false; | 
|     cond := ProductInStockingPointInPeriod::CanEnterSupplyQuantity( feedback, cell, attributes, isSupply_o );  | 
|      | 
|     // Only check for condition 2 if editing supplyQuantity | 
|     if( cond ) | 
|     { | 
|       if( isSupply_o ) | 
|       { | 
|         periods := selectset( cell, Elements.Period_MP, period, true ); | 
|         cond := Form.CheckExistParamAndProfile( feedback, | 
|                                                 cell.Element( 0 ), // pispip | 
|                                                 /* User [Real] instead of ApplicationMacroPlanner.FormatStringToReal | 
|                                                    MatrixEdiot will do the format internaly to match the server locale | 
|                                                    and it only allow Real for cell bind to Real attribute */ | 
|                                                 [Real]newvalue.Element( 0 ).NewValue() ) | 
|                 and ScenarioManager::CanStartSmartPlan( ScenarioManager, | 
|                                                         DataHolderActiveScenario.Data(), | 
|                                                         true, | 
|                                                         periods, | 
|                                                         feedback ); | 
|       }      | 
|     } | 
|      | 
|     return cond; | 
|   *] | 
| } |