Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method GetCumulativeProduction ( 
 | 
  const IncomingShelfLifeDay itday 
 | 
) const as Real 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    // compute cumulative production for pispip when restricted to 'itday'  
 | 
     
 | 
    value := 0.0;  
 | 
    productintrips := this.GetIncomingProductInTrips( itday); // incoming trips to pispip.ProductInStockingPoint, that add itday to shelf life, and that depart in period pispip.Period 
 | 
    value := value + sum( productintrips, Elements, pit, true, pit.Quantity()) ;  
 | 
     
 | 
    // New supply, inventory supply and actual goes into itday with 0 lead time 
 | 
    if ( itday.ShelfLifeDays() = 0 )  
 | 
    { 
 | 
      supplynontrip := sum( this, Supply_MP.astype( NewSupply ), ns, not ns.IsNewSupplyOfTrip(), ns.Quantity() );  
 | 
      value := value + supplynontrip   
 | 
      value := value - sum( productintrips, Elements, pit, true, pit.Quantity() );  
 | 
      // inventory supply in future period with manufacture date = current period start is considered production for the current period 
 | 
      nextpsipipstoconsider := this.GetNextPISPIPWithinShelfLife( DateTime::MaxDateTime() );  
 | 
      traverse( nextpsipipstoconsider, Elements.Supply_MP.astype( InventorySupply ), invsup, invsup.GetManufacturingPISPIP() = this )  
 | 
      { 
 | 
        value := value + invsup.Quantity();  
 | 
      } 
 | 
       
 | 
      //contributions: inventory actual'; 
 | 
      lastpispipwithactual := this.ProductInStockingPoint_MP().LastPlanningPISPIPWithActual();  
 | 
      if ( this.IsPeriodFrozen() and not isnull( lastpispipwithactual ) )  
 | 
      { 
 | 
        value := 0.0;  
 | 
        actualtoconsider := selectset( lastpispipwithactual, ActualProductInStockingPointInPeriod, a, true, true );  
 | 
        traverse( actualtoconsider, Elements, actualpispip, actualpispip.GetManufacturingPISPIP() = this  )  
 | 
        { 
 | 
          value := value + actualpispip.ActualInventoryLevelEnd();  
 | 
        } 
 | 
      }   
 | 
    } 
 | 
     
 | 
    value := value +  guard( this.PreviousPlanningPISPIP().GetCumulativeProduction( itday ), 0.0 );  
 | 
     
 | 
    return value; 
 | 
  *] 
 | 
} 
 |