Quintiq file version 2.0
#parent: GanttChartDemandSupplyGroup
Response OnDrawNode (
  ProductInStockingPointInPeriod element
) id:Response_GanttChartDemandSupplyGroup_OnDrawNode_1
{
  #keys: '[11660.0.112571207]'
  Body:
  [*
    // Determine colors for gantt chart pispip nodes
    if( not element.HasConstraintViolations() )
    {
      // Allow negative
      if( element.ProductInStockingPoint_MP().IsNegativeInventoryAllowed() )
      {
        drawinfo.AddCompartment( ColorScheme.GanttChart_Custom1(), element.Period_MP().Duration() );
      }
      // Is in-active
      else if( element.IsInactive() )
      {
        drawinfo.AddCompartment( ColorScheme.GanttChart_Free(), element.Period_MP().Duration() );
      }
      // Has unfulfilled all dependentdemand and salesdemand
      else if( not element.HasFulfilledDependentDemand() or not element.HasFulfilledSalesDemand() )
      {
        drawinfo.AddCompartment( ColorScheme.GanttChart_Warning1(), element.Period_MP().Duration() );
      }
      // Has unfulfilled target inventory level
      else if( not element.HasFulfilledInventoryDemand() )
      {
        drawinfo.AddCompartment( ColorScheme.GanttChart_Warning2(), element.Period_MP().Duration() );
      }
      // Has fulfilled demand or it within tolerance
      else if( element.HasFulfilledAllDemand() )
      {
        drawinfo.AddCompartment( ColorScheme.GanttChart_Good(), element.Period_MP().Duration() );
      }
    }
    
    // Check if background is dark
    if( drawinfo.BackgroundColor().IsDark() )
    {
      drawinfo.TextColor( Color::White() );
    }
  *]
  DefinitionID: 'Responsedef_GanttChart_OnDrawNode'
}
