| Quintiq file version 2.0 | 
| #parent: #root | 
| Method GetPlanningCapacity ( | 
|   DateTimeVector datetimevector, | 
|   RealVector realvector | 
| ) const declarative as Duration | 
| { | 
|   Description: 'sum of capacity from period start to end base on shiftpattern' | 
|   TextBody: | 
|   [* | 
|     duration := Duration::Zero(); | 
|     numberofdays := this.Period_MP().EndDate() - this.Period_MP().StartDate(); | 
|      | 
|     firstday := this.Start(); | 
|     datetimes := datetimevector.AsValues(); | 
|      | 
|     // Only calculate if there's data to start with | 
|     if( datetimevector.Size() > 0 and realvector.Size() > 0 ) | 
|     { | 
|       for( i := 0; i < numberofdays; i++ ) | 
|       { | 
|         start := firstday + Duration::Days( i ); | 
|         index := datetimes.Find( start ); | 
|         if ( index >-1 ) | 
|         { | 
|           capacityinreal := realvector.Get( index ); | 
|           duration := duration + Duration::Hours( capacityinreal ); | 
|         }   | 
|       } | 
|     } | 
|      | 
|     return duration; | 
|   *] | 
| } |