📄 productquery_do.jsp
字号:
<script language="JavaScript">
<!--
function CheckForm()
{
alert("错误!!!");
return false;
}
// -->
</script>
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ page import="java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>物品信息显示</title>
</head>
<body>
<jsp:useBean id="dbcon" scope="session" class="bb.Dbcon" />
<jsp:useBean id="login" scope="session" class="bb.login" />
<%if(login.dept!=1&&login.dept!=5)
{
%>
<jsp:forward page="index.jsp"/>
<%
}
%>
<%
ResultSet rs=null;
String sql=null;
Connection con=dbcon.getConn();
String pro_name=dbcon.getStr(request.getParameter("pro_name"));
String type=dbcon.getStr(request.getParameter("type"));
String year=request.getParameter("year");
String month=request.getParameter("month");
String day=request.getParameter("day");
String year1=request.getParameter("year1");
String month1=request.getParameter("month1");
String day1=request.getParameter("day1");
String sto_price1=request.getParameter("sto_price");
String price1=request.getParameter("price");
String quantity1=request.getParameter("quantity");
String pro_mer1=request.getParameter("pro_mer");
if(type==null||year==null||month==null||day==null||year1==null||month1==null||day1==null)
{
%>
<script language="JavaScript">
CheckForm();
document.location.href="stock.jsp"
</script>
<%
}
if(pro_name==null)
{
pro_name="";
}
if(type==null)
{
type="";
}
if(year==null)
{
year="";
}
if(month==null)
{
month="";
}
if(day==null)
{
day="";
}
if(year1==null)
{
year1="";
}
if(month1==null)
{
month1="";
}
if(day1==null)
{
day1="";
}
if(sto_price1==null)
{
sto_price1="";
}
if(price1==null)
{
price1="";
}
if(quantity1==null)
{
quantity1="";
}
if(pro_mer1==null)
{
pro_mer1="";
}
sql="select * from tpb.product where";
if(!pro_name.equals(""))
{
sql+=" pro_name='"+pro_name+"'";
}else
{
sql+=" pro_name like '%'";
}
if(!type.equals("0"))
{
sql+=" and type='"+type+"'";
}
if(!year.equals("0")||!month.equals("0")||!day.equals("0"))
{
sql+=" and manu_date like '"+year+"%"+month+"%"+day+"'";
}
if(!year1.equals("0")||!month1.equals("0")||!day1.equals("0"))
{
sql+=" and avail_date like '"+year1+"%"+month1+"%"+day1+"'";
}
if(!sto_price1.equals(""))
{
float sto_price=Float.parseFloat(sto_price1);
sql+=" and sto_price="+sto_price;
}
if(!price1.equals(""))
{
float price=Float.parseFloat(price1);
sql+=" and price="+price;
}
if(!quantity1.equals(""))
{
int quantity=Integer.parseInt(quantity1);
sql+=" and quantity="+quantity;
}
if(!pro_mer1.equals(""))
{
int pro_mer=Integer.parseInt(pro_mer1);
sql+=" and pro_mer="+pro_mer;
}
%>
<div align="center"><span class="style3">物品信息显示</span><BR>
</div>
<BR>
<table border=2 bordercolor="#FF0000" align="center">
<tr>
<td>商品编码</td>
<td>商品名称</td>
<td>商品类别</td>
<td>生产日期</td>
<td>有效日期</td>
<td>进价(元)</td>
<td>单价(元)</td>
<td>数量</td>
<td>供应商</td>
<td>删除</td>
</tr>
<%
Statement stmt=con.createStatement();
rs=stmt.executeQuery(sql);
while(rs.next())
{
%>
<tr>
<td><%=rs.getString("pro_id") %></td>
<td><%=rs.getString("pro_name") %></td>
<td><%=rs.getString("type") %></td>
<td><%=rs.getString("manu_date") %></td>
<td><%=rs.getString("avail_date") %></td>
<td><%=rs.getString("sto_price") %></td>
<td><%=rs.getString("price") %></td>
<td><%=rs.getString("quantity") %></td>
<td><%=rs.getString("pro_mer") %></td>
<td><a href="productDelete.jsp?pro_id=<%=rs.getString("pro_id")%>" onclick="if (confirm('确定要删除商品吗')) { var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;f.submit(); };return false;">删除</a> </td>
</tr>
<%
}
%>
</table>
<%
rs.close();
stmt.close();
dbcon.Close();
%>
<hr>
返回进货管理页面:
<a href="productQuery.jsp">返回</a>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -