📄 booksource_info.asp
字号:
<%response.expires=0%>
<!--#include file="asp/sqlstr.asp"-->
<!--#include file="asp/bgsub.asp"-->
<!--#include file="asp/opendb.asp"-->
<!--#include file="asp/checked.asp"-->
<!--#include file="asp/keepformat.asp"-->
<!--#include file="asp/check_resource.asp"-->
<%
'today1=date()
'today2=date()+1
yearvalue=request.form("yearvalue")
monthvalue=request.form("monthvalue")
dayvalue=request.form("dayvalue")
if yearvalue="" and monthvalue="" and dayvalue="" then
yearvalue=year(date())
monthvalue=month(date())
dayvalue=day(date())
today1=date()
today2=dateadd("d",1,date())
else
newdate=dateserial(yearvalue,monthvalue,dayvalue)
today1=newdate
today2=dateadd("d",1,newdate)
end if
'-----------------------------------------
oabusyname=request.cookies("oabusyname")
oabusyusername=request.cookies("oabusyusername")
oabusyuserdept=request.cookies("oabusyuserdept")
oabusyuserlevel=request.cookies("oabusyuserlevel")
if oabusyusername="" then
response.write("<script language=""javascript"">")
response.write("window.top.location.href='default.asp';")
response.write("</script>")
response.end
end if
'--------------------------------------
'删除以前的记录
resourceflag=check_resource_setting(oabusyusername,0)
set conn=opendb("oabusy","conn","accessdsn")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="expires" content="no-cache">
<link rel="stylesheet" href="css/css.css">
<title>企业办公自动化IE37-OA系统</title>
</head>
<body bgcolor="#ffffff" topmargin="5" leftmargin="5">
<center>
<table align="center">
<tr>
<form method="post" action="booksource_info.asp">
<td>
<select name="yearvalue" size=1>
<%
for i=2001 to year(date())
if clng(yearvalue)=i then
response.write("<option selected value="&cstr(i)&">"&cstr(i)&"</option>")
else
response.write("<option value="&cstr(i)&">"&cstr(i)&"</option>")
end if
next
%>
</select>
<select name="monthvalue" size=1>
<%
for i=1 to 12
if clng(monthvalue)=i then
response.write("<option selected value="&cstr(i)&">"&cstr(i)&"</option>")
else
response.write("<option value="&cstr(i)&">"&cstr(i)&"</option>")
end if
next
%>
</select>
<select name="dayvalue" size=1>
<%
for i=1 to 31
if clng(dayvalue)=i then
response.write("<option selected value="&cstr(i)&">"&cstr(i)&"</option>")
else
response.write("<option value="&cstr(i)&">"&cstr(i)&"</option>")
end if
next
%>
</select>
<input type="submit" name="lookbtn" value="查询">
</td>
</form>
<%
if resourceflag=0 then
%>
<form method=post action="addequipment.asp">
<td>
<input type="submit" value="增加">
</td>
</form>
<%
set rs=nothing
end if
%>
<form method=post action="booksource.asp">
<td>
<input type="submit" value="预约">
</td>
</form>
</tr>
</table>
<%=yearvalue&"年"&monthvalue&"月"&dayvalue&"日"%>的资源占用情况图(<font color=red>红色</font>表示被占用时间段)
</center>
<%
%>
<center>
<table border="1" cellspacing="0" cellpadding="0" width="95%" bordercolorlight="#808080" bordercolordark="#D4D0C8">
<%
'显示图表
'打开数据库,读出设备
set rs=server.createobject("adodb.recordset")
sql="select * from equipment"
rs.open sql,conn,1
while not rs.eof and not rs.bof
%>
<tr>
<%
if resourceflag=0 then
%>
<td width=90 align=center><a href="editequipment.asp?id=<%=rs("id")%>"><%=keepformat(rs("equipment"))%></a></td><td align=center>
<%
else
%>
<td width=90 align=center><%=keepformat(rs("equipment"))%></td><td align=center>
<%
end if
'读出预约数据
set rs1=server.createobject("adodb.recordset")
sql="select * from booking where endtime>#" & today1 & "# and starttime<#" & today2 & "# and equipment=" & sqlstr(rs("equipment")) & " or (year(notedate)="&yearvalue&" and month(notedate)="&monthvalue&" and day(notedate)="&dayvalue&" and equipment="&sqlstr(rs("equipment"))&") order by starttime"
rs1.open sql,conn,1
%>
<table border="0" cellspacing="0" cellpadding="0" width="430" height="10">
<tr>
<td align=left>00:00</td><td align=center>12:00</td><td align=right>24:00</td>
</tr>
</table>
<%
if rs1.eof or rs1.bof then
%>
<table border="0" cellspacing="0" cellpadding="0" width="400" height="15">
<tr>
<td bgcolor="#aaaaaa"></td>
</tr>
</table>
<%
else
%>
<table border="0" cellspacing="0" cellpadding="0" width="400" height="15">
<tr>
<%
'初始化前面没记录
a=0
while not rs1.eof and not rs1.bof
'如果是第一条记录
if a=0 then
'现在不是第一条记录了
a=1
'计算开始时间到零点的小时数
starttime=rs1("starttime")
endtime=rs1("endtime")
starttime1=rs1("starttime")
endtime1=rs1("endtime")
a1=datediff("h",today1,starttime)
'如果开始时间在今天就显示无色的长度
if a1>0 then
'计算色条长度
colorwidth=a1/24*400
'显示无色
%>
<td bgcolor="#aaaaaa" width="<%=colorwidth%>" align=center><%=a1%></td>
<%
end if
'计算结束时间到零点的小时数
b1=datediff("h",today1,endtime)
'如果a1<=0,b1>=24
if a1<=0 and b1>=24 then
%>
<td bgcolor="red" width="400" align=center>24</td>
<%
end if
'如果a1<=0,b1<24
if a1<=0 and b1<24 then
colorwidth=b1/24*400
%>
<td bgcolor="red" width="<%=colorwidth%>" align=center><%=b1%></td>
<%
end if
'如果a1>0,b1>=24
if a1>0 and b1>=24 then
colorwidth=(24-a1)/24*400
%>
<td bgcolor="red" width="<%=colorwidth%>" align=center><%=(24-a1)%></td>
<%
end if
'如果a1>0,b1<24
if a1>0 and b1<24 then
c1=datediff("h",starttime,endtime)
colorwidth=c1/24*400
%>
<td bgcolor="red" width="<%=colorwidth%>" align=center><%=c1%></td>
<%
end if
else
'计算无色长度
starttime=rs1("starttime")
endtime=rs1("endtime")
a1=datediff("h",endtime1,starttime)
'如果有时间间隔就显示无色长度
if a1>0 then
colorwidth=a1/24*400
%>
<td bgcolor="#aaaaaa" width="<%=colorwidth%>" align=center><%=a1%></td>
<%
end if
'显示有色长度
b1=datediff("h",today1,endtime)
'如果b1>=24
if b1>=24 then
d1=datediff("h",today1,starttime)
colorwidth=(24-d1)/24*400
%>
<td bgcolor="red" width="<%=colorwidth%>" align=center><%=(24-d1)%></td>
<%
end if
'如果b1<24
if b1<24 then
d1=datediff("h",starttime,endtime)
colorwidth=d1/24*400
%>
<td bgcolor="red" width="<%=colorwidth%>" align=center><%=d1%></td>
<%
end if
starttime1=rs1("starttime")
endtime1=rs1("endtime")
end if
rs1.movenext
wend
'显示最后无色区
e1=datediff("h",today1,endtime1)
if e1<24 then
colorwidth=(24-e1)/24*400
%>
<td bgcolor="#aaaaaa" width="<%=colorwidth%>" align=center><%=(24-e1)%></td>
<%
end if
%>
</tr>
</table>
<%
end if
%>
</td>
</tr>
<%
rs.movenext
wend
%>
</table>
<table border="1" cellspacing="0" cellpadding="5" width="95%" bordercolorlight="#808080" bordercolordark="#D4D0C8">
<%
'打开数据库,读出设备
set rs=server.createobject("adodb.recordset")
sql="select * from equipment"
rs.open sql,conn,1
while not rs.eof and not rs.bof
%>
<tr>
<td><b><%=keepformat(rs("equipment"))%></b></td>
</tr>
<tr>
<td height=40>
<%
'读出预约数据
set rs1=server.createobject("adodb.recordset")
'sql="select * from booking where equipment=" & sqlstr(rs("equipment")) & " and year(notedate)="&yearvalue&" and month(notedate)="&monthvalue&" and day(notedate)="&dayvalue&" order by starttime"
sql="select * from booking where endtime>#" & today1 & "# and starttime<#" & today2 & "# and equipment=" & sqlstr(rs("equipment")) & " or (year(notedate)="&yearvalue&" and month(notedate)="&monthvalue&" and day(notedate)="&dayvalue&" and equipment="&sqlstr(rs("equipment"))&") order by starttime"
rs1.open sql,conn,1
'rs1.movefirst
while not rs1.eof and not rs1.bof
select case rs1("auditing")
case 0
imgsrc="image/resource_auditing.gif"
explainstr="<font color=""#0000ff"">未审核</font>"
case 1
nowtime=cdate(cstr(date())&" "&cstr(time()))
if nowtime>=rs1("starttime") and nowtime<=rs1("endtime") then
imgsrc="image/resource_go.gif"
explainstr="使用中..."
elseif nowtime<rs1("starttime") then
imgsrc="image/resource_auditing.gif"
explainstr="等待使用"
elseif nowtime>rs1("endtime") then
imgsrc="image/finish.gif"
explainstr="已完成"
end if
case 2
imgsrc="image/auditing_no.gif"
explainstr="<font color=""#ff0000""><b>审核未通过</b></font>"
end select
%>
<img src="<%=imgsrc%>" border="0">
<a href="editbooking.asp?id=<%=rs1("id")%>"><font color="#0000ff">[<%=rs1("starttime")%>----<%=rs1("endtime")%>]</font></a>
<%
set rs2=server.createobject("adodb.recordset")
sql="select * from userinf where username=" & sqlstr(rs1("username"))
rs2.open sql,conn,1
if not rs2.eof and not rs2.bof then
if oabusyusername=rs1("username") then response.write "<font color=red>"
%>
部门:<%=rs2("userdept")%> 预约者:<%=keepformat(rs2("name"))%><%
if oabusyusername=rs1("username") then response.write "</font>"
response.write("["&explainstr&"]")
end if
%>
<br>
<%
rs1.movenext
wend
rs.movenext
wend
%>
</table>
</center>
<%
%>
<div align="center">
<center>
<table>
<tr>
<td height=19>
<table border="0" cellpadding="0" cellspacing="0" width="610" height="19">
<tr>
<td width="100%" height=20><p align="center"><font color="#808080">IE37 © <a href="http://www.ie37.com" target="_blank">IE37.com</a></font></td>
</tr>
</table>
</td>
</tr>
<%
conn.close
set conn=nothing
%>
</table>
</center>
</div>
</body>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -