CommMatlCodeTree.jsp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <%--
  2. - FileName : CommMatlCodeTree.jsp
  3. - Author(s) : pej
  4. - Date : 2007-06-13
  5. - Copyright : Copyright (c) 2002-2003 www.hwenc.com, Inc.
  6. -
  7. - Description: 자재코드 등록 > 자재코드트리
  8. --%>
  9. <%@ page contentType="text/html; charset=utf-8" %>
  10. <%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
  11. <%@ page import="kr.co.hsnc.common.util.*" %>
  12. <%@ page import="kr.co.hsnc.common.sql.*" %>
  13. <jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
  14. <%
  15. ctx.init(request, response);
  16. HandlerStorage storage = ctx.getHandlerStorage();
  17. ValueObject user = ctx.getUser();
  18. ValueObject params = storage.getParams();
  19. String event = storage.getEvent();
  20. String deptCd = ctx.getUser().get("site_code");
  21. String deptName = ctx.getUser().get("site_name");
  22. String estGb = "EST";
  23. RowSet rowset = storage.getRowSet("rsSectList");
  24. %>
  25. <div style="margin-top: 10px;"></div>
  26. <SCRIPT LANGUAGE="JavaScript">
  27. <!--
  28. root=gFld("공통자재코드", '/common/CommMatlCodeList.screen');
  29. root.iconSrc = ICONPATH + 'root.gif';
  30. root.iconSrcClosed = ICONPATH + 'root.gif';
  31. <%
  32. if(rowset != null && rowset.size()> 0) {
  33. out.println(getTreeHtml(deptCd, rowset));
  34. }
  35. %>
  36. </SCRIPT>
  37. <style>
  38. a {
  39. color : dimgray;
  40. line-height : 120%;
  41. font-family : 굴림, arial;
  42. font-size : 12px;
  43. text-decoration : none;
  44. };
  45. </style>
  46. <% if(rowset != null && rowset.size()> 0) { %>
  47. <div style="position:absolute;display:none; top:0; left:0;"><table border=0><tr><td><font size=-2><a style="font-size:7pt;text-decoration:none;color:silver" href="http://www.treemenu.net/" target=_blank>www.treemenu.net</a></font></td></tr></table></div>
  48. <script>initializeDocument();</script>
  49. <noscript>
  50. A tree for site navigation will open here if you enable JavaScript in your browser.
  51. </noscript>
  52. <% } else { %>
  53. <font style=font-size:9pt>There is no actual budget registered.</font>
  54. <% } %>
  55. <%!
  56. private String getTreeHtml(String deptCd, RowSet rowset){
  57. StringBuffer html = new StringBuffer();
  58. String sectCodeL1 = "";
  59. String sectCodeL2 = "";
  60. String sectCodeL3 = "";
  61. String sectCodeNameL1 = "";
  62. String sectCodeNameL2 = "";
  63. String sectCodeNameL3 = "";
  64. int iDepth = 0;
  65. try {
  66. for(int i=0; i<rowset.size(); i++){
  67. iDepth = rowset.getRow(i).getInt("MATERIALLEVEL");
  68. if ( iDepth == 1 ){
  69. sectCodeL1 = rowset.getRow(i).get("MATERIALGROUP");
  70. sectCodeNameL1 = rowset.getRow(i).get("MATERIALGROUPNAME");
  71. html.append("aux0=insFld(root, gFld(\""+rowset.getRow(i).get("MATERIALGROUPNAME")+"("+rowset.getRow(i).get("MATERIALGROUP")+")"+"\", \"/common/CommMatlCodeList.screen?sect_id="+rowset.getRow(i).get("MATERIALGROUP")+"&level="+rowset.getRow(i).get("MATERIALLEVEL")+"&isNode=true&code="+sectCodeL1+"\"));").append("\n");
  72. }
  73. else if ( iDepth == 2 ){
  74. sectCodeL2 = rowset.getRow(i).get("MATERIALGROUP");
  75. sectCodeNameL2 = rowset.getRow(i).get("MATERIALGROUPNAME");
  76. html.append("aux1=insFld(aux0, gFld(\""+rowset.getRow(i).get("MATERIALGROUPNAME")+"("+rowset.getRow(i).get("MATERIALGROUP")+")"+"\", \"/common/CommMatlCodeList.screen?sect_id="+rowset.getRow(i).get("MATERIALGROUP")+"&level="+rowset.getRow(i).get("MATERIALLEVEL")+"&isNode=true&code="+sectCodeL1+"-"+sectCodeL2+"\"));").append("\n");
  77. }
  78. else if ( iDepth == 3 ){
  79. sectCodeL3 = rowset.getRow(i).get("MATERIALGROUP");
  80. sectCodeNameL3 = rowset.getRow(i).get("MATERIALGROUPNAME");
  81. html.append("aux2=insFld(aux1, gFld(\""+rowset.getRow(i).get("MATERIALGROUPNAME")+"("+rowset.getRow(i).get("MATERIALGROUP")+")"+"\", \"/common/CommMatlCodeList.screen?sect_id="+rowset.getRow(i).get("MATERIALGROUP")+"&level="+rowset.getRow(i).get("MATERIALLEVEL")+"&code="+sectCodeL1+"-"+sectCodeL2+"-"+sectCodeL3+"\"));").append("\n");
  82. }
  83. }
  84. }
  85. catch(Exception e){
  86. System.out.println(e);
  87. }
  88. return html.toString();
  89. }
  90. %>