ExportGoodsBill.jsp
上传用户:wenzhanhao
上传日期:2022-03-28
资源大小:9150k
文件大小:16k
源码类别:

百货/超市行业

开发平台:

Visual C++

  1. <%@ page contentType="text/html; charset=gbk" language="java" %>
  2. <%@ page import="mediastore.web.global.*"%>
  3. <%@ page import="mediastore.web.form.*"%>
  4. <%@ page import="java.util.*"%>
  5. <body onload="document.form1.goodsid.focus()">
  6. <script language="JavaScript">
  7. //去掉空格
  8. function Trim(str){
  9.  if(str.charAt(0) == " "){
  10.   str = str.slice(1);
  11.   str = Trim(str); 
  12.  }
  13.  return str;
  14. }
  15. //判断是否是空
  16. function isEmpty(pObj,errMsg){
  17.  var obj = eval(pObj);
  18.  if( obj == null || Trim(obj.value) == ""){
  19.   if (errMsg == null || errMsg =="")
  20.    alert("输入为空");
  21.   else
  22.    alert(errMsg); 
  23.   obj.focus(); 
  24.   return false;
  25.  }
  26.  return true;
  27. }
  28. //判断是否是整数
  29. function isNumber(pObj,errMsg){
  30.  var obj = eval(pObj);
  31.  strRef = "1234567890";
  32.  if(!isEmpty(pObj,errMsg))return false;
  33.  for (i=0;i<obj.value.length;i++) {
  34.   tempChar= obj.value.substring(i,i+1);
  35.   if (strRef.indexOf(tempChar,0)==-1) {
  36.    if (errMsg == null || errMsg =="")
  37.     alert("数据不符合要求,请检查");
  38.    else
  39.     alert(errMsg);
  40.    if(obj.type=="text") 
  41.     obj.focus(); 
  42.    return false; 
  43.   }
  44.  }
  45.  return true;
  46. }
  47. //判断是否是小数
  48. function isFloat(pObj,errMsg){
  49.  var obj = eval(pObj);
  50.  strRef = "1234567890.";
  51.  if(!isEmpty(pObj,errMsg))return false;
  52.  for (i=0;i<obj.value.length;i++) {
  53.   tempChar= obj.value.substring(i,i+1);
  54.   if (strRef.indexOf(tempChar,0)==-1) {
  55.    if (errMsg == null || errMsg =="")
  56.     alert("数据不符合要求,请检查");
  57.    else
  58.     alert(errMsg);
  59.    if(obj.type=="text") 
  60.     obj.focus(); 
  61.    return false; 
  62.   }
  63.  }
  64.  return true;
  65. }
  66. function verify(form){
  67. if (Trim(form.goodsid.value) == "" | form.goodsid.value == null) 
  68. alert("请输入货物标识"); 
  69. form.goodsid.value=""
  70. form.goodsid.focus(); 
  71. return (false); 
  72. }
  73. function updateExportAmount(goodsid, newexportamount, repertoryamount)
  74. {
  75. //用于数据校验的临时对象
  76. document.form2.obj4numbercheck.value = newexportamount;
  77. if(Number(newexportamount) > Number(repertoryamount))
  78. {
  79. alert("售货数量不可大于库存数量");
  80. return '1';
  81. }
  82. else if(isNumber(document.form2.obj4numbercheck)==false)
  83. {}
  84. else if(document.form2.obj4numbercheck.value == null || document.form2.obj4numbercheck.value == '')
  85. {
  86. alert("售货数量不可为空");
  87. }
  88. else
  89. {
  90. document.form2.action = "exportGoodsBillUdtEAmount.do?updategoodsid="+goodsid+"&newexportamount="+newexportamount+"&";
  91. document.form2.submit();
  92. }
  93. }
  94. function deleteATempExportGoods(goodsid)
  95. {
  96. if(confirm("确定要删除该货物吗?")) 
  97. {
  98. document.form2.action = "exportGoodsBillGoodsDelete.do?deletegoodsid="+goodsid+"&";
  99. document.form2.submit();
  100. }
  101. }
  102. function updateMemberId(newmemberid)
  103. {
  104. //用于数据校验的临时对象
  105. if(newmemberid==null||newmemberid=="")
  106. {
  107. document.form2.obj4numbercheck.value = 0;
  108. }
  109. else
  110. {
  111. document.form2.obj4numbercheck.value = newmemberid;
  112. }
  113. if(isNumber(document.form2.obj4numbercheck)==false)
  114. {}
  115. else if(document.form2.obj4numbercheck.value == null || document.form2.obj4numbercheck.value == '')
  116. {
  117. document.form2.action = "exportGoodsBillUptMembId.do?newmemberid=0&";
  118. document.form2.submit();
  119. }
  120. else
  121. {
  122. document.form2.action = "exportGoodsBillUptMembId.do?newmemberid="+newmemberid+"&";
  123. document.form2.submit();
  124. }
  125. }
  126. function deleteAllGoods()
  127. {
  128. try{
  129. var goods_num = document.form2.goodsid.length;
  130. if(goods_num == null || document.form2.goodsid == null)
  131. {//
  132. //alert("空列表");
  133. }
  134. }catch(e)
  135. {
  136. alert("货物列表目前为空");
  137. document.form1.goodsid.focus();
  138. return;
  139. }
  140. if(confirm("确定要清空该货物列表吗?")) 
  141. {
  142. document.form2.action = "exportGoodsBillGoodsDelAll.do";
  143. document.form2.submit();
  144. }
  145. }
  146. function submitAllGoods()
  147. {
  148. //查看该单是否是空列表,空列表就不提交
  149. try{
  150. var goods_num = document.form2.goodsid.length;
  151. if(goods_num == null || document.form2.goodsid == null)
  152. {//
  153. //alert("空列表");
  154. }
  155. }catch(e)
  156. {
  157. alert("请添加货物后再提交售货单");
  158. document.form1.goodsid.focus();
  159. return;
  160. }
  161. //检查数量和单价是否都为数字
  162. var errMsg;
  163. var amount_num;
  164. try{
  165. amount_num = document.form2.exportamount.length;
  166. }catch(e)
  167. {
  168. alert("该售货单中不存在有库存货物");
  169. document.form1.goodsid.focus();
  170. return;
  171. }
  172. document.form2.obj4numbercheck.value = document.form2.memberid.value;
  173. if(document.form2.memberid.value==""||document.form2.memberid.value==null)
  174. {
  175. document.form2.obj4numbercheck.value = 0;
  176. }
  177. //amount_num有库存货物的数量,amount_num>0
  178. if(amount_num == null)
  179. {//只有一项
  180. var isNumberFlage = 'yes';//默认为“是数字”
  181. if(isNumber(document.form2.exportamount)==false)
  182. {
  183. isNumberFlage = 'no';
  184. }
  185. if(isNumber(document.form2.obj4numbercheck)==false)
  186. {
  187. isNumberFlage = 'no';
  188. }
  189. if(isNumberFlage=='yes')
  190. {//数字
  191. if(confirm("确定要提交该售货单吗?")) 
  192. {
  193. if(document.form2.memberid.value==""||document.form2.memberid.value==null)
  194. {
  195. document.form2.memberid.value = 0;
  196. }
  197. document.form2.action = "exportGoodsBillGoodsSubmit.do";
  198. document.form2.submit();
  199. }
  200. }
  201. else
  202. {//非数字
  203. document.form2.totaldisprice.value = "请修改售货数量或会员标识";
  204. document.form2.totaldisprice_value.value = "请修改售货数量或会员标识";
  205. document.form2.totalprice.value = "请修改售货数量或会员标识";
  206. document.form2.totalprice_value.value = "请修改售货数量或会员标识";
  207. }
  208. }
  209. else
  210. {//两项以上
  211. var isNumberFlage = 'yes';//默认为“是数字”
  212. for(iii=0; iii<amount_num; iii++)
  213. {
  214. if(isNumber(document.form2.exportamount[iii])==false)
  215. {
  216. isNumberFlage = 'no';
  217. }
  218. }
  219. if(isNumber(document.form2.obj4numbercheck)==false)
  220. {
  221. isNumberFlage = 'no';
  222. }
  223. if(isNumberFlage=='yes')
  224. {//数字
  225. if(confirm("确定要提交该售货单吗?")) 
  226. {
  227. if(document.form2.memberid.value==""||document.form2.memberid.value==null)
  228. {
  229. document.form2.memberid.value = 0;
  230. }
  231. document.form2.action = "exportGoodsBillGoodsSubmit.do";
  232. document.form2.submit();
  233. }
  234. }
  235. else
  236. {//非数字
  237. document.form2.totaldisprice.value = "请修改售货数量或会员标识";
  238. document.form2.totaldisprice_value.value = "请修改售货数量或会员标识";
  239. document.form2.totalprice.value = "请修改售货数量或会员标识";
  240. document.form2.totalprice_value.value = "请修改售货数量或会员标识";
  241. }
  242. }
  243. }
  244. function showNewBill()
  245. {
  246. document.form2.action = "exportGoodsBillShowNew.do";
  247. document.form2.submit();
  248. }
  249. </script>
  250. <table width="768" border="0" align="center" cellpadding="0" cellspacing="0">
  251.   <tr> 
  252.     <td width="5" rowspan="4" class="trtable"></td>
  253.     <td width="6" bgcolor="#214984" height="1"></td>
  254.     <td rowspan="4" bgcolor="#214984" width="1" height="1"></td>
  255.     <td bgcolor="#214984" class="10p" colspan="2" height="1"></td>
  256.     <td rowspan="4" width="1" bgcolor="#214984" height="1"></td>
  257.     <td bgcolor="#214984" width="5" height="1"></td>
  258.     <td width="5" rowspan="4" class="trtable"></td>
  259.   </tr>
  260.   <tr> 
  261.     <td width="6"></td>
  262.     <td width="379" height="20" class="mainhead">售货单录入</td>
  263.     <td class="mainhead" width="379" height="20">&nbsp;</td>
  264.     <td width="5"></td>
  265.   </tr>
  266. <tr> 
  267.     <td width="6"></td>
  268.     <td valign="top" colspan="2"> 
  269.     <table width="100%" border="0" cellspacing="0" cellpadding="0">
  270.         
  271.         <tr> 
  272.           <td height="300" align="center" valign="top">   
  273.           
  274. <%
  275. ExportGoodsBillFB egbfb = (ExportGoodsBillFB)request.getAttribute(Globals.REQUEST_EXPORTGOODSBILL);
  276. int maxBillId = egbfb.getMaxBillId();
  277. List goodsList = egbfb.getGoodsList();
  278. float discount = egbfb.getDiscount();
  279. %>
  280.      <form name="form1" method="post" action="exportGoodsBillGoodsInsert.do" onSubmit="javascript:return verify(this);">
  281.      <font color=#215385><b>添加货物</b></font>
  282.      <IMG src="images/line1.gif" border=0>
  283.      <br>
  284.      <input type="hidden" name="maxBillId"  value="<%=maxBillId%>">
  285.      <TABLE width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="#FFFFFF" class="mailtable"> 
  286.   <tr>
  287.             <td  align="right" width=20%> 
  288.                 <b>售货单号:</b>
  289.             </td>
  290.             <td width=20%>
  291.              <INPUT class=none  name="billid" type="text" size="30" value="<%=maxBillId%>" disabled>
  292.             </td>
  293.             <td width=30%>&nbsp;</td>
  294.           </tr>
  295.           <tr>
  296.             <td  align="right" width=20%> 
  297.                 <b>货物标识:</b>
  298.             </td>
  299.             <td width=20%>
  300.              <INPUT class=none  name="goodsid" type="text" size="30" value="" >
  301.             </td>
  302.             <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  303.             <input name=submit type=submit value="添加" ></td>
  304.           </tr>
  305. </TABLE>
  306. </form>
  307. <br>
  308.      <br>
  309. <form name="form2" method="post" action="" >
  310. <font color=#215385><b>货物列表</b></font>
  311. <IMG src="images/line1.gif" border=0>
  312. <input type="hidden" name="curBillId"  value="<%=maxBillId%>">
  313. <input type="hidden" name="obj4numbercheck" value="">
  314. <TABLE width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="#FFFFFF" class="mailtable">  
  315. <%
  316. if(goodsList.size()>0)
  317. {
  318. %>
  319. <tr bgcolor="#C2CEDC">
  320. <th></th>
  321. <th>货物标识</th>
  322. <th>货物名称</th>
  323. <th>目前库存</th>
  324. <th>售货数量</th>
  325. <th>售货单价</th>
  326. <th>销售人员</th>
  327. <th>删除</th>
  328. </tr>
  329. <%
  330. }
  331. %>
  332. <%
  333.      int index = 0;
  334.        GoodsExportGoodsInfo tmpInfo = null;
  335.        float totalPrice = 0;
  336.       
  337.        for (index=0; index<goodsList.size(); index++)
  338. {
  339.        tmpInfo = (GoodsExportGoodsInfo)goodsList.get(index);
  340.        totalPrice = totalPrice + (tmpInfo.getExportAmount() * tmpInfo.getExportUnitPrice());
  341.        %>
  342.         <tr <%if((index%2)==1){%>bgcolor="#CAE4F4"<%}%> >
  343.         <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>
  344.         <td align='center'><%= tmpInfo.getGoodsId() %>
  345.         <input type="hidden" name="goodsid"  value="<%= tmpInfo.getGoodsId() %>">
  346.         </td>
  347.         <td align='center'>
  348.          <%= tmpInfo.getGoodsName() %>
  349.         </td>
  350.         <td align='center'>
  351.          <%
  352.          if(tmpInfo.getCurRepertoryAmount()>0)
  353.          {
  354.          %>
  355.          <%= tmpInfo.getCurRepertoryAmount() %>
  356.          <%
  357.          }
  358.          else
  359.          {
  360.          %>
  361.          无库存
  362.          <%
  363.          }
  364.          %>
  365.         </td>
  366.         <td align='center'>
  367.          <%
  368.          if(tmpInfo.getCurRepertoryAmount()>0)
  369.          {
  370.          %>
  371.          <input type="text" name="exportamount"  value="<%= tmpInfo.getExportAmount() %>" size=5 onChange="if(updateExportAmount('<%=tmpInfo.getGoodsId()%>', this.value, '<%= tmpInfo.getCurRepertoryAmount() %>')=='1'){this.value='<%= tmpInfo.getExportAmount() %>'}">
  372.          <%
  373.          }
  374.          else
  375.          {
  376.          %>
  377.          <%= tmpInfo.getExportAmount() %>
  378.          <%
  379.          }
  380.          %>
  381.         </td>
  382. <td align='center'>
  383.          <%= tmpInfo.getExportUnitPrice() %>
  384.          <%
  385.          if("1".equals(tmpInfo.getIsSpecialUnitPrice()))
  386.          {
  387.          %>
  388.          <font color=red><b>特价</b></font>
  389.          <%
  390.          }
  391.          %>
  392. </td>
  393.         <td align='center'><%= tmpInfo.getSalesPerson() %><input type="hidden" name="salesperson"  value="<%= tmpInfo.getSalesPerson() %>"></td>
  394.         <td align='center'>
  395.          <a href="javascript:deleteATempExportGoods('<%= tmpInfo.getGoodsId() %>') "><IMG src="images/delto.gif" border=0></a>
  396.         </td>
  397.         </tr>
  398.         <%
  399.        }//for
  400.         %>
  401. </TABLE>
  402.     
  403.      <TABLE width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="#FFFFFF" class="mailtable"> 
  404.   <tr>
  405.             <td  align="right" > 
  406.                 <b>售货单号:</b>
  407.             </td>
  408.             <td >
  409.              <INPUT class=none  name="billid" type="text" size="30" value="<%=maxBillId%>" disabled>
  410.             </td>
  411.             <td  align="right" > 
  412.                 <b>会员标识:</b>
  413.             </td>
  414.             <td >
  415.              <%
  416.             
  417.              //同一张单上的会员标识是一样的,所以这里只取最后项的memberid
  418.              if(goodsList.size()>=1)
  419.              {//至少有一项
  420.              String memberid = tmpInfo.getMemberId()+"";
  421.              if("0".equals(memberid))
  422.              {//无会员标识
  423.              discount=1;
  424.              %>
  425.              <INPUT class=none  name="memberid" type="text" size="30" value="" onChange="updateMemberId(this.value)">
  426.              <%
  427.              }else
  428.              {
  429.              %>
  430.              <INPUT class=none  name="memberid" type="text" size="30" value="<%=memberid%>" onChange="updateMemberId(this.value)">
  431.             <%
  432.             }
  433.             }
  434.             else
  435.             {//无会员标识
  436.             discount=1;
  437.             %>
  438.             <INPUT class=none  name="memberid" type="text" size="30" value="" onChange="updateMemberId(this.value)">
  439.             <%
  440.             }
  441.             %>
  442.             </td>
  443.           </tr>
  444.           <tr>
  445.             <td  align="right" > 
  446.                 <b>会员折扣:</b>
  447.             </td>
  448.             <td >
  449.              <%
  450.             
  451.              //同一张单上的会员标识是一样的,所以这里只取最后项的memberid
  452.              if(goodsList.size()>=1)
  453.              {//至少有一项
  454.              String memberid = tmpInfo.getMemberId()+"";
  455.              if("0".equals(memberid))
  456.              {//无会员标识
  457.              discount=1;
  458.              %>
  459.              <INPUT class=none  name="discount" type="text" size="30" value="1" disabled>
  460.              <INPUT class=none  name="discount_value" type="hidden" size="30" value="1" >
  461.              <%
  462.              }else
  463.              {//含会员标识
  464.              %>
  465.              <INPUT class=none  name="discount" type="text" size="30" value="<%=discount%>" disabled>
  466.              <INPUT class=none  name="discount_value" type="hidden" size="30" value="<%=discount%>" >
  467.             <%
  468.             }
  469.             }
  470.             else
  471.             {//无会员标识
  472.             discount=1;
  473.             %>
  474.             <INPUT class=none  name="discount" type="text" size="30" value="1" disabled>
  475.             <INPUT class=none  name="discount_value" type="hidden" size="30" value="1" >
  476.             <%
  477.             }
  478.             %>
  479.             
  480.             </td>
  481.             <td  align="right" > 
  482.                 <b>折前总价:</b>
  483.             </td>
  484.             <td >
  485.              <INPUT class=none  name="totalprice" type="text" size="30" value="<%=totalPrice%>" disabled>
  486.              <INPUT class=none  name="totalprice_value" type="hidden" size="30" value="<%=totalPrice%>" >
  487.             </td>
  488.           </tr>
  489.           <tr>
  490.             <td  align="right" > 
  491.                 <b>实收总价:</b>
  492.             </td>
  493.             <td >
  494.              <INPUT class=none  name="totaldisprice" type="text" size="30" value="<%=totalPrice*discount%>" disabled>
  495.              <INPUT class=none  name="totaldisprice_value" type="hidden" size="30" value="<%=totalPrice*discount%>" >
  496.             </td>
  497.             <td  align="right" > 
  498.                 <b>是否付款:</b>
  499.             </td>
  500.             <td >
  501.              &nbsp;
  502.              <input type="radio" name="payornot" value="1" checked>已付款
  503.              &nbsp;
  504.              <input type="radio" name="payornot" value="0" >未付款
  505.             </td>
  506.           </tr>
  507. </TABLE>
  508. </form>
  509. <p><center>
  510. <input name=newbill type=button value="新售货单" onClick="showNewBill()">
  511. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  512. <input name=deleteall type=button value="清空列表" onClick="deleteAllGoods()">
  513. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  514. <input name=submitall type=button value="确认提交" onClick="submitAllGoods()">
  515.      </center><p>
  516. </td>
  517.         </tr>
  518.         <tr> 
  519.           <td valign="middle" align="center">&nbsp;</td>
  520.         </tr>
  521.       </table>
  522.       
  523.     </td>
  524.     <td width="5"></td>
  525.   </tr>
  526.   <tr> 
  527.     <td width="6"></td>
  528.     <td colspan="2" class="mainhead">&nbsp;</td>
  529.     <td width="5"></td>
  530.   </tr>
  531.   <tr> 
  532.     <td colspan="8" bgcolor="#214984" height="2"></td>
  533.   </tr>
  534. </table>
  535. </body>