'//此功能僅for寄內部信件
先在套表上設定mail格式內容,再coding
Dim richStyle As NotesRichTextStyle
Dim rtpStyle As NotesRichTextParagraphStyle
Dim Memodoc As NotesDocument
Dim RTItem As NotesRichTextItem
Dim HoldDescRItem As NotesRichTextItem, LinkRItem As NotesRichTextItem, HoldDescRItemB As NotesRichTextItem
Set richStyle = Session.CreateRichTextStyle
Set rtpStyle = Session.CreateRichTextParagraphStyle
rtpStyle.Alignment = ALIGN_NOWRAP
strRemark = "<WB QAR 產品處置>" + doc.SerialNumber(0)
'//----------20140213 added ------------------
Set memoDoc = New NotesDocument(jmcdb)
memodoc.Form = "Memo"
memodoc.Principal = db.Title
memodoc.Subject = "<WB QAR 產品處置>" + doc.SerialNumber(0) + " - " + _
doc.Customer(0) + "/" + doc.Customer1(0) + " - " + _
Implode(doc.LotNo,",") + " - " + _
Implode(doc.CustLotNo,",") + " - "
'//---------mail -----------------------------------
Set RTItem = MemoDoc.CreateRichTextItem("Body")
richStyle.FontSize = 10
richStyle.NotesFont = RTItem.GetNotesFont("Arial", True)
Call RTItem.AppendStyle(richStyle)
Call RTItem.AppendParagraphStyle(rtpStyle)
richStyle.NotesColor = COLOR_BLACK
Call RTItem.AppendStyle(richStyle)
Set sdoc = New NotesDocument(db)
Call sdoc.ReplaceItemValue("Form", "Form-mail_ProdDisposition")
'Call sdoc.Save(True, True)
'Call sdoc.RenderToRTItem(RTItem)
Call sdoc.ReplaceItemValue("ActionName", "<WB QAR 產品處置>")
Call sdoc.ReplaceItemValue("SerialNumber", doc.SerialNumber(0))
Call sdoc.RemoveItem("DocLink")
Set LinkRItem = sdoc.CreateRichTextItem("DocLink")
Call LinkRItem.AppendDocLink(doc, Subject)
Call sdoc.ReplaceItemValue("ProdDisposition", "QC產品處置:")
Call sdoc.ReplaceItemValue("DispositionDesc", doc.DispositionDesc(0))
If ChkIsRTFNull("HoldDesc") <> True Then
Call sdoc.ReplaceItemValue("HoldDisposition", "QC不良品處置:")
Call sdoc.RemoveItem("HoldDesc")
Set HoldDescRItemB = doc.GetFirstItem("HoldDesc")
Call sdoc.CopyItem(HoldDescRItemB,"HoldDesc")
'Set HoldDescRItem = sdoc.CreateRichTextItem("HoldDesc")
'Set HoldDescRItemB = doc.GetFirstItem("HoldDesc")
'Call HoldDescRItem.AppendRTItem(HoldDescRItemB)
End If
Call sdoc.Save(True,True)
Call sdoc.RenderToRTItem(RTItem)
Call memoDoc.ReplaceItemValue("SendTo", varSendTo)
Const Macro$ = "@IsMember('[NO MAILSEND]';@UserRoles)"
txtItem = Evaluate(Macro$)
If txtitem(0)=0 Then
If DB.Server = "CN=CMOS051/O=CHIPMOS" Then
Call rtItem.AddNewLine(2)
Call rtItem.AppendText("測試用 - Mail不直接寄送簽核者, 下列為實際收件者的名單" )
Call rtItem.AddNewLine(1)
Call rtItem.AppendText("SendTo List : " )
If memoDoc.hasitem("SendTo") Then
Set itemSendTo = memodoc.GetFirstItem( "SendTo" )
Forall v In itemSendTo.Values
Call rtItem.AppendText( v)
Call rtItem.AppendText( " , ")
End Forall
End If
Call rtItem.AddNewLine(2)
Call rtItem.AppendText("CopyTo List : " )
If memoDoc.hasitem("CopyTo") Then
Set itemSendTo = memodoc.GetFirstItem( "CopyTo" )
Forall v In itemSendTo.Values
Call rtItem.AppendText( v)
Call rtItem.AppendText( " , ")
End Forall
End If
memoDoc.SendTo=session.UserName
memoDoc.CopyTo=""
memoDoc.BlindCopyTo = ""
End If
Call memoDoc.Send(False)
Call sdoc.Remove(True)
End If
'-------------------------------------------------------
'Call MailSend(varSendTo, ccName, strSubject, strRemark, doc, True)
End If
End If
varEmpInfo = GetEmpInfoByNotesID(session.username) '//取得當下的操作人員
沒有留言:
張貼留言