ContItemPopup.jsp 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <%--
  2. - FileName : ContItemPopup.jsp
  3. - Author(s) : mklee
  4. - Date : 2018.10.23
  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. %>
  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. if(jQuery("#edit_yn").val() == "Y"){
  37. jQuery("#btnSave").show();
  38. }else{
  39. jQuery("#btnSave").hide();
  40. }
  41. gridInit(sheet1);
  42. //autoResize();
  43. jQuery("#btnSearch").click(function() {
  44. jQuery("#fevent").val("SHEET_SELECT");
  45. var url = Modular.model.PageContext.CONTEXT_ROOT + "/cont/outside/ContItemPopup_sheet.screen";
  46. Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 30, "");
  47. });
  48. jQuery("#btnSave").click(function() {
  49. for (var i = 2; i <= sheet1.RowCount(); i ++ ){
  50. if (Number(sheet1.GetCellValue(i, "SUPPLY_AMT")) != Number(sheet1.GetCellValue(i, "SUPPLY_TAMT")) + Number(sheet1.GetCellValue(i, "SUPPLY_NAMT")) ){
  51. alert("과세,면세 합계가 공급액과 일치하지 않습니다.");
  52. alert(Number(sheet1.GetCellValue(i, "SUPPLY_AMT")));
  53. alert(Number(sheet1.GetCellValue(i, "SUPPLY_AMT"))+ Number(sheet1.GetCellValue(i, "SUPPLY_NAMT")) );
  54. return;
  55. }
  56. if (Number(sheet1.GetCellValue(i, "SUPPLY_TAMT")) < Number(sheet1.GetCellValue(i, "FUND_TAMT")) ){
  57. alert("기성과세누계보다 과세금액이 적습니다. "); //변경계약일때
  58. return;
  59. }
  60. if (Number(sheet1.GetCellValue(i, "SUPPLY_NAMT")) < Number(sheet1.GetCellValue(i, "FUND_NAMT")) ){
  61. alert("기성면세누계보다 면세금액이 적습니다. "); //변경계약일때
  62. return;
  63. }
  64. }
  65. if (confirm("저장 하시겠습니까?")){
  66. var f = document.form1;
  67. $("#fevent").val("DATA_SAVE");
  68. var url = Modular.model.PageContext.CONTEXT_ROOT + "ContItemPopup_form.screen";
  69. var result = Modular.view.IBSheet7.doSave(sheet1, url, $("#form1"), false);
  70. }
  71. });
  72. jQuery("#btnSearch").click();
  73. }
  74. function gridInit(sheetName){
  75. var init_sheet = {};
  76. init_sheet.Cfg = {SearchMode:2, Page:5000, MergeSheet:msPrevColumnMerge + msHeaderOnly};
  77. if ( "<%=params.get("MOD_NO")%>" == '0') {//원계약
  78. init_sheet.Cols = [
  79. {Header:'Status', Type:"Status", SaveName:"STATUS", Width:0, Align:"Center", Hidden:"True"},
  80. {Header:'공종코드|공종코드', Type:"Text", SaveName:"CD_CSTR", Width:80, Align:"Left", Edit:"false"},
  81. {Header:'내역코드|내역코드', Type:"Text", SaveName:"DL_CSTR", Width:100, Align:"Left", Edit:"false"},
  82. {Header:'내역명|내역명', Type:"Text", SaveName:"ITEM_NAME", Width:200, Align:"Left", Edit:"false"},
  83. {Header:'현재|공급액', Type:"AutoSum", SaveName:"SUPPLY_AMT", Width:80, Align:"Right", Edit:"True",PointCount:"<%=params.get("digit")%>"},
  84. {Header:'현재|과세', Type:"AutoSum", SaveName:"SUPPLY_TAMT", Width:80, Align:"Right", Edit:"True",PointCount:"<%=params.get("digit")%>"},
  85. {Header:'현재|면세', Type:"AutoSum", SaveName:"SUPPLY_NAMT", Width:80, Align:"Right", Edit:"false",PointCount:"<%=params.get("digit")%>"},
  86. {Header:'MATERIAL_CD', Type:"Text", SaveName:"MATERIAL_CD", Width:50, Align:"Center", Hidden:"true"},
  87. {Header:'과세비율', Type:"Text", SaveName:"SUPP_RATE", Width:80, Align:"Right", Hidden:"true" }
  88. ];
  89. }
  90. else { //변경계약
  91. init_sheet.Cols = [
  92. {Header:'Status', Type:"Status", SaveName:"STATUS", Width:0, Align:"Center", Hidden:"True"},
  93. {Header:'공종코드|공종코드',Type:"Text", SaveName:"CD_CSTR", Width:80, Align:"Left", Edit:"false"},
  94. {Header:'내역코드|내역코드',Type:"Text", SaveName:"DL_CSTR", Width:100, Align:"Left", Edit:"false"},
  95. {Header:'내역명|내역명', Type:"Text", SaveName:"ITEM_NAME", Width:200, Align:"Left", Edit:"false"},
  96. {Header:'이전|공급액', Type:"AutoSum", SaveName:"B_SUPPLY_AMT", Width:80, Align:"Right", Edit:"false",PointCount:"<%=params.get("digit")%>"},
  97. {Header:'이전|과세', Type:"AutoSum", SaveName:"B_SUPPLY_TAMT", Width:80, Align:"Right", Edit:"false",PointCount:"<%=params.get("digit")%>"},
  98. {Header:'이전|면세', Type:"AutoSum", SaveName:"B_SUPPLY_NAMT", Width:80, Align:"Right", Edit:"false",PointCount:"<%=params.get("digit")%>"},
  99. {Header:'현재|공급액', Type:"AutoSum", SaveName:"SUPPLY_AMT", Width:80, Align:"Right", Edit:"True", PointCount:"<%=params.get("digit")%>"},
  100. {Header:'현재|과세', Type:"AutoSum", SaveName:"SUPPLY_TAMT", Width:80, Align:"Right", Edit:"True",PointCount:"<%=params.get("digit")%>"},
  101. {Header:'현재|면세', Type:"AutoSum", SaveName:"SUPPLY_NAMT", Width:80, Align:"Right", Edit:"false",PointCount:"<%=params.get("digit")%>"},
  102. {Header:'기성누계|과세', Type:"AutoSum", SaveName:"FUND_TAMT", Width:80, Align:"Right", Edit:"false",PointCount:"<%=params.get("digit")%>"},
  103. {Header:'기성누계|면세', Type:"AutoSum", SaveName:"FUND_NAMT", Width:80, Align:"Right", Edit:"false",PointCount:"<%=params.get("digit")%>"},
  104. {Header:'MATERIAL_CD', Type:"Text", SaveName:"MATERIAL_CD", Width:50, Align:"Center", Hidden:"true"},
  105. {Header:'과세비율', Type:"Text", SaveName:"SUPP_RATE", Width:80, Align:"Right", Hidden:"true" }
  106. ];
  107. }
  108. init_sheet.HeaderMode = {Sort:1};
  109. IBS_InitSheet(sheetName, init_sheet);
  110. sheetName.SetDataAutoTrim(0);
  111. setGridSize();
  112. }
  113. function setGridSize() {
  114. sheet1.FitColWidth();
  115. }
  116. function sheet1_OnSearchEnd(code, message) {
  117. if(code == 0) {
  118. setGridSize();
  119. } else {
  120. //조회 에러 수행
  121. alert(message);
  122. }
  123. }
  124. function sheet1_OnSaveEnd(code, msg)
  125. {
  126. var event = $("#fevent").val();
  127. if(event == "DATA_SAVE"){
  128. alert("저장 완료되었습니다.");
  129. }
  130. }
  131. /**
  132. * IBSheet Change Event
  133. */
  134. function sheet1_OnChange(Row, Col, Value, OldValue, RaiseFlag) {
  135. if (Col == 5 || Col == 8) { //과세 수정
  136. sheet1.SetCellValue(Row,"SUPPLY_NAMT", sheet1.GetCellValue(Row,"SUPPLY_AMT") - sheet1.GetCellValue(Row,"SUPPLY_TAMT"));
  137. sheet1.SetCellValue(Row,"SUPPLY_AMT", sheet1.GetCellValue(Row,"SUPPLY_NAMT") + sheet1.GetCellValue(Row,"SUPPLY_TAMT"));
  138. }else if (Col == 4 || Col == 7){ //공급가액 수정
  139. sheet1.SetCellValue(Row,"SUPPLY_TAMT", (sheet1.GetCellValue(Row,"SUPPLY_AMT") * sheet1.GetCellValue(Row,"SUPP_RATE")) );
  140. sheet1.SetCellValue(Row,"SUPPLY_NAMT", sheet1.GetCellValue(Row,"SUPPLY_AMT") - (sheet1.GetCellValue(Row,"SUPPLY_AMT") * sheet1.GetCellValue(Row,"SUPP_RATE")));
  141. }
  142. //}else if(Col == 6){ //면세수정
  143. // sheet1.SetCellValue(Row,"SUPPLY_TAMT", sheet1.GetCellValue(Row,"SUPPLY_AMT") - sheet1.GetCellValue(Row,"SUPPLY_NAMT"));
  144. //} SUP_RATE = 계약과세/계약공급가*/
  145. }
  146. function sheet1_OnSmartResize(Width, Height) {
  147. sheet1.FitColWidth();
  148. //autoResize();
  149. }
  150. function autoResize(){
  151. var t1_height = document.getElementById("search-table").scrollHeight + document.getElementById("title_pop").scrollHeight + 20;
  152. var iframeHeight= document.body.scrollHeight - t1_height;
  153. var iframeWidth= document.body.scrollWidth;
  154. sheet1.SetSheetHeight(iframeHeight);
  155. }
  156. function doResult(resultObj) {
  157. try {
  158. if( resultObj.getRequestEvent() == "DATA_SAVE" ) {
  159. if( resultObj.getSuccess() ) {
  160. alert("저장 완료되었습니다.");
  161. }
  162. else {
  163. dlgErrorMsg(resultObj);
  164. }
  165. document.form1.isSubmit = false;
  166. }
  167. }
  168. catch(errorObject) {
  169. showErrorDlg("doResult()", errorObject);
  170. }
  171. }
  172. </SCRIPT>
  173. <modular:search id="form1">
  174. <modular:key id="fevent" />
  175. </modular:search>
  176. <FORM id="form1" name="form1" method="get" modular:type="search">
  177. <INPUT type="hidden" name="fevent" id="fevent" value="">
  178. <INPUT type="hidden" name="SUB_CONT_MOD_ID" value="<%=params.get("SUB_CONT_MOD_ID")%>" />
  179. <INPUT type="hidden" name="MOD_NO" value="<%=params.get("MOD_NO")%>" />
  180. <INPUT type="hidden" name="pop_win_id" value="<%=params.get("pop_win_id")%>" />
  181. <INPUT type="hidden" name="digit" value="<%=params.get("digit") %>">
  182. <INPUT type="hidden" name="edit_yn" value="<%=params.get("edit_yn") %>">
  183. <table id="search-table" class="search-form-table">
  184. <colgroup>
  185. <col width="*" />
  186. </colgroup>
  187. <tr>
  188. <td class="button" style="text-align:right; padding-right:10px;">
  189. <span class="btnSearch center" id="btnSave" style="display:;"><a href="javascript:void(0);">저장</a></span>
  190. <span class="btnSearch center" id="btnSearch" style="display:;"><a href="javascript:void(0);">검색</a></span>
  191. </td>
  192. </tr>
  193. </table>
  194. <!-- 검색조건 종료 -->
  195. <div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 450px; overflow: auto;">
  196. <script>createIBSheet('sheet1','100%', '450px');</script>
  197. </div>
  198. </form>