<%
Dim jmail,mailBody,fs,txtfs,strsql,strdate,strid
Dim Conn,RsName,strename,strw,strm,rw,strduedate,strpcp
set Conn = CreateObject ("ADODB.Connection")
Conn.Open "Provider=MSDataShape; DATA PROVIDER=SQLOLEDB.1;Password=**;Persist Security Info=True;User ID=**;Initial Catalog=**;Data Source=**"
strsql="select emp_id,Login_name,paphno,mdate from papayh,am_employee where mdate<year(dateadd(month,-1,getdate()))*10000+month(dateadd(month,-1,getdate()))*100+day(dateadd(month,-1,getdate())) and paphno not in (select papayno from prepd a,fm_form_header b where form_kind='bqs.form.t030' and form_no=predno and form_status in ('WP','WA','UA','AP')) and papayh.preq=am_employee.emp_id"
set RsName=Conn.Execute(strsql)
if not RsName.eof then
do while not RsName.eof
Set jmail = CreateObject("JMail.Message")
strename=RsName("Login_Name")
intformno=RsName("paphno")
strid=RsName("emp_id")
strborrowdte=left(trim(RsName("mdate")),4) & "/" & mid(trim(RsName("mdate")),5,2) & "/" & right(trim(RsName("mdate")),2)
streml=replace(strename," ","")+"@benq.com"
strsql="select (select replace(login_name,' ','')+'@benq.com' from am_employee where emp_id=approver_id) as meml from am_approve_list where emp_id='"& strid &"' and approver_sequence<=2"
set rsmeml=Conn.Execute(strsql)
set rsmeml=nothing
if not rsmeml.eof then
do while not rsmeml.eof
rsmeml.movenext
loop
end if
set rsmeml=nothing
set fs = CreateObject("Scripting.FileSystemObject")
set txtf = fs.OpenTextFile("//**/e$/Mail/epayment.htm")
mailBody = ""
if not txtf.atEndOfStream then
mailBody = txtf.ReadAll
end if
mailBody = replace(mailBody,"##ename##",strename)
mailBody = replace(mailBody,"##borrowdte##",strborrowdte)
mailBody = replace(mailBody,"##formno##",intformno)
mailBody = replace(mailBody,"##strdate##",strdate)
jmail.AddRecipient "**@**.com"
jmail.AddRecipientBCC "**@**.com"
jmail.From = "**@**.com"
jmail.FromName="**"
jmail.Logging = True
jmail.Silent = True
jmail.ContentType = "text/html"
jmail.Charset = "GB2312"
jmail.Subject = "提醒( " &year(Date)&"/"&month(date)&"/"&Day(Date)& " )"
jmail.Body = ""
jmail.HTMLBody=mailBody
jmail.Send( "**" )
set jmail = Nothing
set fs = Nothing
RsName.movenext
Loop
end if
set Conn = Nothing
%>