📄 sale.jsp
字号:
<%@ page language="java" pageEncoding="GB2312" import="sell.MerchItem"%>
<jsp:useBean id="dealingbean" class="sell.DealingBean" scope="session"></jsp:useBean>
<html>
<head>
<title>商品销售</title>
<style>
td{font-family:Tahoma;font-size:15px;}
a{text-decoration:none;}
a:hover{text-decoration:underline;}
</style>
<script language="JavaScript">
function numberOnly(){
if (!((event.keyCode>=48)&&(event.keyCode<=57))||(event.keyCode==8)||(event.keyCode==10)||(event.keyCode==13))
event.returnValue=false;
if((event.shiftKey)&&((event.keyCode>=48)&&(event.keyCode<=57))) event.returnValue=false;
}
function moneyOnly()
{
if (!(((event.keyCode>=48)&&(event.keyCode<=57))||(event.keyCode==8)||(event.keyCode==10)||(event.keyCode==13)||(event.keyCode==46)))
event.returnValue=false
if((event.shiftKey)&&((event.keyCode>=48)&&(event.keyCode<=57))) event.returnValue=false
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style type="text/css">
<!--
body {
background-image: url(../image/backgrounds.jpg);
}
-->
</style></head>
<body text="#666666">
<div id="Layer1" style="position:absolute; left:66px; top:15px; width:450px; height:305px; z-index:1">
<table width="440" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25"><img src="../image/obj_sba1.gif" width="25" height="25"></td>
<td width="81"><img src="../image/obj_sba_topics.gif" width="81" height="25"></td>
<td width="319"><img src="../image/obj_sba2.gif" width="339" height="25"></td>
<td width="15"><img src="../image/obj_sba3.gif" width="15" height="25"></td>
</tr>
</table>
<p>
<p>
交易额:
<span id="DealingPrice"><%=dealingbean.getDealingPrice()%>
元</span>
找零:
<%
float gathering = 0;
String gatheringstr = request.getParameter("Gathering");
if (gatheringstr != null) {
try {
gathering = Float.parseFloat(gatheringstr);
} catch (NumberFormatException e) {
}
}
%>
<%
if (dealingbean.getDealingPrice() != 0 || gatheringstr != null) {
%>
<span id="Gmoney"><%=gathering - dealingbean.getDealingPrice()%>
元</span>
<%
} else {
%>
<span id="Gmoney"><%=gathering%>
元</span>
<%
}
%>
<form name="saleform" mothod="post" action="SellServlet">
收款:
<input type="text" name="Gathering" maxlength="8" size="15" onKeyPress="moneyOnly()" onkeyup="if(value.indexOf('.')==-1)value=value.replace(/[^\d]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''));">
元
<input type="submit" value="完成销售"
onClick='saleform.action.value="SuccessSale";'>
<input type="submit" value="取消销售"
onClick='saleform.action.value="CancelSell";'>
<input type="hidden" value="" name="action">
</form>
<form name="dealingform" method="post" action="SellServlet">
<table width="500" border="0">
<tr>
<td height="80" style="">
条形码:
<input type="text" name="BarCode" maxlength="13" size="15" onKeyPress="numberOnly()" onkeyup="value=value.replace(/[^\d]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''));">
数量:
<input type="text" name="SaleNum" maxlength="4" size="15" onKeyPress="numberOnly()" onkeyup="value=value.replace(/[^\d]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''));">
<input type="submit" value="提交"
onClick='dealingform.action.value="SellAddItem";'>
<input type="hidden" value="" name="action">
</td>
</tr>
</table>
<table width="440" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25"><img src="../image/obj_sba1.gif" width="25" height="25"></td>
<td width="81"><img src="../image/obj_sba_topics.gif" width="81" height="25"></td>
<td width="319"><img src="../image/obj_sba2.gif" width="339" height="25"></td>
<td width="15"><img src="../image/obj_sba3.gif" width="15" height="25"></td>
</tr>
</table>
</form>
<%
MerchItem[] miArr = dealingbean.getAllItem();
if (miArr.length != 0) {
%>
<table width="440" border="1" cellpadding="1" cellspacing="0">
<tr bgcolor="#EBEBEB">
<th width="80" scope="col">
编号
</th>
<th width="100" scope="col">
名称
</th>
<th width="80" scope="col">
价格
</th>
<th width="80" scope="col">
数量
</th>
<th width="80" scope="col">
取消
</th>
</tr>
<%
for (MerchItem mi : miArr) {
%>
<tr>
<th width="80" scope="col">
<%=mi.getMerchID()%>
</th>
<th width="120" scope="col">
<%=mi.getMerchName()%>
</th>
<th width="80" scope="col">
<%=mi.getCurPrice()%>
</th>
<th width="80" scope="col">
<%=mi.getSaleNum()%>
</th>
<th width="80" scope="col">
<div align="center">
<a href="delitem.jsp?MerchID=<%=mi.getMerchID()%>"><font color="#666666">删除</font></a>
</div>
</th>
</tr>
<%
}
%>
</table>
<%
}
%>
<%
String success = (String) request.getAttribute("success");
if ("null".equals(success)) {
%>
<script language="javascript">
alert("商品条形码和数量不能为空!");
</script>
<%
request.removeAttribute("success");
} else if ("unsale".equals(success)) {
%>
<script language="javascript">
alert("您还没有购买商品!");
</script>
<%
request.removeAttribute("success");
} else if ("failue".equals(success)) {
%>
<script language="javascript">
alert("不存在你输入的商品!");
</script>
<%
request.removeAttribute("success");
} else if ("success".equals(success)) {
%>
<script language="javascript">
alert("销售成功!");
</script>
<%
request.removeAttribute("success");
} else if ("gnull".equals(success)) {
%>
<script language="javascript">
alert("请输入收款!");
</script>
<%
request.removeAttribute("success");
} else if ("money".equals(success)) {
%>
<script language="javascript">
alert("金额不足!");
</script>
<%
request.removeAttribute("success");
}
%>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -