⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 workthings_stat_user.asp

📁 一套简单的OA系统
💻 ASP
字号:
<%response.expires=0%>
<!--#include file="../asp/sqlstr.asp"-->
<%
'session.abandon
'Server.ScriptTimeOut=500
function opendb(DBPath,sessionname,dbsort)
dim conn
'if not isobject(session(sessionname)) then
Set conn=Server.CreateObject("ADODB.Connection")
'if dbsort="accessdsn" then conn.Open "DSN=" & DBPath
'if dbsort="access" then conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath 
'if dbsort="sqlserver" then conn.Open "DSN=" & DBPath & ";uid=wsw;pwd=wsw"
DBPath1=server.mappath("../db/jzud-oa.asa")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath1
set session(sessionname)=conn
'end if
set opendb=session(sessionname)
end function
%>
<!--#include file="../asp/bgsub.asp"-->
<!--#include file="../asp/checked.asp"-->
<!--#include file="setpopedom.asp"-->
<%
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
set conn=opendb("oabusy","conn","accessdsn")
set rs1=server.createobject("adodb.recordset")
sql="select * from workthings_type"
rs1.open sql,conn,1
if rs1.eof and rs1.bof then
	set rs1=nothing
	conn.close
	set conn=nothing
	response.redirect "../asp/disperrorinfo.asp?errorinfo=没有办公用品,请先增加办公用品!"
	response.end
end if
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="expires" content="no-cache">
<title>办公用品使用统计</title>
<link rel="stylesheet" type="text/css" href="../css/css.css">
<script language="javascript">
function printsub()
{
	window.open('workthings_stat_user_print.asp?userdept='+document.form1.userdept.value+'&yearvalue='+document.form1.yearvalue.value+'&monthvalue='+document.form1.monthvalue.value+'&username='+document.form1.username.value,'kqprintwindow','location=no,height=450, width=600, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
}
</script>
</head>
<body topmargin="5" leftmargin="5">
<%
 
%>
<div align="center">
<table border="0">
<tr>
<td align="center"><b><font size="+1">办公用品使用统计(<font color="#ee0000">按员工统计</font>)</font></b></td></tr>
<tr><td align="center">
<input type="button" name="btn1" value="编辑领用表" onclick="location.href='edit_putouttable.asp';">&nbsp;<input type="button" name="btn2" value="按部门查看统计" onclick="location.href='workthings_stat_dept.asp';">&nbsp;<input type="button" name="btn3" value="按办公用品名称查看统计" onclick="location.href='workthings_stat_things.asp';">
</td></tr>
</table>
</div>
<%
 
%>
<div align="center">
<table align="center">
<tr>
<%
yearvalue=request("yearvalue")
monthvalue=request("monthvalue")
userdept=request("userdept")
username=request("username")
if userdept="" then
	userdept=oabusyuserdept
end if
if yearvalue="" then
	yearvalue=year(date())
end if
if monthvalue="" then
	monthvalue=month(date())
end if
%>
<tr>
<form method="post" action="workthings_stat_user.asp" name="form1">
<td align="center">
<select size="1" name="yearvalue">
<%
for i=2001 to cint(year(date()))
	if cstr(i)=cstr(yearvalue) then
		response.write("<option selected value="&chr(34)&cstr(i)&chr(34)&">"&cstr(i)&"年"&"</option>") 
	else
		response.write("<option value="&chr(34)&cstr(i)&chr(34)&">"&cstr(i)&"年"&"</option>") 
	end if
next
%>
</select>
<select size="1" name="monthvalue">
<%
for i=1 to 12
	if cstr(i)=cstr(monthvalue) then
		response.write("<option selected value="&chr(34)&cstr(i)&chr(34)&">"&cstr(i)&"月"&"</option>") 
	else
		response.write("<option value="&chr(34)&cstr(i)&chr(34)&">"&cstr(i)&"月"&"</option>") 
	end if
next
%>
</select>
<%
allow_lookallinfo_workthings=request.cookies("allow_lookallinfo_workthings")
if allow_lookallinfo_workthings="yes" then
'读取部门和人员
	set rs=server.createobject("adodb.recordset")
	sql="select DISTINCT userdept from userinf"
	rs.open sql,conn,1
%>
<select size=1 name="userdept"  onChange="document.form1.submit();">
<%
	if not rs.eof and not rs.bof then
		userdept=rs("userdept")
	end if
	if request("userdept")<>"" then
		userdept=request("userdept")
	end if
	while not rs.eof and not rs.bof
%>
<option value="<%=rs("userdept")%>"<%=selected(userdept,rs("userdept"))%>><%=rs("userdept")%></option>
<%
		rs.movenext
	wend
	set rs=nothing
%>
</select>
<%
end if
set rs2=server.createobject("adodb.recordset")
sql="select DISTINCT username,name from userinf where userdept='"&userdept&"'"
rs2.open sql,conn,1
%>
<select size=1 name="username">
<%
	if not rs2.eof and not rs2.bof then
		username=rs2("username")
	end if
	if session("userdept")=userdept and request("username")<>"" then
		username=request("username")
	end if
	while not rs2.eof and not rs2.bof
		if rs2("username")=username then
			namevalue=rs2("name")
		end if
%>
<option value="<%=rs2("username")%>"<%=selected(username,rs2("username"))%>><%=rs2("name")%></option>
<%
		rs2.movenext
	wend
set rs2=nothing
session("userdept")=userdept
%>
</select>
<input type="submit" value="查看">
<%
if allow_lookallinfo_workthings="yes" then
%>
<input type="button" name="pintbtn" value="打印" onclick="printsub();">
<%
end if
%>
</td>
</form>
</tr>
<td><br><center><b><font size="+1"><%=namevalue%></font><b><font color="#ee0000" size="+1"><%=yearvalue&"年"&monthvalue&"月"%></font><font size="+1">办公用品使用统计</font></b></center></b></td>
</table>
<p>
  <table border="1" width="80%" cellpadding="5" cellspacing="0" bordercolorlight="#808080" bordercolordark="#D4D0C8">
    <tr>
      <td height="25" bgcolor="#D4D0C8" align="center" width="58">编号</td>
      <td height="25" bgcolor="#D4D0C8" align="center" width="201">办公用品名称</td>
      <td height="25" bgcolor="#D4D0C8" align="center" width="116">申请发放数量</td>
      <td height="25" bgcolor="#D4D0C8" align="center" width="115">实际发放数量</td>
    </tr>
<%
recordsums=1
do while not rs1.eof
	set rs=server.createobject("adodb.recordset")
	sql3="select sum(workthings_userthings.putoutnumber) as putoutsums,sum(workthings_userthings.putoutfactnumber) as putoutfactsums from workthings_userthings,userinf,workthings_use where workthings_use.writeuserid=userinf.ID and userinf.userdept='"&userdept&"' and workthings_userthings.recordid=workthings_use.autoid and workthings_userthings.workthingsid="&cstr(rs1("autoid"))&" and workthings_use.putoutusername<>'' and year(workthings_use.writetabletime)="&yearvalue&" and month(workthings_use.writetabletime)="&monthvalue&" and userinf.username='"&username&"'"
	rs.open sql3,conn,1
%>
    <tr bgcolor="#ffffff">
      <td height="25" align="center" width="58"><%=cstr(recordsums)%></td>
      <td height="25" align="center" width="201"><%=rs1("workthingsname")%></td>
      <td height="25" align="center" width="116">
<%
	if isnull(rs("putoutsums")) then
		response.write("0")
	else
		response.write(rs("putoutsums"))
	end if
%>	  
	  </td>
      <td height="25" align="center" width="115">
<%
	if isnull(rs("putoutfactsums")) then
		response.write("0")
	else
		response.write(rs("putoutfactsums"))
	end if
%>	  
	  </td>
    </tr>
<%
	rs1.movenext
	recordsums=recordsums+1
loop
set rs1=nothing
%>
  </table>
</div>
<%
 
conn.close
set conn=nothing
%>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -