sheet_worker_sign_off.jsp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <%@page import="com.udapsoft.waf.common.web.ibsheet7.IBSheet7TD"%>
  2. <%@page import="com.udapsoft.waf.common.web.ibsheet7.IBSheet7TR"%>
  3. <%@page import="com.udapsoft.waf.common.web.ibsheet7.IBSheet7Data"%>
  4. <%@page import="com.udapsoft.waf.system.HandlerStorage"%>
  5. <%@ page import="kr.co.hsnc.common.util.*" %>
  6. <%@ page import="kr.co.hsnc.common.sql.*" %>
  7. <%@ page import="kr.co.hsnc.common.message.WAFMessage" %>
  8. <%@ page contentType="text/html; charset=utf-8" %>
  9. <jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
  10. <%
  11. ctx.init(request, response);
  12. HandlerStorage storage = ctx.getHandlerStorage();
  13. String msg = storage.getMessage();
  14. ValueObject params = storage.getParams();
  15. WAFMessage wafMessage = WAFMessage.getInstance();
  16. wafMessage.setLocale(ctx.getLocale());
  17. boolean success = storage.getSuccess();
  18. IBSheet7Data sheetData = storage.getIBSheet7Data();
  19. %>
  20. <?xml version="1.0" ?>
  21. <% if( !success ) { %>
  22. <ERROR>
  23. <MESSAGE><![CDATA[<%= storage.getMessage() %>]]></MESSAGE>
  24. <ETC-DATA>
  25. <ETC KEY="detail_message"><![CDATA[<%= storage.getDetailMessage() %>]]></ETC>
  26. </ETC-DATA>
  27. </ERROR>
  28. <% }
  29. else { %>
  30. <SHEET>
  31. <% if( sheetData != null ) { %>
  32. <% if( sheetData.getAttribute("TOTAL").equals("") ) { %>
  33. <DATA TOTAL="<%= sheetData.getRowSetSize() %>"
  34. <% }
  35. else { %>
  36. <DATA TOTAL="<%= sheetData.getAttribute("TOTAL") %>"
  37. <% } %>
  38. <% ValueObject dataAttr = sheetData.getAttributes(); %>
  39. <% dataAttr.remove("TOTAL"); %>
  40. <% for( int attrIndex = 0 ; attrIndex < dataAttr.size() ; attrIndex++ ) { %>
  41. <%= dataAttr.getKey(attrIndex) %>="<%= dataAttr.get(attrIndex) %>"
  42. <% } %>
  43. <%= ">" %>
  44. <% for( int i = 0 ; i < sheetData.getRowSetSize() ; i++ ) { %>
  45. <%IBSheet7TR sheetTR = sheetData.sheetTR;%>
  46. <% ValueObject trAttr = sheetTR.getAttributes(); %>
  47. <% int columnSize = sheetTR.getSheetTDSize(); %>
  48. <TR
  49. <% for( int attrIndex = 0 ; attrIndex < trAttr.size() ; attrIndex++ ) { %>
  50. <%= trAttr.getKey(attrIndex) %>="<%= trAttr.get(attrIndex) %>"
  51. <% } %>
  52. <%= ">" %>
  53. <% for( int j = 0 ; j < columnSize ; j++ ) { %>
  54. <TD
  55. <%IBSheet7TD sheetTD = sheetTR.getSheetTD(j);%>
  56. <% ValueObject tdAttr = sheetTD.getAttributes(); %>
  57. <% for( int attrIndex = 0 ; attrIndex < tdAttr.size() ; attrIndex++ ) { %>
  58. <%= tdAttr.getKey(attrIndex) %>="<%= tdAttr.get(attrIndex) %>"
  59. <% } %>
  60. <% if( sheetTD.isBlankValue ) { %>
  61. <%= ">" %></TD>
  62. <% }
  63. else { %>
  64. <% RowSet rowSet = sheetData.getRowSet(sheetTD.rowSetKey); %>
  65. <% if( rowSet != null ) { %>
  66. <% String temp = "";
  67. if( sheetTD.rowSetColumnIndex < rowSet.getColumnSize() ) {
  68. temp = rowSet.getRow(i).get(sheetTD.rowSetColumnIndex);
  69. if( !"".equals(sheetTD.currencyType) ) {
  70. double amount = rowSet.getRow(i).getDouble(sheetTD.rowSetColumnIndex);
  71. if( sheetTD.currencyType.equalsIgnoreCase("KRW") )
  72. temp = formatCurrency(amount, "###,###", "₩");
  73. else if( sheetTD.currencyType.equalsIgnoreCase("USD") )
  74. temp = formatCurrency(amount, "###,##0,##", "$");
  75. else if( sheetTD.currencyType.equalsIgnoreCase("EUR") )
  76. temp = formatCurrency(amount, "###,##0,##", "");
  77. else if( sheetTD.currencyType.equalsIgnoreCase("JPY") )
  78. temp = formatCurrency(amount, "###,##0,##", "");
  79. else if( sheetTD.currencyType.equalsIgnoreCase("SAR") )
  80. temp = formatCurrency(amount, "###,##0,##", "");
  81. }
  82. }
  83. else {
  84. temp = sheetTD.rowSetColumnIndex + " column is not exist(rowset key name: " + sheetTD.rowSetKey + ", rowset column size:" + rowSet.getColumnSize() + ", column index:" + sheetTD.rowSetColumnIndex + ")";
  85. }
  86. %>
  87. <%= ">" %><![CDATA[<%= temp %>]]></TD>
  88. <% }
  89. else { %>
  90. <%= ">" %></TD>
  91. <% } %>
  92. <% } %>
  93. <% } %>
  94. </TR>
  95. <% } %>
  96. </DATA>
  97. <% } %>
  98. </SHEET>
  99. <% } %>
  100. <%!
  101. private static String formatCurrency(double amount, String pattern, String currencySymbol) {
  102. java.text.DecimalFormatSymbols symbol = new java.text.DecimalFormatSymbols();
  103. symbol.setCurrencySymbol(currencySymbol.trim());
  104. java.text.DecimalFormat df = new java.text.DecimalFormat(pattern, symbol);
  105. return currencySymbol + df.format(amount);
  106. }
  107. %>