📄 order_3_1.jsp
字号:
<%@ page contentType="text/html; charset=GB2312" %>
<%@ page import="com.hzs.order.*,java.util.*" %>
<jsp:useBean id="DB" scope="page" class="com.hzs.order.DBHandle" />
<%
if (session.getAttribute("grade")==null || session.getAttribute("user_nm")==null)
{
%>
<jsp:forward page="con_error.jsp">
<jsp:param name="error_nm" value="非 法 操 作" />
<jsp:param name="error_all" value="非法操作,请重新登陆!" />
</jsp:forward>
<%
}
%>
<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 { font-size: 14px; text-align: center}
-->
</style>
<script language="javascript" src="js/global.js"></script>
<script language="JavaScript">
<!--
function open_chose(htmlurl)
{
var newwin=window.open(htmlurl,"newwin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=550,height=300");
}
function init()
{
document.fo_main.tx_acount.value=0;
}
function count_price()
{
var mount=0;
var price=0;
GxTrimStr(document.fo_main.tx_mount);
if (GxIsEmpty(document.fo_main.tx_mount))
{
mount=0;
}
else
{
mount=document.fo_main.tx_mount.value;
}
GxTrimStr(document.fo_main.tx_price);
if (GxIsEmpty(document.fo_main.tx_price))
{
price=0;
}
else
{
price=document.fo_main.tx_price.value;
}
if (!GxNumberCheck(document.fo_main.tx_mount,"3"))
{
document.fo_main.tx_mount.select();
alert("请输入正整数!");
return false;
}
if (!GxNumberCheck(document.fo_main.tx_price,""))
{
document.fo_main.tx_price.select();
alert("请输入正确单价!");
return false;
}
document.fo_main.tx_acount.value=parseFloat(price)*parseInt(mount);
}
function do_del()
{
return confirm("该份定单将被删除,确定吗?!");
}
function go_page()
{
window.location.replace('order_user.jsp');
}
function confirm_all()
{
GxTrimStr(document.fo_main.tx_food);
if (GxIsEmpty(document.fo_main.tx_food))
{
document.fo_main.tx_food.select();
alert("请输入菜名!");
return false;
}
GxTrimStr(document.fo_main.tx_mount);
if (GxIsEmpty(document.fo_main.tx_mount))
{
document.fo_main.tx_mount.select();
alert("请输入份数!");
return false;
}
if (!GxNumberCheck(document.fo_main.tx_mount,"3"))
{
document.fo_main.tx_mount.select();
alert("请输入正整数!");
return false;
}
if (parseFloat(document.fo_main.tx_mount.value)==0)
{
document.fo_main.tx_mount.select();
alert("请输入正确份数!");
return false;
}
GxTrimStr(document.fo_main.tx_price);
if (GxIsEmpty(document.fo_main.tx_price))
{
document.fo_main.tx_price.select();
alert("请输入单价!");
return false;
}
if (!GxNumberCheck(document.fo_main.tx_price,""))
{
document.fo_main.tx_price.select();
alert("请输入正确单价!");
return false;
}
if (parseFloat(document.fo_main.tx_price.value)==0)
{
document.fo_main.tx_price.select();
alert("请输入正确单价!");
return false;
}
return true;
}
-->
</script>
</head>
<%
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);
%>
<body bgcolor="#FFFFFF" text="#000000" background="images/menu.gif" onload="init();">
<h2>---定 单 添 加--- </h2>
<center>
<form name="fo_main" method="post" action="order_3_2.jsp" onsubmit="return confirm_all();">
<table width="33%">
<tr>
<th>日 期:</th>
<td>
<div align="left">
<input type="text" readonly style="width:130;border:0 background-color:ffffff" name="tx_date" value=<%=strDate%>>
</div>
</td>
</tr>
<tr>
<th>菜 名:</th>
<td>
<div align="left">
<input type="text" readonly style="border-style:double;width=140;background-color:#DCDCDC" name="tx_food" value=>
<input type="button" name="bt_chose" value="选 择" onclick="open_chose('order_99_1.jsp');">
</div>
</td>
</tr>
<tr>
<th>份 数:</th>
<td>
<div align="left">
<input type="text" name="tx_mount" size="5" maxlength="2" onchange="return count_price();">
</div>
</td>
</tr>
<tr>
<th>单 价:</th>
<td>
<div align="left">
<input type="text" readonly style="border-style:double;width=40;background-color:#DCDCDC" name="tx_price" value="" onchange="return count_price();">
</div>
</td>
</tr>
<tr>
<th>总 价:</th>
<td>
<div align="left">
<input type="text" readonly style="border-style:double;width=80;background-color:#DCDCDC" name="tx_acount" value=>
<input type="hidden" name="hid_tel" >
</div>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="sb_1" value="添 加">
<input type="button" name="bt_1" value="返 回" onClick="go_page();">
</td>
</tr>
</table>
</form>
<br>
<%
Vector Result=new Vector();
try{
DB.connect();
Result=DB.select("SELECT ord_foodid,ord_what,ord_amount,ord_amount*ord_price FROM user_foodinfo where ord_usernm='"+session.getAttribute("user_nm")+"' and to_char(ord_date,'YYYY/MM/DD')='"+strDate+"'");
DB.close();
}
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>
<%
}
out.print("<h2>---今日已定饭菜一览---<br></h2>");
if (Result.size()==0)
{
out.print("<span class=\"help\">今天您还没有定过饭,您可以在上面预定!</span>");
}
else
{
out.print("<table><tr><th>编号:</th><th>定单内容:</th><th>份数:</th><th>总价:</th><th> </th><th> </th></tr>");
int i;
for (i=0;i<Result.size();i++)
{
String tempstr=Result.elementAt(i).toString();
out.print("<tr><td>"+Result.elementAt(i++).toString()+"</td><td>"+Result.elementAt(i++).toString()+"</td><td>"+Result.elementAt(i++).toString()+"</td><td>"+Result.elementAt(i).toString()+"</td><td width=\"50\"><a href=\"order_3_3.jsp?id="+tempstr+"\">编 辑</a></td><td width=\"50\"><a href=\"order_3_5.jsp?id="+tempstr+"\" onclick=\"return do_del();\">删 除</a></td></tr>");
}
}
%>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -