StockList.jsp 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. <%--
  2. - FileName : StockList.jsp
  3. - Author : gyeongmo an
  4. - Date : 2014.07.15
  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 materialKindCodeLv1 = storage.getRowSet("materialKindCodeLv1");
  24. RowSet materialKindCodeLv2 = new RowSetImpl();
  25. RowSet materialKindCodeLv3 = new RowSetImpl();
  26. %>
  27. <SCRIPT language="JavaScript">
  28. /*예약함수*/
  29. var sheet1;
  30. var sheet1Row;
  31. var sheet1PageNo = 1;
  32. var pageLastRowIndex = 1;
  33. var validationResult = false;
  34. var filterShow = false;
  35. $(function(){
  36. $("#material_Kind_Code_Lv1").change(function(){
  37. var f = document.form1;
  38. if($("#material_Kind_Code_Lv1").val().trim() == "")
  39. {
  40. $("#material_Kind_Code_Lv2").empty().data("options");
  41. $("#material_Kind_Code_Lv2").append("<option value=''>-- 전체 --</option>");
  42. $("#material_Kind_Code_Lv3").empty().data("options");
  43. $("#material_Kind_Code_Lv3").append("<option value=''>-- 전체 --</option>");
  44. }
  45. else
  46. {
  47. $("#fevent").val("GET_MATL_KIND_CODE_LV2");
  48. $("#materiallevel").val("2");
  49. $("#materialgroup").val($("#material_Kind_Code_Lv1").val());
  50. $("#material_Kind_Code_Lv3").empty().data("options");
  51. $("#material_Kind_Code_Lv3").append("<option value=''>-- 전체 --</option>");
  52. submitXmlRequest("/cont/purchase/ContPriceSearch_form.screen", "GET_MATL_KIND_CODE_LV2", f, "ROWSET");
  53. }
  54. });
  55. $("#material_Kind_Code_Lv2").change(function(){
  56. var f = document.form1;
  57. if($("#material_Kind_Code_Lv2").val().trim() == "")
  58. {
  59. $("#material_Kind_Code_Lv3").empty().data("options");
  60. $("#material_Kind_Code_Lv3").append("<option value=''>-- 전체 --</option>");
  61. $.searchList();
  62. }
  63. else
  64. {
  65. $("#fevent").val("GET_MATL_KIND_CODE_LV3");
  66. $("#materiallevel").val("3");
  67. $("#materialgroup").val($("#material_Kind_Code_Lv2").val());
  68. submitXmlRequest("/cont/purchase/ContPriceSearch_form.screen", "GET_MATL_KIND_CODE_LV3", f, "ROWSET");
  69. }
  70. });
  71. $("#material_Kind_Code_Lv3").change(function(){
  72. //jQuery("#btnSearch").click();
  73. });
  74. });
  75. function _onReady(){
  76. gridInit(sheet1);
  77. var f = document.form1;
  78. jQuery("#btnSearch").click(function() {
  79. jQuery("#fevent").val("GET_DATA_LIST");
  80. var url = Modular.model.PageContext.CONTEXT_ROOT + "/warehouse/purchase/StockList_sheet.screen";
  81. Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 10, "");
  82. });
  83. jQuery("#btnExcel").click(function() {
  84. if(sheet1.RowCount() == 0) {
  85. alert("내역이 없습니다.");
  86. return;
  87. }
  88. var params = { FileName : "StockList.xls", SheetName : "StockList", SheetDesign:0, Merge:1, DownCols:"dept_nm|vendor_name|pay_item|pay_item_desc|cst_doc_name|material_cd|material_name|"+
  89. "material_spec|unit_kind_name|stock_date|stock_qty|remarks", TitleText:"입고 현황", UserMerge:"0,0,1,12", AutoSizeColumn:1 } ;
  90. sheet1.Down2Excel(params);
  91. });
  92. $("#dataClear2").click(function(){$("#sYmdSt").val("");$("#sYmdEd").val("");});
  93. jQuery("#btnSearch").click();
  94. autoResize();
  95. }
  96. function gridInit(sheetName){
  97. var init_sheet = {};
  98. init_sheet.Cfg = {SearchMode:2, Page:10};
  99. init_sheet.Cols = [
  100. {Header:'현장', Type:"Text", SaveName:"dept_nm", Width:150, Align:"Left"},
  101. {Header:'거래처', Type:"Text", SaveName:"vendor_name", Width:150, Align:"Left"},
  102. {Header:'Pay Item', Type:"Text", SaveName:"pay_item", Width:100, Align:"Center"},
  103. {Header:'Pay Desc', Type:"Text", SaveName:"pay_item_desc", Width:100, Align:"Center"},
  104. {Header:'계약명', Type:"Text", SaveName:"cst_doc_name", Width:150, Align:"Left"},
  105. {Header:'자재코드', Type:"Text", SaveName:"material_cd", Width:90, Align:"Center"},
  106. {Header:'자재명', Type:"Text", SaveName:"material_name", Width:120, Align:"Left"},
  107. {Header:'규격', Type:"Text", SaveName:"material_spec", Width:50, Align:"Left"},
  108. {Header:'단위', Type:"Text", SaveName:"unit_kind_name", Width:50, Align:"Center"},
  109. {Header:'일자', Type:"Date", SaveName:"stock_date", Width:90, Align:"Center"},
  110. {Header:'수량', Type:"AutoSum", SaveName:"stock_qty", Width:50, Align:"Right"},
  111. {Header:'비고', Type:"Text", SaveName:"remarks", Width:150, Align:"Left"},
  112. {Header:'H_입고ID', Type:"Text", SaveName:"stock_id", Width:100, Align:"Center", Hidden:"True"},
  113. {Header:'H_현장코드', Type:"Text", SaveName:"dept_cd", Width:100, Align:"Center", Hidden:"True"},
  114. {Header:'H_거래처코드', Type:"Text", SaveName:"vendor_cd", Width:100, Align:"Center", Hidden:"True"}
  115. ];
  116. init_sheet.HeaderMode = {Sort:1};
  117. IBS_InitSheet(sheetName, init_sheet);
  118. sheetName.SetDataAutoTrim(0);
  119. sheetName.SetEditable(false);
  120. var info = [{StdCol:"dept_nm", SumCols:"stock_qty", CaptionCol:"dept_nm"}];
  121. sheet1.ShowSubSum(info);
  122. sheet1.SetActionMenu("ExcelDown");
  123. setGridSize();
  124. }
  125. function sheet1_OnSearchEnd(code, message) {
  126. if(code == 0) {
  127. //소계 머지
  128. var str = "";
  129. for(var i=1; i<sheet1.LastRow(); i++) {
  130. str = sheet1.GetCellText(i, "dept_nm");
  131. if(str.indexOf("소계:") > -1) {
  132. sheet1.SetCellAlign(i,0,"Center");
  133. sheet1.SetCellText(i, "dept_nm", "소 계 : ");
  134. sheet1.SetMergeCell(i,0,1,10);
  135. }
  136. }
  137. //합계 머지
  138. sheet1.SetCellText(sheet1.LastRow(), "dept_nm", "합 계");
  139. sheet1.SetMergeCell(sheet1.LastRow(), 0, 1, 10);
  140. sheet1.SetCellAlign(sheet1.LastRow(), 0, "Center");
  141. setGridSize();
  142. } else {
  143. alert(message);
  144. }
  145. }
  146. function setGridSize() {
  147. sheet1.FitColWidth();
  148. }
  149. function doKeyPress() {
  150. if( event.keyCode == 13 ) {
  151. jQuery("#btnSearch").click();
  152. }
  153. }
  154. function sheet1_OnSmartResize(Width, Height) {
  155. sheet1.FitColWidth();
  156. autoResize();
  157. }
  158. function autoResize(){
  159. var t1_height = document.getElementById("search-table").scrollHeight + document.getElementById("title").scrollHeight + 24;
  160. var iframeHeight= document.body.scrollHeight - t1_height;
  161. var iframeWidth= document.body.scrollWidth;
  162. sheet1.SetSheetHeight(iframeHeight);
  163. }
  164. function suppChoicePop(){
  165. var win_id = "corp";
  166. var link = "/common/corp/SuppChoicePop.screen";
  167. fLayerPop(win_id, link, 800,400, '', '', 'NO');
  168. }
  169. $.test = function(resultVal)
  170. {
  171. var f=document.form1;
  172. f.corp_id.value = resultVal[0][0];
  173. f.corp_name.value = resultVal[2][0];
  174. };
  175. function doSearchMaterialCode() {
  176. var win_id = "_search_material_cd";
  177. var link = "/lib/dlgSearchMaterialCd.screen";
  178. link += "?pop_win_id="+win_id;
  179. fLayerPop(win_id, link, 800,400, '', '', 'NO');
  180. }
  181. function doSearchMaterialCodeClose(resultValue) {
  182. var f=document.form1;
  183. if(resultValue == null) {
  184. f.material_cd.value = "";
  185. f.material_nm.value = "";
  186. } else {
  187. f.material_cd.value = resultValue[0];
  188. f.material_nm.value = resultValue[1];
  189. }
  190. fLayerPopClose('_search_material_cd');
  191. }
  192. function sheet1_OnSelectMenu(Text, Code) {
  193. switch(Text) {
  194. case "ExcelDown":
  195. jQuery("#btnExcel").click();
  196. break;
  197. }
  198. }
  199. function doResult(resultObj) {
  200. try {
  201. if ( resultObj.getRequestEvent() == "GET_MATL_KIND_CODE_LV2" )
  202. {
  203. if ( resultObj.getSuccess() == true )
  204. {
  205. var rowSet = resultObj.getRowSet();
  206. $("#material_Kind_Code_Lv2").empty().data("options");
  207. $("#material_Kind_Code_Lv2").append("<option value=''>-- 전체 --</option>");
  208. for ( var i = 0; i < rowSet.getRowSize(); i++ )
  209. {
  210. $("#material_Kind_Code_Lv2").append("<option value='"+rowSet.getColValue( i, 0 )+"'>"+rowSet.getColValue( i, 1 ) + "</option>");
  211. }
  212. document.form1.isSubmit = false;
  213. var material_Kind_Code_Lv2 = "<%=params.get("material_Kind_Code_Lv2")%>";
  214. if(material_Kind_Code_Lv2.trim() != "")
  215. {
  216. $("#material_Kind_Code_Lv2").val(material_Kind_Code_Lv2).attr("selected", "selected");
  217. $("#material_Kind_Code_Lv2").change();
  218. }
  219. //$.searchList();
  220. } else {
  221. dlgErrorMsg(resultObj);
  222. }
  223. }
  224. else if ( resultObj.getRequestEvent() == "GET_MATL_KIND_CODE_LV3" )
  225. {
  226. if ( resultObj.getSuccess() == true )
  227. {
  228. var rowSet = resultObj.getRowSet();
  229. $("#material_Kind_Code_Lv3").empty().data("options");
  230. $("#material_Kind_Code_Lv3").append("<option value=''>-- 전체 --</option>");
  231. for ( var i = 0; i < rowSet.getRowSize(); i++ )
  232. {
  233. $("#material_Kind_Code_Lv3").append("<option value='"+rowSet.getColValue( i, 0)+"'>"+rowSet.getColValue( i, 1 ) + "</option>");
  234. }
  235. document.form1.isSubmit = false;
  236. var material_Kind_Code_Lv3 = "<%=params.get("material_Kind_Code_Lv3")%>";
  237. if(material_Kind_Code_Lv3.trim() != "")
  238. {
  239. $("#material_Kind_Code_Lv3").val(material_Kind_Code_Lv3).attr("selected", "selected");
  240. }
  241. //$.searchList();
  242. }
  243. else if(resultObj.getRequestEvent() == "GET_MATL_KIND_CODE_LV3")
  244. {
  245. dlgErrorMsg(resultObj);
  246. }
  247. }
  248. }
  249. catch(errorObject) {
  250. showErrorDlg("doResult()", errorObject);
  251. }
  252. }
  253. document.body.onresize = addEvent( document.body.onresize, "autoResize()");
  254. </SCRIPT>
  255. <modular:search id="form1">
  256. <modular:key id="fevent" />
  257. </modular:search>
  258. <form id="form1" name="form1" method="post" modular:type="search" style="width:100%;height:100%;">
  259. <INPUT type="hidden" name="fevent">
  260. <div align="left" id="title">
  261. <ul>
  262. <li>입고 현황</li>
  263. </ul>
  264. </div>
  265. <!-- 검색조건 시작 -->
  266. <table id="search-table" class="search-form-table">
  267. <colgroup>
  268. <col width="100" />
  269. <col width="350" />
  270. <col width="100" />
  271. <col width="*" />
  272. <col width="200" />
  273. </colgroup>
  274. <tr>
  275. <th>현장</th>
  276. <td>
  277. <%=InputText.getSiteCodeNew("dept_cd", "dept_name", "", user, params.get("dept_cd"), params.get("dept_name"))%>
  278. </td>
  279. <th>입고일자</th>
  280. <td>
  281. <%= InputText.get("sYmdSt", params.get("sYmdSt"), 10, 50, "hangule,center, desc=기간,ReadOnly") %>
  282. <IMG name="sYmdSt_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgCalendar('sYmdSt');">
  283. ~
  284. <%= InputText.get("sYmdEd", params.get("sYmdEd"), 10, 50, "hangule,center, desc=기간,ReadOnly") %>
  285. <IMG name="sYmdEd_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgCalendar('sYmdEd');">
  286. <IMG name="dataClear2" id="dataClear2" src="/img/buyer/button/bt_eraser1.gif" border="0" align="absmiddle" style="cursor:pointer;">
  287. </td>
  288. <td class="button" rowspan="3">
  289. <span class="btnSearch center"><a href="javascript:void(0);" id="btnSearch">검색</a></span>
  290. <span class="btnSearch center"><a href="javascript:void(0);" id="btnExcel">엑셀</a></span>
  291. </td>
  292. </tr>
  293. <tr>
  294. <th>계약명</th>
  295. <td>
  296. <input type='text' id="cst_doc_name" name="cst_doc_name" class="input" style="width:90%" onkeypress="doKeyPress()">
  297. </td>
  298. <th>거래처</th>
  299. <td>
  300. <%= InputText.get("corp_name", params.get("corp_name"), 50, 50, "hangule,left, desc=거래처") %>
  301. </td>
  302. </tr>
  303. <tr>
  304. <th>자재분류</th>
  305. <td>
  306. <%= HTMLMaker.getSelectTag(materialKindCodeLv1, "materialgroup", "materialgroupname" , "material_Kind_Code_Lv1", "style='width:28%;height=18;'", "<OPTION value=''>-- 전체 --</OPTION>", params.get("material_Kind_Code_Lv1"), 0) %>
  307. <%= HTMLMaker.getSelectTag(materialKindCodeLv2, "materialgroup", "materialgroupname" , "material_Kind_Code_Lv2", "style='width:28%;height=18;'", "<OPTION value=''>-- 전체 --</OPTION>", params.get("material_Kind_Code_Lv2"), 0) %>
  308. <%= HTMLMaker.getSelectTag(materialKindCodeLv3, "materialgroup", "materialgroupname" , "material_Kind_Code_Lv3", "style='width:28%;height=18;'", "<OPTION value=''>-- 전체 --</OPTION>", params.get("material_Kind_Code_Lv3"), 0) %>
  309. </td>
  310. <th>자재명</th>
  311. <td>
  312. <%= InputText.get("material_cd", "","", 15, 255, "class=input byteChk, perSize", "onkeypress=\"doKeyPress();\" onClick=\"\"") %>
  313. <%= InputText.get("material_nm", "","", 45, 255, "class=input byteChk, perSize", "onkeypress=\"doKeyPress();\" onClick=\"\"") %>
  314. <IMG id='search_spot_button' onClick="doSearchMaterialCode();" src='/img/buyer/button/bt_search_right.gif' border='0' align='absmiddle' alt='[자재코드]' style='cursor:pointer;'>
  315. </td>
  316. </tr>
  317. </table>
  318. <!-- 검색조건 종료 -->
  319. <div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 350px; overflow: auto;">
  320. <script>createIBSheet('sheet1','100%', '350px');</script>
  321. </div>
  322. </FORM>