Quintiq file version 2.0 
 | 
#parent: #root 
 | 
DeclarativeOwningNMRelation CalcAsBaseProductInStockingPointPeriodInPeriod 
 | 
{ 
 | 
  #keys: '1[134266.1.22295573]' 
 | 
  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 
 | 
    pispips := construct( ProductInStockingPointInPeriods ); 
 | 
     
 | 
    if( this.IsBase() ) 
 | 
    { 
 | 
      pispips := selectset( this,ProductInStockingPoint_MP.ProductInStockingPointInPeriod, pispip, 
 | 
                            not pispip.Period_MP().IsDeleted() 
 | 
                            and not pispip.IsBase(), 
 | 
                            this.Period_MP().IsInPeriod( pispip.Start(), pispip.End() ) 
 | 
                            and guard( ( this.Start() < pispip.StockingPointInPeriod().ChildOfPeriodStart() 
 | 
                                         or this.End() > pispip.StockingPointInPeriod().ChildOfPeriodEnd() ), false ) ); 
 | 
    } 
 | 
     
 | 
     
 | 
    return &pispips; 
 | 
  *] 
 | 
  HelperRelation: ProductInStockingPointInPeriod 
 | 
  InstantiationType: ProductInStockingPointPeriodInPeriod 
 | 
  Relation: AsBaseProductInStockingPointPeriodInPeriod 
 | 
} 
 |