| Quintiq file version 2.0 | 
| #parent: #root | 
| FunctionOverride CalcAllocation | 
| { | 
|   TextBody: | 
|   [* | 
|     value := 1.0; | 
|      | 
|     if( this.IsPlanning() or this.IsBase() ) | 
|     { | 
|       planningup := ifexpr( this.IsPlanning(),  | 
|                             this,                                             // Case 1: planning UnitPeriod: aggregate values from associated period tasks  | 
|                             this.PlanningUP().astype( UnitPeriodTime ) );     // Case 2: base, non planning UnitPeriod: inherit value from planning UnitPeriod | 
|                             | 
|       value := guard( planningup.UnitAvailability().Allocation(), | 
|                       this.MacroPlan().GlobalParameters_MP().DefaultAllocation() ); | 
|     } | 
|      | 
|     this.Allocation( value ); | 
|   *] | 
| } |