Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Function CalcDifference 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    // desmondt Jul-17-2014 (created) 
 | 
     
 | 
    value := 0.0; 
 | 
    kpivalue := this.Value(); 
 | 
     
 | 
    if( this.KPI().IsAccount() ) 
 | 
    { 
 | 
      account := this.GetTypeKPIAccount(); 
 | 
      budget := account.Budget(); 
 | 
     
 | 
      value := guard( ( ( kpivalue - budget ) / budget ) * 100, 0.0 ); 
 | 
    } 
 | 
     
 | 
    if( not this.KPI().IsMaximize() ) 
 | 
    { 
 | 
      value := value * -1; 
 | 
    } 
 | 
     
 | 
    this.Difference( value ); 
 | 
  *] 
 | 
} 
 |