| Quintiq file version 2.0 | 
| #parent: #root | 
| Method CalculateToAndFrom () declarative | 
| { | 
|   Description: 'Set the to and from position of stocking point unit edge' | 
|   TextBody: | 
|   [* | 
|     // Set the to and from position of stocking point unit edge | 
|     // This is only used in GUI | 
|     sp := this.StockingPointNode(); | 
|     unit := this.UnitNode(); | 
|      | 
|     // Check if StockingPointNode and UnitNode is null | 
|     if( not isnull( sp ) and not isnull( unit ) ) | 
|     { | 
|       // Check if StockingPointNode's unit is at the same level as UnitNode's parent | 
|       issamelevel := guard( sp.StockingPoint_MP().Unit() = unit.Unit().Parent(), true ); | 
|       // Check if this StockingPointUnit is acting as input, populate the from/to x/y accordingly | 
|       if( this.StockingPointUnit().IsInput() ) | 
|       { | 
|         belongstounit := select( sp, StockingPoint_MP.Unit.UnitNode, u, not issamelevel, u.ViewBase() = sp.ViewBase() ) | 
|         this.FromX( guard( belongstounit.X(), sp.X() ) ); | 
|         this.FromY( guard( belongstounit.Y(), sp.Y() ) ); | 
|      | 
|         this.ToX( unit.X() ); | 
|         this.ToY( unit.Y() ); | 
|       } | 
|       else | 
|       { | 
|         this.FromX( unit.X() ); | 
|         this.FromY( unit.Y() ); | 
|      | 
|         belongstounit := select( sp, StockingPoint_MP.Unit.UnitNode, u, not issamelevel, u.ViewBase() = sp.ViewBase() ) | 
|         this.ToX( guard( belongstounit.X(), sp.X() ) ); | 
|         this.ToY( guard( belongstounit.Y(), sp.Y() ) ); | 
|       } | 
|     } | 
|   *] | 
| } |