Quintiq file version 2.0 
 | 
#parent: #root 
 | 
DeclarativeOwningNMRelation CalcAsBaseStockingPointPeriodInPeriod 
 | 
{ 
 | 
  #keys: '1[110702.1.443100397]' 
 | 
  Expression: 
 | 
  [* 
 | 
    // soh yee Sep-15-2015 (created) 
 | 
     
 | 
    //           __________________________ 
 | 
    // Quarter: |__________________________| 
 | 
    // Month:   |________|________|________| 
 | 
    // Week:    |_|_|_|_|_|_|_|_|_|_|_|_|_|_| 
 | 
     
 | 
    // System periods will be created as for splitting the week to two months 
 | 
    // This logic will create the N:M of the system periods to Week, and to Month. 
 | 
    // By checking that the Month1 can only link to Week1 to Week4 directly, so we will create N:M for Week5 to Month1 and Month2 
 | 
    // Month2 can link to Week6 to Week8 week directly, so we will create N:M for Week9 to Month2 and Month3 
 | 
    spips := selectset( this, Period_MP.AsBasePeriodInPeriod.Period_MP.StockingPointInPeriod, spip, 
 | 
                        spip.StockingPoint_MP() = this.StockingPoint_MP(), 
 | 
                        this.Start() < spip.ChildOfPeriodStart() or this.End() > spip.ChildOfPeriodEnd() ); 
 | 
     
 | 
    return &spips; 
 | 
  *] 
 | 
  HelperRelation: StockingPointInPeriod 
 | 
  InstantiationType: StockingPointPeriodInPeriod 
 | 
  Relation: AsBaseStockingPointPeriodInPeriod 
 | 
} 
 |