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

📄 order_8_1.jsp

📁 该系统是一个B/S结构的公司定饭系统,整套软件由JSP编制,希望大家能够多提宝贵意见,但请不要将它应用于商业环境,如实在要使用的话,请与作者联系!(使用此系统无比要有ORACLE8i以上版本数据库!)
💻 JSP
字号:
<%@ page contentType="text/html; charset=GB2312" %>
<%@ page import="com.hzs.order.*,java.util.*,java.lang.*"%>
<jsp:useBean id="dbHandle" class="com.hzs.order.DBHandle" scope="page" />
<%
	if (session.getAttribute("grade")==null||!(session.getAttribute("grade").equals("1")))
	{
%>
      <jsp:forward page="con_error.jsp">
      <jsp:param name="error_nm" value="非 法 操 作" />
      <jsp:param name="error_all" value="非法操作,您并不是管理员!" />
     </jsp:forward>
<%
	}
%>

<script language="JavaScript">
	function LxMode(){
		document.modeForm.submit();
	}
</script>

<html>
<head>
<title>今日定单查询</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="css/global.css" type="text/css">
<style type="text/css">
<!--
td {  text-align: center}
-->
</style>
</head>
<body background="images/menu.gif">
<%
	Date date=new Date();
	Calendar calendar=Calendar.getInstance();
	calendar.setTime(date);
	int month=calendar.get(2)+1;//月从零开始,加一处理
	String strDate=calendar.get(1)+"/"+month+"/"+calendar.get(5);
	out.print(strDate);
	String custom="checked";
	String conclusion="";
	String temp=request.getParameter("queryMode");
	if(temp==null||temp.equals("customer")){//用户清单模式
		custom="checked";
		conclusion=" ";
	}else{
		custom=" ";
		conclusion="checked";
	}
 %>
	<center>
  		<h2>---<%=session.getAttribute("group")%>组今日定单查询--- </h2>
 				 <form name="modeForm" method="post" action="order_8_1.jsp">
    				<table width="80%" border="0">
    				  <tr>
       					 <td width="50%">用户定饭情况
      					    <input type="radio" name="queryMode" value="customer" <%=custom %> onclick="LxMode();">
      					  </td>
      				  	<td width="41%">汇总情况
          					<input type="radio" name="queryMode" value="conclusion" <%=conclusion %> onclick="LxMode();">
        				</td>
      				</tr>
   				 </table>
   				</form>

  <%

	if(custom.equals("checked")){//	用户定饭情况
		float sum=0;
		float allSum=0;
		int counter=0;
		int i=0;
		String strSQL="SELECT ord_usernm,ord_what,ord_tel,ord_price,ord_amount ,ord_price*ord_amount FROM user_foodinfo where ord_date=to_date('"+strDate+"',('YYYY/MM/DD')) AND ORD_USGROUP='"+session.getAttribute("group")+"' ORDER BY ord_tel";
		try{
			dbHandle.connect();
			Vector vecStatistics=dbHandle.select(strSQL);
			int numberOfRecorders=vecStatistics.size();
			if(numberOfRecorders>0){//
				while(counter<numberOfRecorders){//
				%>
  					<table align="center" width="90%" border="0" bgcolor="#DBDBDB">
   						 <tr  bgcolor="#FFFFFF">
      						<th>用户名</th>

     						<th>菜 名</th>

      						<th>单 价</th>

      						<th>数 量</th>

      						<th>共 计</th>
						</tr>
					<%
					strSQL="SELECT cp_nm FROM all_cp WHERE cp_id='"+vecStatistics.elementAt(counter+2).toString()+"'";
					//out.print(strSQL);
					Vector vecCompany=dbHandle.select(strSQL);
					int numberOfCompanies=vecCompany.size();
					String companyName=new String();
					if(numberOfCompanies!=0){
						companyName=vecCompany.elementAt(0).toString();
					}else{
						%>
						<jsp:forward page="con_error.jsp">
      						<jsp:param name="error_nm" value="数 据 库 错 误" />
      						<jsp:param name="error_all" value="公司名不匹配"/>
     					</jsp:forward>
						<%
					}
					//String companyName=vecCompany.elementAt(2).toString();
					out.print("<font face=\"宋体\" color=\"#061B6C\"><b>"+companyName+"(预定电话:"+vecStatistics.elementAt(counter+2).toString()+")</b></font>");

					for(i=counter;i<vecStatistics.size();i+=6){
					%>

    					<tr bgcolor="#FFFFFF">
      						<td><%=vecStatistics.elementAt(i) %></td>

      						<td><%=vecStatistics.elementAt(i+1) %></td>

     						<td><%=dbHandle.toFloat(vecStatistics.elementAt(i+3).toString()) %></td>

      						<td><%=vecStatistics.elementAt(i+4) %></td>

     						<td><%=dbHandle.toFloat(vecStatistics.elementAt(i+5).toString()) %></td>
						</tr>
					<%
					//Float.parseFloat()无法使用,待解决
						Float flo=new Float(vecStatistics.elementAt(i+5).toString());
						sum+=flo.floatValue() ;
						if((i+6+2)>numberOfRecorders || !((vecStatistics.elementAt(i+6+2).toString()).equals(vecStatistics.elementAt(i+2).toString()))){
							//out.print(i);
							i+=6;
							//out.println(!((vecStatistics.elementAt(i+6+2).toString()).equals(vecStatistics.elementAt(i+2).toString())));
							break;
						}
					}
					%>

    				<tr bgcolor="#FFFFFF">
      					<td>&nbsp;</td>

      					<td>&nbsp;</td>

						<td>&nbsp;</td>

      					<th>小 计:</th>

      					<td><%=sum %></td>
					</tr>
				</table>
			<%
			//out.println("i="+i+"counter="+counter);
			counter=i;
			//out.println("i="+i+"counter="+counter+"numberOfRecorders="+numberOfRecorders);
			allSum+=sum;
			sum=0;
			out.print("<br>");
			}//end of while
			%>
			<hr>

  <br>
  <font face="宋体"><b><font color="#666666">总 计:</font></b></font><%=allSum %> <br>
  <br>
				<input type="button" name="bt_2" value="打 印" onclick="print();">
	    		<input type="button" name="bt_3" value="关  闭" onclick="self.close();">
			</center>
			<%
			}else{
				out.print("<center><h2>今日无定单记录</h2>");
				out.print("<INPUT type='button' name='bt1' value='关 闭' onclick='self.close();'></center>");
			}
		}catch (DBException e){
		%>
			<jsp:forward page="con_error.jsp">
      		<jsp:param name="error_nm" value="数 据 库 错 误" />
      		<jsp:param name="error_all" value="<%=e.getMessage()%>"/>
     		</jsp:forward>
			<p align="center">
  		<%

		}finally{
			dbHandle.close();
		}
	}else{//汇总情况
		int intConSum=0;
		int intConAllsum=0;
		int intI=0;
		int intMealAmount=0;
		float floMealPrice=0,floMealSum=0,floCompanySum=0,allMealSum=0;
		int intConCounter=0;
		String mealName=new String();
		String strConSQL=new String();
		strConSQL="SELECT ord_what,ord_price,ord_amount,ord_price*ord_amount, ord_usernm,ord_tel FROM user_foodinfo where ord_date=to_date('"+strDate+"',('YYYY/MM/DD')) AND ORD_USGROUP='"+session.getAttribute("group")+"' ORDER BY ord_tel,ord_what";
		try{
			dbHandle.connect();
			Vector vecConclusion=dbHandle.select(strConSQL);
			//out.print(vecConclusion);
			int intConNumber=vecConclusion.size();
			if(intConNumber>0){//有记录
				while(intConCounter<intConNumber){//区分公司
				%>
				<center>
					<table align="center" width="90%" border="0" bgcolor="#DBDBDB">
   						 <tr  bgcolor="#FFFFFF">
      						<th>菜 名</th>

      						<th>单 价</th>

      						<th>数 量</th>

      						<th>共 计</th>
						</tr>
				<%
					strConSQL="SELECT cp_nm FROM all_cp WHERE cp_id='"+vecConclusion.elementAt(intConCounter+5).toString()+"'";
					//out.print(strConSQL);
					Vector vecConCompany=dbHandle.select(strConSQL);
					int numberOfConCompanies=vecConCompany.size();
					if(numberOfConCompanies==0){
						%>
						<jsp:forward page="con_error.jsp">
      						<jsp:param name="error_nm" value="数 据 库 错 误" />
      						<jsp:param name="error_all" value="公司名不匹配"/>
     					</jsp:forward>
						<%
					}
					//String companyConName=new String();
					String companyName=vecConCompany.elementAt(0).toString();
					out.print("<font face=\"宋体\" color=\"#061B6C\"><b>"+companyName+"(预定电话:"+vecConclusion.elementAt(intConCounter+5).toString()+")</b></font>");
					do{
						mealName=vecConclusion.elementAt(intConCounter).toString();
						floMealPrice=dbHandle.toFloat(vecConclusion.elementAt(intConCounter+1).toString());
						do{

							intMealAmount+=Integer.parseInt(vecConclusion.elementAt(intConCounter+2).toString());
							floMealSum+=dbHandle.toFloat(vecConclusion.elementAt(intConCounter+3).toString());
							intConCounter+=6;//记录移动到后一条
						}while((intConCounter)<intConNumber&&
						(vecConclusion.elementAt(intConCounter-6).toString()).equals(vecConclusion.elementAt(intConCounter).toString()));//已经进行统计的记录的菜名与本记录是否相同
					%>
						<tr bgcolor="#FFFFFF">
      						<td><%=mealName%></td>

      						<td><%=floMealPrice %></td>

     						<td><%=intMealAmount%></td>

      						<td><%=floMealSum%></td>
						</tr>
					<%
					floCompanySum+=floMealSum;
					floMealPrice=0;
					intMealAmount=0;
					floMealSum=0;
					}while((intConCounter)<intConNumber&&
						(vecConclusion.elementAt(intConCounter-1).toString()).equals(vecConclusion.elementAt(intConCounter+5).toString()));////已经进行统计的记录的公司名与本记录是否相同
					%>
						<tr bgcolor="#FFFFFF">
      						<td>&nbsp;</td>

      						<td>&nbsp;</td>

     						<th>小 计:</th>

      						<td><%=floCompanySum%></td>
						</tr>
					</table>
					<br>
				<%
				allMealSum+=floCompanySum;
				floCompanySum=0;
				}//end of while
				%>
					<hr>

  					<br>
  					<font face="宋体"><b><font color="#666666">总 计:</font></b></font><%=allMealSum %> <br>
 					<br>
				<input type="button" name="bt_2" value="打 印" onclick="print();">
	    		<input type="button" name="bt_3" value="关  闭" onclick="self.close();">
			</center>
			<%}else{
				out.print("<center><h2>今日无定单记录</h2>");
				out.print("<INPUT type='button' name='bt1' value='关 闭' onclick='self.close();'></center>");
			}
		}catch(DBException e){
		%>
			<jsp:forward page="con_error.jsp">
      		<jsp:param name="error_nm" value="数 据 库 错 误" />
      		<jsp:param name="error_all" value="<%=e.getMessage()%>"/>
     		</jsp:forward>
		<%
		}finally{
			dbHandle.close();
		}
	}
	%>


</body>
</html>

⌨️ 快捷键说明

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