Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method GetUnusedPIT ( 
 | 
  output owning ProductInTrips unusedpits_o, 
 | 
  output Number nrofunsedtrip_o 
 | 
) 
 | 
{ 
 | 
  Description: 'Retrieve all the unsed pit from algorithmrun, count trip that is totally not in used' 
 | 
  TextBody: 
 | 
  [* 
 | 
    unusedpits_o := selectset( this, ProductInTrip, productintrip, 
 | 
                             productintrip.OptimizerQuantity() = 0 
 | 
                              and not productintrip.HasUserQuantity() 
 | 
                              and not productintrip.HasFeedback() ); 
 | 
     
 | 
    // get all the trip in that has unused pits 
 | 
    totaltripfromunsedpit := counter( unusedpits_o, Elements.Trip, trip, true, true ); 
 | 
    // exclude the trip that still has pit with optimizer quantity or has feedback or has user quantity 
 | 
    excludetrips := counter(  unusedpits_o, Elements.Trip, trip,  
 | 
                              exists(  trip, ProductInTrip, pit, pit.OptimizerQuantity() > 0 or pit.HasUserQuantity() or pit.HasFeedback() ) ); 
 | 
     
 | 
    nrofunsedtrip_o := totaltripfromunsedpit - excludetrips; 
 | 
  *] 
 | 
  InterfaceProperties { Accessibility: 'Module' } 
 | 
} 
 |