| Quintiq file version 2.0 | 
| #parent: #root | 
| Function CalcMaxCapacity | 
| { | 
|   TextBody: | 
|   [* | 
|     // Soh Yee Aug-26-2012 (created) | 
|      | 
|      | 
|     // The MaxCapacity doesn't need to be divided by the the period's duration. | 
|     // For example, if its time unit is Week, max capacity is 1000, but the period duration is 5 days, the max capacity is still 1000 for 5 days. | 
|     value := guard( this.StockingPointCapacity().MaxCapacity(), | 
|                     this.StockingPoint_MP().MacroPlan().GlobalParameters_MP().DefaultMaxCapacityForStockingPoint() ); | 
|                     | 
|      | 
|     // MaxCapacity will be 0 if the period is not within the stocking point period validity. | 
|     if( this.Duration() = Duration::Zero() or ( this.StockingPoint_MP().IsSystem() and not this.StockingPoint_MP().IsPlannedInfinite() ) ) | 
|     { | 
|       value := 0; | 
|     } | 
|      | 
|     this.MaxCapacity( value ); | 
|   *] | 
| } |