PayItemPopup.jsp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <%--
  2. - FileName : PayItemPopup.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 + "/payment/outside/PayItemPopup_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()+1; i ++){
  50. if ( sheet1.GetCellValue(i, "RE_TAMT") < 0 ) {
  51. alert("입력한 금회 기성 과세액이 계약 과세금 보다 큽니다.");
  52. return;
  53. }
  54. if ( sheet1.GetCellValue(i, "RE_NAMT") < 0 ) {
  55. alert("입력한 금회 기성 면세액이 계약 면세금 보다 큽니다.");
  56. return;
  57. }
  58. }
  59. if (confirm("저장 하시겠습니까?")){
  60. var f = document.form1;
  61. $("#fevent").val("DATA_SAVE");
  62. var url = Modular.model.PageContext.CONTEXT_ROOT + "PayItemPopup_form.screen";
  63. var result = Modular.view.IBSheet7.doSave(sheet1, url, $("#form1"), false);
  64. }
  65. });
  66. jQuery("#btnSearch").click();
  67. }
  68. function gridInit(sheetName){//CalcLogic:"|CUR_TAMT|*|RATE|" CalcLogic:"|SUPPLY_TAMT|-|BEF_TAMT|-|CUR_TAMT|", CalcLogic:"|SUPPLY_NAMT|-|BEF_NAMT|-|CUR_TAMT|*|RATE|",
  69. var init_sheet = {};
  70. init_sheet.Cfg = {SearchMode:2, Page:5000, MergeSheet:msPrevColumnMerge + msHeaderOnly};
  71. init_sheet.Cols = [
  72. {Header:'Status', Type:"Status", SaveName:"STATUS", Width:10, Align:"Center" , Hidden:"true"},
  73. {Header:'공종코드', Type:"Text", SaveName:"CD_CSTR", Width:80, Align:"Left", Edit:"false", Hidden:"true"},
  74. {Header:'내역코드', Type:"Text", SaveName:"DL_CSTR", Width:100, Align:"Left", Edit:"false", Hidden:"true"},
  75. {Header:'내역명|내역명', Type:"Text", SaveName:"ITEM_NAME", Width:200, Align:"Left", Edit:"false"},
  76. {Header:'전회|과세', Type:"AutoSum", SaveName:"BEF_TAMT", Width:80, Align:"Right", Edit:"false", PointCount:"<%=params.get("digit")%>"},
  77. {Header:'전회|면세', Type:"AutoSum", SaveName:"BEF_NAMT", Width:80, Align:"Right", Edit:"false", PointCount:"<%=params.get("digit")%>"},
  78. {Header:'금회|과세', Type:"AutoSum", SaveName:"CUR_TAMT", Width:80, Align:"Right", Edit:"True", PointCount:"<%=params.get("digit")%>"},
  79. {Header:'금회|면세', Type:"AutoSum", SaveName:"CUR_NAMT", Width:80, Align:"Right", Edit:"True", PointCount:"<%=params.get("digit")%>"},
  80. {Header:'잔여|과세', Type:"AutoSum", SaveName:"RE_TAMT", Width:80, Align:"Right", Edit:"false", PointCount:"<%=params.get("digit")%>"},
  81. {Header:'잔여|면세', Type:"AutoSum", SaveName:"RE_NAMT", Width:80, Align:"Right", Edit:"false", PointCount:"<%=params.get("digit")%>"},
  82. {Header:'ACMP_ID', Type:"Text", SaveName:"ACMP_ID", Width:50, Align:"Center", Hidden:"true"},
  83. {Header:'SUB_CONT_ID', Type:"Text", SaveName:"SUB_CONT_ID", Width:50, Align:"Center", Hidden:"true"},
  84. {Header:'SUPPLY_TAMT', Type:"Text", SaveName:"SUPPLY_TAMT", Width:50, Align:"Center", Hidden:"true"},
  85. {Header:'SUPPLY_NAMT', Type:"Text", SaveName:"SUPPLY_NAMT", Width:50, Align:"Center", Hidden:"true"},
  86. {Header:'RATE', Type:"Text", SaveName:"RATE", Width:50, Align:"Center", Hidden:"true"},
  87. {Header:'MATERIAL_CD', Type:"Text", SaveName:"MATERIAL_CD", Width:50, Align:"Center", Hidden:"true"},
  88. {Header:'CD_SITE', Type:"Text", SaveName:"CD_SITE", Width:50, Align:"Center", Hidden:"true"}
  89. ];
  90. init_sheet.HeaderMode = {Sort:1};
  91. IBS_InitSheet(sheetName, init_sheet);
  92. sheetName.SetDataAutoTrim(0);
  93. setGridSize();
  94. }
  95. function setGridSize() {
  96. sheet1.FitColWidth();
  97. }
  98. function doResult(resultObj) {
  99. try {
  100. if( resultObj.getRequestEvent() == "DATA_SAVE" ) {
  101. if( resultObj.getSuccess() ) {
  102. }
  103. else {
  104. dlgErrorMsg(resultObj);
  105. }
  106. document.form1.isSubmit = false;
  107. }
  108. }
  109. catch(errorObject) {
  110. showErrorDlg("doResult()", errorObject);
  111. }
  112. }
  113. function sheet1_OnSearchEnd(code, message) {
  114. if(code == 0) {
  115. for (var i = 2; i <= sheet1.RowCount()+1; i ++){
  116. sheet1.SetCellValue(i, "RE_TAMT", sheet1.GetCellValue(i, "SUPPLY_TAMT")- sheet1.GetCellValue(i, "BEF_TAMT")- sheet1.GetCellValue(i, "CUR_TAMT"));
  117. sheet1.SetCellValue(i, "RE_NAMT", sheet1.GetCellValue(i, "SUPPLY_NAMT")- sheet1.GetCellValue(i, "BEF_NAMT")- sheet1.GetCellValue(i, "CUR_NAMT"));
  118. sheet1.SetCellEditable(i, 7, 1); //2023.07.21 면세금 입력 권한 제한 해제
  119. //면세만 금액이 있을경우 수정할수 있게 오픈
  120. /* if (sheet1.GetCellValue(i, "SUPPLY_TAMT") > 0 ) {
  121. sheet1.SetCellEditable(i, 7, 0); //과세금액이 있으면 수정금지
  122. } */
  123. //외주 담당자는 모든경우 면세수정. 변경계약, 준공기성 처리시 비율이 안맞는 경우 발생함.
  124. <%-- <% if (user.get("RIGHT_NAME").equals("ADMIN NEW") || user.get("RIGHT_NAME").equals("OUTSIDE")) { %>
  125. sheet1.SetCellEditable(i, 7, 1);
  126. <%}%> --%>
  127. }
  128. setGridSize();
  129. } else {
  130. //조회 에러 수행
  131. alert(message);
  132. }
  133. }
  134. function sheet1_OnSaveEnd(code, msg)
  135. {
  136. var row = 0;
  137. var rown = 0 ;
  138. for (var i = 2; i <= sheet1.RowCount()+1; i ++){
  139. row = row + sheet1.GetCellValue(i, "CUR_TAMT") ;
  140. rown = rown + sheet1.GetCellValue(i, "CUR_NAMT") ;
  141. }
  142. parent.RtnClose(row, rown);
  143. }
  144. /*IBSheet Change Event */
  145. function sheet1_OnChange(Row, Col, Value, OldValue, RaiseFlag) {
  146. if (Col == 6){ //과세
  147. /* 잔여면세금 로직 추가 20230703 */
  148. var amt = Value * sheet1.GetCellValue(Row, "RATE"); //금회 면세 자동등록(과세금 * 자동면세금비율)
  149. var re_namt = sheet1.GetCellValue(Row, "RE_NAMT"); //잔여 면세
  150. var cal_amt = Math.abs(re_namt - amt); //잔여 면세금 - 금회 면세금(자동등록)
  151. if(re_namt == 0) amt = re_namt; //잔여 면세금이 없으면 0원 자동등록
  152. else if(cal_amt < 1) amt = re_namt; //면세금 계산 차이가 1보다 작으면 잔여 면세금으로 자동등록(이 2조건 외에는 amt(자동면세금비율 금액)로 면세금 자동등록)
  153. sheet1.SetCellValue(Row, "CUR_NAMT", amt);
  154. sheet1.SetCellValue(Row, "RE_TAMT", sheet1.GetCellValue(Row, "SUPPLY_TAMT")- sheet1.GetCellValue(Row, "BEF_TAMT") - Value);
  155. sheet1.SetCellValue(Row, "RE_NAMT", sheet1.GetCellValue(Row, "SUPPLY_NAMT")- sheet1.GetCellValue(Row, "BEF_NAMT") - amt);
  156. }
  157. else if (Col == 7){ //면세
  158. sheet1.SetCellValue(Row, "RE_NAMT", sheet1.GetCellValue(Row, "SUPPLY_NAMT")- sheet1.GetCellValue(Row, "BEF_NAMT") - Value);
  159. }
  160. /*else if (Col == 7 && sheet1.GetCellValue(Row, "SUPPLY_TAMT")== 0){ //면세
  161. var supp_amt = sheet1.GetCellValue(Row, "SUPPLY_NAMT") - sheet1.GetCellValue(Row, "BEF_NAMT") ;
  162. sheet1.SetCellValue(Row, "CUR_TAMT", 0);
  163. sheet1.SetCellValue(Row, "RE_TAMT", 0);
  164. sheet1.SetCellValue(Row, "RE_NAMT",supp_amt - Value );
  165. }*/
  166. }
  167. function sheet1_OnSmartResize(Width, Height) {
  168. sheet1.FitColWidth();
  169. //autoResize();
  170. }
  171. function autoResize(){
  172. var t1_height = document.getElementById("search-table").scrollHeight + document.getElementById("title_pop").scrollHeight + 20;
  173. var iframeHeight= document.body.scrollHeight - t1_height;
  174. var iframeWidth= document.body.scrollWidth;
  175. sheet1.SetSheetHeight(iframeHeight);
  176. }
  177. </SCRIPT>
  178. <modular:search id="form1">
  179. <modular:key id="fevent" />
  180. </modular:search>
  181. <FORM id="form1" name="form1" method="get" modular:type="search">
  182. <INPUT type="hidden" name="fevent" id="fevent" value="">
  183. <INPUT type="hidden" name="ACMP_ID" value="<%=params.get("ACMP_ID")%>" />
  184. <INPUT type="hidden" name="SUB_CONT_ID" value="<%=params.get("SUB_CONT_ID")%>" />
  185. <INPUT type="hidden" name="pop_win_id" value="<%=params.get("pop_win_id")%>" />
  186. <INPUT type="hidden" name="EDIT_YN" value="<%=params.get("EDIT_YN")%>" />
  187. <INPUT type="hidden" name="digit" value="<%=params.get("digit") %>">
  188. <table id="search-table" class="search-form-table">
  189. <colgroup>
  190. <col width="*" />
  191. </colgroup>
  192. <tr>
  193. <td class="button" style="text-align:right; padding-right:10px;">
  194. <span class="btnSearch center" id="btnSave" style="display:;"><a href="javascript:void(0);">저장</a></span>
  195. <span class="btnSearch center" id="btnSearch" style="display:none;"><a href="javascript:void(0);">검색</a></span>
  196. </td>
  197. </tr>
  198. </table>
  199. <!-- 검색조건 종료 -->
  200. <div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 450px; overflow: auto;">
  201. <script>createIBSheet('sheet1','100%', '450px');</script>
  202. </div>
  203. </form>