📄 cert_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 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();
}
}
}
function ajaxfuct(num,op)
{
// 创建AJAX对象
var ajaxobj=new AJAXRequest();
ajaxobj.method="post";
// 设置回调函数,输出响应内容
ajaxobj.callback=function(xmlobj)
{
if (op=="2")
{
document.getElementById("pnm").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();
}
</SCRIPT>
</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"),30)
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="Cert_form.asp" method="post">
<table width="92%" border="0" align="center" cellpadding="0" cellspacing="0">
<TR height="20">
<td align="center"><a href="Basic_form.asp">基本信息报表</a></td>
<td align="center" class="td1"><a href="Cert_form.asp">证照信息报表</a></td>
<td colspan="4"></td>
</TR>
<TR>
<TD width="18%" class="td1">定义报表:</TD>
<TD width="18%" class="td1" onchange="ajaxfuct(this.value,'2')">部门:
<select name="dept" onChange="ajaxfuct(this.value,'2')">
<option value="">-请选择-
<%
res.Open "select dept_id,dept_name from dept where dept_state='启用' and dept_level<>1",conn,3,3
do while not res.EOF=true
Response.Write "<option value='"&res.Fields(0).Value&"' />"&res.Fields(1).Value
res.MoveNext
loop
res.Close
%>
</select>
</TD>
<TD width="16%" id="pnm" class="td1">员工姓名:
<input name="pname" type="text" size="6" onblur="incheck(this,'CEN')" onkeyup="testlen(this,10,0)">
</TD>
<TD width="20%" class="td1">证照名称:<input name="cert" type="text" size="12" onblur="incheck(this,'CEN')" onkeyup="testlen(this,30,0)"></TD>
<TD width="22%" class="td1">
证照有效期:
<input name="edate" type="text" onFocus="javascript:ShowCalendar(this.name)" size="10" onblur="incheck(this,'Date')">
</TD>
<TD width="6%" class="td1"><INPUT type="submit" value="查看报表" name=submit1 class="button"></TD>
</TR>
</table>
</form>
</div>
<%
if Request.Form("submit1")="查看报表" then
%>
<div id="mainop" style="position:absolute; width:100%; height:100%; z-index:3; left: 0%; top: 58px;">
<%
dim dept,pname,cert,sdate,edate
dept=Request.Form("dept")
pname=Request.Form("pname")
cert=Request.Form("cert")
edate=Request.Form("edate")
if edate="" then
edate=cstr(year(date))&"-"&cstr(month(date))&"-"&cstr(day(date))
end if
res.Open "select b.dept_name as '部门',c.personnel_name as '员工姓名',d.certificate_name as '证照名称',a.card_time as '证照有效期' from card as a inner join personnel as c on a.personnel_id=c.personnel_id inner join dept as b on c.dept_id=b.dept_id inner join certificate as d on a.certificate_id=d.certificate_id where b.dept_id like '%"&dept&"%' and c.personnel_name like '%"&pname&"%' and d.certificate_name like '%"&cert&"%' and a.card_time >='"&edate&"'",conn,3,1
'''Response.Write res.RecordCount
%>
<table width="92%" border="1" align="center" cellpadding="0" cellspacing="0" id="baobiao" class="table1">
<tr>
<%
for i=0 to res.Fields.count-1
Response.Write "<td class='td1'>"&res.Fields(i).Name&"</td>"
next
Response.Write "</tr>"
do while not res.EOF=true
Response.Write "<tr>"
for i=0 to res.Fields.count-1
Response.Write "<td>"&res.Fields(i).Value&"</td>"
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 + -