DialogBox
Sub Click(Source As Button)
On Error Goto Errhandle
Dim ss As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim view As NotesView
Dim slc As NotesDocumentCollection
Set db=ss.CurrentDatabase
Set doc=New NotesDocument(db)
doc.form="groundEdit"
Dim ws As New NotesUIWorkspace
Dim nSuccess As Boolean
nSuccess = ws.dialogbox("groundEdit",True,True,False, False,False,False,"請輸入~",doc,True)
If nSuccess = True Then
If doc.ground(0) = "" Then
Msgbox("請設定廠區")
Exit Sub
Elseif doc.employee(0) = "" Then
Msgbox("請設定負責窗口")
Exit Sub
End If
If doc.GetItemValue("ground")(0) = "5" Then
ground = "台南廠區"
Elseif doc.GetItemValue("ground")(0) = "6" Then
ground = "台北廠區"
Elseif doc.GetItemValue("ground")(0) = "7" Then
ground = "麻豆廠區"
Elseif doc.GetItemValue("ground")(0) = "8" Then
ground = "苗栗廠區"
End If
Set view = db.GetView("groundlistview")
Set slc = view.GetAllDocumentsByKey(ground)
If Not(slc.Count = 0) Then
ans = Messagebox("該廠區已經有負責窗口人員,是否修改", MB_YESNO + MB_ICONQUESTION, "注意")
Print ans
If ans = "1" Then
Dim tempdoc As NotesDocument
Set tempdoc = slc.GetFirstDocument
Call tempdoc.Remove(0)
Call doc.ReplaceItemValue("apply_datetime", Now())
Call doc.save(True, True)
Call ws.ViewRefresh
End If
Else
Call doc.ReplaceItemValue("apply_datetime", Now())
Call doc.save(True, True)
Call ws.ViewRefresh
End If
End If
Errhandle:
If Not(Erl=0) Then
Print Str(Err) + ": " + Error$ + " on line " + Cstr(Erl)
End If
End Sub