officeequip_add.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:7k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=utf-8"%>
  2. <%@ page import = "java.net.URLEncoder"%>
  3. <%@ page import = "java.util.*"%>
  4. <%@ page import = "cn.js.fan.util.*"%>
  5. <%@ page import = "cn.js.fan.web.*"%>
  6. <%@ page import = "com.redmoon.oa.officeequip.*"%>
  7. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  8. <html>
  9. <head>
  10. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  11. <title>办公用品入库登记</title>
  12. <link href="../common.css" rel="stylesheet" type="text/css">
  13. <script language="JavaScript" type="text/JavaScript">
  14. <!--
  15. function findObj(theObj, theDoc)
  16. {
  17.   var p, i, foundObj;
  18.   
  19.   if(!theDoc) theDoc = document;
  20.   if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  21.   {
  22.     theDoc = parent.frames[theObj.substring(p+1)].document;
  23.     theObj = theObj.substring(0,p);
  24.   }
  25.   if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  26.   for (i=0; !foundObj && i < theDoc.forms.length; i++) 
  27.     foundObj = theDoc.forms[i][theObj];
  28.   for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
  29.     foundObj = findObj(theObj,theDoc.layers[i].document);
  30.   if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  31.   
  32.   return foundObj;
  33. }
  34. var GetDate=""; 
  35. function SelectDate(ObjName,FormatDate){
  36. var PostAtt = new Array;
  37. PostAtt[0]= FormatDate;
  38. PostAtt[1]= findObj(ObjName);
  39. GetDate = showModalDialog("../util/calendar/calendar.htm", PostAtt ,"dialogWidth:286px;dialogHeight:221px;status:no;help:no;");
  40. }
  41. function SetDate()
  42. findObj(ObjName).value = GetDate; 
  43. }
  44. //-->
  45. </script>
  46. <%
  47.   String strTypeId = ParamUtil.get(request, "typeId");
  48.   String strEquipId =ParamUtil.get(request, "equipId");
  49.   String equipId1 = "";
  50.   String officeN = "";
  51. %>
  52. <script>
  53. var oldTypeId = "<%=strTypeId%>";
  54. function getOfficeEquipOfType(typeId) {
  55. if (typeId=="") {
  56. alert("请选择类别");
  57. form1.typeId.value = oldTypeId;
  58. return;
  59. }
  60. window.location.href = "?typeId=" + typeId + "&equipId=" + oldEquipId;
  61. }
  62. var oldEquipId = "<%=strEquipId%>";
  63. function setEquipName(equipName) {
  64. form1.officeName.value = equipName;
  65. }
  66. </script>
  67. <style type="text/css">
  68. <!--
  69. .style2 {font-size: 14px}
  70. -->
  71. </style>
  72. </head>
  73. <body>
  74. <jsp:useBean id="fchar" scope="page" class="cn.js.fan.util.StrUtil"/>
  75. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  76. <%
  77. String priv="officeequip";
  78. if (!privilege.isUserPrivValid(request, priv)) {
  79. out.println(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  80. return;
  81. }
  82. String op = ParamUtil.get(request, "op");
  83. if (op.equals("add")) {
  84. OfficeMgr bm = new OfficeMgr();
  85. boolean re = false;
  86. try {
  87.   re = bm.create(request);
  88. }
  89. catch (ErrMsgException e) {
  90. out.print(StrUtil.Alert(e.getMessage()));
  91. }
  92. if (re)
  93. out.print(StrUtil.Alert("操作成功!"));
  94. }
  95. %>
  96. <%@ include file="officeequip_inc_menu_top.jsp"%>
  97. <br>
  98. <table width="559" border="0" align="center" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF" class="tableframe">
  99. <form action="?op=add" name="form1" method="post">
  100. <tr>
  101.   <td colspan="4" class="right-title">办公用品入库登记</td>
  102.   </tr>
  103. <tr>
  104.  <td width="64" bgcolor="#FFFFFF">用品类别:</td>
  105.  <td width="163" bgcolor="#FFFFFF"><%
  106.   OfficeTypeDb otd = new OfficeTypeDb();
  107.   String opts = "";
  108.   Iterator ir = otd.list().iterator();
  109.   while (ir.hasNext()) {
  110.     otd = (OfficeTypeDb)ir.next();
  111.     opts += "<option value='" + otd.getId() + "'>" + otd.getName() + "</option>";
  112.   }
  113.   %>
  114.    <select name="typeId" id="typeId" onChange="getOfficeEquipOfType(form1.typeId.value)" >
  115.      <option selected>-----请选择-----</option>
  116.      <%=opts%>
  117.    </select>
  118.    <script>
  119.   form1.typeId.value = "<%=strTypeId%>";
  120.    </script>
  121.    <font color=red>*</font></td>
  122.  <td width="99" bgcolor="#FFFFFF">办公用品名称:</td>
  123.  <td width="215" bgcolor="#FFFFFF"><%
  124.   String opts1 = "";
  125.   int total =0 ;
  126.   OfficeDb od = new OfficeDb();
  127.   OfficeDb odb = new OfficeDb();
  128.   if (!strTypeId.equals("")) {
  129.   String sql = "select id from office_equipment where typeId=" + strTypeId;
  130.   Iterator ir1 = od.list(sql).iterator();
  131.   while (ir1.hasNext()) {
  132.  od = (OfficeDb)ir1.next();
  133.  opts1 += "<option value='" + od.getId() + "'>" + od.getOfficeName() + "</option>";
  134.      total += od.getStorageCount();
  135.  equipId1 = ParamUtil.get(request, "equipId") ; 
  136.        if (equipId1 == "")
  137.             equipId1 = Integer.toString(od.getId());
  138. odb = odb.getOfficeDb(StrUtil.toInt(equipId1));
  139. officeN = odb.getOfficeName();
  140.   }
  141.   }
  142.   %>
  143.    <script>
  144.   </script>
  145.    <font color=red>
  146.    <input name="officeName" type="text" id="officeName" value="" size="10" maxlength="100" >
  147.    </font>
  148.         
  149.    <font color=red>*   
  150.    <select name="equipId" id="equipId" onChange="setEquipName(form1.equipId.options(form1.equipId.selectedIndex).text)">
  151.      <option value = 0 selected>-----请选择-----</option>
  152.      <%=opts1%>
  153.    </select>
  154.    </font></td>       
  155. </tr>
  156. <tr>
  157.   <td bgcolor="#FFFFFF">计量单位:</td>
  158.   <td bgcolor="#FFFFFF"><font color=red>
  159.   <%
  160.   OfficeTypeDb otdb = new OfficeTypeDb();
  161.   String unitId = ParamUtil.get(request, "typeId") ; 
  162.   if (unitId == "")
  163.      unitId = "1";
  164.   otdb = otdb.getOfficeTypeDb(StrUtil.toInt(unitId));
  165.   String unit;
  166.   unit = otdb.getUnit();
  167.   if (unit ==null)
  168.     unit = "";
  169. %>
  170.   <input name="measureUnit" type="text" id="measureUnit" value="<%=unit%>" size="10" maxlength="100">
  171.   *  </font></td>
  172.   <td bgcolor="#FFFFFF">用品数量:</td>
  173.   <td bgcolor="#FFFFFF"><font color=red>
  174.     <input name="storageCount" type="text" id="storageCount"value="" size="10" maxlength="100">
  175.   *</font></td>
  176. </tr>
  177. <tr>
  178.   <td bgcolor="#FFFFFF">价格:(¥)</td>
  179.   <td bgcolor="#FFFFFF"><input name="price" type="text" id="price" value="<%=od.getPrice()%>" size="10" maxlength="100">
  180.     <font color=red>*</font></td>
  181.  <td bgcolor="#FFFFFF">供&nbsp;&nbsp;应&nbsp;&nbsp;商:</td>
  182.   <td bgcolor="#FFFFFF"><input name="buyPerson" type="text" id="buyPerson"value="" size="20" maxlength="100"></td>
  183. </tr>
  184. <tr>
  185.   <td bgcolor="#FFFFFF">购置时间:</td>
  186.   <td bgcolor="#FFFFFF">
  187.   <%
  188.    Date d = new Date();
  189.    String dt = DateUtil.format(d, "yyyy-MM-dd");
  190.   %>
  191.     <input name="buyDate" type="text" id="buyDate"value="<%=dt%>" size="10" maxlength="100">
  192.     <img style="CURSOR: hand" onClick="SelectDate('buyDate', 'yyyy-MM-dd')" src="../images/form/calendar.gif" align="absMiddle" border="0" width="26" height="26"></td>
  193.  <td bgcolor="#FFFFFF">&nbsp;</td>
  194.   <td bgcolor="#FFFFFF">&nbsp;</td>
  195. </tr><tr>
  196.   
  197.   <td colspan="4" align="center">
  198.      <input name="submit" type="submit" class="button1"  value=" 确  定 " > 
  199.      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  200.      <input type="reset" class="button1"  value=" 重  置 " >  </td>
  201. </tr>
  202. </form>
  203. </table>
  204. </body>
  205. </html>