📄 basic_form.asp
字号:
<%@ Language=VBScript Transaction="Required"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>人力资源管理系统</title>
<link href="../Include/type.css" rel="stylesheet" type="text/css">
</head>
<body>
<!--#include file="../Include/conn.asp"-->
<!--#include file="../Include/Head.asp"-->
<!--#include file="../Include/Syscheck.asp"-->
<script type="text/javascript" src="../Include/regtest.js"></script>
<div id="content" style="position:absolute; width:90%; z-index:3; left: 48px; top: 178px;">
<!--内容开始-->
<script type="text/javascript" src="../Include/ajaxrequest.js"></script>
<script type="text/javascript" src="../Include/date.js"></script>
<script type="text/javascript">
function ajaxfuct(num,op)
{
// 创建AJAX对象
var ajaxobj=new AJAXRequest();
ajaxobj.method="post";
// 设置回调函数,输出响应内容
ajaxobj.callback=function(xmlobj)
{
if (op=="1")
{
document.getElementById("keys").innerHTML=xmlobj.responseText;
}
}
// 发送请求
ajaxobj.send("Basic_form_bk.asp?hi="+num+"&op="+op);
}
function AutomateExcel() //生成excel
{ var i;
var j;
// Start Excel and get Application object.
var oXL = new ActiveXObject("Excel.Application");
// Get a new workbook.
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;
var table = document.getElementById("baobiao");
var hang = table.rows.length;
var lie = table.rows(0).cells.length;
// Add table headers going cell by cell.
for (i=0;i<hang;i++)
{
for (j=0;j<lie;j++)
{
oSheet.Cells(i+1,j+1).value = table.rows(i).cells(j).innerText;
}
}
oXL.Visible = true;
oXL.UserControl = true;
//oXL.quit();
}
function incheck(checkobj,type)
{
var regtest=/^([A-Za-z0-9-]|[\u0391-\uFFE5])+$/;
var regdate=/^(\d{4}-(\d{2}|\d{1})-(\d{2}|\d{1}))$/;
if (type=="CEN")
{ //alert(regtest.test(checkobj.value));
if(regtest.test(checkobj.value)==false&&checkobj.value!="")
{
alert("输入无效字符!");
checkobj.focus();
}
}
if (type=="Date")
{
if(regdate.test(checkobj.value)==false&&checkobj.value!="")
{
alert("输入无效字符!");
checkobj.focus();
}
}
}
</script>
<script language="vbscript">
Sub buildDoc ''''生成word报表
set table = document.getElementById("baobiao")
row = table.rows.length
column = table.rows(1).cells.length
Set objWordDoc = CreateObject("Word.Document")
'objWordDoc.Application.Documents.Add theTemplate,False
objWordDoc.Application.Visible=True
Dim theArray(20,1000) '列,行初始化
for i=0 to row-1
for j=0 to column-1
theArray(j+1,i+1) = table.rows(i).cells(j).innerTEXT
next
next
objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertBefore("思远人事报表")
'显示表格标题
objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertBefore("")
Set rngPara = objWordDoc.Application.ActiveDocument.Paragraphs(1).Range
With rngPara
.Bold = True '将标题设为粗体
.ParagraphFormat.Alignment = 1 '将标题居中
.Font.Name = "宋体" '设定标题字体
.Font.Size = 18 '设定标题字体大小
End With
Set rngCurrent = objWordDoc.Application.ActiveDocument.Paragraphs(3).Range
Set tabCurrent = ObjWordDoc.Application.ActiveDocument.Tables.Add(rngCurrent,row,column)
for i = 1 to column
objWordDoc.Application.ActiveDocument.Tables(1).Rows(1).Cells(i).Range.InsertAfter theArray(i,1)
objWordDoc.Application.ActiveDocument.Tables(1).Rows(1).Cells(i).Range.ParagraphFormat.alignment=1
next
For i =1 to column
For j = 2 to row
objWordDoc.Application.ActiveDocument.Tables(1).Rows(j).Cells(i).Range.InsertAfter theArray(i,j)
objWordDoc.Application.ActiveDocument.Tables(1).Rows(j).Cells(i).Range.ParagraphFormat.alignment=1
Next
Next
End Sub
</SCRIPT>
<%
call checkin_sys(session("UsersId"),session("PerId"),29)
dim res,i,j '记录集,大循环计数,小循环计数
set res=server.CreateObject("ADODB.recordset")
%>
<div id="serch" style="position:absolute; width:100%; height:100px; z-index:2; left: 0%; top: 0px;">
<form name="search" action="Basic_form.asp" method="post">
<table width="92%" border="0" align="center" cellpadding="0" cellspacing="0">
<TR height="20">
<td class="td1" align="center"><a href="Basic_form.asp">基本信息报表</a></td>
<td align="center"><a href="Cert_form.asp">证照信息报表</a></td>
<td colspan="3"></td>
</TR>
<TR height="25">
<TD width="18%" class="td1">定义报表:</TD>
<TD width="18%" class="td1">部门:
<select name="dept">
<option value="">-请选择-
<%
dim dept_res
set dept_res=server.CreateObject("adodb.recordset")
dept_res.Open "select dept_id,dept_name from dept where dept_state='启用' and dept_level<>1",conn,3,3
do while not dept_res.EOF=true
Response.Write "<option value='"&dept_res.Fields(0).Value&"' />"&dept_res.Fields(1).Value
dept_res.MoveNext
loop
dept_res.Close
set dept_res=nothing
%>
</select>
</TD>
<TD width="23%" class="td1"> 条件字段:
<select name="others" onChange="ajaxfuct(this.value,'1')">
<option value="">-请选择-
<option value="personnel_deptman">是否负责人
<option value="personnel_sex">性别
<option value="personnel_birthday">出生年月
<option value="personnel_address">家庭住址
<option value="personnel_hometown">籍贯
<option value="personnel_educ">学历
<option value="personnel_skill">技能
<option value="personnel_graduate">毕业院校
<option value="personnel_sdate">入职时间
<option value="personnel_descript">个人描述
</select>
</TD>
<TD id="keys" class="td1" width="31%"> </TD>
<TD width="10%" class="td1">
<a href="#" onClick="javascript:document.getElementById('sebb').style.display='inline';if(document.getElementById('mainop')!=null){document.getElementById('mainop').style.display='none';}">报表字段</a>
</TD>
</TR>
</table>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" style="display:none;" id="sebb" class="table1">
<TR>
<TD width="16.67%" class="td1"><INPUT type="checkbox" name=checkbox1 value="员工号">员工号</TD>
<TD width="16.67%" class="td1"><INPUT type="checkbox" name=checkbox1 value="部门">部门</TD>
<TD width="16.67%" class="td1"><INPUT type="checkbox" name=checkbox1 value="岗位">岗位</TD>
<TD width="16.67%" class="td1"><INPUT type="checkbox" name=checkbox1 value="行政级别">行政级别</TD>
<TD width="16.67%" class="td1"><INPUT type="checkbox" name=checkbox1 value="姓名">姓名</TD>
<TD width="16.67%" class="td1"><INPUT type="checkbox" name=checkbox1 value="是否部门负责人">是否部门负责人</TD>
</TR>
<TR>
<TD class="td1"><INPUT type="checkbox" name=checkbox1 value="民族">民族</TD>
<TD class="td1"><INPUT type="checkbox" name=checkbox1 value="性别">性别</TD>
<TD class="td1"><INPUT type="checkbox" name=checkbox1 value="出生年月">出生年月</TD>
<TD class="td1"><INPUT type="checkbox" name=checkbox1 value="学历">学历</TD>
<TD class="td1"><INPUT type="checkbox" name=checkbox1 value="毕业院校">毕业院校</TD>
<TD class="td1"><INPUT type="checkbox" name=checkbox1 value="婚否">婚否</TD>
</TR>
<TR>
<TD class="td1"><INPUT type="checkbox" name=checkbox1 value="身份证号码">身份证号码</TD>
<TD class="td1"><INPUT type="checkbox" name=checkbox1 value="政治面貌"> 政治面貌</TD>
<TD class="td1"><INPUT type="checkbox" name=checkbox1 value="籍贯"> 籍贯</TD>
<TD class="td1"><INPUT type="checkbox" name=checkbox1 value="家庭住址">家庭住址</TD>
<TD class="td1"><INPUT type="checkbox" name=checkbox1 value="邮政编码">邮政编码</TD>
<TD class="td1"><INPUT type="checkbox" name=checkbox1 value="移动电话">移动电话</TD>
</TR>
<TR>
<TD class="td1"><INPUT type="checkbox" name=checkbox1 value="住宅电话">住宅电话</TD>
<TD class="td1"><INPUT type="checkbox" name=checkbox1 value="电子邮箱">电子邮箱</TD>
<TD class="td1"><INPUT type="checkbox" name=checkbox1 value="技能">技能</TD>
<TD class="td1"><INPUT type="checkbox" name=checkbox1 value="入职日期">入职日期</TD>
<TD class="td1"><INPUT type="checkbox" name=checkbox1 value="个人描述">个人描述</TD>
<TD class="td1"> </TD>
</TR>
<TR>
<TD colspan="6" align="center" class="td1">
<INPUT type="submit" value="查看报表" name=submit1 class="button">
</TD>
</TR>
</div>
</TABLE>
</form>
</div>
<%
if Request.Form("submit1")="查看报表" then
dim dept,others,keycode,sdate,edate,colums,sqlstr,t_array
dept=Request.Form("dept")
others=Request.Form("others")
keycode=Request.Form("keytxt")
sdate=Request.Form("sdate")
edate=Request.Form("edate")
colums=Request.Form("checkbox1") ''''''接心自定义的列名
t_array=split(colums,",") ''''''自定义的列名数组
sqlstr="select a.personnel_id as '员工号',b.dept_name as '部门',c.post_name as '岗位',d.plevel_name as '行政级别',a.personnel_name as '姓名',a.personnel_deptman as '是否部门负责人',a.personnel_nation as '民族',a.personnel_sex as '性别',a.personnel_birthday as '出生年月',a.personnel_educ as '学历',a.personnel_marry as '婚否',a.personnel_graduate as '毕业院校',a.personnel_idcode as '身份证号码',a.personnel_political as '政治面貌', a.personnel_hometown as '籍贯',a.personnel_address as '家庭住址',a.personnel_postcode as '邮政编码',a.personnel_mphone as '移动电话',a.personnel_fphone as '住宅电话',a.personnel_email as '电子邮箱',a.personnel_skill as '技能',a.personnel_sdate as '入职日期',a.personnel_descript as '个人描述' from personnel as a inner join dept as b on a.dept_id=b.dept_id inner join post as c on a.post_id=c.post_id inner join plevel as d on a.plevel_id=d.plevel_id where a.personnel_state!='离职'"
if dept<>"" and others<>"" then
if others="personnel_birthday" or others="personnel_sdate" then
sqlstr=sqlstr&" and a.dept_id="&dept&" and a."&others&">'"&sdate&"' and a."&others&"<'"&edate&"'"
else
sqlstr=sqlstr&" and a.dept_id="&dept&" and a."&others&" like '%'+'"&keycode&"'+'%'"
end if
elseif dept="" and others<>"" then
if others="personnel_birthday" or others="personnel_sdate" then
sqlstr=sqlstr&" and a."&others&">'"&sdate&"' and a."&others&"<'"&edate&"'"
else
sqlstr=sqlstr&" and a."&others&" like '%'+'"&keycode&"'+'%'"
end if
elseif dept<>"" and others="" then
sqlstr=sqlstr&" and a.dept_id="&dept
end if
res.Open sqlstr,conn,1,1
%>
<div id="mainop" style="position:absolute; width:100%; height:100%; z-index:3; left: 0%; top: 58px;">
<table width="90%" border="1" align="center" cellpadding="0" cellspacing="0" id="baobiao" class="table1">
<%
Response.Write "<tr>"
for each i in t_array
Response.Write "<td class='td1'>"&res.Fields(trim(i)).name&"</td>" '''输出表头
next
Response.Write "</tr>"
do while not res.EOF=true
Response.Write "<tr>"
for each i in t_array
if res(trim(i))<>"" and res(trim(i))<>"<NULL>" then
Response.Write "<td>"&res(trim(i))&"</td>" '''输出表内容
else
Response.Write "<td> </td>"
end if
next
Response.Write "</tr>"
res.MoveNext
loop
%>
</table>
<center>
<INPUT type="button" name="outexcel" onClick="AutomateExcel();" value="导出excel" class="button">
<input type="button" name="out_word" onClick="vbscript:buildDoc" value="导出word" class="button">
<input type="button" name="print" onClick="javascript:window.print();" value="打印" class="button">
</center>
<%
%>
</div>
<%
end if
if res.State=1 then
res.close
end if
conn.close
set res = nothing
set conn=nothing
%>
<!--内容结束-->
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -