PlanStockList.jsp 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <%--
  2. - FileName : PlanStockList.jsp
  3. - Author : gyeongmo an
  4. - Date : 2014.08.05
  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. <%@ include file="/jsp/work/taglib.jsp" %>
  16. <jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
  17. <%
  18. ctx.init(request, response);
  19. HandlerStorage storage = ctx.getHandlerStorage();
  20. ValueObject params = storage.getParams();
  21. ValueObject user = storage.getUser();
  22. String fevent = storage.getEvent();
  23. RowSet stockGbRowSet = storage.getRowSet("stockGbRowSet");
  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/PlanStockList_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 : "PlanStockList.xls", SheetName : "계획대비입고조회", SheetDesign:0, Merge:1, DownCols:"dept_nm|material_cd|material_name|material_spec|unit_nm|"+
  46. "wkdate|plan_qty|stock_qty|contrast_plan_stoc", TitleText:"계획대비 입고조회", UserMerge:"0,0,1,9", AutoSizeColumn:1 } ;
  47. sheet1.Down2Excel(params);
  48. });
  49. $("#dataClear2").click(function(){$("#sYmdSt").val("");$("#sYmdEd").val("");});
  50. sheet1.SetActionMenu("ExcelDown");
  51. autoResize();
  52. }
  53. function gridInit(sheetName){
  54. var init_sheet = {};
  55. init_sheet.Cfg = {SearchMode:2, Page:10};
  56. init_sheet.Cols = [
  57. {Header:'현장', Type:"Text", SaveName:"dept_nm", Width:150, Align:"Left"},
  58. {Header:'자재코드', Type:"Text", SaveName:"material_cd", Width:50, Align:"Center"},
  59. {Header:'자재명', Type:"Text", SaveName:"material_name", Width:150, Align:"Left"},
  60. {Header:'규격', Type:"Text", SaveName:"material_spec", Width:120, Align:"Left"},
  61. {Header:'단위', Type:"Text", SaveName:"unit_nm", Width:30, Align:"Center"},
  62. {Header:'일자', Type:"Date", SaveName:"wkdate", Width:50, Align:"Center"},
  63. {Header:'계획수량', Type:"AutoSum", SaveName:"plan_qty", Width:50, Align:"Right", PointCount:2},
  64. {Header:'입고수량', Type:"AutoSum", SaveName:"stock_qty", Width:50, Align:"Right", PointCount:2},
  65. {Header:'계획대비 미입고수량', Type:"AutoSum", SaveName:"contrast_plan_stoc", Width:70, Align:"Right", PointCount:2},
  66. {Header:'H_현장코드', Type:"Text", SaveName:"dept_cd", Width:0, Align:"Center", Hidden:"True"}
  67. ];
  68. init_sheet.HeaderMode = {Sort:1};
  69. IBS_InitSheet(sheetName, init_sheet);
  70. sheetName.SetDataAutoTrim(0);
  71. sheetName.SetEditable(false);
  72. sheetName.SetMergeSheet(msPrevColumnMerge);
  73. var info = [{StdCol:"dept_nm", SumCols:"plan_qty|stock_qty|contrast_plan_stoc", CaptionCol:"dept_nm"}];
  74. sheet1.ShowSubSum(info);
  75. setGridSize();
  76. }
  77. function sheet1_OnSearchEnd(code, message) {
  78. if(code == 0) {
  79. setGridSize();
  80. for(var i=1; i <= sheet1.LastRow(); i++){
  81. if(sheet1.GetCellValue(i , "contrast_plan_stoc") < 0){
  82. sheet1.SetCellFontColor(i, "contrast_plan_stoc", "#ff0000");
  83. }
  84. }
  85. //소계 머지
  86. var str = "";
  87. for(var i=1; i<sheet1.LastRow(); i++) {
  88. str = sheet1.GetCellText(i, "dept_nm");
  89. if(str.indexOf("소계:") > -1) {
  90. sheet1.SetCellAlign(i,0,"Center");
  91. sheet1.SetCellText(i, "dept_nm", "소 계 : ");
  92. sheet1.SetMergeCell(i,0,1,6);
  93. }
  94. }
  95. //합계 머지
  96. sheet1.SetCellText(sheet1.LastRow(), "dept_nm", "합 계");
  97. sheet1.SetMergeCell(sheet1.LastRow(), 0, 1, 6);
  98. sheet1.SetCellAlign(sheet1.LastRow(), 0, "Center");
  99. setGridSize();
  100. } else {
  101. alert(message);
  102. }
  103. }
  104. function setGridSize() {
  105. sheet1.FitColWidth();
  106. }
  107. function doKeyPress() {
  108. if( event.keyCode == 13 ) {
  109. jQuery("#btnSearch").click();
  110. }
  111. }
  112. function doSearchMaterialCode() {
  113. var win_id = "_search_material_cd";
  114. var link = "/lib/dlgSearchMaterialCd.screen";
  115. link += "?pop_win_id="+win_id;
  116. fLayerPop(win_id, link, 800,400, '', '', 'NO');
  117. }
  118. function doSearchMaterialCodeClose(resultValue) {
  119. var f=document.form1;
  120. if(resultValue == null) {
  121. f.material_cd.value = "";
  122. f.material_nm.value = "";
  123. } else {
  124. f.material_cd.value = resultValue[0];
  125. f.material_nm.value = resultValue[1];
  126. }
  127. fLayerPopClose('_search_material_cd');
  128. }
  129. function sheet1_OnSelectMenu(Text, Code) {
  130. switch(Text) {
  131. case "ExcelDown":
  132. jQuery("#btnExcel").click();
  133. break;
  134. }
  135. }
  136. function sheet1_OnSmartResize(Width, Height) {
  137. sheet1.FitColWidth();
  138. autoResize();
  139. }
  140. function autoResize(){
  141. var t1_height = document.getElementById("search-table").scrollHeight + document.getElementById("title").scrollHeight + 24;
  142. var iframeHeight= document.body.scrollHeight - t1_height;
  143. var iframeWidth= document.body.scrollWidth;
  144. sheet1.SetSheetHeight(iframeHeight);
  145. }
  146. document.body.onresize = addEvent( document.body.onresize, "autoResize()");
  147. </SCRIPT>
  148. <modular:search id="form1">
  149. <modular:key id="fevent" />
  150. </modular:search>
  151. <form id="form1" name="form1" method="post" modular:type="search" style="width:100%;height:100%;">
  152. <INPUT type="hidden" name="fevent">
  153. <div align="left" id="title">
  154. <ul>
  155. <li>계획대비 입고조회</li>
  156. </ul>
  157. </div>
  158. <!-- 검색조건 시작 -->
  159. <table id="search-table" class="search-form-table">
  160. <colgroup>
  161. <col width="80" />
  162. <col width="330" />
  163. <col width="80" />
  164. <col width="330" />
  165. <col width="80" />
  166. <col width="*" />
  167. <col width="130" />
  168. </colgroup>
  169. <tr>
  170. <th>현장</th>
  171. <td>
  172. <%=InputText.getSiteCodeNew("dept_cd", "dept_name", "", user, params.get("dept_cd"), params.get("dept_name"))%>
  173. </td>
  174. <th>일자</th>
  175. <td>
  176. <%= InputText.get("sYmdSt", params.get("sYmdSt"), 10, 50, "hangule,center, desc=기간,ReadOnly") %>
  177. <IMG name="sYmdSt_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgCalendar('sYmdSt');">
  178. ~
  179. <%= InputText.get("sYmdEd", params.get("sYmdEd"), 10, 50, "hangule,center, desc=기간,ReadOnly") %>
  180. <IMG name="sYmdEd_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgCalendar('sYmdEd');">
  181. <IMG name="dataClear2" id="dataClear2" src="/img/buyer/button/bt_eraser1.gif" border="0" align="absmiddle" style="cursor:pointer;">
  182. </td>
  183. <th>자재명</th>
  184. <td>
  185. <%= InputText.get("material_cd", "","", 15, 255, "class=input byteChk, perSize", "onkeypress=\"doKeyPress();\" onClick=\"\"") %>
  186. <%= InputText.get("material_nm", "","", 65, 255, "class=input byteChk, perSize", "onkeypress=\"doKeyPress();\" onClick=\"\"") %>
  187. <IMG id='search_spot_button' onClick="doSearchMaterialCode();" src='/img/buyer/button/bt_search_right.gif' border='0' align='absmiddle' alt='[자재코드]' style='cursor:pointer;'>
  188. </td>
  189. <td class="button">
  190. <span class="btnSearch center"><a href="javascript:void(0);" id="btnSearch">검색</a></span>
  191. <span class="btnSearch center"><a href="javascript:void(0);" id="btnExcel">엑셀</a></span>
  192. </td>
  193. </tr>
  194. </table>
  195. <!-- 검색조건 종료 -->
  196. <div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 400px; overflow: auto;">
  197. <script>createIBSheet('sheet1','100%', '400px');</script>
  198. </div>
  199. </FORM>