Quintiq file version 2.0
#parent: GanttChartDemandSupplyGroup
Response OnDrawNode (
  StockingPointInPeriod element
) id:Response_GanttChartDemandSupplyGroup_OnDrawNode
{
  #keys: '[110880.5.2031055784]'
  Body:
  [*
    // Determine colors for gantt chart spip nodes
    if( not element.HasConstraintViolations() )
    {
      // All pispip is negative inventory allowed
      if( element.HasAllProductsWithNegativeInventoryAllowed() )
      {
        drawinfo.AddCompartment( ColorScheme.GanttChart_Custom1(), element.Period_MP().Duration() );
      }
      // All pispip is inactive
      else if( element.HasAllInActiveProducts() )
      {
        drawinfo.AddCompartment( ColorScheme.GanttChart_Free(), element.Period_MP().Duration() );
      }
      // Not all pispip have fulfilled dependentdemand and salesdemand
      else if( not element.HasAllProductsWithFulfilledDependentAndSalesDemand() )
      {
        drawinfo.AddCompartment( ColorScheme.GanttChart_Warning1(), element.Period_MP().Duration() );
      }
      // Not all pispip have fulfilled inventorty target
      else if( not element.HasAllProductsWithFulfilledInventoryDemand() )
      {
        drawinfo.AddCompartment( ColorScheme.GanttChart_Warning2(), element.Period_MP().Duration() );
      }
      // All pispip have fulfilled demand
      else if( element.HasAllProductsWithFulfilledDemand() )
      {
        drawinfo.AddCompartment( ColorScheme.GanttChart_Good(), element.Period_MP().Duration() );
      }
    
    }
    
    // Check if background is dark
    if( drawinfo.BackgroundColor().IsDark() )
    {
      drawinfo.TextColor( Color::White() );
    }
  *]
  CanBindMultiple: false
  DefinitionID: 'Responsedef_GanttChart_OnDrawNode'
}
