ContBudgetMR.jsp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  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. %>
  28. <script type="text/javascript" src="/js/creditEvaluationPop.js"></script>
  29. <script language="javascript">
  30. /*예약함수*/
  31. var sheet1 = new ibsheetObject();
  32. var sheet1Row;
  33. var sheet1PageNo = 1;
  34. var sheet2 = new ibsheetObject();
  35. var sheet2Row;
  36. var sheet2PageNo = 1;
  37. var pageLastRowIndex = 1;
  38. var validationResult = false;
  39. var filterShow = false;
  40. $(document).on("keyup", "input:text", function(e) {
  41. if($(this).attr("numberOnly") == "true")
  42. {
  43. $(this).val( $(this).val().replace(/[^0-9]/gi,"") );
  44. }
  45. if (e.keyCode == 13)
  46. {
  47. $.searchList();
  48. }
  49. });
  50. $.gridInit = function(sheetName)
  51. {
  52. var init_sheet = {};
  53. init_sheet.Cfg = {SearchMode:2, MergeSheet:msHeaderOnly, Page:100,ChildPage:10};
  54. if(sheetName.id == "sheet1") {
  55. init_sheet.Cols = [
  56. {Header:"레벨", Type:"Text", TreeCol:1, LevelSaveName:"GROUP_SEQ", SaveName:"GROUP_SEQ" , Width:50},
  57. {Header:'Del', Type:"DelCheck", SaveName:"DEL_CHECK", Width:50, Align:"Center" },
  58. {Header:'Status', Type:"Status", SaveName:"STATUS", Width:0, Align:"Center", Edit:"true", Hidden:"True"},
  59. {Header:'ORD', Type:"Text", SaveName:"ORD", Width:120, Align:"Left", Edit:"true", Hidden:"True"},
  60. {Header:'DEPT_CD', Type:"Text", SaveName:"DEPT_CD", Width:120, Align:"Left", Edit:"true", Hidden:"True"},
  61. {Header:'PAY_ITEM', Type:"Text", SaveName:"PAY_ITEM", Width:40, Align:"Left", Edit:"true", Hidden:"True"},
  62. {Header:'구분', Type:"Combo", SaveName:"KIND_GB", Width:40, Align:"Left", Edit:"false",ComboText:"구매|외주", ComboCode:"P|O"},
  63. {Header:'PO NO', Type:"Text", SaveName:"MR_NO", Width:60, Align:"Left", Edit:"true"},
  64. {Header:'품목', Type:"Combo", SaveName:"PAY_ITEM_SEQ", Width:120, Align:"Left", Edit:"true",ComboText:"", ComboCode:""},
  65. {Header:'MR_ID', Type:"Text", SaveName:"MR_ID", Width:120, Align:"Left", Edit:"true", Hidden:"True"},
  66. {Header:'ITEM_NAME', Type:"Text", SaveName:"ITEM_NAME", Width:60, Align:"Left", Edit:"true", Hidden:"True"},
  67. {Header:'실행예산', Type:"Int", SaveName:"EXEAMT", Width:60, Align:"Right", Edit:"false",Format:"#,##0"},
  68. {Header:'집행금액', Type:"Int", SaveName:"CONAMT", Width:60, Align:"Right", Edit:"true", Format:"#,##0"},
  69. {Header:'계약체결일', Type:"Text", SaveName:"CONDATE", Width:60, Align:"Center", Edit:"true"},
  70. {Header:'C/O', Type:"Int", SaveName:"COAMT", Width:60, Align:"Right", Edit:"false", Format:"#,##0"},
  71. {Header:'예실대비', Type:"Float", SaveName:"RATE", Width:60, Align:"Right", Edit:"false", Format:"#,##0.00"},
  72. {Header:'절감액', Type:"Int", SaveName:"SAVEAMT", Width:60, Align:"Right", Edit:"false", Format:"#,##0"},
  73. {Header:'예실대비(C/O)', Type:"Float", SaveName:"CORATE", Width:60, Align:"Right", Edit:"false", Format:"#,##0.00"},
  74. {Header:'절감액(C/O)', Type:"Int", SaveName:"COSAVEAMT", Width:60, Align:"Right", Edit:"false", Format:"#,##0"},
  75. {Header:'통화', Type:"Text", SaveName:"CURRENCY_GB", Width:60, Align:"Center", Edit:"true"},
  76. {Header:'업체', Type:"Text", SaveName:"VENDOR_NM", Width:60, Align:"Left", Edit:"true"},
  77. {Header:'계약명', Type:"Text", SaveName:"TITLE", Width:60, Align:"Left", Edit:"true"},
  78. {Header:'REMARK1', Type:"Text", SaveName:"REMARK1", Width:60, Align:"Left", Edit:"true", Hidden:"True"},
  79. {Header:'수정일자', Type:"Text", SaveName:"UPD_DATE", Width:60, Align:"Center", Edit:"false"}
  80. ];
  81. }else{
  82. init_sheet.Cols = [
  83. {Header:'Del', Type:"DelCheck", SaveName:"DEL_CHECK", Width:40, Align:"Center", Hidden:"False",ColMerge:"False"},
  84. {Header:'Status', Type:"Status", SaveName:"STATUS", Width:0, Align:"Center", Edit:"false", Hidden:"True"},
  85. {Header:'DEPT_CD', Type:"Text", SaveName:"DEPT_CD", Width:120, Align:"Left", Edit:"true", Hidden:"True"},
  86. {Header:'SEQ', Type:"Text", SaveName:"SEQ", Width:60, Align:"Left", Edit:"true", Hidden:"True"},
  87. {Header:'PO NO', Type:"Text", SaveName:"MR_NO", Width:60, Align:"Left", Edit:"true"},
  88. {Header:'품목', Type:"Combo", SaveName:"PAY_ITEM_SEQ", Width:120, Align:"Left", Edit:"true",ComboText:"", ComboCode:""},
  89. {Header:'실행예산', Type:"AutoSum", SaveName:"EXEAMT", Width:60, Align:"Right", Edit:"false", Format:"#,##0"},
  90. {Header:'집행금액', Type:"AutoSum", SaveName:"CONAMT", Width:60, Align:"Right", Edit:"false", Format:"#,##0"},
  91. {Header:'C/O', Type:"AutoSum", SaveName:"COAMT", Width:60, Align:"Right", Edit:"true", Format:"#,##0"},
  92. {Header:'C/O포함예산', Type:"AutoSum", SaveName:"RATE", Width:60, Align:"Right", Edit:"false", CalcLogic:"|EXEAMT|+|COAMT|"},
  93. {Header:'예실대비(C/O)', Type:"AutoAvg", SaveName:"CORATE", Width:60, Align:"Right", Edit:"false", CalcLogic:"|CONAMT| / (|EXEAMT|+|COAMT|) * 100", Format:"#,##0.00" },
  94. {Header:'상태', Type:"Combo", SaveName:"STATUS_CD", Width:60, Align:"Center", Edit:"true", ComboText:"승인|미승인", ComboCode:"1|0"},
  95. {Header:'비고', Type:"Text", SaveName:"REMARK1", Width:100, Align:"Left", Edit:"true" }
  96. ];
  97. }
  98. init_sheet.HeaderMode = {Sort:1};
  99. IBS_InitSheet(sheetName, init_sheet);
  100. sheetName.SetDataAutoTrim(0);
  101. sheet1.SetCountPosition(0);
  102. sheet1.FitColWidth();
  103. setGridSize();
  104. }
  105. $(function(){
  106. $("#btn_search").click(function(){
  107. if ($("#p_dept_cd").val() == "") {
  108. alert("현장을 선택하십시요.");
  109. return ;
  110. }
  111. $.searchList();
  112. });
  113. $("#btn_add").click(function(){
  114. var f = document.form1;
  115. if ($("#p_dept_cd").val() == "") {
  116. alert("현장을 선택하십시요.");
  117. return ;
  118. }
  119. sheet1.DataAutoTrim = false;
  120. if (sheet1.LastRow() == 0){
  121. var rowIdx = sheet1.DataInsert(0);
  122. sheet1.SetRowEditable(rowIdx, true);
  123. }
  124. else{
  125. var rowIdx = sheet1.DataCopy();
  126. sheet1.SetCellValue(rowIdx, "ITEM_NAME", '');
  127. sheet1.SetCellValue(rowIdx, "UPD_DATE", '');
  128. sheet1.SetRowEditable(rowIdx, true);
  129. }
  130. });
  131. $("#btn_save").click(function(){
  132. var rowcnt = sheet1.RowCount();
  133. for(var r=1; r < rowcnt+1; r++)
  134. {
  135. if(sheet1.GetCellValue(r,"DEL_CHECK") == 0 && sheet1.GetCellValue(r,"CONAMT") == "0" && sheet1.GetCellValue(r,"VENDOR_NM") != "" && (sheet1.GetCellValue(r,"ORD") == "2" || sheet1.GetCellValue(r,"ORD") == "6") ){
  136. alert(sheet1.GetCellValue(r,"VENDOR_NM") + " 집행금액이 0입니다." );
  137. return ;
  138. }
  139. }
  140. jQuery("#fevent").val("BUDGET_SAVE");
  141. var url = Modular.model.PageContext.CONTEXT_ROOT + "/cont/purchase/ContBudgetMR_sheet.screen";
  142. var result = Modular.view.IBSheet7.doSave(sheet1, url, jQuery("#form1"), false);
  143. });
  144. $("#btn_excel").click(function(){
  145. var params = {FileName:"예산현황.xls",SheetName:"예산현황",Merge:1,SheetDesign:1, HiddenColumn:1};
  146. sheet1.Down2Excel (params);
  147. });
  148. $("#btn_file").click(function(){
  149. var f = document.form1;
  150. var v_dept = $("#p_dept_cd").val();
  151. if (v_dept == "") {
  152. alert("현장을 선택하십시요.");
  153. return ;
  154. }
  155. else if(v_dept != ''){
  156. var upLoadFlg = "Y";
  157. viewFileListNew1('CONT_BCS_'+v_dept, v_dept, upLoadFlg, "cont/bcs/"+v_dept) ;
  158. }
  159. });
  160. $("#btn_AddCo").click(function(){
  161. var f = document.form1;
  162. if ($("#p_dept_cd").val() == "") {
  163. alert("현장을 선택하십시요.");
  164. return ;
  165. }
  166. sheet2.DataAutoTrim = false;
  167. var rowIdx = sheet2.DataInsert(0);
  168. var data_lc = document.form1.GET_ITEM_CO.value;
  169. var data_lc_value = document.form1.GET_ITEM_NAME_CO.value;
  170. var info = {Header:'PAY_ITEM_SEQ', Type:"Combo", SaveName:"PAY_ITEM_SEQ", Width:100, Align:"Left", Edit:"true" , ComboText:data_lc, ComboCode:data_lc_value, ColMerge:"False"};
  171. sheet2.InitCellProperty(rowIdx, "PAY_ITEM_SEQ", info);
  172. });
  173. $("#btn_SaveCo").click(function(){
  174. jQuery("#fevent").val("BUDGET_SAVE_CO");
  175. var url = Modular.model.PageContext.CONTEXT_ROOT + "/cont/purchase/ContBudgetMR_sheet.screen";
  176. var result = Modular.view.IBSheet7.doSave(sheet2, url, jQuery("#form1"), false);
  177. });
  178. $.searchList = function()
  179. {
  180. var f= document.form1;
  181. $("#fevent").val("GET_ITEM");
  182. submitXmlRequest("/cont/purchase/ContBudgetMR_form.screen", "GET_ITEM", f, "ROWSET");
  183. }
  184. });
  185. $(document).ready(function(){
  186. <%if(user.get("right_name").equals("OUTSIDE")){%>
  187. $("#P_KIND_GB").val("O");
  188. <%}else if(user.get("right_name").equals("PURCHASE")){%>
  189. $("#P_KIND_GB").val("P");
  190. <%}%>
  191. $.gridInit(sheet1);
  192. $.gridInit(sheet2);
  193. autoResize();
  194. });
  195. function setGridSize() {
  196. sheet1.FitColWidth();
  197. sheet2.FitColWidth();
  198. }
  199. function autoResize(){
  200. var t1_height = document.getElementById("search-table").scrollHeight + document.getElementById("title").scrollHeight + 350;
  201. var iframeHeight= document.body.scrollHeight - t1_height;
  202. var iframeWidth= document.body.scrollWidth;
  203. sheet1.SetSheetHeight(iframeHeight);
  204. sheet2.SetSheetWidth(sheet1.GetSheetWidth());
  205. }
  206. function sheet1_OnSmartResize(Width, Height) {
  207. sheet1.FitColWidth();
  208. autoResize();
  209. }
  210. function sheet2_OnSmartResize(Width, Height) {
  211. sheet2.FitColWidth();
  212. autoResize();
  213. }
  214. function doResult(resultObj) {
  215. try {
  216. if ( resultObj.getRequestEvent() == "GET_ITEM" ) {
  217. var rowSet = resultObj.getRowSet();
  218. var getData = "";
  219. var getDataValue = "";
  220. var getDataCo = "";
  221. var getDataValueCo = "";
  222. for ( var i = 0; i < rowSet.getRowSize(); i++ ){
  223. getData = getData + rowSet.getColValue( i, 1 ) + "|";
  224. getDataValue = getDataValue + rowSet.getColValue( i, 0 ) + "|";
  225. if (rowSet.getColValue( i, 2 ) != 0){
  226. getDataCo = getDataCo + rowSet.getColValue( i, 1 ) + "|";
  227. getDataValueCo = getDataValueCo + rowSet.getColValue( i, 2 ) + "|";
  228. }
  229. }
  230. $("#GET_ITEM").val(getData);
  231. $("#GET_ITEM_NAME").val(getDataValue);
  232. $("#GET_ITEM_CO").val(getDataCo);
  233. $("#GET_ITEM_NAME_CO").val(getDataValueCo);
  234. document.form1.isSubmit = false;
  235. jQuery("#fevent").val("BUDGET_CONTROL");
  236. var url = Modular.model.PageContext.CONTEXT_ROOT + "/cont/purchase/ContBudgetMR_sheet.screen";
  237. Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 10, "");
  238. }
  239. }
  240. catch(errorObject) {
  241. showErrorDlg("doResult()", errorObject);
  242. }
  243. }
  244. function sheet1_OnSearchEnd(code, msg) {
  245. if(code == 0){
  246. var data_lc = document.form1.GET_ITEM.value;
  247. var data_lc_value = document.form1.GET_ITEM_NAME.value;
  248. var info = {Header:'ITEM_NAME', Type:"Combo", SaveName:"ITEM_NAME", Width:100, Align:"Left", Edit:"true" , ComboText:data_lc, ComboCode:data_lc_value, ColMerge:"False"};
  249. var rowcnt = sheet1.RowCount();
  250. if(rowcnt > 0){
  251. for(var r=1; r < rowcnt+1; r++)
  252. {
  253. if(sheet1.GetCellValue(r,"MR_ID") == "0" && sheet1.GetCellValue(r,"ORD") != "2" ){
  254. sheet1.SetRowBackColor(r,"#DBE5F1");
  255. sheet1.SetRowEditable(r, false);
  256. if (sheet1.GetCellValue(r,"ORD") == "1" ){
  257. sheet1.SetRowBackColor(r,"#FFFFFF");
  258. sheet1.SetRangeFontBold(r, 0, r, 22, 1);
  259. }else if ( sheet1.GetCellValue(r,"ORD") == "5"){
  260. sheet1.SetRangeFontBold(r, 0, r, 22, 1);
  261. }
  262. }
  263. else{
  264. if (sheet1.GetCellValue(r,"MR_ID") == "0"){
  265. sheet1.SetRowEditable(r, false);
  266. }
  267. sheet1.InitCellProperty(r, "PAY_ITEM_SEQ", info);
  268. }
  269. }
  270. }
  271. sheet1.ShowTreeLevel(0, 1);
  272. jQuery("#fevent").val("BUDGET_CONTROL_CO");
  273. var url = Modular.model.PageContext.CONTEXT_ROOT + "/cont/purchase/ContBudgetMR_sheet.screen";
  274. Modular.view.IBSheet7.doSearch(sheet2, url, jQuery("#form1"), 10, "");
  275. }else{
  276. alert(message);
  277. }
  278. }
  279. function sheet2_OnSearchEnd(code, msg) {
  280. if(code == 0){
  281. var data_lc = document.form1.GET_ITEM_CO.value;
  282. var data_lc_value = document.form1.GET_ITEM_NAME_CO.value;
  283. var info = {Header:'PAY_ITEM_SEQ', Type:"Combo", SaveName:"PAY_ITEM_SEQ", Width:100, Align:"Left", Edit:"true" , ComboText:data_lc, ComboCode:data_lc_value, ColMerge:"False"};
  284. var rowcnt = sheet2.RowCount();
  285. if(rowcnt > 0){
  286. for(var r=1; r < rowcnt+1; r++)
  287. {
  288. sheet2.InitCellProperty(r, "PAY_ITEM_SEQ", info);
  289. }
  290. }
  291. }else{
  292. alert(message);
  293. }
  294. }
  295. function sheet1_OnSaveEnd(code, msg) {
  296. if(code >= 0) {
  297. alert("저장되었습니다.");
  298. $.searchList();
  299. } else {
  300. alert("저장 실패");
  301. }
  302. }
  303. function sheet2_OnSaveEnd(code, msg) {
  304. if(code >= 0) {
  305. alert("저장되었습니다.");
  306. $.searchList();
  307. } else {
  308. alert("저장 실패");
  309. }
  310. }
  311. function viewFileListNew1(fileGB, id, isModify, isDrectory, iframeID, user_filename) {
  312. var win_id = "_viewFileList";
  313. var link = "/common/file/FileListNew.screen";
  314. link += "?pop_win_id="+win_id;
  315. link += "&extFunction=viewFileListClose1";
  316. link += "&file_gb=" + fileGB;
  317. link += "&id=" + id;
  318. if( iframeID != null )
  319. link += "&iframeID=" + iframeID;
  320. if( isModify != null )
  321. link += "&is_modify=" + isModify;
  322. if( isDrectory != null )
  323. link += "&sys_gb=" + isDrectory;
  324. if( user_filename != null )
  325. link += "&user_filename=" + user_filename;
  326. fLayerPop(win_id, link, 750,430, '', '', 'NO', '200');
  327. }
  328. document.body.onresize = addEvent( document.body.onresize, "autoResize()");
  329. </script>
  330. <modular:search id="form1">
  331. <modular:key id="fevent" />
  332. </modular:search>
  333. <form id="form1" name="form1" method="post" modular:type="search">
  334. <input type="hidden" name="fevent" id="fevent" value="">
  335. <input type="hidden" name="materialgroup" id="materialgroup" value=""/>
  336. <input type="hidden" name="work_sheet" value="">
  337. <input type="hidden" name="GET_ITEM" value="">
  338. <input type="hidden" name="GET_ITEM_NAME" value="">
  339. <input type="hidden" name="GET_ITEM_CO" value="">
  340. <input type="hidden" name="GET_ITEM_NAME_CO" value="">
  341. <div align="left" id="title">
  342. <ul>
  343. <li>Budget Control Sheet</li>
  344. </ul>
  345. </div>
  346. <!-- 검색조건 시작 -->
  347. <table id="search-table" class="search-form-table">
  348. <colgroup>
  349. <col width="100" />
  350. <col width="400" />
  351. <col width="100" />
  352. <col width="*" />
  353. <col width="300" />
  354. </colgroup>
  355. <tr height="25">
  356. <th>현장</th>
  357. <td>
  358. <%=InputText.getSiteCodeNew("p_dept_cd", "p_dept_nm", "", user, params.get("p_dept_cd"), params.get("p_dept_nm"))%>
  359. </td>
  360. <th>구분</th>
  361. <td>
  362. <%=CommCodeManager.getSelectCodeList("JOB_DIV","P_KIND_GB","height=18;width:80px;","<option value=''>--전체--</option>",params.get("P_KIND_GB")) %>
  363. </td>
  364. <td class="button" >
  365. <span class="btnSearch center" id="btn_search"><a href="javascript:void(0);">검색</a></span>
  366. <span class="btnSearch center" id="btn_add"><a href="javascript:void(0);">추가</a></span>
  367. <span class="btnSearch center" id="btn_save"><a href="javascript:void(0);">저장</a></span>
  368. <span class="btnSearch center"><a href="javascript:void(0);" id="btn_excel">엑셀</a></span>
  369. <span class="btnSearch center" id="btn_file"><a href="javascript:void(0);" >첨부파일</a></span>
  370. </td>
  371. </tr>
  372. </table>
  373. </form>
  374. <img src="/img/com/blank.gif" height="5px" />
  375. <div align="right" id="bugase">
  376. <ul>
  377. 단위(원)
  378. </ul>
  379. </div>
  380. <div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 315px; overflow: auto;">
  381. <script>createIBSheet('sheet1','100%', '300px');</script>
  382. </div>
  383. <div class="application-info magT15">
  384. <div class="application-sub-title">
  385. <span class="title">C/O합산시 추정 절감율</span>
  386. </div>
  387. <div style="text-align:right;">
  388. <span class="btnSearch center"><a href="javascript:void(0);" id="btn_AddCo">추가</a></span>
  389. <span class="btnSearch center"><a href="javascript:void(0);" id="btn_SaveCo">저장</a></span>
  390. </div>
  391. </div>
  392. <div id="sheet2_div" style="padding-top:5px; height: auto; min-height: 200px; overflow: auto;">
  393. <script>createIBSheet('sheet2','100%', '200px');</script>
  394. </div>