Do not let any software impress you!

Only let it convince your intellect.
Slider img 1
Do not look for a business paradise!

It is a waste of time.
Slider img 2
Only yourself can push you uphill.

There is no easy road to prizes.
Slider img 3
Productivity is the name of the game.

And you have to conquer it.
Slider img 4
As long as you understand it,

you will start to build your know-how.
Slider img 5
We can help with that.

We have the tools and the method.
Slider img 6


Title : Gantt diagram

Toolbars

call Print()
call CloseForm(False)

Buttons

Fields



AutoScript

lib

proc Form_Start()

    ag         = getfprevfield("PARENT_AGENT_ID")
    process_id = getfprevfield("AU_PROCESS")
    comm     = LookUpId("AU_PROCESS",process_id,"COMM")
    
    f = TopForm()
    call SetClass("f","TDForm")
    f.Caption = GetMessage("Gantt diagram")
    f.Caption = strcat(f.Caption," : ",comm)

    '================================= CHART1 ==================================
    c = FindComponent(f,"CHART1")
    call SetClass("c","TChart")

    c.Align = "alClient"
    c.Color = "clWhite"
    c.AllowPanning = "pmHorizontal"
    c.BackWall.Brush.Color = "clWhite"
    c.BackWall.Brush.Style = "bsClear"
    c.Foot.Alignment = "taRightJustify"
    c.Foot.Font.Charset = 0
    c.Foot.Font.Color = "clYellow"
    c.Foot.Font.Height = 0-12
    c.Foot.Font.Name = "Arial"
    c.Foot.Font.Style = "[fsItalic]"
    c.Foot.Frame.Color = "clScrollBar"
    c.Foot.Text.Strings = ""'
    c.Title.Font.Charset = 0
    c.Title.Font.Color = "clBlue"
    c.Title.Font.Height = 0-20
    c.Title.Font.Name = "Arial"
    c.Title.Font.Style = "[fsBold]"
    c.Title.Frame.Color = "clScrollBar"
    c.Title.Text.Strings = GetMessage("The Gantt diagram of the process")
    c.Title.Text.Strings = strcat(c.Title.Text.Strings," : ",comm)
    c.BottomAxis.LabelsAngle = 90
    c.BottomAxis.LabelsFont.Charset = 0
    c.BottomAxis.LabelsFont.Color = "clGreen"
    c.BottomAxis.LabelsFont.Height = 0-12
    c.BottomAxis.LabelsFont.Name = "Arial"
    c.BottomAxis.LabelsFont.Style = []
    c.BottomAxis.LabelStyle = "talValue"
    c.BottomAxis.MinorTicks.Color = "clWhite"
    c.BottomAxis.TickInnerLength = 4
    c.BottomAxis.Ticks.Color = "clLime"
    c.BottomAxis.TicksInner.Color = 8388863
    c.BottomAxis.Title.Caption = GetMessage("Time")
    c.BottomAxis.Title.Font.Charset = 0
    c.BottomAxis.Title.Font.Color = "clBlue"
    c.BottomAxis.Title.Font.Height = 0-19
    c.BottomAxis.Title.Font.Name = "Arial"
    c.BottomAxis.Title.Font.Style = "[fsItalic]"
    c.LeftAxis.Grid.Color = "clLime"
    c.LeftAxis.LabelsFont.Charset = 151
    c.LeftAxis.LabelsFont.Color = "clNavy"
    c.LeftAxis.LabelsFont.Height = 0-13
    c.LeftAxis.LabelsFont.Name = "Arial"
    c.LeftAxis.LabelsFont.Style = []
    c.LeftAxis.LabelsSeparation = 3
    c.LeftAxis.LabelStyle = "talText"
    c.LeftAxis.Title.Font.Charset = 0
    c.LeftAxis.Title.Font.Color = "clPurple"
    c.LeftAxis.Title.Font.Height = 0-16
    c.LeftAxis.Title.Font.Name = "Arial"
    c.LeftAxis.Title.Font.Style = "[fsBold, fsItalic]"
    c.Legend.Visible = "False"
    c.View3D = "True"

    b = FindComponent(f,"CHART1_GANTT")
    call SetClass("b","TGanttSeries")

    call FreeEmbSQL("DATA")
    start_sql "DATA" "KOSMOS"
       SELECT AU_PROCESS.PARENT_AGENT_ID, AU_STEP.STEP_DESCR AS DESCR, AU_STEP.UNAME,
       AU_STEP.UNAME, AU_STEP.ACTIVITY, AU_STEP.FINISHED,
       AU_STEP.ASSIGNED_AT_DATE AS D1, AU_STEP.ASSIGNED_AT_TIME AS T1, AU_STEP.FINISHED_AT_DATE AS D2,
       AU_STEP.FINISHED_AT_TIME AS T2
       FROM AU_PROCESS AS AU_PROCESS_1 INNER JOIN (AU_PROCESS INNER
       JOIN AU_STEP ON AU_PROCESS.AU_PROCESS = AU_STEP.AU_PROCESS)
       ON AU_PROCESS_1.AGENT_ID = AU_PROCESS.PARENT_AGENT_ID
       WHERE (((AU_PROCESS.PARENT_AGENT_ID)=:P)) AND (AU_STEP.ISTEP = 0)
       ORDER BY AU_STEP.AU_STEP DESC
    end_sql

    call RunEmbSQL("DATA",ag)
    q = QueryByName("DATA")
    count = TRecordCount(q)

    call TFirst(q)
    dmin = TGetFld(q,"D1")
    dmin = DateToNum(dmin)
    dmin = dmin - 1

    y = 0
    for i = 1 to count
        descr = TGetFld(q,"ACTIVITY")
        finished = TGetFld(q,"FINISHED")
        user = TGetFld(q,"UNAME")
        descr = strcat(descr,"(",user,")")
        
        d1 = TGetFld(q,"D1")
        d2 = TGetFld(q,"D2")
        t1 = TGetFld(q,"T1")
        t2 = TGetFld(q,"T2")

        {........................the real time..............}
        if (finished = 1) then
         d1 = DateToNum(d1)
         d2 = DateToNum(d2)
         t1 = TimeToNum(t1)
         t2 = TimeToNum(t2)
         d1 = d1 + t1
         d2 = d2 + t2
         y = y + 1
         color = StringToColor("clLime")
         a = b.AddGanttColor(d1,d2,y,descr,color)
        else
         d1 = DateToNum(d1)
         d2 = DateToNum(crDate)
         t1 = TimeToNum(t1)
         t2 = TimeToNum(crTime)
         d1 = d1 + t1
         d2 = d2 + t2
         y = y + 1
         color = StringToColor("clRed")
         a = b.AddGanttColor(d1,d2,y,descr,color)
        
         if (d2+1-dmax > 0) then
         dmax = d2 + 1
         endif
        endif

        {........................the standart time..............}
        dd2 = d2 - (d2-d1)*0.3
        y = y + 1
        color = StringToColor("clBlue")
        a = b.AddGanttColor(d1,dd2,y,"Standard Time",color)

        if (d2+1-dmax > 0) then
         dmax = d2 + 1
        endif
        call TNext(q)
    next
    
    b.Align = "alClient"
    b.ColorEachPoint = "True"
    b.Marks.ArrowLength = 0
    b.Marks.BackColor = "clWhite"
    b.Marks.Clip = "True"
    b.Marks.Font.Charset = 0
    b.Marks.Font.Color = "clNavy"
    b.Marks.Font.Height = 0-11
    b.Marks.Font.Name = "Arial"
    b.Marks.Font.Style = []
    b.Marks.Frame.Color = "clRed"
    b.Marks.Visible = "False"
    b.SeriesColor = "clRed"
    b.Pointer.Draw3D = "True"
    b.Pointer.HorizSize = 83
    b.Pointer.InflateMargins = "True"
    b.Pointer.Style = "psRectangle"
    b.Pointer.VertSize = 10
    b.Pointer.Visible = "True"
    b.XValues.DateTime = "False"
    b.XValues.Name = "start"
    b.XValues.Multiplier = 1
    b.XValues.Order = "loAscending"
    b.YValues.DateTime = "False"
    b.YValues.Name = "Y"
    b.YValues.Multiplier = 1
    b.YValues.Order = "loNone"
    b.ConnectingPen.Color = "clRed"
    b.ConnectingPen.Width = 2
    b.StartValues.DateTime = "True"
    b.StartValues.Name = "Start"
    b.StartValues.Multiplier = 1
    b.StartValues.Order = "loAscending"
    b.EndValues.DateTime = "True"
    b.EndValues.Name = "End"
    b.EndValues.Multiplier = 1
    b.EndValues.Order = "loNone"
    b.NextTask.DateTime = "False"
    b.NextTask.Name = "NextTask"
    b.NextTask.Multiplier = 1
    b.NextTask.Order = "loNone"
end