chgItemPopup.jsp 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <%--
  2. - FileName : chgItemPopup.jsp
  3. - Author(s) : Kim Myung HO
  4. - Date : 2014.10.28
  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.ui.HTMLMaker" %>
  14. <%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
  15. <%@ page import="com.udapsoft.waf.common.util.*" %>
  16. <%@ include file="/jsp/work/taglib.jsp" %>
  17. <jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
  18. <%
  19. ctx.init(request, response);
  20. HandlerStorage storage = ctx.getHandlerStorage();
  21. ValueObject user = ctx.getUser();
  22. ValueObject params = storage.getParams();
  23. String event = storage.getEvent();
  24. ValueObject cont = storage.getValueObject("cont");
  25. ValueObject ContInfo = storage.getValueObject("ContInfo");
  26. RowSet chgItemList = storage.getRowSet("chgItemList");
  27. %>
  28. <SCRIPT language="JavaScript">
  29. var sheet1;
  30. var sheet1Row;
  31. var sheet1PageNo = 1;
  32. var pageLastRowIndex = 1;
  33. var validationResult = false;
  34. var filterShow = false;
  35. function _onReady(){
  36. gridInit(sheet1);
  37. autoResize();
  38. jQuery("#btnSearch").click(function() {
  39. jQuery("#fevent").val("SHEET_SELECT");
  40. var url = Modular.model.PageContext.CONTEXT_ROOT + "/cont/purchase/chgItemPopup_sheet.screen";
  41. Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 30, "");
  42. });
  43. jQuery("#btnSave").click(function() {
  44. if(!chgSaveChk()){
  45. return;
  46. }
  47. if(!sheet1.IsDataModified()) {
  48. alert("저장할 내역이 없습니다.");
  49. return;
  50. }
  51. if (confirm("변경 내역을 저장 하시겠습니까?")){
  52. jQuery("#fevent").val("SHEET_SAVE");
  53. var url = Modular.model.PageContext.CONTEXT_ROOT + "/cont/purchase/chgItemPopup_sheet.screen";
  54. var result = Modular.view.IBSheet7.doSave(sheet1, url, jQuery("#form1"), false);
  55. }
  56. });
  57. jQuery("#btnSearch").click();
  58. }
  59. function gridInit(sheetName){
  60. var init_sheet = {};
  61. init_sheet.Cfg = {SearchMode:2, Page:5000, MergeSheet:msPrevColumnMerge + msHeaderOnly};
  62. init_sheet.Cols = [
  63. {Header:'자재코드|자재코드', Type:"Text", SaveName:"MATERIAL_CD", Width:100, Align:"Left", Edit:"false"},
  64. {Header:'자재명|자재명', Type:"Text", SaveName:"ITEM_NAME", Width:150, Align:"Left", Edit:"false"},
  65. {Header:'규격|규격', Type:"Text", SaveName:"ITEM_SPEC", Width:80, Align:"center", Edit:"false"},
  66. {Header:'단위|단위', Type:"Text", SaveName:"ITEM_UNIT", Width:60, Align:"center", Edit:"false"},
  67. {Header:'변경전|수량', Type:"Float", SaveName:"ITEM_QTY", Width:80, Align:"Right", Edit:"false",PointCount:2},
  68. {Header:'변경전|단가', Type:"Float", SaveName:"ITEM_PRICE", Width:100, Align:"Right", Edit:"false", PointCount:'<%=cont.get("POINTCOUNT")%>'},
  69. {Header:'변경전|금액', Type:"AutoSum", SaveName:"ITEM_AMT", Width:150, Align:"Right", Edit:"false", PointCount:'<%=cont.get("POINTCOUNT")%>'},
  70. {Header:'변경후|수량', Type:"Float", SaveName:"CONT_QTY", Width:80, Align:"Right", Edit:"true",PointCount:2},
  71. {Header:'변경후|단가', Type:"Float", SaveName:"CONT_PRICE", Width:100, Align:"Right", Edit:"true", PointCount:'<%=cont.get("POINTCOUNT")%>'},
  72. {Header:'변경후|금액', Type:"AutoSum", SaveName:"CONT_AMT", Width:150, Align:"Right", Edit:"false", PointCount:'<%=cont.get("POINTCOUNT")%>'},
  73. {Header:'발주수량|발주수량', Type:"Int", SaveName:"DEMANDED_QTY", Width:80, Align:"Right", Edit:"false"},
  74. {Header:'입고수량|입고수량', Type:"Int", SaveName:"STOCK_QTY", Width:80, Align:"Right", Edit:"false"},
  75. {Header:'상태|상태', Type:"Text", SaveName:"CHG_MOD_CD", Width:80, Align:"Left", Edit:"false", Hidden:"True"},
  76. {Header:'Status|Status',Type:"Status", SaveName:"STATUS", Width:50, Align:"Center", Hidden:"True"},
  77. {Header:'INFLAG|INFLAG',Type:"Text", SaveName:"INFLAG", Width:50, Align:"Center", Hidden:"True"},
  78. ];
  79. init_sheet.HeaderMode = {Sort:1};
  80. IBS_InitSheet(sheetName, init_sheet);
  81. sheetName.SetDataAutoTrim(0);
  82. setGridSize();
  83. }
  84. function setGridSize() {
  85. sheet1.FitColWidth();
  86. }
  87. function sheet1_OnSearchEnd(code, message) {
  88. if(code == 0) {
  89. setGridSize();
  90. for(var i=1;i <= sheet1.RowCount();i++){
  91. if(sheet1.GetCellValue(i,"CHG_MOD_CD") == "DELETE"){
  92. sheet1.SetRowEditable(i,0);
  93. }
  94. }
  95. } else {
  96. //조회 에러 수행
  97. alert(message);
  98. }
  99. }
  100. function sheet1_OnSaveEnd(code, msg)
  101. {
  102. var event = $("#fevent").val();
  103. if(code>= "0"){
  104. if(event == "SHEET_SAVE"){
  105. alert("저장되었습니다.");
  106. parent.window.location.reload();
  107. }
  108. }else{
  109. alert("저장실패.");
  110. }
  111. }
  112. /**
  113. * IBSheet Change Event
  114. */
  115. function sheet1_OnChange(Row, Col, Value, OldValue, RaiseFlag) {
  116. if (sheet1.ColSaveName(Col) == "CONT_QTY") {
  117. if(RaiseFlag==0){
  118. if((sheet1.GetCellValue(Row,"CONT_QTY") < sheet1.GetCellValue(Row,"STOCK_QTY")) || (sheet1.GetCellValue(Row,"CONT_QTY") > sheet1.GetCellValue(Row,"DEMANDED_QTY"))){
  119. alert("변경 수량은 발주 수량보다 많을수 없으며 입고수량보다 적을수 없습니다.");
  120. sheet1.SetCellValue(Row, Col, OldValue);
  121. // return false;
  122. }
  123. }
  124. }
  125. if ((sheet1.ColSaveName(Col) == "CONT_QTY") || (sheet1.ColSaveName(Col) == "CONT_PRICE")) {
  126. //alert(sheet1.GetCellValue(Row,"CONT_QTY") * sheet1.GetCellValue(Row,"CONT_PRICE"));
  127. sheet1.SetCellValue(Row, "CONT_AMT", sheet1.GetCellValue(Row,"CONT_QTY") * sheet1.GetCellValue(Row,"CONT_PRICE"));
  128. }
  129. }
  130. function sheet1_OnSmartResize(Width, Height) {
  131. sheet1.FitColWidth();
  132. autoResize();
  133. }
  134. /**
  135. * enter click 시 자동으로 검색이되도록 조
  136. */
  137. function check_Enter(){
  138. if (event.keyCode==13)
  139. jQuery("#btnSearch").click();
  140. }
  141. function chgSaveChk(){
  142. for(var i=2; i<=sheet1.RowCount()+1; i++){
  143. if(sheet1.GetCellValue(i,"CHG_MOD_CD")!="DELETE"){
  144. /*if((sheet1.GetCellValue(i,"CONT_AMT")=="") ){
  145. alert(i-1 + "번째 " + sheet1.GetCellValue(i,"ITEM_NAME") + " 변경 내역에 대해 수랑 또는 단가 입력이 안되었습니다.");
  146. return false;
  147. }*/
  148. sheet1.SetCellValue(i, "INFLAG", "Y");
  149. }
  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="post" 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="pDemID" value="<%=params.get("pDemID")%>" />
  170. <table id="search-table" class="search-form-table">
  171. <colgroup>
  172. <col width="*" />
  173. </colgroup>
  174. <tr>
  175. <td class="button" style="text-align:right; padding-right:10px;">
  176. <span class="btnSearch center" id="btnSearch" style="display:;"><a href="javascript:void(0);">검색</a></span>
  177. <%if (params.get("editYN").equals("Y")){%>
  178. <span class="btnSearch center" id="btnSave"><a href="javascript:void(0);">저장</a></span>
  179. <%} %>
  180. </td>
  181. </tr>
  182. </table>
  183. <!-- 검색조건 종료 -->
  184. <div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 330px; overflow: auto;">
  185. <script>createIBSheet('sheet1','100%', '330px');</script>
  186. </div>
  187. </form>
  188. <%//상품 목록 %>
  189. <%@ include file="/jsp/ko_KR/buyer/cont/purchase/chgItemList.jsp" %>
  190. <%
  191. if (params.get("isClose").equals("Y")) {
  192. %>
  193. <script>
  194. winClose();
  195. </script>
  196. <%
  197. }
  198. %>