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

📄 gz.jsp

📁 JSP页面和oracle9i数据库的源代码
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>按工资统计</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
String page_type=(String)session.getAttribute("page_type");
String page_name=(String)session.getAttribute("page_name");
String page_bm=(String)session.getAttribute("page_bm");
if(page_type==null){page_type="";}
if(page_bm==null){page_type="";}
if(session.isNew()){response.sendRedirect("../index.jsp");}
else
{	if(!(page_type.equals("gz")) && !page_type.equals("sgz"))
	{response.sendRedirect("../index.jsp");}	
}
%>
<script language="javascript">
function check()
{	var true_false=true;
	if(document.gztj.gzmin.value=="")
    {	alert("请填写'基本工资下限'");
        true_false=false;
    }
	else
	{	if(!isfloat(document.gztj.gzmin.value))
		{	alert("请填写一个正确的'基本工资下限'")
			true_false=false;
		}
	}
	if(document.gztj.gzmax.value=="")
    {	alert("请填写'基本工资上限'");
        true_false=false;
    }
	else
	{	if(!isfloat(document.gztj.gzmax.value))
		{	alert("请填写一个正确的'基本工资上限'")
			true_false=false;
		}
	}
	return true_false;
}
function isfloat(str)
{	var test = true;
	var xsd=0,w=0;
	for(j=0;j<str.length;j++)
	{	if(str.substring(j,j+1)==".")
		{	xsd++;
			if(xsd==1){	w=j+1;}
		}
	}
	if(xsd==0){w=str.length+1;}
	if(xsd>1){test=false;}
	if(xsd==1||xsd==0)
	{	j=0;
		if(w==1||w==str.length){test=false;}
		if((str.length-w)>2){alert("数字精确到小数点后2位");test=false;}
		if((w>5)){alert("小数点前不能超过4位");test=false;}
		if(w==2 && test==true)
		{	if(	str.substring(j,j+1) != "0"&&
				str.substring(j,j+1) != "1"&&
				str.substring(j,j+1) != "2"&&
				str.substring(j,j+1) != "3"&&
				str.substring(j,j+1) != "4"&&
				str.substring(j,j+1) != "5"&&
				str.substring(j,j+1) != "6"&&
				str.substring(j,j+1) != "7"&&  
				str.substring(j,j+1) != "8"&&
				str.substring(j,j+1) != "9")
				test=false;
		}
		if(w!=2 && test==true)
		{	if(str.substring(j,j+1) != "1"&&
				str.substring(j,j+1) != "2"&&
				str.substring(j,j+1) != "3"&&
				str.substring(j,j+1) != "4"&&
				str.substring(j,j+1) != "5"&&
				str.substring(j,j+1) != "6"&&
				str.substring(j,j+1) != "7"&&  
				str.substring(j,j+1) != "8"&&
				str.substring(j,j+1) != "9")
				test=false;
		}
		for(j=1;j<w-1;j++)
		{	if(str.substring(j,j+1) != "0"&&
				str.substring(j,j+1) != "1"&&
				str.substring(j,j+1) != "2"&&
				str.substring(j,j+1) != "3"&&
				str.substring(j,j+1) != "4"&&
				str.substring(j,j+1) != "5"&&
				str.substring(j,j+1) != "6"&&
				str.substring(j,j+1) != "7"&&  
				str.substring(j,j+1) != "8"&&
				str.substring(j,j+1) != "9")
				test=false;
		}
		for(j=w;j<str.length;j++)
		{	if(str.substring(j,j+1) != "0"&&
				str.substring(j,j+1) != "1"&&
				str.substring(j,j+1) != "2"&&
				str.substring(j,j+1) != "3"&&
				str.substring(j,j+1) != "4"&&
				str.substring(j,j+1) != "5"&&
				str.substring(j,j+1) != "6"&&
				str.substring(j,j+1) != "7"&&  
				str.substring(j,j+1) != "8"&&
				str.substring(j,j+1) != "9")
				test=false;
		}
	}
	return test;
}
</script>
<style type="text/css">
<!--
.style1 {font-size: 16px}
.style2 {
	font-size: 24px;
	color: #FF66CC;
}
.style3 {color: #FFFFFF}
.style4 {font-size: 14px}
-->
</style>
<body>
<Font size=4>
<div align="center" class="style2">按工资统计</div>
<jsp:useBean id="conn" scope="page" class="beans.conn"/>
<%@ page import="java.util.Calendar"%>
<%String meb=response.encodeURL("gz.jsp");%>
<FORM action="<%=meb%>" Method="post" name="gztj" id="gztj" onSubmit="return check()">
  <th width=100><table  border="0" align="center">
  <tr>
    <td colspan="2" nowrap><div align="center"><span class="style1">请输入要查询工资的数额范围</span></div></td>
    </tr>
  <tr>
    <td colspan="2" nowrap><div align="center"><span class="style1">工资在</span>
          <Input name="gzmin" type=text maxlength="7">
          <span class="style1"> (元)到</span>
          <Input name="gzmax" type=text maxlength="7">
          <span class="style1">(元)之间的职工 </span></div></td>
    </tr>
  <tr>
    <td nowrap><div align="center">
      <input type="submit" name="Submit" value="查询">
    </div></td>
    <td nowrap><div align="center">
      <input type="reset" name="Submit2" value="重置">
    </div></td>
  </tr>
</table>  
</Form>
<%	String condition_all="select bh from zgxx";
	conn.setcondition(condition_all);
	ResultSet rs_all=conn.getrs();
	rs_all.last();
	int all_all=rs_all.getRow();
	float gzmin=0;
	float gzmax=0;
	String gzmin_s=request.getParameter("gzmin");
	if(gzmin_s==null){gzmin_s="";}
	else{gzmin=Float.parseFloat(gzmin_s);}
	String gzmax_s=request.getParameter("gzmax");
	if(gzmax_s==null){gzmax_s="";}
	else{gzmax=Float.parseFloat(gzmax_s);}
	if(gzmin_s!=""&&gzmax_s!="")
	{	String condition_gz="select * from zgxx where gz>="+gzmin+" and gz<="+gzmax;
		conn.setcondition(condition_gz);
		ResultSet rs=conn.getrs();
		rs.last();
		int all=rs.getRow();
		if(all==0){out.print("<center>没有在工资此范围内的职工</center>");}
		else
		{	double bl=(int)((all*100.0/all_all)*100.0)/100.0;
			out.print("<center>找到此范围内的职工共"+all+"人,占在职职工的"+bl+"%</center>");
			rs.first();
%>
<table border="0" align="center">
  <tr>
    <td><table border="1" align="center" cellspacing="1" bordercolor="#FF99CC">
<%			while(rs.next())
			{
%>

      <tr>
        <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4"><span class="style3">编号:</span></div></td>
        <td height="20" nowrap><%=rs.getString("BH")%></td>
        <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4"><span class="style3">姓名:</span></div></td>
        <td height="20" nowrap><%=rs.getString("XM")%></td>
        <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4"><span class="style3">性别:</span></div></td>
        <td height="20" nowrap><%=rs.getString("XB")%></td>
        <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4"><span class="style3">年龄:</span></div></td>
        <td height="20" nowrap>
          <%	Calendar birthday=Calendar.getInstance();	
						birthday.setTime(rs.getDate("CSNY"));
						Calendar day=Calendar.getInstance();
						int age=0;
						age=day.get(day.YEAR)-birthday.get(birthday.YEAR);
						if(day.get(day.MONTH)<birthday.get(birthday.MONTH)){age--;}
						if(day.get(day.MONTH)==birthday.get(birthday.MONTH))
						{if(day.get(day.DATE)<birthday.get(birthday.DATE)){age--;}}
					%>
          <%=age%></td>
        <td nowrap bgcolor="#FF99CC"><span class="style3">工资</span></td>
        <td nowrap><%=rs.getString("GZ")%></td>
		 <td nowrap bgcolor="#FF99CC"><span class="style3">各种补贴:</span></td>
		 <td nowrap><%=rs.getString("GZBT")%></td>
		 <td valign="middle" nowrap><a href="../cx/rs_cx_card_xxxx.jsp?bh=<%=rs.getString("bh")%>" target="_blank">详细信息...</a></td>
      </tr>
<%			}%>
 	</table></td>
  </tr>
</table>
<%		}
	}
%>
<jsp:include page="../checkout.jsp"></jsp:include>
</body>
</html>

⌨️ 快捷键说明

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