培训费用统计查询1

<%@ page language="java" import="java.util.*,java.sql.*"%>
<%@ page import="com.hongyi.oms.app.workflow.spcx.*"%>
<%@ page import="com.hongyi.oms.app.workflow2.formeditor.Utils"%>
<%@ page import="com.hongyi.oms.framework.util.*"%>
<%@ page import="com.hongyi.oms.app.util.*"%>
<%@ page import="com.hongyi.oms.framework.dboperator.*" %>
<%@ page import="com.hongyi.oms.framework.safety.*"%>
<%@ page import = "com.hongyi.oms.app.user.*" %>
<%@ page import ="com.hongyi.oms.app.system.dict.DictionaryInfoCache"%>

<%
PageBaseInfo pageInfo = null;
int pageNo = StringUtil.castToInt(request.getParameter("curPageNo"), 1);
UserProfile profile = (UserProfile)session.getAttribute(UserProfile.USERINFO);
String FEIYONG1 = request.getParameter("FEIYONG1");
String CREATE_DATE1 = request.getParameter("CREATE_DATE1");
String CREATE_DATE2 = request.getParameter("CREATE_DATE2");
String disable="";
String disable2="";

String CITY = request.getParameter("CITY");
String DEPT_ID = request.getParameter("DEPT_ID");


Map cityMap = DictionaryInfoCache.getDictionaryCache("CITY");
java.util.Calendar ca = java.util.Calendar.getInstance();
int curYear = ca.get(Calendar.YEAR);

if (CITY == null)
CITY = "";
if (DEPT_ID == null)
DEPT_ID = "";
if (CREATE_DATE1 == null)
CREATE_DATE1 = curYear+"-01-01";
if (CREATE_DATE2 == null)
CREATE_DATE2 = "";

String sql = "select sum(t.FEIYONG) as FEIYONG1,t.CITY from pxfy_tab t where 1=1 ";
if (CITY.length() > 0)
sql += " and t.CITY='" + CITY + "'";
if (DEPT_ID.length() > 0)
sql += " and t.DEPT_ID=" + DEPT_ID;
if (CREATE_DATE1.length() > 0)
sql += " and t.CREATEDATE>=to_date('" + CREATE_DATE1.trim()
+ " 00:00:00','yyyy-mm-dd hh24:mi:ss')";
if (CREATE_DATE2.length() > 0)
sql += " and t.CREATEDATE<to_date('" + CREATE_DATE2.trim()
+ " 23:59:59','yyyy-mm-dd hh24:mi:ss')";

sql+=" group by t.CITY";

sql = "select * from ("+sql+") order by FEIYONG1 desc" ;


Connection conn = null;
Statement st = null;
ResultSet rs = null;
ArrayList cblist = new ArrayList();
String sqla="";
try{
conn = DBUtil.getConnection();
PageSearchSupporter ps = new PageSearchSupporter();
if (pageNo < 1)
pageNo = 1;
pageInfo = ps.accountPageinfo(conn, pageNo, sql);
if (pageInfo.getCountPagenum() < pageNo) {
pageNo = pageInfo.getCountPagenum();
}
pageInfo = ps.accountPageinfo(conn, pageNo, sql);
st = conn.createStatement();
sqla = ps.getPageSearchSql(sql, pageNo);
rs = st.executeQuery(sqla);
System.out.println(sql);
while (rs.next()) {
String[] data=new String[3];
data[0]=""+rs.getString("city");
data[1]=""+rs.getFloat("FEIYONG1");
cblist.add(data);
}
}catch(Exception ex){
ex.printStackTrace();
}finally{
SQLUtils.closeAll(rs,st,conn);
}
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link href="/css/style.css" rel="stylesheet" type="text/css"/>
<link href="/js/datepicker/default/datepicker.css" rel="stylesheet" type="text/css">
<link href="/js/datepicker/whyGreen/datepicker.css" rel="stylesheet" type="text/css" disabled="disabled">
<script language="javascript" type="text/javascript" src="/js/datepicker/WdatePicker.js"></script>
<script language="JavaScript" src="/js/calendar.js"></script>
<script language="JavaScript" src="/js/coolcalendar.js"></script>
<script language=javascript src="/js/valid.js"></script>
<script language=javascript src="/js/include.js"></script>
<script language=javascript src="/js/info_wnd.js"></script>
<script language="javascript">
function addOption(obj, value, text, optionSelected){
if(obj != null)
{
var e = document.createElement("option");
e.value = value;
e.text = text;
obj.options.add(e);
if(optionSelected == 'selected')
e.selected = true;
}
}
function selectUser1(){
var win= openTargetWin("win","/workflow2/forms/sjgl/select_users.jsp?title=选择发布人&multiple=false&ACCOUNT=SQR&NAME=full_name", 600,400);
win.focus();
}
</script>
</head>
<body bgcolor="#FFFFFF" background="/images/mainback.gif"
leftmargin="0" topmargin="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="20" bgcolor="80B1DC">
您当前的位置是:<font color=black><B>培训费用统计查询&gt;&gt;</B> </font>
</td>
<td height="20" bgcolor="80B1DC">
<p align="right">
<a href="/main?functionId=DisplayFirstPage" target=_parent><img
src="/images/5.gif" alt="返回首页" border="0"> </a>
</p>
</td>
</tr>
</table>
<table width="100%" align="center" border="0" cellpadding="2"
cellspacing="1">
<form method="post" action="/workflow2/forms/pxlc/pxfy.jsp" Name="formQuery">
<tr bgcolor="#D0DDF0">
<td width="8%" rowspan=4 align="right">
查询条件
</td>
</tr>

<tr bgcolor="#D0DDF0">
<td align="right">部门:</td>
</td>
<td colspan=3>
<jsp:include page="//system/dept/includeDept.jsp">
<jsp:param name="formName" value="formQuery" />
<jsp:param name="elementName1" value="CITY" />
<jsp:param name="elementName2" value="DEPT_ID" />
<jsp:param name="element2Type" value="0"/>
<jsp:param name="disable" value="<%=disable %>" />
<jsp:param name="disable2" value="<%=disable2 %>" />
<jsp:param name="elementName1Value" value="<%=CITY %>" />
<jsp:param name="elementName2Value" value="<%=DEPT_ID %>" />
</jsp:include>
</td>
</tr>
<tr bgcolor="#D0DDF0">
<td align="right">培训开始日期:</td>
<td colspan=3>
<input type=text name="CREATE_DATE1" onClick="Calendar(this)"
value="<%=CREATE_DATE1 %>" size=12>

<input type=text name="CREATE_DATE2" onClick="Calendar(this)"
value="<%=CREATE_DATE2 %>" size=12>
</td>
</tr>
<tr bgcolor="#D0DDF0" align=center><td colspan=4><input class='button' type='submit' name='Submit7a' value='查询'></td></tr>
</form>
</table>
<table width="100%" border="0" align="center" cellpadding="2"
cellspacing="1" class="small">
<tr class="tableheader">
<td>序号</td>
<td>所在部门</td>
<td>培训费用</td>
</tr>
<%
int ii=0;
String sqyy="";
boolean t=true;
for(int i=0;cblist !=null && i<cblist.size();i++){
String[] data=(String[])cblist.get(i);
String tr = ii % 2 == 0 ? "tr1" : "tr2";
%>
<tr class="<%=tr %>" align="center">
<td><%=i+pageInfo.getCurRowNo() %></td>
<td><%=cityMap.get(data[0])%></td>
<td><a href="/workflow2/forms/pxlc/pxfy_view_tj_details.jsp?CITY=<%=data[0] %>&CREATE_DATE1=<%=CREATE_DATE1%>&CREATE_DATE2=<%=CREATE_DATE2%>"><%=data[1] %></td>
</tr>
<%ii++;
}
%>

</table>
<%
if (pageInfo != null) {
%>
<SCRIPT LANGUAGE=javascript>
<!--
function thisUrl(page){
document.FormTitle.curPageNo.value = page;
document.FormTitle.submit();
}
-->
</Script>
<table width="100%" border="0" cellpadding="2" cellspacing="0"
class="pages" align="center">
<form method="post" action="/workflow2/forms/pxlc/pxfy.jsp"
Name="FormTitle">
<input type=hidden name="CITY" value="<%=CITY%>">
<input type=hidden name="DEPT_ID" value="<%=DEPT_ID%>">
<input type=hidden name="CREATE_DATE1" value="<%=CREATE_DATE1%>">
<input type=hidden name="CREATE_DATE2" value="<%=CREATE_DATE2%>">
<tr>
<td>
<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td align='left'>
从第
<%=pageInfo.getCurRowNo()%>
条到第
<%=pageInfo.getCurRowNo() + ii - 1%>
条; 总记录数:
<%=pageInfo.getCountRownum()%>
(第
<%=pageInfo.getCurPageNo()%>
页; 共
<%=pageInfo.getCountPagenum()%>
页)
</td>
<td align='right'>
<input class='button' type='button' name='Submit8' value='首页'
<%=pageInfo.disabledInfo(pageInfo.THEFIRSTPAGE)%>
onClick="thisUrl(1);">
<input class='button' type='button' name='Submit6' value='上页'
<%=pageInfo.disabledInfo(pageInfo.THEFIRSTPAGE)%>
onClick="thisUrl(<%=pageInfo.getPrevPageNo()%>);">
到第
<input type='text' name='curPageNo' size='5' class='form'
value='<%=pageInfo.getCurPageNo()%>'>

<input
style='background-color: #FFFFFF;border: 1px solid #4B81D3;height: 20px;width: 30px;vertical-align: bottom;'
type="submit" value="Go..." />
<input class='button' type='button' name='Submit7' value='下页'
<%=pageInfo.disabledInfo(pageInfo.THELASTPAGE)%>
onClick="thisUrl(<%=pageInfo.getLastPageNo()%>);">
<input class='button' type='button' name='Submit9' value='末页'
<%=pageInfo.disabledInfo(pageInfo.THELASTPAGE)%>
onClick="thisUrl(<%=pageInfo.getCountPagenum()%>);">
</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
<%
}
%>
<table width=100%>
<tr>
<td align=center>
<input type=button class=button onclick="history.back()" value="返回">
</td>
</tr>
</table>

</body>
</html>

你可能感兴趣的:(查询)