📄 booking.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Style.css" rel="stylesheet" type="text/css">
<title>专家预约</title>
</head>
<body>
<!--#include file="inc/adovbs.asp"-->
<!--#include file="Inc/Conn.asp"-->
<!--#include file="Inc/Check.asp"-->
<!--#include file="inc/SQLCHK.asp"-->
<%
Dim ExpertID, Name, Sex, Office, Speciality, TimeList
ExpertID=Request("ExpertID")
if ExpertID="" then
Response.write "<script language='javascript'>" &Chr(13)
Response.write "alert('专家ID号有问题!');" &Chr(13)
Response.write "window.document.location.replace('Expert.asp');"&Chr(13)
Response.write "</script>" &Chr(13)
Response.End
end if
'查询专家是否存在
dim RS
set RS=Server.CreateObject("ADODB.RecordSet")
RS.ActiveConnection=Conn
RS.Source = "Select * From [EXPERT] Where ID="&ExpertID
RS.CursorType = adOpenKeyset
RS.CursorLocation = adUseServer
RS.LockType = adLockReadOnly
RS.Open
If RS.Eof or RS.Bof Then
Response.write "<script language='javascript'>" &Chr(13)
Response.write "alert('专家ID号有问题!');" &Chr(13)
Response.write "window.document.location.replace('Expert.asp');"&Chr(13)
Response.write "</script>" &Chr(13)
Response.End
end if
'记录专家信息
Name = RS("Name")
Sex = RS("Sex")
Office = RS("Office")
Speciality = RS("Speciality")
TimeList = RS("TimeList")
RS.Close
RS=nothing
Dim DayStart, DayEnd, RegCount
'取得两个星期这个时间段
DayStart = Date() + 1
DayEnd = DayStart+14
'在记录表中查找当前专家将来2个星期内的预约情况
RS.Source = "Select * From [REGISTRATION] Where ExpertID="&ExpertID&" And DiagDate>=#"&DayStart&"# And DiagDate<=#"&DayEnd&"#"
RS.Open
RegCount = RS.RecordCount
'字段数组
Dim RSField(3)
RSField(0)="DiagDate"
RSField(1)="APM"
RSField(2)="ExpertID"
'记录数组
Dim RSArray
RSArray=RS.GetRows(RegCount, 1)
'关闭数据库
RS.Close
ConnClose()
Function GetRegNum(varDate, varAPM)
Dim I, Num
Num=0
If RegCount > 0 Then
For I=0 To UBOUND(RSArray,2) Step 1
If RSArray(2,I)=varDate And RSArray(3,I)=varAPM Then
Num = Num + 1
End If
Next
End If
GetRegNum = Num
End Function
%>
<!--#include file="Inc/Head.asp"-->
<table width="772" height="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="11" background="Image/LeftMargin.gif"></td>
<td width="750" background="Image/BGBlock.gif"><br>
<table width="600" border="0" cellspacing="1" cellpadding="0" align="center" bgcolor="#CCCCCC" class="TableInfo">
<tr>
<td bgcolor="#EFEFEF" height="20" width="70" align="center">姓名:</td>
<td bgcolor="#FFFFFF" height="20" colspan="2" class="Text1"> <b><%=Name%></b></td>
</tr>
<tr>
<td bgcolor="#EFEFEF" height="20" width="70" align="center">性别:</td>
<td bgcolor="#FFFFFF" height="20" colspan="2"> <%=Sex%></td>
</tr>
<tr>
<td bgcolor="#EFEFEF" height="20" width="70" align="center">科室:</td>
<td bgcolor="#FFFFFF" height="20" colspan="2"> <%=Office%></td>
</tr>
<tr>
<td bgcolor="#EFEFEF" height="22" width="70" align="center" >专长:</td>
<td bgcolor="#FFFFFF" height="22" colspan="2"> <%=Speciality%></td>
</tr>
</table><br>
<%If IsNull(TimeList) = True Then %>
<table width="600" border="0" cellspacing="0" cellpadding="0" align="center" class="TableInfo">
<tr>
<td height="60" align="center">目前尚无工作安排</td>
</tr>
</table>
<%Else%>
<table width="600" border="0" cellspacing="1" cellpadding="0" align="center" bgcolor="#CCCCCC">
<tr>
<td width="90" height="20" align="center" bgcolor="#C6DF9C">日期</td>
<td width="90" height="20" align="center" bgcolor="#C6DF9C">星期</td>
<td width="90" height="20" align="center" bgcolor="#C6DF9C">上/下午</td>
<td width="90" height="20" align="center" bgcolor="#C6DF9C">可挂号</td>
<td width="90" height="20" align="center" bgcolor="#C6DF9C">剩余挂号</td>
<td height="20" align="center" bgcolor="#C6DF9C">预约</td>
</tr>
<%
Dim DayIdx
'可以提前2个星期预约
For DayIdx = DayStart To DayEnd
'计算当前日期专家是否工作(上午)
Dim Str, nowWeekDay, AM, PM
nowWeekDay = Weekday(DayIdx, vbMonday)
Str = "["&nowWeekDay&",1]"
If InStr(TimeList, Str) <> 0 Then
AM = True
Else
AM = False
End If
Str = "["&nowWeekDay&",2]"
If InStr(TimeList, Str) <> 0 Then
PM = True
Else
PM = False
End If
If AM or PM Then
Dim RegNumAM, RegNumPM
RegNumAM = GetRegNum(DayIdx,True)
RegNumPM = GetRegNum(DayIdx,False)
%>
<tr><td width="90" colspan="6" align="center" bgcolor="#EFEFEF"></td></tr>
<tr>
<td width="90" <%if AM and PM then %>rowspan="2"<%end if%> align="center" bgcolor="#EFEFEF"><%=DayIdx%></td>
<td width="90" <%if AM and PM then %>rowspan="2"<%end if%> align="center" bgcolor="#EFEFEF"><%=WeekdayName(nowWeekDay, False, vbMonday)%></td>
<%if AM then%>
<td width="90" height="30" align="center" bgcolor="#EFEFEF">上午</td>
<td width="90" align="center" bgcolor="#EFEFEF">5</td>
<td width="90" align="center" bgcolor="#EFEFEF"><%=5-RegNumAM%></td>
<td align="center" bgcolor="#EFEFEF">
<%If RegNumAM=5 Then%>预约已满<%Else%><a href="BookingAffirm.asp?ExpertID=<%=ExpertID%>&DiagDate=<%=DayIdx%>&APM=true">预约</a><%End If%>
<%else%>
<td width="90" height="30" align="center" bgcolor="#EFEFEF">下午</td>
<td width="90" align="center" bgcolor="#EFEFEF">5</td>
<td width="90" align="center" bgcolor="#EFEFEF"><%=5-RegNumPM%></td>
<td align="center" bgcolor="#EFEFEF">
<%If RegNumPM=5 Then%>预约已满<%Else%><a href="BookingAffirm.asp?ExpertID=<%=ExpertID%>&DiagDate=<%=DayIdx%>&APM=false">预约</a><%End If%>
<%end if%>
</td>
</tr>
<%If AM and PM then%>
<tr>
<td width="90" height="30" align="center" bgcolor="#EFEFEF">下午</td>
<td width="90" align="center" bgcolor="#EFEFEF">5</td>
<td width="90" align="center" bgcolor="#EFEFEF"><%=5-RegNumPM%></td>
<td align="center" bgcolor="#EFEFEF"><%If RegNumPM=5 Then%>预约已满<%Else%><a href="BookingAffirm.asp?ExpertID=<%=ExpertID%>&DiagDate=<%=DayIdx%>&APM=false">预约</a><%End If%></td>
</tr>
<%End if
End If
Next
RS.Close
Set RS=Nothing
Conn.Close
Set Conn=Nothing
%>
</table>
<%End If%>
<br>
</td>
<td width="11" background="Image/RightMargin.gif"></td>
</tr>
</table>
<!--#include file="Inc/Trail.asp"-->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -