equipment_modify.jsp
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:15k
源码类别:

电子政务应用

开发平台:

Java

  1. <%@ page errorPage="/vnex/ErrorPage.jsp" %>
  2. <%@ page import="java.lang.*"%>
  3. <%@ page import="java.util.Collection"%>
  4. <%@ page import="java.util.Iterator"%>
  5. <%@ page import="java.util.Vector"%>
  6. <%@ page import="java.sql.Timestamp"%>
  7. <%@ page import="com.vnex.intranet.util.TimeStamp"%>
  8. <%@ page import="com.vnex.intranet.util.FieldUtil"%>
  9. <%@ page import="com.vnex.intranet.equipment.value.UserValueBean"%>
  10. <%@ taglib uri="/vnex.tld" prefix="vnex" %>
  11. <%@ taglib uri="/vnex_organization.tld" prefix="org" %>
  12. <%@ taglib uri="/vnex_hr.tld" prefix="hr" %>
  13. <jsp:useBean id="equipmentProxy" class="com.vnex.intranet.equipment.proxy.EquipmentProxyBean" scope="session" /> 
  14. <jsp:useBean id="equipmentValue2" class="com.vnex.intranet.equipment.value.EquipmentValueBean" scope="session" /> 
  15. <jsp:setProperty name="equipmentValue2" property="*" />
  16. <%!
  17. Collection list = null;
  18. Collection list2 = null;
  19. Collection listUsePerson = null;
  20. Collection listBuyPerson = null;
  21. Iterator ite = null;
  22. UserValueBean user = null;
  23. int i = -1;
  24. String sId;
  25. String fromSelf;
  26. int equipmentId;
  27. Timestamp tDate;
  28. %> 
  29. <%
  30. fromSelf = request.getParameter("fromSelf");
  31. if (  fromSelf.equals("0"))
  32. {
  33. sId = request.getParameter("equipmentId");
  34. equipmentId = (new Integer(sId)).intValue();
  35. System.out.println("id" + equipmentId);
  36. equipmentValue2 = equipmentProxy.getEquipmentDetail(equipmentId);
  37. tDate = equipmentValue2.getBuyDate();
  38. equipmentValue2.setBeginDay(TimeStamp.formatCalendar(1,TimeStamp.convertTimestampToCalendar(tDate)));
  39. if (equipmentValue2.getTerm() == -1)
  40. equipmentValue2.setTerm(0);
  41. if (equipmentValue2.getQuantity() == -1)
  42. equipmentValue2.setQuantity(0);
  43. %> 
  44. <script Language="JavaScript" src="/vnex/util/Popup.js"></script>
  45. <script language="JavaScript" src="/vnex/util/validate.js"></script>
  46. <script language=JavaScript>
  47. function isNumberValid()
  48. {
  49. if (!(isFloat(myForm.price.value)))
  50. {
  51. alert("价格必须必须是数字!");
  52. myForm.price.focus();
  53. return false;
  54. }
  55. else
  56. {
  57. if (Number(myForm.price.value) > 99999999.99 || Number(myForm.price.value)< 0)
  58.     {
  59.      alert("价格必须在0和99999999.99之间!");
  60.      myForm.price.focus();
  61.      return false;
  62.     }
  63. }
  64. if (!(isInteger(myForm.term.value)))
  65. {
  66. alert("使用期限必须是整数!");
  67. myForm.term.focus();
  68. return false;
  69. }
  70. else
  71. {
  72. if (Number(myForm.term.value) > 99999 || Number(myForm.term.value)< 0)
  73.     {
  74.      alert("使用期限必须在0和99999之间");
  75.      myForm.term.focus();
  76.      return false;
  77.     }
  78. }
  79. return true;
  80. }
  81. function isDataValid()
  82. {
  83. if (! isNumberValid())
  84. return false;
  85. if ( myForm.categoryId.value.length <= 0 || myForm.categoryName.value.length == 0)
  86. {
  87. alert("请选择分类!");
  88. myForm.categoryId.value = "";
  89. myForm.categoryName.value = "";
  90. return false;
  91. }
  92. if (myForm.equipmentName.value.length <= 0 || myForm.equipmentName.value.length > 25 || !stripWhitespace(myForm.equipmentName.value))
  93. {
  94. alert("固定资产的名称是1-25个字符且不能为空!!");
  95. myForm.equipmentName.focus();
  96. return false;
  97. }
  98. if (myForm.purpose.value.length > 50)
  99. {
  100. alert("固定资产的用途应少于50个字符!");
  101. myForm.purpose.focus();
  102. return false;
  103. }
  104. if (myForm.model.value.length > 50)
  105. {
  106. alert("固定资产的型号应少于50个字符!");
  107. myForm.model.focus();
  108. return false;
  109. }
  110. if ("<%=equipmentValue2.getEquipmentCode()%>" != "")
  111. {
  112. if (myForm.equipmentCode.value.length > 25 || myForm.equipmentCode.value.length <1 )
  113. {
  114. alert("固定资产的编号应是1-25个字符!");
  115. myForm.equipmentCode.focus();
  116. return false;
  117. }
  118. }
  119. if (myForm.configure.value.length > 125)
  120. {
  121. alert("固定资产的配置应少于125个字符!");
  122. myForm.configure.focus();
  123. return false;
  124. }
  125. if (myForm.supplier.value.length > 50)
  126. {
  127. alert("固定资产的提供者应少于50个字符!");
  128. myForm.supplier.focus();
  129. return false;
  130. }
  131. if (myForm.place.value.length > 50)
  132. {
  133. alert("固定资产的地点应少于50个字符!");
  134. myForm.place.focus();
  135. return false;
  136. }
  137. if (myForm.remark.value.length > 125)
  138. {
  139. alert("固定资产的说明应少于125个字符!");
  140. myForm.remark.focus();
  141. return false;
  142. }
  143. if (myForm.buyDeptId.value == "-1")
  144. {
  145. alert ("请选择购买部门!");
  146. myForm.buyDeptId.focus();
  147. return false;
  148. }
  149. var price=0.0;
  150. price = myForm.price.value;
  151. if (price <= 0)
  152. {
  153. alert("价格必须大于0");
  154. myForm.price.focus();
  155. return false;
  156. }
  157. if (myForm.beginDay.value == "")
  158. {
  159. alert("请选择购买日期!");
  160. return false;
  161. }
  162. return true;
  163. }
  164. function change(select)
  165. {
  166. if (isNumberValid())
  167. {
  168. myForm.action="/mainctrl/equipmentModify?fromSelf=1&equipmentId=<%=sId%>";
  169. myForm.submit();
  170. }
  171. }
  172. function toSuccess()
  173. {
  174. if (isDataValid())
  175. {
  176. myForm.action="/mainctrl/equipmentModifySuccess?equipmentId=<%= sId%>";
  177. myForm.submit();
  178. }
  179. }
  180. function toCategory()
  181. {
  182. if (isNumberValid())
  183. {
  184. <%
  185. session.removeAttribute("equipmentValue2");
  186. %>
  187. myForm.action="/mainctrl/equipmentModifySave?pageName=equipmentModify";
  188. myForm.submit();
  189. }
  190. }
  191. </script>
  192. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  193. <HTML><jsp:include page="/vnex/page/FORM_HEAD.jsp" />
  194. <BODY text=#000000 vLink=#000000 aLink=#000000 link=#000000 bgColor=#ffffff topMargin=20 leftmargin="0" marginwidth="0" marginheight="0">
  195. <script language="JavaScript1.2" src="/vnex/menu/dockmenu_office.js"></script>
  196. <script language="JavaScript1.2" src="/vnex/menu/dockmenu.js"></script>
  197. <DIV align=center>
  198. <form name="myForm" method="post" action="">
  199.     <TABLE class=outter cellSpacing=0 cellPadding=0 width=600 border=0>
  200.     <TBODY> 
  201.     <jsp:include page="/vnex/page/TTOA_TABLE_TOP.jsp" />
  202.     <TR> 
  203.         <TD colSpan=3 align="center"><br>
  204.           <table width="600" border="1" cellspacing="1" bordercolor="#666666">
  205.             <tr bgcolor="#FAFAFA"> 
  206.               <td> 
  207.                 <table width="600" border="0" cellspacing="0" cellpadding="2">
  208.                   <tr>
  209.                     <td colspan="3" height="15" bgcolor="#666666"><font class="strongw"><a href="/mainctrl/home/index"><font color="#FFFFFF">首页</font></a>&gt;&gt;<a href="/mainctrl/office/main"><font color="#FFFFFF">办公室管理</font></a>&gt;&gt;<a href = "/mainctrl/equipmentSearchResult"><font color="#FFFFFF">固定资产管理</font></a>&gt;&gt;<a href="/mainctrl/equipmentDetail?equipmentId=<%=sId%>"><font color="#FFFFFF">固定资产详细信息</font></a>&gt;&gt;修改固定资产信息</font>
  210.                     </td>
  211.                   </tr>
  212.                 </table>
  213.                 <table class=title width="600" border="0" cellspacing="1" cellpadding="2">
  214.                   <tr bgcolor="#e0e0e0"> 
  215.                     <td width="125"> 
  216.                       <div align="left"><font class="strong" >&nbsp;资产类别:</font></div>
  217.                     </td>
  218.                     <td  width="452"> 
  219.                       <input type="hidden" name="categoryId" size="24" class="file" value="<%= equipmentValue2.getCategoryId()%>">
  220.                       <input type="text" name="categoryName" size="24" class="file" readonly value="<%= FieldUtil.filterQuotTag(equipmentValue2.getCategoryName())%>">
  221.                       <input type="button" name="Submit3" value="选择" class="file" onClick = toCategory()>&nbsp;*&nbsp;(注:带*为必填内容)
  222.                     </td>
  223.                   </tr>
  224.                   <tr bgcolor="#fafafa"> 
  225.                     <td width="125"> 
  226.                       <div align="left"><font class="strong" >&nbsp;名称:</font> </div>
  227.                     </td>
  228.                     <td  width="452"> 
  229.                       <input type="text" name="equipmentName" size="24" class="file" value="<%= FieldUtil.filterQuotTag(equipmentValue2.getEquipmentName())%>">&nbsp;*
  230.                     </td>
  231.                   </tr>
  232.                   <tr bgcolor="#e0e0e0"> 
  233.                     <td width="125"> 
  234.                       <div align="left"><font  class="strong">&nbsp;用途: </font></div>
  235.                     </td>
  236.                     <td  width="452"><font  class="strong"> 
  237.                       <input type="text" name="purpose" size="24" class="file" value="<%= FieldUtil.filterQuotTag(equipmentValue2.getPurpose())%>">
  238.                       </font></td>
  239.                   </tr>
  240.                   <tr bgcolor="#fafafa"> 
  241.                     <td width="125"> 
  242.                       <div align="left"><font  class="strong"><font  class="strong">&nbsp;型号:<font  class="strong"> 
  243.                         </font> </font></font></div>
  244.                     </td>
  245.                     <td  width="452"><font  class="strong"><font  class="strong"> 
  246.                       <input type="text" name="model" size="24" class="file" value="<%= FieldUtil.filterQuotTag(equipmentValue2.getModel())%>">
  247.                       </font></font></td>
  248.                   </tr>
  249.                   <tr bgcolor="#e0e0e0"> 
  250.                     <td width="125"><font  class="strong"><font  class="strong">&nbsp;资产编号:</font></font></td>
  251.                     <td  width="452"><font  class="strong"> 
  252.                       <input type="text" name="equipmentCode" size="24" class="file" <%=(equipmentValue2.getEquipmentCode().equals(""))?("readonly"):("")%> value="<%= FieldUtil.filterQuotTag(equipmentValue2.getEquipmentCode())%>">&nbsp;*
  253.                       </font></td>
  254.                   </tr>
  255.                   <tr bgcolor="#fafafa"> 
  256.                     <td width="125"><font  class="strong">&nbsp;配置</font>:</td>
  257.                     <td  width="452"><font  class="strong"><font  class="strong"> 
  258.                       <input type="text" name="configure" size="24" class="file" value="<%= FieldUtil.filterQuotTag(equipmentValue2.getConfigure())%>">
  259.                       </font></font></td>
  260.                   </tr>
  261.                   
  262.                   <tr bgcolor="#e0e0e0"> 
  263.                     <td width="125"> 
  264.                       <div align="left"><font  class="strong">&nbsp;购买价格</font>:</div>
  265.                     </td>
  266.                     <td  width="452"><font  class="strong"><font  class="strong"> 
  267.                       <input type="text" name="price" size="24" class="file" size="4" value="<%= equipmentValue2.getPrice()%>">
  268.                       </font></font>元&nbsp;*</td>
  269.                   </tr>
  270.                   <tr bgcolor="#fafafa"> 
  271.                     <td width="125"> 
  272.                       <div align="left"><font  class="strong">&nbsp;购买日期</font>:</div>
  273.                     </td>
  274.                     <td  width="452"> 
  275.                       <div align="left">
  276.                           <input type="text" name="beginDay" readonly size="24" class="text" value="<%= equipmentValue2.getBeginDay()%>" >
  277.                           <img src="/vnex/util/datetime.gif" style="cursor:hand;" align="absmiddle" alt="选择日期" onClick="fPopUpCalendarDlg(beginDay);return false">&nbsp;*
  278.                       </div> 
  279.                     </td>
  280.                   </tr>
  281.                   <tr bgcolor="#e0e0e0"> 
  282.                     <td width="125"><font  class="strong">&nbsp;购买者:</font></td>
  283.                     <td  width="452"> 
  284.                       <select name="buyDeptId" class=choice onChange=change(this)>
  285.                     <org:DivisionList>
  286.                     <vnex:items select='<%= equipmentValue2.getBuyDeptId()+"" %>' >
  287.                     <option value=<org:DivisionAttribute attribute="id"/> <org:DivisionAttribute attribute="isSelected"/> >
  288.                     <org:DivisionAttribute attribute="levelStr"/>+<org:DivisionAttribute attribute="name"/>
  289.                     </option>
  290.                     </vnex:items>
  291.                     </org:DivisionList>
  292.                     </select>&nbsp;*
  293.                     
  294.                     <select name="buyPersonId">
  295.                     <hr:EmployeeList divisionId='<%= equipmentValue2.getBuyDeptId()%>'>             
  296.             <vnex:items  select ='<%= equipmentValue2.getBuyPersonId()+""%>'>
  297.             <option value="<hr:EmployeeAttribute attribute="id" />" <hr:EmployeeAttribute attribute="isSelected"/> >
  298.             <hr:EmployeeAttribute attribute='<%= null %>' />
  299.             </option>
  300.             </vnex:items>            
  301.            </hr:EmployeeList>
  302.            </select>&nbsp;
  303.            
  304.                     </td>
  305.                   </tr>
  306.                   <tr bgcolor="#fafafa"> 
  307.                     <td width="125"><font  class="strong">&nbsp;供应者:</font></td>
  308.                     <td  width="452"><font  class="strong"><font  class="strong"> 
  309.                       <input type="text" name="supplier" size="24" class="file" value="<%= FieldUtil.filterQuotTag(equipmentValue2.getSupplier())%>">
  310.                       </font></font></td>
  311.                   </tr>
  312.                   
  313.                   <tr bgcolor="#e0e0e0"> 
  314.                     <td width="125"> 
  315.                       <div align="left"><font  class="strong">&nbsp;放置地点</font>:</div>
  316.                     </td>
  317.                     <td  width="452"><font  class="strong"> 
  318.                       <input type="text" name="place" size="24" class="file" <%=(equipmentValue2.getEquipmentCode().equals(""))?("readonly"):("")%> value="<%= FieldUtil.filterQuotTag(equipmentValue2.getPlace())%>">
  319.                       </font> </td>
  320.                   </tr>
  321.                   <tr bgcolor="#fafafa"> 
  322.                     <td width="125"> 
  323.                       <div align="left"><font  class="strong">&nbsp;估计使用年限</font>:</div>
  324.                     </td>
  325.                     <td  width="452">
  326.                       <input type="text" name="term" class="file" size="24" value="<%= equipmentValue2.getTerm()%>">
  327.                      月</td>
  328.                   </tr>
  329.                   <tr bgcolor="#e0e0e0"> 
  330.                     <td width="125"><font  class="strong">&nbsp;其他说明:</font></td>
  331.                     <td width="452"> 
  332.                       <textarea name="remark" cols="59" rows="5"><%= FieldUtil.filterQuotTag(equipmentValue2.getRemark())%></textarea>
  333.                     </td>
  334.                   </tr>
  335.                   <tr bgcolor="#fafafa" height="30"> 
  336.                     <td colspan="2"> 
  337.                       <div align="center"> 
  338.                         <input type="button" name="Button" value="保存" class="file" onclick=toSuccess() >&nbsp;&nbsp;
  339.                         <input type="button" name="Button3" value="重置" class="file" onclick="location='/mainctrl/equipmentModify?equipmentId=<%=request.getParameter("equipmentId")%>&fromSelf=0'" >&nbsp;&nbsp;
  340.                         <input type="button" name="Button3" value="放弃" class="file" onClick="location='equipmentDetail?equipmentId=<%=sId%>'" >
  341.                       </div>
  342.                     </td>
  343.                   </tr>
  344.                 </table>
  345.               </td>
  346.             </tr>
  347.           </table>
  348.           <jsp:include page="/vnex/page/TTOA_HELP.jsp" />
  349.        </TD>
  350.      </TR>
  351.      <jsp:include page="/vnex/page/TTOA_TABLE_BOTTOM.jsp" />
  352.     </TBODY> 
  353.   </TABLE>
  354.     <BR>
  355.   <jsp:include page="/vnex/page/TTOA_PRODUCER_LOGO.jsp" />
  356. </form>
  357. </DIV>
  358. </BODY>
  359. </HTML>