ItemPopup.jsp 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <%--
  2. - FileName : ItemPopup.jsp
  3. - Author(s) : Kim Myung HO
  4. - Date : 2014.11.21
  5. - Description: ITEM 변경 내역
  6. --%>
  7. <%@ page contentType="text/html; charset=utf-8" %>
  8. <%@ page import="kr.co.hsnc.common.sql.RowSet" %>
  9. <%@ page import="kr.co.hsnc.common.util.ValueObject" %>
  10. <%@ page import="com.udapsoft.waf.system.*" %>
  11. <%@ page import="com.udapsoft.waf.common.*" %>
  12. <%@ page import="kr.co.udapsoft.common.*" %>
  13. <%@ page import="com.udapsoft.waf.common.util.*" %>
  14. <%@ page import="kr.co.hsnc.common.util.*"%>
  15. <%@ page import="kr.co.hsnc.common.util.Formatter"%>
  16. <%@ page import="com.udapsoft.waf.common.ui.HTMLMaker" %>
  17. <%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
  18. <%@page import="java.net.URLDecoder"%>
  19. <%@ include file="/jsp/work/taglib.jsp" %>
  20. <jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
  21. <%
  22. ctx.init(request, response);
  23. HandlerStorage storage = ctx.getHandlerStorage();
  24. ValueObject user = ctx.getUser();
  25. ValueObject params = storage.getParams();
  26. String event = storage.getEvent();
  27. System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
  28. System.out.println(params);
  29. System.out.println("#################################################");
  30. ValueObject ContInfo = new ValueObject();
  31. ContInfo.set("DIV_PO_YN", params.get("DIV_PO_YN"));
  32. request.setCharacterEncoding("utf-8");
  33. String curr_std_nm = URLDecoder.decode(request.getParameter("curr_std_nm"),"UTF-8");
  34. /*계약 구매 내역 목록*/
  35. RowSet itemList = storage.getRowSet("itemList");
  36. %>
  37. <SCRIPT language="JavaScript">
  38. var sheet1;
  39. var sheet1Row;
  40. var sheet1PageNo = 1;
  41. var pageLastRowIndex = 1;
  42. var validationResult = false;
  43. var filterShow = false;
  44. function _onReady(){
  45. gridInit(sheet1);
  46. //autoResize();
  47. jQuery("#btnSearch").click(function() {
  48. jQuery("#fevent").val("SHEET_ITEM_SELECT");
  49. var url = Modular.model.PageContext.CONTEXT_ROOT + "/cont/purchase/ItemPopup_sheet.screen";
  50. Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 30, "");
  51. });
  52. jQuery("#btnSave").click(function() {
  53. if(!SaveChk()){
  54. return;
  55. }
  56. if(!sheet1.IsDataModified()) {
  57. alert("저장할 내역이 없습니다.");
  58. return;
  59. }
  60. if (confirm("수정된 내역을 저장 하시겠습니까?")){
  61. jQuery("#fevent").val("SHEET_ITEM_SAVE");
  62. var url = Modular.model.PageContext.CONTEXT_ROOT + "/cont/purchase/ItemPopup_sheet.screen";
  63. var result = Modular.view.IBSheet7.doSave(sheet1, url, jQuery("#form1"), false);
  64. }
  65. });
  66. jQuery("#btnAddItem").click(function() {
  67. var win_id = "ItemAddPop";
  68. var editYN = "N";
  69. var link = "/cont/purchase/ItemAddPopup.screen";
  70. link += "?pop_win_id="+win_id+"&PUR_CONT_MOD_ID="+$("#PUR_CONT_MOD_ID").val()+"&PUR_CONT_ID="+$("#PUR_CONT_ID").val()+"&pDemID="+$("#pDemID").val()+"&editYN="+ editYN;;
  71. fLayerPop(win_id, link, 500,200, '','', 'NO');
  72. });
  73. jQuery("#btnSearch").click();
  74. }
  75. function ItemAddClose(){
  76. setTimeout(function(){fLayerPopClose('ItemAddPop');},100);
  77. jQuery("#btnSearch").click();
  78. }
  79. function gridInit(sheetName){
  80. var init_sheet = {};
  81. init_sheet.Cfg = {SearchMode:2, Page:5000, MergeSheet:msPrevColumnMerge + msHeaderOnly};
  82. init_sheet.Cols = [
  83. {Header:'자재코드', Type:"Text", SaveName:"MATERIAL_CD", Width:100, Align:"Left", Edit:"false"},
  84. {Header:'자재명', Type:"Text", SaveName:"ITEM_NAME", Width:150, Align:"Left", Edit:"false"},
  85. {Header:'규격', Type:"Text", SaveName:"ITEM_SPEC", Width:80, Align:"center", Edit:"false"},
  86. {Header:'단위', Type:"Text", SaveName:"ITEM_UNIT", Width:60, Align:"center", Edit:"false"},
  87. {Header:'수량', Type:"Float", SaveName:"CONT_QTY", Width:80, Align:"Right", Edit:"true", PointCount:2},
  88. {Header:'단가', Type:"Float", SaveName:"CONT_PRICE", Width:100, Align:"Right", Edit:"true", PointCount:<%=params.get("digit")%>},
  89. {Header:'금액', Type:"AutoSum", SaveName:"CONT_AMT", Width:150, Align:"Right", Edit:"false", PointCount:<%=params.get("digit")%>},
  90. {Header:'Status', Type:"Status", SaveName:"STATUS", Width:50, Align:"Center", Hidden:"True"},
  91. {Header:'INFLAG', Type:"Text", SaveName:"INFLAG", Width:50, Align:"Center", Hidden:"true"},
  92. ];
  93. init_sheet.HeaderMode = {Sort:1};
  94. IBS_InitSheet(sheetName, init_sheet);
  95. sheetName.SetDataAutoTrim(0);
  96. setGridSize();
  97. }
  98. function setGridSize() {
  99. sheet1.FitColWidth();
  100. }
  101. function sheet1_OnSearchEnd(code, message) {
  102. if(code == 0) {
  103. setGridSize();
  104. } else {
  105. //조회 에러 수행
  106. alert(message);
  107. }
  108. }
  109. function sheet1_OnSaveEnd(code, msg)
  110. {
  111. var event = $("#fevent").val();
  112. if(code>= "0"){
  113. if(event == "SHEET_ITEM_SAVE"){
  114. alert("저장되었습니다.");
  115. jQuery("#isClose").val("Y");
  116. jQuery("#fevent").val("");
  117. document.form1.submit();
  118. }
  119. }else{
  120. alert("저장실패.");
  121. }
  122. }
  123. /**
  124. * IBSheet Change Event
  125. */
  126. function sheet1_OnChange(Row, Col, Value, OldValue, RaiseFlag) {
  127. if ((sheet1.ColSaveName(Col) == "CONT_QTY") || (sheet1.ColSaveName(Col) == "CONT_PRICE")) {
  128. //alert(sheet1.GetCellValue(Row,"CONT_QTY") * sheet1.GetCellValue(Row,"CONT_PRICE"));
  129. sheet1.SetCellValue(Row, "CONT_AMT", sheet1.GetCellValue(Row,"CONT_QTY") * sheet1.GetCellValue(Row,"CONT_PRICE"));
  130. }
  131. }
  132. function sheet1_OnSmartResize(Width, Height) {
  133. sheet1.FitColWidth();
  134. //autoResize();
  135. }
  136. /**
  137. * enter click 시 자동으로 검색이되도록 조
  138. */
  139. function check_Enter(){
  140. if (event.keyCode==13)
  141. jQuery("#btnSearch").click();
  142. }
  143. function SaveChk(){
  144. for(var i=1; i<=sheet1.RowCount()+1; i++){
  145. if((sheet1.GetCellValue(i,"CONT_AMT")=="") || (sheet1.GetCellValue(i,"CONT_AMT")=="0")){
  146. alert(i-1 + "번째 " + sheet1.GetCellValue(i,"ITEM_NAME") + " 내역에 대해 수랑 또는 단가 입력이 안되었습니다.");
  147. return false;
  148. }
  149. sheet1.SetCellValue(i, "INFLAG", "Y");
  150. }
  151. return true;
  152. }
  153. function autoResize(){
  154. var t1_height = document.getElementById("search-table").scrollHeight + document.getElementById("title_pop").scrollHeight + 20;
  155. var iframeHeight= document.body.scrollHeight - t1_height;
  156. var iframeWidth= document.body.scrollWidth;
  157. sheet1.SetSheetHeight(iframeHeight);
  158. }
  159. document.onkeydown = closePopupWindow;
  160. //document.body.onresize = addEvent( document.body.onresize, "autoResize()");
  161. </SCRIPT>
  162. <modular:search id="form1">
  163. <modular:key id="fevent" />
  164. </modular:search>
  165. <FORM id="form1" name="form1" method="get" modular:type="search">
  166. <INPUT type="hidden" name="fevent" id="fevent" value="">
  167. <INPUT type="hidden" name="PUR_CONT_MOD_ID" value="<%=params.get("PUR_CONT_MOD_ID")%>" />
  168. <INPUT type="hidden" name="PUR_CONT_ID" value="<%=params.get("PUR_CONT_ID")%>" />
  169. <INPUT type="hidden" name="pop_win_id" value="<%=params.get("pop_win_id")%>" />
  170. <INPUT type="hidden" name="editYN" value="<%=params.get("editYN")%>" />
  171. <INPUT type="hidden" name="pDemID" value="<%=params.get("pDemID")%>" />
  172. <INPUT type="hidden" name="DIV_PO_YN" value="<%=params.get("DIV_PO_YN") %>">
  173. <INPUT type="hidden" name="TEMPLATE_CD" value="<%=params.get("TEMPLATE_CD") %>">
  174. <INPUT type="hidden" name="isClose" value="<%=params.get("isClose") %>">
  175. <INPUT type="hidden" name="digit" value="<%=params.get("digit") %>">
  176. <INPUT type="hidden" name="curr_std_nm" value="<%=curr_std_nm%>">
  177. <table id="search-table" class="search-form-table">
  178. <colgroup>
  179. <col width="*" />
  180. </colgroup>
  181. <tr>
  182. <td class="button" style="text-align:right; padding-right:10px;">
  183. <span class="btnSearch center" id="btnSearch" style="display:;"><a href="javascript:void(0);">검색</a></span>
  184. <%if (params.get("TEMPLATE_CD").equals("4") || params.get("TEMPLATE_CD").equals("13")){%>
  185. <span class="btnSearch center" id="btnAddItem"><a href="javascript:void(0);">품목추가</a></span>
  186. <%} %>
  187. <%if (params.get("editYN").equals("Y")){%>
  188. <span class="btnSearch center" id="btnSave"><a href="javascript:void(0);">저장</a></span>
  189. <%} %>
  190. </td>
  191. </tr>
  192. </table>
  193. <!-- 검색조건 종료 -->
  194. <div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 450px; overflow: auto;">
  195. <script>createIBSheet('sheet1','100%', '450px');</script>
  196. </div>
  197. </form>
  198. <%//상품 목록 %>
  199. <%@ include file="/jsp/ko_KR/buyer/cont/purchase/itemList2.jsp" %>
  200. <%
  201. if (params.get("isClose").equals("Y")) {
  202. %>
  203. <script>
  204. winClose();
  205. </script>
  206. <%
  207. }
  208. %>