2014年12月19日 星期五

[AP] 衝突文件通知

[Document Selection]
選擇In folder 'All-CheckConflict'
'//All-CheckConflict

[Option]
Option Public

Use "AgnesLibrary"

[Initialize]
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim viewConflict As NotesView
Dim docSetup As NotesDocument

Set db = session.CurrentDatabase
Set viewConflict = db.getview("All-CheckConflict")
Set docSetup = GetSystemDocument("Form-SystemSetup")
If viewConflict.EntryCount <> 0 Then
Call MailSend(docSetup.itmEmpNo,"","<Conflict Inform> " + db.Title ,"",viewConflict,False)
End If

End Sub



Sub MailSend(SendTo As Variant, CopyTo As Variant, Subject As String, Remark As String, IncludeView As Variant, PromptMessage As Variant)
Dim session As New NotesSession
Dim DB As NotesDatabase
Dim MailDoc As NotesDocument     
Dim UserDoc As NotesDocument

Set DB = session.CurrentDatabase 

Set UserDoc = New NotesDocument(DB)
UserDoc.Form = "Form-SwitchUserName"

Set MailDoc = New NotesDocument(DB)
MailDoc.Form = "Memo"

UserDoc.UserName = CopyTo
Call UserDoc.ComputeWithForm(True, True)
MailDoc.CopyTo = UserDoc.FullUserName

UserDoc.UserName = SendTo
Call UserDoc.ComputeWithForm(True, True)
MailDoc.SendTo = UserDoc.FullUserName

MailDoc.Subject = Subject

Set RTItem = MailDoc.CreateRichTextItem("Body")
Call RTItem.AppendText(Remark)
Call RTItem.AddNewLine(1)
Call RTItem.AppendText("Document Link Icon -->")
Call RTItem.AppendDocLink(IncludeView, Subject)
Call MailDoc.Send(False)

'-- Tracking Log

Call RTItem.AddNewLine(1)
Call RTItem.AddNewLine(1)
Call RTItem.AddNewLine(1)
Call RTItem.AddNewLine(1)
Call RTItem.AddNewLine(1)
Call RTItem.AppendText("*** ITM Tracking Log***")
Call RTItem.AddNewLine(1)
Call RTItem.AddNewLine(1)
Call RTItem.AppendText("It's sent from:")
Call RTItem.AddNewLine(1)  
Call RTItem.AddNewLine(1)
Call RTItem.AppendText("Server :" + DB.Server)
Call RTItem.AddNewLine(1)
' Call RTItem.AppendText("Current Status:" + IncludeDoc.SignStatus(0)) 
'--
         '=======Add By Morris 2001/03/16 ======
Const Macro$ = "@IsMember('[NO MAILSEND]';@UserRoles)"
txtItem = Evaluate(Macro$)

If  txtitem(0)=0 Then
Call MailDoc.Send(False)
End If
If PromptMessage Then
Messagebox "The '" + Subject + "' is mailed to " + Cstr(UserDoc.UserNameList(0)) + ".", 0, "Mailed Complete"
End If
End Sub

沒有留言:

張貼留言