ContBudget.jsp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <%--
  2. - FileName : ContBudget.jsp
  3. - Author(s) : lee mi kyoung
  4. - Date : 2017.1.25
  5. -
  6. - Description: 구매외주 예산등록
  7. --%>
  8. <%@ page contentType="text/html; charset=utf-8" %>
  9. <%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
  10. <%@ page import="com.udapsoft.waf.common.ui.*" %>
  11. <%@ page import="kr.co.hsnc.common.util.*"%>
  12. <%@ page import="kr.co.hsnc.common.sql.*" %>
  13. <%@ page import = "blowfishj.*"%>
  14. <%@ page import = "java.text.SimpleDateFormat"%>
  15. <%@ page import="com.udapsoft.waf.common.util.DateUtil"%>
  16. <%@ page import="kr.co.udapsoft.common.code.CommCodeManager" %>
  17. <%@ page import = "java.util.Date"%>
  18. <%@ page import = "java.util.*"%>
  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 params = storage.getParams();
  25. ValueObject user = storage.getUser();
  26. String event = storage.getEvent();
  27. RowSet rowSet = storage.getRowSet("ROWSET");
  28. String temp1="";
  29. String temp2="";
  30. for(int i=0;i<rowSet.size();i++){
  31. if(i==rowSet.size()-1){
  32. temp1 +=(rowSet.getColumn(i,"ESTDESC").toString().substring(8)) ;
  33. temp2 +=(rowSet.getColumn(i,"PAYITEM").toString().substring(8)) ;
  34. }else{
  35. temp1 =temp1+(rowSet.getColumn(i,"ESTDESC").toString().substring(8)+"|") ;
  36. temp2 =temp2+(rowSet.getColumn(i,"PAYITEM").toString().substring(8)+"|") ;
  37. }
  38. }
  39. //2017.04.04 외주별도처리
  40. temp1 = temp1 + "|(T01)Engineering|(T02)Construction";
  41. temp2 = temp2 + "|T01|T02";
  42. %>
  43. <script type="text/javascript" src="/js/creditEvaluationPop.js"></script>
  44. <script language="javascript">
  45. /*예약함수*/
  46. var sheet1 = new ibsheetObject();
  47. var sheet1Row;
  48. var sheet1PageNo = 1;
  49. var pageLastRowIndex = 1;
  50. var validationResult = false;
  51. var filterShow = false;
  52. $(document).on("keyup", "input:text", function(e) {
  53. if($(this).attr("numberOnly") == "true")
  54. {
  55. $(this).val( $(this).val().replace(/[^0-9]/gi,"") );
  56. }
  57. if (e.keyCode == 13)
  58. {
  59. $.searchList();
  60. }
  61. });
  62. $.gridInit = function(sheetName)
  63. {
  64. var init_sheet = {};
  65. init_sheet.Cfg = {SearchMode:2, MergeSheet:msHeaderOnly, Page:100};
  66. init_sheet.Cols = [
  67. {Header:'Del', Type:"DelCheck", SaveName:"DEL_CHECK", Width:50, Align:"Center" },
  68. {Header:'Status', Type:"Status", SaveName:"STATUS", Width:0, Align:"Center", Edit:"true", Hidden:"True"},
  69. {Header:'DEPT_CD', Type:"Text", SaveName:"DEPT_CD", Width:120, Align:"Left", Edit:"true", Hidden:"True"},
  70. {Header:'부서명', Type:"Text", SaveName:"DEPT_NM", Width:180, Align:"Left", Edit:"true", Hidden:"True"},
  71. {Header:'정렬순서', Type:"Int", SaveName:"ORDER_SEQ", Width:40, Align:"Center", Edit:"true"},
  72. {Header:'구매/외주', Type:"Combo", SaveName:"KIND_GB", Width:40, Align:"Left", Edit:"true", ComboText:"구매|외주", ComboCode:"P|O"},
  73. {Header:'PAY_ITEM', Type:"Combo", SaveName:"PAY_ITEM", Width:60, Align:"Left", Edit:"true", ComboText:"<%=temp1%>", ComboCode:"<%=temp2%>"},
  74. {Header:'PAY_ITEM_NAME', Type:"Text", SaveName:"PAY_ITEM_NAME", Width:80, Align:"Left", Edit:"true", Hidden:"False"},
  75. {Header:'PAY_ITEM_SEQ', Type:"Text", SaveName:"PAY_ITEM_SEQ", Width:60, Align:"Left", Edit:"true", Hidden:"True"},
  76. {Header:'품목', Type:"Text", SaveName:"ITEM_NAME", Width:100, Align:"Left", Edit:"true"},
  77. {Header:'실행예산', Type:"Int", SaveName:"EXEAMT", Width:60, Align:"Right", Edit:"true", Format:"#,##0"},
  78. {Header:'FILE_GB', Type:"Text", SaveName:"FILE_GB", Width:70, Align:"Left", Edit:"true", Hidden:"True"},
  79. {Header:'수정일자', Type:"Text", SaveName:"UPD_DATE", Width:60, Align:"Center", Edit:"true"}
  80. ];
  81. init_sheet.HeaderMode = {Sort:1};
  82. IBS_InitSheet(sheetName, init_sheet);
  83. sheetName.SetDataAutoTrim(0);
  84. var info = [{StdCol:3, SumCols:"EXEAMT", CaptionCol:9}
  85. ,{StdCol:5, SumCols:"EXEAMT", CaptionCol:9}
  86. ,{StdCol:6, SumCols:"EXEAMT", CaptionCol:9} ];
  87. sheetName.ShowSubSum(info);
  88. setGridSize();
  89. }
  90. $(function(){
  91. $("#btn_search").click(function(){
  92. $.searchList();
  93. });
  94. $("#btn_add").click(function(){
  95. var f = document.form1;
  96. if ($("#p_dept_cd").val() == "") {
  97. alert("현장을 선택하십시요.");
  98. return ;
  99. }
  100. sheet1.DataAutoTrim = false;
  101. if (sheet1.LastRow() == 0){
  102. //선급공사원가 통합
  103. var f= document.form1;
  104. $("#fevent").val("PRE_WORK");
  105. submitXmlRequest("/cont/purchase/ContBudget_form.screen", "PRE_WORK", f, "ROWSET");
  106. //sheet1.DataInsert(0);
  107. }
  108. else{
  109. var rowIdx = sheet1.DataCopy();
  110. sheet1.SetCellValue(rowIdx, "ITEM_NAME", '');
  111. sheet1.SetCellValue(rowIdx, "EXEAMT", 0);
  112. sheet1.SetCellValue(rowIdx, "UPD_DATE", '');
  113. sheet1.SetCellValue(rowIdx, "ORDER_SEQ", 0);
  114. changeList(sheet1.GetCellValue(rowIdx, "KIND_GB"), rowIdx);
  115. }
  116. });
  117. $("#btn_save").click(function(){
  118. jQuery("#fevent").val("BUDGET_SAVE");
  119. var url = Modular.model.PageContext.CONTEXT_ROOT + "/cont/purchase/ContBudget_sheet.screen";
  120. var result = Modular.view.IBSheet7.doSave(sheet1, url, jQuery("#form1"), false);
  121. });
  122. $("#btn_excel").click(function(){
  123. var params = {FileName:"예산현황.xls",SheetName:"예산현황",Merge:1,SheetDesign:1, HiddenColumn:1};
  124. sheet1.Down2Excel (params);
  125. });
  126. $("#btn_file").click(function(){
  127. var f = document.form1;
  128. var v_dept = $("#p_dept_cd").val();
  129. if (v_dept == "") {
  130. alert("현장을 선택하십시요.");
  131. return ;
  132. }
  133. else if(v_dept != ''){
  134. var upLoadFlg = "Y";
  135. viewFileListNew1('CONT_BCS_'+v_dept, v_dept, upLoadFlg, "cont/bcs/"+v_dept) ;
  136. }
  137. });
  138. $.searchList = function()
  139. {
  140. if ($("#p_dept_cd").val() == "") {
  141. alert("현장을 선택하십시요.");
  142. return ;
  143. }
  144. $("#fevent").val("BUDGET_CONTROL");
  145. var url = Modular.model.PageContext.CONTEXT_ROOT + "/cont/purchase/ContBudget_sheet.screen";
  146. Modular.view.IBSheet7.doSearch(sheet1, url, $("#form1"), 30, "");
  147. }
  148. });
  149. $(document).ready(function(){
  150. $.gridInit(sheet1);
  151. autoResize();
  152. <%if(user.get("right_name").equals("OUTSIDE")){%>
  153. $("#P_KIND_GB").val("O");
  154. <%}else if(user.get("right_name").equals("PURCHASE")){%>
  155. $("#P_KIND_GB").val("P");
  156. <%}%>
  157. });
  158. function doResult(resultObj) {
  159. try {
  160. if ( resultObj.getRequestEvent() == "PRE_WORK" ) {
  161. document.form1.isSubmit = false;
  162. $.searchList();
  163. alert("최초 작성시 선급공사원가 확인하였습니다.");
  164. if (sheet1.LastRow() == 0){
  165. sheet1.DataInsert(0);
  166. sheet1.SetCellValue(1, "KIND_GB",$("#P_KIND_GB").val() );
  167. changeList($("#P_KIND_GB").val(), 1);
  168. }
  169. }
  170. }
  171. catch(errorObject) {
  172. showErrorDlg("doResult()", errorObject);
  173. }
  174. }
  175. function setGridSize()
  176. {
  177. sheet1.FitColWidth();
  178. autoResize();
  179. }
  180. function autoResize(){
  181. var t1_height = document.getElementById("search-table").scrollHeight + document.getElementById("title").scrollHeight + 54;
  182. var iframeHeight= document.body.scrollHeight - t1_height;
  183. var iframeWidth= document.body.scrollWidth;
  184. sheet1.SetSheetHeight(iframeHeight);
  185. }
  186. function sheet1_OnSmartResize(Width, Height) {
  187. sheet1.FitColWidth();
  188. autoResize();
  189. }
  190. function sheet1_OnSaveEnd(code, msg) {
  191. if(code >= 0) {
  192. alert("저장되었습니다.");
  193. $.searchList();
  194. } else {
  195. alert("저장 실패");
  196. }
  197. }
  198. function viewFileListNew1(fileGB, id, isModify, isDrectory, iframeID, user_filename) {
  199. var win_id = "_viewFileList";
  200. var link = "/common/file/FileListNew.screen";
  201. link += "?pop_win_id="+win_id;
  202. link += "&extFunction=viewFileListClose1";
  203. link += "&file_gb=" + fileGB;
  204. link += "&id=" + id;
  205. if( iframeID != null )
  206. link += "&iframeID=" + iframeID;
  207. if( isModify != null )
  208. link += "&is_modify=" + isModify;
  209. if( isDrectory != null )
  210. link += "&sys_gb=" + isDrectory;
  211. if( user_filename != null )
  212. link += "&user_filename=" + user_filename;
  213. fLayerPop(win_id, link, 750,430, '', '', 'NO', '200');
  214. }
  215. function sheet1_OnChange(Row, Col, Value, OldValue, RaiseFlag)
  216. {
  217. //2017.04.04 외주 구분 두개로 고정
  218. if (Col == "5"){
  219. changeList(sheet1.GetCellValue(Row,5), Row);
  220. }
  221. if (Col == "6"){
  222. var vText = sheet1.GetCellText(Row,6);
  223. sheet1.SetCellText(Row, 7, vText.substring(5,vText.length));
  224. }
  225. }
  226. function sheet1_OnSearchEnd(code, message) {
  227. if(code == 0) {
  228. for(var i=1; i <= sheet1.RowCount()-1; i++){
  229. changeList(sheet1.GetCellValue(i, "KIND_GB"), i);
  230. }
  231. } else {
  232. //조회 에러 수행
  233. alert(message);
  234. }
  235. }
  236. function changeList(payGB, Row){
  237. if (payGB == "O"){
  238. var data_lc = "(T01)Engineering|(T02)Construction";
  239. var data_lc_value = "T01|T02";
  240. var info = {Header:'PAY_ITEM', Type:"Combo", SaveName:"PAY_ITEM", Width:100, Align:"Left", Edit:"true" , ComboText:data_lc, ComboCode:data_lc_value, ColMerge:"False"};
  241. sheet1.InitCellProperty(Row, "PAY_ITEM", info);
  242. }else{
  243. var info = {Header:'PAY_ITEM', Type:"Combo", SaveName:"PAY_ITEM", Width:100, Align:"Left", Edit:"true" , ComboText:"<%=temp1%>", ComboCode:"<%=temp2%>", ColMerge:"False"};
  244. sheet1.InitCellProperty(Row, "PAY_ITEM", info);
  245. }
  246. }
  247. document.body.onresize = addEvent( document.body.onresize, "autoResize()");
  248. </script>
  249. <modular:search id="form1">
  250. <modular:key id="fevent" />
  251. </modular:search>
  252. <form id="form1" name="form1" method="post" modular:type="search">
  253. <input type="hidden" name="fevent" id="fevent" value="">
  254. <input type="hidden" name="materialgroup" id="materialgroup" value=""/>
  255. <div align="left" id="title">
  256. <ul>
  257. <li>예산등록</li>
  258. </ul>
  259. </div>
  260. <!-- 검색조건 시작 -->
  261. <table id="search-table" class="search-form-table">
  262. <colgroup>
  263. <col width="100" />
  264. <col width="400" />
  265. <col width="100" />
  266. <col width="*" />
  267. <col width="300" />
  268. </colgroup>
  269. <tr height="25">
  270. <th>현장</th>
  271. <td>
  272. <%=InputText.getSiteCodeNew("p_dept_cd", "p_dept_nm", "", user, params.get("p_dept_cd"), params.get("p_dept_nm"))%>
  273. </td>
  274. <th>구분</th>
  275. <td>
  276. <%=CommCodeManager.getSelectCodeList("JOB_DIV","P_KIND_GB","height=18;width:80px;","<option value=''>--전체--</option>",params.get("P_KIND_GB")) %>
  277. </td>
  278. <td class="button" >
  279. <span class="btnSearch center" id="btn_search"><a href="javascript:void(0);">검색</a></span>
  280. <span class="btnSearch center" id="btn_add"><a href="javascript:void(0);">추가</a></span>
  281. <span class="btnSearch center" id="btn_save"><a href="javascript:void(0);">저장</a></span>
  282. <span class="btnSearch center" id="btn_excel"><a href="javascript:void(0);" >엑셀</a></span>
  283. <span class="btnSearch center" id="btn_file"><a href="javascript:void(0);" >첨부파일</a></span>
  284. </td>
  285. </tr>
  286. </table>
  287. </form>
  288. <img src="/img/com/blank.gif" height="5px" />
  289. <div align="right" id="bugase">
  290. <ul>
  291. 단위(원)
  292. </ul>
  293. </div>
  294. <div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 400px; overflow: auto;">
  295. <script>createIBSheet('sheet1','100%', '400px');</script>
  296. </div>