Skip to content

Instantly share code, notes, and snippets.

@rmehta
Created December 3, 2014 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmehta/6ada15047b150c56fe21 to your computer and use it in GitHub Desktop.
Save rmehta/6ada15047b150c56fe21 to your computer and use it in GitHub Desktop.
Attribute VB_Name = "ForwardSchedule"
Option Explicit
Public Sub FwdSchedule(ORD As clsOrders, PRD() As clsProducts, RES() As clsResources, TM As clsTimeScale)
Dim RMax&, OMax&, OrderID&
OMax = ORD.Max
frmProgress.lblProgress.Caption = "Forward Scheduling..."
frmProgress.Refresh
Dim PRDID&, EB!, RType$, ResCode$, RSID&, PTime!, ET!, AltRequirement As Boolean
'complete all material requirements
'******* To be done
For OrderID = 1 To OMax
frmProgress.pbOverall.Value = (OrderID) / OMax * 100
RMax = PRD(OrderID).Max
For PRDID = RMax To 1 Step -1 'for all tasks
PRD(OrderID).GetPRD PRDID, RType, , , , , EB, , , ResCode, PTime, , , , AltRequirement
'Stop
If RType = "T" And AltRequirement = False Then
'Stop
RSID = GetRSID(RES(), ResCode)
RES(RSID).FwdSchTask PRD(OrderID), PRDID, ET
'now set earliest bounds for all dependant tasks!
PRD(OrderID).SetEBForDependantTasks PRDID, ET
End If
Next PRDID
Next OrderID
frmProgress.lblProgress.Caption = "Forward Scheduling... Done!"
frmProgress.Refresh
End Sub
Private Function GetRSID&(RS() As clsResources, Code$)
Dim i&
For i = 1 To UBound(RS)
If RS(i).ResourceCode = Code Then
GetRSID = i
Exit Function
End If
Next i
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment