代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript" src="js/jquery-1-3-1.js"></script>
<!--#include file="conn.asp"-->
<%
response.Buffer=true
Response.Expires = 0
dim rs1,sqlconn
sqlconn="select * from [user] where user_name='"+session("username")+"'"
set rs1=conn.execute(sqlconn)
if rs1("user_kind")="管理员" or rs1("user_kind")="前台" then
sql="select * from booking where datediff(d,start_time,getdate())=0 order by start_time desc"
rs.open sql,conn,3,3
else
sql="select * from booking where disabled='"+session("username")+"' and datediff(d,start_time,getdate())=0 order by start_time desc"
rs.open sql,conn,3,3
end if
dim ac,str
ac = request.QueryString("ac")
if ac="refresh" then
pagesize = 5
rs.pagesize =pagesize
TotalPages=rs.PageCount
TotalRecords=rs.RecordCount
if TotalRecords<1 then
Response.Write "对不起,今天没有任何记录!"
response.end
end if
PageAction=Request.Form("PageAction")
if Cint(Session("page"))<1 then
Session("Page")=1
end if
if Cint(Session("Page"))>TotalPages then
Session("Page")=TotalPages
end if
rs.AbsolutePage=Session("Page")
response.Clear()
str = str & "<meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" />"
str = str & "<form action=""booking_index.asp"" method=""POST"">"
str = str & "<table border=0 cellspacing=2 cellpadding=1 bgcolor=#cccccc>"
str = str & "<tr><td width=""210""><font color=red>"&session("username")&"</font>,您好,欢迎登陆!</td></tr>"
str = str & "<Tr><td colspan=3 align=center></td></tr>"
str = str & "<tr><td colspan=3 align=center></td></tr>"
str = str & "共"&TotalRecords&"条记录!"
str = str & "<tr><th>客户状态</th><th>被预约客户名</th><th>预约者名</th><th>预约者职位</th><th>预约类型</th><th>预约开始时间</th><th>预约结束时间</th><th>新老客户</th><th>预约详细信息</th><th>预约特殊要求</th></tr>"
i=1
do while not rs.eof and i<=PageSize
if rs("book_kind")="回访" and datediff("d", now(),rs("start_time"))=3 then
str = str & "<script language=""javascript"">"
str = str & "{alert('客户:" & rs("Customer_name") & ",三天后会有回访!请及时通知!')}"
str = str & "</script>"
elseif datediff("m", now(),rs("start_time"))=0 then
str = str & "<script language=""javascript"">"
str = str & "{alert('客户:" & rs("Customer_name") & ",预约或回访时间已到!请及时通知!')}"
str = str & "</script>"
end if
str = str & "<tr>"
if rs("state")=0 then
str = str & "<td><div align=center ><img src=""images/quest.gif"" alt=""未到门诊!"" /></div></td>"
elseif rs("state")=1 then
str = str & "<td><div align=center ><img src=""images/coming.gif"" alt=""已到门诊!"" /></div></td>"
elseif rs("state")=2 then
str = str & "<td><div align=center ><img src=""images/worry.gif"" alt=""病人等急了!"" /></div></td>"
elseif rs("state")=3 then
str = str & "<td><div align=center ><img src=""images/doctor_do.gif"" alt=""已就诊!"" /></div></td>"
elseif rs("state")=4 then
str = str & "<td><div align=center ><img src=""images/over.gif"" alt=""就诊完毕!"" /></div></td>"
end if
str = str & "<td>" & rs("Customer_name") & "</td>"
str = str & "<td>" & rs("DN_name") & "</td>"
str = str & "<td>" & rs("DorN") & "</td>"
str = str & "<td>" & rs("book_kind") & "</td>"
str = str & "<td>" & rs("start_time") & "</td>"
str = str & "<td>" & rs("end_time") & "</td>"
str = str & "<td>" & rs("NeworOld") & "</td>"
str = str & "<td>" & rs("BK_info") & "</td>"
str = str & "<td>" & rs("other_need") & "</td>"
str = str & "</tr>"
i=i+1
rs.MoveNext
loop
str = str & "</table>"
str = str & "</form>"
response.Write(str)
rs1.close
set rs1=nothing
rs.close
set rs=nothing
response.End()
end if
%>
<script language="javascript">
function test()
{
$.get("booking_index.asp?ac=refresh&r="+Math.random(),null,function(data)
{
$("#CustomerList").html(data);
})
};
$(document).ready(function()
{
setInterval(test,60000);
});
</script>
</head>
<body bgcolor="#CCCCCC">
<div id="CustomerList">
请稍候(一分钟后自动加载数据,数据每分钟自动更新!) 正在加载数据.....
</div>
</body>
</html>