📄 hrmbase_list_xls.asp
字号:
<%
'OA 表单生成器1.0
'功能:会员基本资料列表
'参数:request("page")=int #当前页码; request.form("Search")=chr #上次查询条件
%>
<!--#include file="../inc/Secure.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/Const.asp"-->
<%
Server.ScriptTimeout=6000
'response.buffer=false
'------------------------------------------------设置参数
LoginID=trim(Session("Mis_LoginID")) : if LoginID="" then LoginID=0 '当前用户ID
maxmessage=10000 '每页显示记录数
currentpage=request("page") '当前页码
Search=request("Search") '上次查询条件
dep_id=session("dep_id")
'------------------------------------------------
xgzdw=Request("xgzdw")'现工作单位
if xgzdw="" then xgzdw=0
'------------------------------------------------取记录
table="tbioaHrmBase" '表名
set rs=Server.CreateObject("ADODB.RecordSet")
sql="select " & table & ".*,PATINDEX('%-%', bh) AS pbh from " & table & " INNER JOIN tbioaDepartment a INNER JOIN FunDepartment("&xgzdw&") b ON a.ID = b.id ON a.ID = xgzdw " & Search & " order by pbh,bh"
'response.write sql
rs.open sql,oConn,1,1
Showpage=XslPaging(rs,maxmessage,currentpage,"Search="&Server.URLEncode(Search)&"&order="&order)
'------------------------------------------------
if request("page")="" and rs.pagecount>1 then
response.write "<font color=red>由于记录过多,系统已自动分割文档!请您分批导出。</font><br>"
response.write Showpage
oConn.close
response.end
end if
'------------------------------------------------
Response.Clear
Response.ContentType = "application/octet-stream"
Response.AddHeader "content-disposition", "attachment; filename=人事基本信息表"¤tpage&".xls"
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>人事基本信息表</title>
</head>
<body topmargin="10" leftmargin="10">
<%
if rs.RecordCount=0 then
response.write "<BR><BR>暂时为空!"
else
%>
<table border="1" width="100%" bordercolorlight="#000000" cellspacing="0" cellpadding="0" bordercolordark="#FFFFFF">
<tr>
<td align="center" colspan="13" nowrap>人事基本信息</td>
</tr>
<tr>
<td align="center" nowrap>编号</td>
<td align="center" nowrap>姓名</td>
<td align="center" nowrap>性别</td>
<td align="center" nowrap>身份证</td>
<td align="center" nowrap>出生日期</td>
<td align="center" nowrap>年龄</td>
<td align="center" nowrap>最高学历</td>
<td align="center" nowrap>工种</td>
<td align="center" nowrap>入职日期</td>
<td align="center" nowrap>现工作单位</td>
<td align="center" nowrap>工作岗位/职务</td>
<td align="center" nowrap>联系电话</td>
</tr>
<%for i = 0 to rs.PageSize-1
If rs.EOF Then Exit For%>
<tr>
<td nowrap><%=HtmlOut(rs("bh"))%> </td>
<td nowrap><%=HtmlOut(rs("xm"))%> </td>
<td nowrap><%=HtmlOut(rs("xb"))%> </td>
<td nowrap><%=HtmlOut(rs("sfzh"))%> </td>
<td nowrap><%=HtmlOut(rs("csrq"))%> </td>
<td nowrap><%=datediff("yyyy",rs("csrq"),date)%> </td>
<td nowrap><%=HtmlOut(rs("xl"))%> </td>
<td nowrap><%=HtmlOut(rs("gz"))%> </td>
<td nowrap><%=HtmlOut(rs("rzdate"))%></td>
<td nowrap><%=HtmlOut(GetTableValue("tbioaDepartment","Name","id",rs("xgzdw")))%> </td>
<td nowrap><%=HtmlOut(rs("xgzgw"))%> </td>
<td align="center" nowrap><%=HtmlOut(rs("bgdh"))%> </td>
</tr>
<%
rs.MoveNext
next
%>
</table>
<%
end if
rs.close
%>
</body>
</html>
<%'输出内容并释放对象变量
Response.Flush
oConn.close
'---------------------------------------------------------
Function XslPaging(rs,maxmessage,currentpage,getstr)
'显示页码-GET(记录集,每页显示记录数,当前页码,传递值)------
dim Str
if currentpage="" then currentpage=1 '当前页码
if getstr<>"" then getstr = getstr & "&" 'GET参数
rs.pagesize=maxmessage '设置每页显示记录数
if not rs.EOF then rs.AbsolutePage=currentpage '设置当前页码
Str = " 共" & rs.recordcount & "条记录,分" & rs.pagecount & "个文档导出,每个文档" & maxmessage & "条 "
Str = Str & "["
ps=1
pe=rs.pagecount
for i=ps to pe
str=str & "<a href=?" & getstr & "page=" & i & ">" & i & "</a>"
if i<>rs.pagecount then str=str & " "
next
Str = Str & "]"
XslPaging = Str
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -