%
Dim ConnStr
Dim Conn
Dim rs
Dim SQL
Dim LogSQL
Dim UpdateFlag
Dim IsNew
Dim TrackID
Dim CaseID
Dim UserID
Dim UserType
Dim EnteredBy
Dim EntryDate
Dim Comment
Dim strErrorMsg
Dim NewTstamp
Dim Confidential
' On Error Resume Next
strErrorMsg = ""
' ***************************************
' Set new values
' ***************************************
CaseID = Request.QueryString("CaseID")
CaseID = trim(CaseID)
EntryDate = Request.QueryString("DateEntered")
EntryDate = trim(EntryDate)
EntryDate = CDate(EntryDate)
If Err.number <> 0 Then
strErrorMsg = strErrorMsg & "The field DATE ENTERED is not a valid date (mm/dd/yyyy format).
" & vbCrLf
Err.Clear
End If
Comment = Request.QueryString("Comment")
Comment = EdLine(Comment)
If len(Comment) = 0 Then
strErrorMsg = strErrorMsg & "The field COMMENT is a required field.
" & vbCrLf
Err.Clear
End If
EnteredBy = Request.QueryString("EnteredBy")
EnteredBy = EdLine(EnteredBy)
Confidential = Request.QueryString("Confidential")
Confidential = trim(Confidential)
if Confidential <> "Y" then
Confidential = "N"
end if
UserID = Session("UserID")
UserType = Session("UserType")
' ***************************************
' Force Confidential option
' ***************************************
if UserType = 3 then
if AGENTPRIVATE then
Confidential = "Y"
end if
end if
' ***************************************
' Append EnteredBy to comment
' ***************************************
if len(enteredBy) > 0 then
comment = "By: " & enteredby & " - " & comment
end if
' ***************************************
' Connect to database
' ***************************************
IF strErrorMsg = "" then
connectdb
If Err.number <> 0 Then
strErrorMsg = strErrorMsg & "305. Error Unable to connect to database.
"
Err.Clear
End If
end if
' ***************************************
' Update Tracking Table
' ***************************************
if strErrorMsg = "" then
TrackID = NewKey("Track")
If TrackID = 0 Then
strErrorMsg = strErrorMsg & "302. Unable to assign next tracking number.
"
Err.Clear
End If
end if
' ***************************************
' Insert Tracking Note
' ***************************************
if strErrorMsg = "" then
UpdateFlag = False
NewTstamp = Now()
if Comment > "" then
WriteLog TrackID,"Track", "Comment","L", Comment,newTstamp
end if
if EntryDate <> "" then
WriteLog TrackID,"Track", "EntryDate","D", EntryDate,newTstamp
end if
if UserID > "" then
WriteLog TrackID,"Track", "EmpID","N", UserID,newTstamp
end if
if CaseID > 0 then
WriteLog TrackID,"Track", "ID","N", CaseID ,newTstamp
end if
if Confidential > "" then
WriteLog TrackID,"Track", "Private","S", Confidential ,newTstamp
end if
SQL = "INSERT INTO Track ( "
SQL = SQL & "TrackID, "
SQL = SQL & "ID, "
SQL = SQL & "EmpID, "
SQL = SQL & "EntryDate, "
SQL = SQL & "Private, "
SQL = SQL & "Comment, "
SQL = SQL & "Tstamp "
SQL = SQL & ") VALUES ( "
SQL = SQL & TrackID & ", "
SQL = SQL & CaseID & ", "
SQL = SQL & UserID & ", "
SQL = SQL & "'" & EntryDate & "', "
SQL = SQL & "'" & Confidential & "', "
SQL = SQL & "'" & Comment & "', "
SQL = SQL & "'" & Now() & "' "
SQL = SQL & ") "
Conn.Execute SQL
If Err.number <> 0 Then
strErrorMsg = strErrorMsg & "304. Error occurred attempting to add a new update.
"
Err.Clear
End If
end if
if not conn is nothing then
conn.close
set conn = nothing
end if
' ***************************************
' Send Response
' ***************************************
if strErrorMsg = "" then
if Session("CurrentPage") = "case.asp" then
response.redirect("case.asp?CaseID=" & CaseID)
else
response.redirect("openInv.asp")
end if
else
ShowError(strErrorMsg)
end if
%>