Hi
I have a workflow application where iam calculating the days like request date and implementation date and depending upon the calculation i received iam updating the field values as major or critical etc. Here iam calculating all the days. Now i want to introduce business days in that, where i want to declare list of holidays in that and for these days it should not calculate. How to inorporate this info in my application. Below i given the code how iam calculating the values.
On Error Goto ErrorHandler
Dim uiws1 As New notesUIWorkspace
Dim uidoc1 As NotesUIDocument
Set uidoc1 = uiws1.CurrentDocument
Dim dc As NotesDocument
Set dc = uidoc1.Document
If uidoc1.FieldGetText("Criticality") = "" Then
Msgbox "Urgency value depends on 'Change Criticality'. Please first calculate Urgency.",MB_OK,"Change Management"
Exit Sub
End If
Dim RequestDate As String, ImplementationDate As String
RequestDate = dc.GetItemValue("RequestDate")(0) '+ " " + uidoc1.FieldGetText("RequestTime")
ImplementationDate = Cstr(dc.GetItemValue("ImplementationDate")(0)) + " " + Cstr(Timevalue(dc.GetItemValue("ImplementationTime")(0)))
If Trim(RequestDate)="" Or Trim(ImplementationDate)="" Then
Msgbox "Please ensure that correct values are set in Request Date and Implementation Date",MB_OK,"Change Management"
Exit Sub
End If
Dim difference_hours As Double
difference_hours = DateTimeDifference_Hours(ImplementationDate, RequestDate)
Dim ChangeCriticality As String
ChangeCriticality = uidoc1.FieldGetText("Criticality")
Dim IsNormalFlag As Boolean, UrgencyValue As String
IsNormalFlag1 = ((ChangeCriticality = "MINOR") And (difference_hours>=10))
IsNormalFlag2 = ((ChangeCriticality = "MEDIUM") And ((difference_hours/24)>=2))
IsNormalFlag3 = ((ChangeCriticality = "MAJOR") And ((difference_hours/24)>=5))
IsNormalFlag4 = ((ChangeCriticality = "CRITICAL") And ((difference_hours/24)>=9))
IsNormalFlag = IsNormalFlag1 Or IsNormalFlag2 Or IsNormalFlag3 Or IsNormalFlag4
If difference_hours < 0 Then
UrgencyValue = "UNPLANNED"
Elseif IsNormalFlag Then
UrgencyValue = "NORMAL"
Else
UrgencyValue = "EMERGENCY"
End If
Call uidoc1.FieldSetText("Urgency", UrgencyValue)
'Call uidoc1.RefreshHideFormulas
Call uidoc1.Refresh
Exit Sub
ErrorHandler:
Msgbox "Error on Click[Calculate Change Urgency], Line # " & Erl & ", Message : " & Error$
Exit Sub
Plz anybody help toovercome this problem
Srini