amiteshsinha
asked on
VB programming
Can anybody suggest any third party Project Management Tool which can be used as Project 2000.
I would like to have any API or DLL for this tool in VB program.
We are trying to use this any such tool to create task, for managing resources also it should have gantt chart functinality.
thanks.
I would like to have any API or DLL for this tool in VB program.
We are trying to use this any such tool to create task, for managing resources also it should have gantt chart functinality.
thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot.
I tried Solutions::Schedule. Its really good.
Thanks
I tried Solutions::Schedule. Its really good.
Thanks
ASKER
Hi,
I am trying to use Solutions::Schedule tool.
pamartz , can you send me some sample code to create a schedule. I am trying to user this OCX for creating Construction schedule and generate gantt chart using that schedule.
Thanks In advance.
I am trying to use Solutions::Schedule tool.
pamartz , can you send me some sample code to create a schedule. I am trying to user this OCX for creating Construction schedule and generate gantt chart using that schedule.
Thanks In advance.
Hi amiteshsinha and thanks for your acceptance !
The next piece of code, extracted from a real working app, shows how you can populate the Control from a recordset, adding a "barcargo" property for each time bar so that you can later access the element referenced by the time bar.
This is being used in a maintenance task planning application, in which we are representing each due date for a task with one time bar which represents one day.
Note: "Plan" is the name of my Solutions::Schedule control in the form.
' This is the function that loads Scheduling information from a recordset.
' For each equipment, all its scheduled tasks are shown in the same line, represented by time bars.
Private Function CargarPlanLista() As Boolean
Dim iCo As Integer, s As String, Rs As ADODB.Recordset, hs As mHisManS
Dim Nus As String, nSec As String, Fec As String, h As mHisMan, His As String
Dim MarAnt As String, n As Integer, iBar As Long, iPer As Integer
On Error GoTo NOVA
DoEvents
InitializePlan
s = MakeSQL()
Set Rs = New ADODB.Recordset
Rs.Open s, Cnx ' Cnx is a previously open connection
SoyYo = True
Do While Not Rs.EOF
If Rs!MFunc <> MarAnt Then ' Equipment is different from previous one so make new line.
s = ""
s = s & Trim("" & Rs!MFunc) & ";"
s = s & Trim("" & Rs!Descr) & ";"
s = s & Trim("" & Rs!CodNUS) & ";"
s = s & Trim("" & Rs!CodApl) & ";"
iCo = Plan.AddItem(s)
Plan.ListCargo(iCo) = Trim("" & Rs!MFunc)
MarAnt = Rs!MFunc
End If
' Note in next sentence that we are setting identical StartDate and EndDate for each task.
iBar = Plan.AddTimeBar(iCo, 180, 1320, CDatePLAN(Rs!Fecha), CDatePLAN(Rs!Fecha))
Nus = Trim("" & Rs!CodNUS)
Fec = Format("" & Rs!Fecha, gMasDM4A)
His = Trim("" & Rs!HistoriaSN)
If IsNull(Rs!NSecu) Then nSec = 0 Else nSec = Format(Rs!NSecu, gMas0D)
s = ""
s = s & Trim("" & Rs!MFunc) & vbTab 'equipment code
s = s & Trim("" & Rs!CodTar) & vbTab 'task code
s = s & Fec & vbTab 'date
s = s & Trim("" & Rs!DescTar) & vbTab 'task description
s = s & Trim(Rs!Estado) & vbTab 'task status
s = s & His & vbTab 'subject to equipment history
s = s & Nus & vbTab 'NUS
s = s & nSec & vbTab 'Sequential no.
'
' Plan.BarCargo is very important: it is used later in the app to take further actions when the users moves, clicks or double-clicks a bar (ie. a task)
' In Plan.BarCargo we place for each time bar all the information that we need in order to refer to the task later.
Plan.BarCargo(iCo, iBar) = s
'
Select Case Rs!Estado ' Depending on task status we set the bar's style.
Case "P": n = 1
Case "F": n = 2
Case "E": n = 3
Case "D": n = 4
End Select
Plan.BarStyle(iCo, iBar) = n
Plan.BarText(iCo, iBar) = " " & Trim("" & Rs!MRC) & " "
Plan.BarTextAlign(iCo, iBar) = 3
Rs.MoveNext
Loop
Rs.Close: Set Rs = Nothing
SoyYo = False
' CargarPeriodos() is a function that colors the background of the "Plan" control in different ways depending on the operational status of the equipments. I won't include it here so as not to make this answer too long. You can comment it out and I suppose everything else will work.
If Not CargarPeriodos() Then GoTo NOVA
CargarPlanLista = True
Plan.ListIndex = 1
Me.Refresh
Exit Function
NOVA:
CargarPlanLista = False
If Screen.MousePointer = vbHourglass Then Screen.MousePointer = vbDefault
MsgBox Error$
End Function 'CargarPlanLista
Private Sub InitializePlan()
With Plan
.ClearSchedule
.ClearBarStyles
.ClearColorBars
.UseImageList = False
.DateFormat = "M/Y"
.TimeType = TimeDays
.DateOffset = 2
.RulerDays = False
.BackColor = vbWindowBackground
.BarSelectBorder = BarSelectRaised
.SelectForeColor = vbHighlightText
.SelectBackColor = vbHighlight
.BarTextWrap = True
.VertReposition = False
.BarSelectBorder = BarSelectRaised
.BarTipSize = 0
''' Scope of the Plan.
' dtpFecIni and dtpFecFin are two DatePicker controls in which the users chooses the initial and ending date that he wants to see.
.DateStart = CDatePLAN(dtpFecIni.Value)
.DateEnd = CDatePLAN(dtpFecFin.Value)
.SnapToGrid = True
.GridFrequency = 1
''' Title for the List part of the control
.TitleText = "F. Code;Description;NUS;APL"
.TitleAlign = AlignLeft
.TitleFont = "Verdana"
.TitleYOffset = 5
.TitleHeight = 30
.ListWidth = 90
.ListColumns = 4
.ColumnWidth(1) = 60
.ColumnWidth(2) = 350
.ColumnWidth(3) = 50
.ColumnWidth(4) = 120
.ListWidth = 60
.DisplayOnly = False
End With
LoadStyles
End Sub 'InitializePlan
Private Sub LoadStyles()
' There are in my case four bar styles representing the status of the tasks:
Dim i As Integer
With Plan
i = .AddBarStyle(18, 0) 'Pending task
.StyleBackColor(i) = vbGreen
.StyleTextXOffset(i) = 2
.StyleEndYOffset(i) = 6
''''
i = .AddBarStyle(18, 0) 'Deferred task
.StyleBackColor(i) = vbCyan
.StyleTextXOffset(i) = 2
.StyleEndYOffset(i) = 6
''''
i = .AddBarStyle(18, 0) 'Executed task
.StyleBackColor(i) = vbBlue
.StyleTextXOffset(i) = 2
.StyleEndYOffset(i) = 6
''''
i = .AddBarStyle(18, 0) 'Discarded task
.StyleBackColor(i) = vbRed
.StyleTextXOffset(i) = 2
.StyleEndYOffset(i) = 6
End With
End Sub
' next Function formats a date so as it is accepted by the Control (change to Long).
Public Function CDatePLAN(F As Variant) As Long
Dim F1 As Date, F2 As Date
F1 = CDate("01/01/1900")
F2 = CDate(F)
CDatePLAN = (DateDiff("d", F1, F2) + 2)
End Function
' Next Function makes up the SQL statement. I'll abbreviate it, but in real app it is dependent on some selection filters.
Private Function MakeSQL() As String
Dim s As String
s = ""
s = s & "SELECT a.MFunc, b.Descr, b.CodNUS, a.NSecu, b.CodApl, "
s = s & "c.CodTar, c.Descr as DescTar, c.MRC, a.Fecha, "
s = s & "a.Estado, b.HistoriaSN "
s = s & "FROM tblScheduledTasks a left join tblEquiments b on "
s = s & "a.CBuq = b.CBuq and a.MFunc = b.MFunc "
s = s & "left join tblTaskDefinitions c on "
s = s & "b.CodApl = c.CodApl and a.CodTar = c.CodTar "
s = s & "WHERE "
s = s & "a.CBuq = " & SBDNoNulo(gCBuq) & " and "
s = s & "a.MFunc LIKE " & SBDNoNulo(Trim(txtMFunc) & "%") & " and "
s = s & "a.Fecha >= " & FBDNoNulo(dtpFecIni.Value) & " and "
s = s & "a.Fecha <= " & FBDNoNulo(dtpFecFin.Value) & " "
s = s & "order by a.MFunc, a.CodTar"
MakeSQL = s
End Function 'MakeSQL
Well, was long but I hope it helps.
Bye,
Pedro.
The next piece of code, extracted from a real working app, shows how you can populate the Control from a recordset, adding a "barcargo" property for each time bar so that you can later access the element referenced by the time bar.
This is being used in a maintenance task planning application, in which we are representing each due date for a task with one time bar which represents one day.
Note: "Plan" is the name of my Solutions::Schedule control in the form.
' This is the function that loads Scheduling information from a recordset.
' For each equipment, all its scheduled tasks are shown in the same line, represented by time bars.
Private Function CargarPlanLista() As Boolean
Dim iCo As Integer, s As String, Rs As ADODB.Recordset, hs As mHisManS
Dim Nus As String, nSec As String, Fec As String, h As mHisMan, His As String
Dim MarAnt As String, n As Integer, iBar As Long, iPer As Integer
On Error GoTo NOVA
DoEvents
InitializePlan
s = MakeSQL()
Set Rs = New ADODB.Recordset
Rs.Open s, Cnx ' Cnx is a previously open connection
SoyYo = True
Do While Not Rs.EOF
If Rs!MFunc <> MarAnt Then ' Equipment is different from previous one so make new line.
s = ""
s = s & Trim("" & Rs!MFunc) & ";"
s = s & Trim("" & Rs!Descr) & ";"
s = s & Trim("" & Rs!CodNUS) & ";"
s = s & Trim("" & Rs!CodApl) & ";"
iCo = Plan.AddItem(s)
Plan.ListCargo(iCo) = Trim("" & Rs!MFunc)
MarAnt = Rs!MFunc
End If
' Note in next sentence that we are setting identical StartDate and EndDate for each task.
iBar = Plan.AddTimeBar(iCo, 180, 1320, CDatePLAN(Rs!Fecha), CDatePLAN(Rs!Fecha))
Nus = Trim("" & Rs!CodNUS)
Fec = Format("" & Rs!Fecha, gMasDM4A)
His = Trim("" & Rs!HistoriaSN)
If IsNull(Rs!NSecu) Then nSec = 0 Else nSec = Format(Rs!NSecu, gMas0D)
s = ""
s = s & Trim("" & Rs!MFunc) & vbTab 'equipment code
s = s & Trim("" & Rs!CodTar) & vbTab 'task code
s = s & Fec & vbTab 'date
s = s & Trim("" & Rs!DescTar) & vbTab 'task description
s = s & Trim(Rs!Estado) & vbTab 'task status
s = s & His & vbTab 'subject to equipment history
s = s & Nus & vbTab 'NUS
s = s & nSec & vbTab 'Sequential no.
'
' Plan.BarCargo is very important: it is used later in the app to take further actions when the users moves, clicks or double-clicks a bar (ie. a task)
' In Plan.BarCargo we place for each time bar all the information that we need in order to refer to the task later.
Plan.BarCargo(iCo, iBar) = s
'
Select Case Rs!Estado ' Depending on task status we set the bar's style.
Case "P": n = 1
Case "F": n = 2
Case "E": n = 3
Case "D": n = 4
End Select
Plan.BarStyle(iCo, iBar) = n
Plan.BarText(iCo, iBar) = " " & Trim("" & Rs!MRC) & " "
Plan.BarTextAlign(iCo, iBar) = 3
Rs.MoveNext
Loop
Rs.Close: Set Rs = Nothing
SoyYo = False
' CargarPeriodos() is a function that colors the background of the "Plan" control in different ways depending on the operational status of the equipments. I won't include it here so as not to make this answer too long. You can comment it out and I suppose everything else will work.
If Not CargarPeriodos() Then GoTo NOVA
CargarPlanLista = True
Plan.ListIndex = 1
Me.Refresh
Exit Function
NOVA:
CargarPlanLista = False
If Screen.MousePointer = vbHourglass Then Screen.MousePointer = vbDefault
MsgBox Error$
End Function 'CargarPlanLista
Private Sub InitializePlan()
With Plan
.ClearSchedule
.ClearBarStyles
.ClearColorBars
.UseImageList = False
.DateFormat = "M/Y"
.TimeType = TimeDays
.DateOffset = 2
.RulerDays = False
.BackColor = vbWindowBackground
.BarSelectBorder = BarSelectRaised
.SelectForeColor = vbHighlightText
.SelectBackColor = vbHighlight
.BarTextWrap = True
.VertReposition = False
.BarSelectBorder = BarSelectRaised
.BarTipSize = 0
''' Scope of the Plan.
' dtpFecIni and dtpFecFin are two DatePicker controls in which the users chooses the initial and ending date that he wants to see.
.DateStart = CDatePLAN(dtpFecIni.Value)
.DateEnd = CDatePLAN(dtpFecFin.Value)
.SnapToGrid = True
.GridFrequency = 1
''' Title for the List part of the control
.TitleText = "F. Code;Description;NUS;APL"
.TitleAlign = AlignLeft
.TitleFont = "Verdana"
.TitleYOffset = 5
.TitleHeight = 30
.ListWidth = 90
.ListColumns = 4
.ColumnWidth(1) = 60
.ColumnWidth(2) = 350
.ColumnWidth(3) = 50
.ColumnWidth(4) = 120
.ListWidth = 60
.DisplayOnly = False
End With
LoadStyles
End Sub 'InitializePlan
Private Sub LoadStyles()
' There are in my case four bar styles representing the status of the tasks:
Dim i As Integer
With Plan
i = .AddBarStyle(18, 0) 'Pending task
.StyleBackColor(i) = vbGreen
.StyleTextXOffset(i) = 2
.StyleEndYOffset(i) = 6
''''
i = .AddBarStyle(18, 0) 'Deferred task
.StyleBackColor(i) = vbCyan
.StyleTextXOffset(i) = 2
.StyleEndYOffset(i) = 6
''''
i = .AddBarStyle(18, 0) 'Executed task
.StyleBackColor(i) = vbBlue
.StyleTextXOffset(i) = 2
.StyleEndYOffset(i) = 6
''''
i = .AddBarStyle(18, 0) 'Discarded task
.StyleBackColor(i) = vbRed
.StyleTextXOffset(i) = 2
.StyleEndYOffset(i) = 6
End With
End Sub
' next Function formats a date so as it is accepted by the Control (change to Long).
Public Function CDatePLAN(F As Variant) As Long
Dim F1 As Date, F2 As Date
F1 = CDate("01/01/1900")
F2 = CDate(F)
CDatePLAN = (DateDiff("d", F1, F2) + 2)
End Function
' Next Function makes up the SQL statement. I'll abbreviate it, but in real app it is dependent on some selection filters.
Private Function MakeSQL() As String
Dim s As String
s = ""
s = s & "SELECT a.MFunc, b.Descr, b.CodNUS, a.NSecu, b.CodApl, "
s = s & "c.CodTar, c.Descr as DescTar, c.MRC, a.Fecha, "
s = s & "a.Estado, b.HistoriaSN "
s = s & "FROM tblScheduledTasks a left join tblEquiments b on "
s = s & "a.CBuq = b.CBuq and a.MFunc = b.MFunc "
s = s & "left join tblTaskDefinitions c on "
s = s & "b.CodApl = c.CodApl and a.CodTar = c.CodTar "
s = s & "WHERE "
s = s & "a.CBuq = " & SBDNoNulo(gCBuq) & " and "
s = s & "a.MFunc LIKE " & SBDNoNulo(Trim(txtMFunc) & "%") & " and "
s = s & "a.Fecha >= " & FBDNoNulo(dtpFecIni.Value)
s = s & "a.Fecha <= " & FBDNoNulo(dtpFecFin.Value)
s = s & "order by a.MFunc, a.CodTar"
MakeSQL = s
End Function 'MakeSQL
Well, was long but I hope it helps.
Bye,
Pedro.
http://www.infragistic.com
Regards,
Sam Tan