?? 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 + -