PurExcutionList.jsp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <%--
  2. - FileName : PurExcutionList.jsp
  3. - Author : gyeongmo an
  4. - Date : 2014.07.25
  5. - Copyright : Copyright (c) 2014 www.udapsoft.co.kr, Inc.
  6. - All rights reserved.
  7. - Description: 구매실적 조회
  8. --%>
  9. <%@ page contentType="text/html; charset=utf-8" %>
  10. <%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
  11. <%@ page import="com.udapsoft.waf.common.ui.*" %>
  12. <%@ page import="kr.co.udapsoft.common.code.*" %>
  13. <%@ page import="kr.co.hsnc.common.util.*"%>
  14. <%@ page import="kr.co.hsnc.common.sql.*" %>
  15. <%@ page import="kr.co.udapsoft.common.code.CommCodeManager" %>
  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 params = storage.getParams();
  22. ValueObject user = storage.getUser();
  23. String fevent = storage.getEvent();
  24. %>
  25. <SCRIPT language="JavaScript">
  26. /*예약함수*/
  27. var sheet1;
  28. var sheet1Row;
  29. var sheet1PageNo = 1;
  30. var pageLastRowIndex = 1;
  31. var validationResult = false;
  32. var filterShow = false;
  33. function _onReady(){
  34. gridInit(sheet1);
  35. jQuery("#btnSearch").click(function() {
  36. jQuery("#fevent").val("GET_DATA_LIST");
  37. var url = Modular.model.PageContext.CONTEXT_ROOT + "/warehouse/purchase/PurExcutionList_sheet.screen";
  38. Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 10, "");
  39. });
  40. jQuery("#btnExcel").click(function() {
  41. if(sheet1.RowCount() == 0) {
  42. alert("내역이 없습니다.");
  43. return;
  44. }
  45. var params = { FileName : "PurExcutionList.xls", SheetName : "구매실적조회", SheetDesign:0, Merge:1, DownCols:"ac_unit_nm|dept_nm|material_cd|material_name|material_spec|unit|stock_qty|"+
  46. "stock_amt|total_contract_amt|total_budget_amt|contrast_contract|contrast_budget", TitleText:"구매실적조회", UserMerge:"0,0,1,12", AutoSizeColumn:1 } ;
  47. sheet1.Down2Excel(params);
  48. });
  49. $("#dataClear2").click(function(){$("#sYmdSt").val("");$("#sYmdEd").val("");});
  50. sheet1.SetActionMenu("ExcelDown");
  51. jQuery("#btnSearch").click();
  52. autoResize();
  53. }
  54. function gridInit(sheetName){
  55. var init_sheet = {};
  56. init_sheet.Cfg = {SearchMode:2, Page:10, PrevColumnMergeMode:0};
  57. init_sheet.Cols = [
  58. {Header:'본부', Type:"Text", SaveName:"ac_unit_nm", Width:70, Align:"Left"},
  59. {Header:'현장', Type:"Text", SaveName:"dept_nm", Width:140, Align:"Left"},
  60. {Header:'자재코드', Type:"Text", SaveName:"material_cd", Width:50, Align:"Center"},
  61. {Header:'자재명', Type:"Text", SaveName:"material_name", Width:150, Align:"Left"},
  62. {Header:'규격', Type:"Text", SaveName:"material_spec", Width:110, Align:"Left"},
  63. {Header:'단위', Type:"Text", SaveName:"unit", Width:30, Align:"Center"},
  64. {Header:'입고수량', Type:"AutoSum", SaveName:"stock_qty", Width:50, Align:"Right", PointCount:2},
  65. {Header:'입고금액', Type:"AutoSum", SaveName:"stock_amt", Width:50, Align:"Right"},
  66. {Header:'도급금액', Type:"AutoSum", SaveName:"total_contract_amt", Width:50, Align:"Right"},
  67. {Header:'실행금액', Type:"AutoSum", SaveName:"total_budget_amt", Width:50, Align:"Right"},
  68. {Header:'도급대비(%)', Type:"Float", SaveName:"contrast_contract", Width:50, Align:"Right", PointCount:2},
  69. {Header:'실행대비(%)', Type:"Float", SaveName:"contrast_budget", Width:50, Align:"Right", PointCount:2},
  70. //{Header:'도급대비(%)', Type:"AutoAvg", SaveName:"contrast_contract", Width:50, Align:"Right"},
  71. //{Header:'실행대비(%)', Type:"AutoAvg", SaveName:"contrast_budget", Width:50, Align:"Right"},
  72. {Header:'H_본부코드', Type:"Text", SaveName:"ac_unit_cd", Width:0, Align:"Left", Hidden:"True"},
  73. {Header:'H_현장코드', Type:"Text", SaveName:"dept_cd", Width:0, Align:"Center", Hidden:"True"}
  74. ];
  75. init_sheet.HeaderMode = {Sort:1};
  76. IBS_InitSheet(sheetName, init_sheet);
  77. sheetName.SetDataAutoTrim(0);
  78. sheetName.SetEditable(false);
  79. //var info = [{StdCol:"dept_nm", SumCols:"stock_qty|stock_amt|total_contract_amt|total_budget_amt", CaptionText:"소 계"}];
  80. var info = [{StdCol:"dept_nm", SumCols:"stock_qty|stock_amt|total_contract_amt|total_budget_amt", CaptionCol:"ac_unit_nm"}];
  81. sheet1.ShowSubSum(info);
  82. sheetName.SetMergeSheet(msPrevColumnMerge);
  83. setGridSize();
  84. }
  85. function sheet1_OnSearchEnd(code, message) {
  86. if(code == 0) {
  87. //소계 머지
  88. var str = "";
  89. for(var i=1; i<sheet1.LastRow(); i++) {
  90. str = sheet1.GetCellText(i, "ac_unit_nm");
  91. if(str.indexOf("소계:") > -1) {
  92. sheet1.SetCellAlign(i,0,"Center");
  93. sheet1.SetCellText(i, "ac_unit_nm", "소 계 : ");
  94. sheet1.SetMergeCell(i,0,1,6);
  95. }
  96. }
  97. var sRow = sheet1.FindSubSumRow();
  98. var arrRow = sRow.split("|");
  99. var info2 = [{Type:"AutoAvg", PointCount:2}];
  100. for (idx=0; idx<arrRow.length; idx++){
  101. if( sheet1.GetCellValue(arrRow[idx] , "stock_amt") != "0" && sheet1.GetCellValue(arrRow[idx] , "total_contract_amt") != "0" ) {
  102. sheet1.SetCellValue(arrRow[idx] , "contrast_contract", Math.floor(sheet1.GetCellValue(arrRow[idx] , "stock_amt") / sheet1.GetCellValue(arrRow[idx] , "total_contract_amt") * 100 * 100) / 100); // 입고금액 / 도급금액
  103. } else {
  104. sheet1.SetCellValue(arrRow[idx] , "contrast_contract", "0"); // 입고금액 / 도급금액
  105. }
  106. if( sheet1.GetCellValue(arrRow[idx] , "stock_amt") != "0" && sheet1.GetCellValue(arrRow[idx] , "total_budget_amt") != "0" ) {
  107. sheet1.SetCellValue(arrRow[idx] , "contrast_budget", Math.floor(sheet1.GetCellValue(arrRow[idx] , "stock_amt") / sheet1.GetCellValue(arrRow[idx] , "total_budget_amt") * 100 * 100) / 100); //입고금액 / 실행금액
  108. }else {
  109. sheet1.SetCellValue(arrRow[idx] , "contrast_budget", "0"); //입고금액 / 실행금액
  110. }
  111. }
  112. //합계 머지
  113. sheet1.SetCellText(sheet1.LastRow(), "ac_unit_nm", "합 계");
  114. sheet1.SetMergeCell(sheet1.LastRow(), 0, 1, 5);
  115. sheet1.SetCellAlign(sheet1.LastRow(), 0, "Center");
  116. if( sheet1.GetCellValue(sheet1.LastRow() , "stock_amt") != "0" && sheet1.GetCellValue(sheet1.LastRow() , "total_contract_amt") != "0" ) {
  117. sheet1.SetCellValue(sheet1.LastRow(), "contrast_contract", Math.floor(sheet1.GetCellValue(sheet1.LastRow() , "stock_amt") / sheet1.GetCellValue(sheet1.LastRow() , "total_contract_amt") * 100 * 100) / 100); // 입고금액 / 도급금액
  118. } else {
  119. sheet1.SetCellValue(sheet1.LastRow(), "contrast_contract", "0"); // 입고금액 / 도급금액
  120. }
  121. if( sheet1.GetCellValue(sheet1.LastRow() , "stock_amt") != "0" && sheet1.GetCellValue(sheet1.LastRow() , "total_budget_amt") != "0" ) {
  122. sheet1.SetCellValue(sheet1.LastRow(), "contrast_budget", Math.floor(sheet1.GetCellValue(sheet1.LastRow() , "stock_amt") / sheet1.GetCellValue(sheet1.LastRow() , "total_budget_amt") * 100 * 100) / 100); //입고금액 / 실행금액
  123. } else {
  124. sheet1.SetCellValue(sheet1.LastRow(), "contrast_budget", "0"); //입고금액 / 실행금액
  125. }
  126. setGridSize();
  127. } else {
  128. alert(message);
  129. }
  130. }
  131. function setGridSize() {
  132. sheet1.FitColWidth();
  133. }
  134. function doResult(resultObj) {
  135. document.form1.isSubmit = false;
  136. try {
  137. if ( resultObj.getRequestEvent() == "GET_DATA_LIST" ) {
  138. if ( resultObj.getSuccess() == true ) {
  139. } else {
  140. dlgErrorMsg(resultObj);
  141. }
  142. document.form1.isSubmit = false;
  143. }
  144. } catch (errorObject) {
  145. dlgErrorDetailAlert("doResult()", errorObject);
  146. }
  147. }
  148. function doSearchMaterialCode() {
  149. var win_id = "_search_material_cd";
  150. var link = "/lib/dlgSearchMaterialCd.screen";
  151. link += "?pop_win_id="+win_id;
  152. fLayerPop(win_id, link, 800,400, '', '', 'NO');
  153. }
  154. function doSearchMaterialCodeClose(resultValue) {
  155. var f=document.form1;
  156. if(resultValue == null) {
  157. f.material_cd.value = "";
  158. f.material_nm.value = "";
  159. } else {
  160. f.material_cd.value = resultValue[0];
  161. f.material_nm.value = resultValue[1];
  162. }
  163. fLayerPopClose('_search_material_cd');
  164. }
  165. function doKeyPress() {
  166. if( event.keyCode == 13 ) {
  167. jQuery("#btnSearch").click();
  168. }
  169. }
  170. function sheet1_OnSmartResize(Width, Height) {
  171. sheet1.FitColWidth();
  172. autoResize();
  173. }
  174. function autoResize(){
  175. var t1_height = document.getElementById("search-table").scrollHeight + document.getElementById("title").scrollHeight + 24;
  176. var iframeHeight= document.body.scrollHeight - t1_height;
  177. var iframeWidth= document.body.scrollWidth;
  178. sheet1.SetSheetHeight(iframeHeight);
  179. }
  180. function sheet1_OnSelectMenu(Text, Code) {
  181. switch(Text) {
  182. case "ExcelDown":
  183. jQuery("#btnExcel").click();
  184. break;
  185. }
  186. }
  187. document.body.onresize = addEvent( document.body.onresize, "autoResize()");
  188. </SCRIPT>
  189. <modular:search id="form1">
  190. <modular:key id="fevent" />
  191. </modular:search>
  192. <form id="form1" name="form1" method="post" modular:type="search" style="width:100%;height:100%;">
  193. <INPUT type="hidden" name="fevent">
  194. <div align="left" id="title">
  195. <ul>
  196. <li>구매실적조회</li>
  197. </ul>
  198. </div>
  199. <!-- 검색조건 시작 -->
  200. <table id="search-table" class="search-form-table">
  201. <colgroup>
  202. <col width="100" />
  203. <col width="400" />
  204. <col width="100" />
  205. <col width="*" />
  206. <col width="200" />
  207. </colgroup>
  208. <tr>
  209. <th>본부</th>
  210. <td>
  211. <%= CommCodeManager.getSelectCodeList("101", "ac_unit_cd", "width:79%;height=18;", "<OPTION value=''>-- 전체 --</OPTION>", params.get("ac_unit_cd"), "") %>
  212. </td>
  213. <th>입고일자</th>
  214. <td>
  215. <%= InputText.get("sYmdSt", params.get("sYmdSt"), 10, 50, "hangule,center, desc=기간,ReadOnly") %>
  216. <IMG name="sYmdSt_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgCalendar('sYmdSt');">
  217. ~
  218. <%= InputText.get("sYmdEd", params.get("sYmdEd"), 10, 50, "hangule,center, desc=기간,ReadOnly") %>
  219. <IMG name="sYmdEd_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgCalendar('sYmdEd');">
  220. <IMG name="dataClear2" id="dataClear2" src="/img/buyer/button/bt_eraser1.gif" border="0" align="absmiddle" style="cursor:pointer;">
  221. </td>
  222. <td class="button" rowspan="2">
  223. <span class="btnSearch center"><a href="javascript:void(0);" id="btnSearch">검색</a></span>
  224. <span class="btnSearch center"><a href="javascript:void(0);" id="btnExcel">엑셀</a></span>
  225. </td>
  226. </tr>
  227. <tr>
  228. <th>현장</th>
  229. <td>
  230. <%=InputText.getSiteCodeNew("dept_cd", "dept_name", "", user, params.get("dept_cd"), params.get("dept_name"))%>
  231. </td>
  232. <th>자재명</th>
  233. <td>
  234. <%= InputText.get("material_cd", "","", 15, 255, "class=input byteChk, perSize", "onkeypress=\"doKeyPress();\" onClick=\"\"") %>
  235. <%= InputText.get("material_nm", "","", 45, 255, "class=input byteChk, perSize", "onkeypress=\"doKeyPress();\" onClick=\"\"") %>
  236. <IMG id='search_spot_button' onClick="doSearchMaterialCode();" src='/img/buyer/button/bt_search_right.gif' border='0' align='absmiddle' alt='[자재코드]' style='cursor:pointer;'>
  237. </td>
  238. </tr>
  239. </table>
  240. <!-- 검색조건 종료 -->
  241. <div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 400px; overflow: auto;">
  242. <script>createIBSheet('sheet1','100%', '400px');</script>
  243. </div>
  244. </FORM>