| Quintiq file version 2.0 | 
| #parent: #root | 
| Function CalcSecondaryQuantityInProcessUOM | 
| { | 
|   TextBody: | 
|   [* | 
|     // Convert the quantity in PIT into the quantity in process secondary uom (defined in TransportCapacity) | 
|     value := 0.0; | 
|      | 
|     // Need to guard this because if we change a periodspec from planning to | 
|     // visualization with trips planned, DepartureUnitPeriod might be null.  | 
|     // Transaction propagate is called before deleting the trips, hence we come | 
|     // in here before deleting trips | 
|     if( guard( not this.Trip().IsTimeBaseTransportation()  | 
|                and this.Trip().DepartureUnitPeriod().HasSecondaryCapacityDefinition(), false ) )  | 
|     { | 
|       secondaryUom := this.Trip().DepartureUnitPeriod().astype( UnitPeriodTransportQuantity ).TransportCapacity().SecondaryUnitOfMeasure(); | 
|       convFactor   := this.DeparturePISPIP().ProductInStockingPoint_MP().UnitOfMeasure_MP().GetConversionFactor( secondaryUom, this.Product_MP() ); | 
|      | 
|       value := this.Quantity() * convFactor;  | 
|     } | 
|      | 
|     this.SecondaryQuantityInProcessUOM( value ); | 
|   *] | 
| } |