Sub Inviewedit(Source As Notesuiview, Requesttype As Integer, Colprogname As Variant, Columnvalue As Variant, Continue As Variant)
REM Define constants for request types
Const QUERY_REQUEST = 1
Const VALIDATE_REQUEST = 2
Const SAVE_REQUEST = 3
Const NEWENTRY_REQUEST = 4
REM Define variables
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim caret As String
REM Get the CaretNoteID - exit if it does not point at a document
caret = Source.CaretNoteID
If caret = "0" Then Exit Sub
REM Get the current database and document
Set db = Source.View.Parent
Set doc = db.GetDocumentByID(caret)
Dim workspace As New NotesUIWorkspace
Dim picklist As Variant
Dim Tmp() As Variant
Dim i As Integer
Dim j As Integer
REM Select the request type
Select Case Requesttype
Case QUERY_REQUEST:
If Colprogname(0) = "Comment" Then
j = 1
i = 0
Do
Redim Preserve Tmp(i) As Variant
If Month(Today())+i > 12 Then
Tmp( i ) = Cstr(Year(Today())+1) + "-" + Cstr( j )
j = j + 1
Else
Tmp( i ) = Cstr(Year(Today())) + "-" + Cstr(Month(Today())+i )
End If
i = i + 1
Loop While j <= 12
picklist = workspace.Prompt (PROMPT_OKCANCELLIST, _
"Select a Database", _
"Select a database to open.", _
Tmp(0), Tmp)
If picklist<>"" Then
Call doc.ReplaceItemValue(Colprogname(0), picklist)
Call doc.Save(True, True, True)
End If
End If
REM Reserved - do not use in Release 6.0
Case VALIDATE_REQUEST
REM Cause validation error if user tries to exit column with no value
' If Fulltrim(Columnvalue(0)) = "" Then
' Messagebox "Требуется ввод данных!", , "DocFlow"
' Continue = False
' End If
Case SAVE_REQUEST
REM Write the edited column view entries back to the document
For i = 0 To Ubound(Colprogname) Step 1
If Colprogname(i) = "Quantity" And Not Isnumeric(Columnvalue(i)) Then
Messagebox "!!!!!!!!!!"
Exit Sub
End If
Call doc.ReplaceItemValue(Colprogname(i), Columnvalue(i))
Next
REM Save(force, createResponse, markRead)
Call doc.Save(True, True, True)
Case NEWENTRY_REQUEST
REM Create document and create "Form" item
REM Write column values to the new document
Set doc = New NotesDocument(db)
Call doc.ReplaceItemValue("Form", "GoodsForClaim")
For i = 0 To Ubound(Colprogname) Step 1
Call doc.ReplaceItemValue(Colprogname(i), Columnvalue(i))
Next
REM Save(force, createResponse, markRead)
Call doc.Save(True, True, True)
End Select
End Sub