yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
}