Quintiq file version 2.0
#parent: SplitterWnd3/MatrixEditorUnitPeriod
Response OnEndEdit (
  structured[UnitPeriod] cell,
  structured[Real] newvalue
) id:Response_SplitterWnd3_MatrixEditorUnitPeriod_OnEndEdit
{
  #keys: '[113694.1.325476479]'
  Body:
  [*
    // Update actual values
    currentattribute := this.Attributes()
    
    UnitPeriod::CreateOrUpdateActual( cell, newvalue.Element( 0 ), currentattribute );
    
    this.EndEdit( false );
  *]
  DefinitionID: 'Responsedef_MatrixEditor_OnEndEdit'
  Precondition:
  [*
    currentattribute := this.Attributes();
    sanitycheckfeedback := '';       
    periodSpecForActual := MacroPlan.GetPeriodSpecification( MacroPlan.GlobalParameters_MP().PeriodSpecificationForUnitActual() );
    
    return UnitPeriod::CanEditActuals( cell, periodSpecForActual, true, feedback )
           and ActualUnitPeriod::ValidateInput( feedback,
                                                sanitycheckfeedback,
                                                cell.Element( 0 ),
                                                ifexpr( UnitPeriod::GetIsActualUtilizationPercentage( currentattribute ), newvalue.Element( 0 ), 0 ),
                                                ifexpr( UnitPeriod::GetIsActualTotalAvailableCapacity( currentattribute ), newvalue.Element( 0 ), 0 ) );
  *]
}
