ImportGoodsBill.jsp
资源名称:barcode.rar [点击查看]
上传用户:wenzhanhao
上传日期:2022-03-28
资源大小:9150k
文件大小:14k
源码类别:
百货/超市行业
开发平台:
Visual C++
- <%@ page contentType="text/html; charset=gbk" language="java" %>
- <%@ page import="mediastore.web.global.*"%>
- <%@ page import="mediastore.web.form.*"%>
- <%@ page import="java.util.*"%>
- <body onload="document.form1.goodsid.focus()">
- <script language="JavaScript">
- //去掉空格
- function Trim(str){
- if(str.charAt(0) == " "){
- str = str.slice(1);
- str = Trim(str);
- }
- return str;
- }
- //判断是否是空
- function isEmpty(pObj,errMsg){
- var obj = eval(pObj);
- if( obj == null || Trim(obj.value) == ""){
- if (errMsg == null || errMsg =="")
- alert("输入为空");
- else
- alert(errMsg);
- obj.focus();
- return false;
- }
- return true;
- }
- //判断是否是整数
- function isNumber(pObj,errMsg){
- var obj = eval(pObj);
- strRef = "1234567890";
- if(!isEmpty(pObj,errMsg))return false;
- for (i=0;i<obj.value.length;i++) {
- tempChar= obj.value.substring(i,i+1);
- if (strRef.indexOf(tempChar,0)==-1) {
- if (errMsg == null || errMsg =="")
- alert("数据不符合要求,请检查");
- else
- alert(errMsg);
- if(obj.type=="text")
- obj.focus();
- return false;
- }
- }
- return true;
- }
- //判断是否是小数
- function isFloat(pObj,errMsg){
- var obj = eval(pObj);
- strRef = "1234567890.";
- if(!isEmpty(pObj,errMsg))return false;
- for (i=0;i<obj.value.length;i++) {
- tempChar= obj.value.substring(i,i+1);
- if (strRef.indexOf(tempChar,0)==-1) {
- if (errMsg == null || errMsg =="")
- alert("数据不符合要求,请检查");
- else
- alert(errMsg);
- if(obj.type=="text")
- obj.focus();
- return false;
- }
- }
- return true;
- }
- function verify(form){
- if (Trim(form.goodsid.value) == "" | form.goodsid.value == null)
- {
- alert("请输入货物标识");
- form.goodsid.value=""
- form.goodsid.focus();
- return (false);
- }
- }
- //当列表中数量和单价发生变化时激活
- function updateGoodsAandUP(){
- var errMsg;
- var amount_num = document.form2.importamount.length;
- var unitpr_num = document.form2.importamount.length;
- //amount_num == unitpr_num
- if(amount_num == null)
- {//只有一项
- var isNumberFlage = 'yes';//默认为“是数字”
- if(isNumber(document.form2.importamount)==false)
- {
- isNumberFlage = 'no';
- }
- if(isFloat(document.form2.importunitprice)==false)
- {
- isNumberFlage = 'no';
- }
- if(isNumberFlage=='yes')
- {//数字
- //计算总进价
- totalp = 0;
- totalp = totalp+(document.form2.importamount.value * document.form2.importunitprice.value);
- document.form2.totalprice.value = totalp;
- document.form2.action = "importGoodsBillGoodsUpdtAUP.do";
- document.form2.submit();
- }
- else
- {//非数字
- document.form2.totalprice.value = "请修改数量或单价";
- }
- }
- else
- {//两项以上
- var isNumberFlage = 'yes';//默认为“是数字”
- for(iii=0; iii<amount_num; iii++)
- {
- //alert(document.form2.importamount[iii].value);
- if(isNumber(document.form2.importamount[iii])==false)
- {
- isNumberFlage = 'no';
- }
- //alert(document.form2.importunitprice[iii].value);
- if(isFloat(document.form2.importunitprice[iii])==false)
- {
- isNumberFlage = 'no';
- }
- }
- //alert('isNumberFlage:'+isNumberFlage);
- if(isNumberFlage=='yes')
- {//数字
- //计算总进价
- totalp = 0;
- for(jjj=0; jjj<amount_num; jjj++)
- {
- totalp = totalp+(document.form2.importamount[jjj].value * document.form2.importunitprice[jjj].value);
- //alert(document.form2.importamount[jjj].value * document.form2.importunitprice[jjj].value);
- }
- //alert("total:"+totalp);
- document.form2.totalprice.value = totalp;
- document.form2.action = "importGoodsBillGoodsUpdtAUP.do";
- document.form2.submit();
- }
- else
- {//非数字
- document.form2.totalprice.value = "请修改数量或单价";
- }
- }
- }
- function deleteAllGoods()
- {
- try{
- var goods_num = document.form2.goodsid.length;
- if(goods_num == null || document.form2.goodsid == null)
- {//
- //alert("空列表");
- }
- }catch(e)
- {
- alert("货物列表目前为空");
- document.form1.goodsid.focus();
- return;
- }
- if(confirm("确定要清空该货物列表吗?"))
- {
- document.form2.action = "importGoodsBillGoodsDelAll.do";
- document.form2.submit();
- }
- }
- function deleteATempImportGoods(billid, goodsid)
- {
- if(confirm("确定要删除该货物吗?"))
- {
- document.form2.action = "importGoodsBillGoodsDelete.do?maxBillId="+billid+"&goodsId="+goodsid+"";
- document.form2.submit();
- }
- }
- function submitAllGoods()
- {
- //查看该单是否是空列表,空列表就不提交
- try{
- var goods_num = document.form2.goodsid.length;
- if(goods_num == null || document.form2.goodsid == null)
- {//
- //alert("空列表");
- }
- }catch(e)
- {
- alert("请添加货物后再提交进货单");
- document.form1.goodsid.focus();
- return;
- }
- //检查数量和单价是否都为数字
- var errMsg;
- var amount_num = document.form2.importamount.length;
- var unitpr_num = document.form2.importunitprice.length;
- //amount_num == unitpr_num
- if(amount_num == null)
- {//只有一项
- var isNumberFlage = 'yes';//默认为“是数字”
- if(isNumber(document.form2.importamount)==false)
- {
- isNumberFlage = 'no';
- }
- if(isFloat(document.form2.importunitprice)==false)
- {
- isNumberFlage = 'no';
- }
- if(isNumberFlage=='yes')
- {//数字
- //计算总进价
- totalp = 0;
- totalp = totalp+(document.form2.importamount.value * document.form2.importunitprice.value);
- document.form2.totalprice.value = totalp;
- if(confirm("确定要提交该进货单吗?"))
- {
- document.form2.action = "importGoodsBillGoodsSubmit.do";
- document.form2.submit();
- }
- }
- else
- {//非数字
- document.form2.totalprice.value = "请修改数量或单价";
- }
- }
- else
- {//两项以上
- var isNumberFlage = 'yes';//默认为“是数字”
- for(iii=0; iii<amount_num; iii++)
- {
- //alert(document.form2.importamount[iii].value);
- if(isNumber(document.form2.importamount[iii])==false)
- {
- isNumberFlage = 'no';
- }
- //alert(document.form2.importunitprice[iii].value);
- if(isFloat(document.form2.importunitprice[iii])==false)
- {
- isNumberFlage = 'no';
- }
- }
- //alert('isNumberFlage:'+isNumberFlage);
- if(isNumberFlage=='yes')
- {//数字
- //计算总进价
- totalp = 0;
- for(jjj=0; jjj<amount_num; jjj++)
- {
- totalp = totalp+(document.form2.importamount[jjj].value * document.form2.importunitprice[jjj].value);
- //alert(document.form2.importamount[jjj].value * document.form2.importunitprice[jjj].value);
- }
- //alert("total:"+totalp);
- document.form2.totalprice.value = totalp;
- if(confirm("确定要提交该进货单吗?"))
- {
- document.form2.action = "importGoodsBillGoodsSubmit.do";
- document.form2.submit();
- }
- }
- else
- {//非数字
- document.form2.totalprice.value = "请修改数量或单价";
- }
- }
- }
- function showNewBill()
- {
- document.form2.action = "importGoodsBillShowNew.do";
- document.form2.submit();
- }
- function updateGoodsName(goodsid, newgoodsname)
- {
- document.form2.action = "importGoodsBillGoodsUpdtName.do?updategoodsid="+goodsid+"&newgoodsname="+newgoodsname;
- document.form2.submit();
- }
- </script>
- <table width="768" border="0" align="center" cellpadding="0" cellspacing="0">
- <tr>
- <td width="5" rowspan="4" class="trtable"></td>
- <td width="6" bgcolor="#214984" height="1"></td>
- <td rowspan="4" bgcolor="#214984" width="1" height="1"></td>
- <td bgcolor="#214984" class="10p" colspan="2" height="1"></td>
- <td rowspan="4" width="1" bgcolor="#214984" height="1"></td>
- <td bgcolor="#214984" width="5" height="1"></td>
- <td width="5" rowspan="4" class="trtable"></td>
- </tr>
- <tr>
- <td width="6"></td>
- <td width="379" height="20" class="mainhead">进货单录入</td>
- <td class="mainhead" width="379" height="20"> </td>
- <td width="5"></td>
- </tr>
- <tr>
- <td width="6"></td>
- <td valign="top" colspan="2">
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td height="300" align="center" valign="top">
- <%
- ImportGoodsBillFB igbfb = (ImportGoodsBillFB)request.getAttribute(Globals.REQUEST_IMPORTGOODSBILL);
- int maxBillId = igbfb.getMaxBillId();
- List goodsList = igbfb.getGoodsList();
- %>
- <form name="form1" method="post" action="importGoodsBillGoodsInsert.do" onSubmit="javascript:return verify(this);">
- <font color=#215385><b>添加货物</b></font>
- <IMG src="images/line1.gif" border=0>
- <br>
- <input type="hidden" name="maxBillId" value="<%=maxBillId%>">
- <TABLE width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="#FFFFFF" class="mailtable">
- <tr>
- <td align="right" width=20%>
- <b>进货单号:</b>
- </td>
- <td width=20%>
- <INPUT class=none name="billid" type="text" size="30" value="<%=maxBillId%>" disabled>
- </td>
- <td width=30%> </td>
- </tr>
- <tr>
- <td align="right" width=20%>
- <b>货物标识:</b>
- </td>
- <td width=20%>
- <INPUT class=none name="goodsid" type="text" size="30" value="" >
- </td>
- <td>
- <input name=submit type=submit value="添加" ></td>
- </tr>
- </TABLE>
- </form>
- <br>
- <br>
- <form name="form2" method="post" action="" >
- <font color=#215385><b>货物列表</b></font>
- <IMG src="images/line1.gif" border=0>
- <input type="hidden" name="curBillId" value="<%=maxBillId%>">
- <TABLE width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="#FFFFFF" class="mailtable">
- <%
- if(goodsList.size()>0)
- {
- %>
- <tr bgcolor="#C2CEDC">
- <th></th>
- <th>货物标识</th>
- <th>货物名称</th>
- <th>目前库存</th>
- <th>进货数量</th>
- <th>进货单价</th>
- <th>录入人员</th>
- <th>删除</th>
- </tr>
- <%
- }
- %>
- <%
- int index = 0;
- GoodsImportGoodsInfo tmpInfo = null;
- float totalPrice = 0;
- for (index=0; index<goodsList.size(); index++)
- {
- tmpInfo = (GoodsImportGoodsInfo)goodsList.get(index);
- totalPrice = totalPrice + (tmpInfo.getImportAmount() * tmpInfo.getImportUnitPrice());
- %>
- <tr <%if((index%2)==1){%>bgcolor="#CAE4F4"<%}%> >
- <td align='center' width=2%><a href="<%= request.getContextPath() + "/goodsInfoView.do?goodsid=" + tmpInfo.getGoodsId() %>" target='goodsinfo'><IMG src="images/goods.gif" border=0 alt='查看货物信息'></a></td>
- <td align='center'><%= tmpInfo.getGoodsId() %>
- <input type="hidden" name="goodsid" value="<%= tmpInfo.getGoodsId() %>">
- </td>
- <td align='center'>
- <%
- if(tmpInfo.getGoodsName().equals("<font color=red>新进货</font>"))
- {
- %>
- <INPUT name="goodsname" type="text" size=23 value="新进货" onChange="updateGoodsName('<%= tmpInfo.getGoodsId() %>', this.value)">
- <%
- }
- else
- {
- %>
- <INPUT name="goodsname" type="text" size=23 value="<%= tmpInfo.getGoodsName() %>" onChange="updateGoodsName('<%= tmpInfo.getGoodsId() %>', this.value)">
- <%
- }
- %>
- </td>
- <td align='center'><%= tmpInfo.getCurRepertoryAmount() %></td>
- <td align='center'>
- <input type="text" name="importamount" value="<%= tmpInfo.getImportAmount() %>" size=5 onChange="updateGoodsAandUP()">
- </td>
- <td align='center'>
- <input type="text" name="importunitprice" value="<%= tmpInfo.getImportUnitPrice() %>" size=8 onChange="updateGoodsAandUP()">
- </td>
- <td align='center'><%= tmpInfo.getCreatePerson() %><input type="hidden" name="createperson" value="<%= tmpInfo.getCreatePerson() %>"></td>
- <td align='center'>
- <a href="javascript:deleteATempImportGoods('<%=maxBillId%>', '<%= tmpInfo.getGoodsId() %>') "><IMG src="images/delto.gif" border=0></a>
- </td>
- </tr>
- <%
- }
- %>
- </TABLE>
- <TABLE width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="#FFFFFF" class="mailtable">
- <tr>
- <td align="right" >
- <b>进货单号:</b>
- </td>
- <td >
- <INPUT class=none name="billid" type="text" size="30" value="<%=maxBillId%>" disabled>
- </td>
- <td align="right" >
- <b>发货人员:</b>
- </td>
- <td >
- <INPUT class=none name="sendpersons" type="text" size="30" value="" >
- </td>
- </tr>
- <tr>
- <td align="right" >
- <b>进货总价:</b>
- </td>
- <td >
- <INPUT class=none name="totalprice" type="text" size="30" value="<%=totalPrice%>" disabled>
- </td>
- <td align="right" >
- <b>是否付款:</b>
- </td>
- <td >
-
- <input type="radio" name="payornot" value="1" >已付款
-
- <input type="radio" name="payornot" value="0" checked>未付款
- </td>
- </tr>
- </TABLE>
- </form>
- <p><center>
- <input name=newbill type=button value="新进货单" onClick="showNewBill()">
-
- <input name=deleteall type=button value="清空列表" onClick="deleteAllGoods()">
-
- <input name=submitall type=button value="确认提交" onClick="submitAllGoods()">
- </center><p>
- </td>
- </tr>
- <tr>
- <td valign="middle" align="center"> </td>
- </tr>
- </table>
- </td>
- <td width="5"></td>
- </tr>
- <tr>
- <td width="6"></td>
- <td colspan="2" class="mainhead"> </td>
- <td width="5"></td>
- </tr>
- <tr>
- <td colspan="8" bgcolor="#214984" height="2"></td>
- </tr>
- </table>
- </body>