StockDeliveryWillPrice.jsp 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <%--
  2. - FileName : StockDeliveryWillPrice.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="com.udapsoft.waf.common.util.*" %>
  13. <%@ page import="kr.co.hsnc.common.util.*"%>
  14. <%@ page import="kr.co.hsnc.common.sql.*" %>
  15. <%@ page import="com.udapsoft.waf.common.util.DateUtil" %>
  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. if( params.get("dateFrom").equals("") ) {
  25. params.set("dateFrom", DateUtil.formatDateTime(DateUtil.getToday(), "yyyyMMdd", "yyyyMM"));
  26. }else {
  27. params.set("dateFrom", StringUtil.replace(DateUtil.formatDateTime(params.get("dateFrom"), "yyyyMMdd", "yyyyMM"), "-", ""));
  28. }
  29. %>
  30. <SCRIPT language="JavaScript">
  31. /*예약함수*/
  32. var sheet1;
  33. var sheet1Row;
  34. var sheet1PageNo = 1;
  35. var pageLastRowIndex = 1;
  36. var validationResult = false;
  37. var filterShow = false;
  38. var clickRow;
  39. function _onReady(){
  40. gridInit(sheet1);
  41. var f = document.form1;
  42. jQuery("#btnSearch").click(function() {
  43. /*
  44. if(f.dept_cd.value == null || f.dept_cd.value == ""){
  45. alert('현장을 선택해 주세요.');
  46. return;
  47. }else{
  48. */
  49. jQuery("#fevent").val("GET_STOCKDELIVERYWILLPRICE");
  50. var url = Modular.model.PageContext.CONTEXT_ROOT + "/warehouse/purchase/StockDeliveryWillPrice_sheet.screen";
  51. Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 10, "");
  52. //}
  53. });
  54. jQuery("#btnSave").click(function() {
  55. getPmmWarehouseClose();
  56. });
  57. jQuery("#btnExcel").click(function() {
  58. if(sheet1.RowCount() == 0) {
  59. alert("내역이 없습니다.");
  60. return;
  61. }
  62. var params = { FileName : "StockDeliveryWillPrice.xls", SheetName : "StockDeliveryWillPrice", SheetDesign:0, Merge:1, DownCols:"dept_cd|dept_nm|vendor_nm|cst_doc_name|material_cd"+
  63. "|material_name|material_spec|unit_kind_name|stock_qty|stock_pri|stock_amt", TitleText:"가입고 단가 등록", UserMerge:"0,0,1,11", AutoSizeColumn:1 } ;
  64. sheet1.Down2Excel(params);
  65. });
  66. $("#dataClear2").click(function(){$("#dateFrom").val("");});
  67. sheet1.SetActionMenu("ExcelDown");
  68. autoResize();
  69. jQuery("#btnSearch").click();
  70. }
  71. function gridInit(sheetName){
  72. var init_sheet = {};
  73. init_sheet.Cfg = {SearchMode:2, Page:10};
  74. init_sheet.Cols = [
  75. {Header:'상태', Type:"Status", SaveName:"status", Width:0, Align:"Center", Hidden:"True"},
  76. {Header:'현장코드', Type:"Text", SaveName:"dept_cd", Width:50, Align:"Center", Edit:"false"},
  77. {Header:'현장명', Type:"Text", SaveName:"dept_nm", Width:150, Align:"Left", Edit:"false"},
  78. {Header:'거래처코드', Type:"Text", SaveName:"vendor_cd", Width:0, Align:"Left", Hidden:"True"},
  79. {Header:'거래처', Type:"Text", SaveName:"vendor_nm", Width:150, Align:"Left", Edit:"false"},
  80. {Header:'계약번호', Type:"Text", SaveName:"pur_cont_id", Width:0, Align:"Left", Hidden:"True"},
  81. {Header:'계약명', Type:"Text", SaveName:"cst_doc_name", Width:150, Align:"Left", Edit:"false"},
  82. {Header:'자재코드', Type:"Text", SaveName:"material_cd", Width:70, Align:"Center", Edit:"false"},
  83. {Header:'자재명', Type:"Text", SaveName:"material_name", Width:150, Align:"Left", Edit:"false"},
  84. {Header:'규격', Type:"Text", SaveName:"material_spec", Width:150, Align:"Left", Edit:"false"},
  85. {Header:'단위', Type:"Text", SaveName:"unit_kind_name", Width:50, Align:"Center", Edit:"false"},
  86. {Header:'입고수량', Type:"Float", SaveName:"stock_qty", Width:80, Align:"Right", Edit:"false", EditLen:14, PointCount:2},
  87. {Header:'단가', Type:"Int", SaveName:"stock_pri", Width:80, Align:"Right", EditLen:14},
  88. {Header:'금액', Type:"Int", SaveName:"stock_amt", Width:80, Align:"Right", EditLen:14}
  89. ];
  90. init_sheet.HeaderMode = {Sort:1};
  91. IBS_InitSheet(sheetName, init_sheet);
  92. sheetName.SetDataAutoTrim(0);
  93. sheetName.SetMergeSheet(msPrevColumnMerge);
  94. setGridSize();
  95. }
  96. function sheet1_OnSearchEnd(code, message) {
  97. if(code == 0) {
  98. setGridSize();
  99. } else {
  100. //조회 에러 수행
  101. alert("조회 실패");
  102. //alert(message);
  103. }
  104. }
  105. function setGridSize() {
  106. sheet1.FitColWidth();
  107. }
  108. function sheet1_OnSaveEnd(code, msg) {
  109. if(code >= 0) {
  110. alert("저장 성공");
  111. } else {
  112. alert("저장 실패");
  113. //alert(msg);
  114. }
  115. jQuery("#btnSearch").click();
  116. }
  117. function doResult(resultObj) {
  118. var f = document.form1;
  119. document.form1.isSubmit = false;
  120. try {
  121. if(resultObj.getRequestEvent() == "GET_PMM_WAREHOUSE_CLOSE") {
  122. f.dept_cd2.value = "";
  123. if (resultObj.getSuccess() == true) {
  124. var listRowSet = resultObj.getRowSet();
  125. if(listRowSet.getRowSize() > 0) {
  126. if( listRowSet.getColValue( 0, 0 ) == "9") {
  127. alert("해당월은 마감되었습니다.");
  128. return;
  129. } else {
  130. doSave();
  131. }
  132. } else {
  133. doSave();
  134. }
  135. } else {
  136. dlgErrorMsg(resultObj);
  137. }
  138. }
  139. } catch (errorObject) {
  140. dlgErrorDetailAlert("doResult()", errorObject);
  141. }
  142. }
  143. function prcKeyPress(){
  144. if( fevent.keyCode == 13 )
  145. {
  146. jQuery("#btnSearch").click();
  147. }
  148. }
  149. function doSave() {
  150. if( sheet1.RowCount() == 0 ) {
  151. alert("등록할 데이터가 없습니다.");
  152. return;
  153. } else if ( !sheet1.IsDataModified() ) {
  154. alert("수정된 데이터가 없습니다. ");
  155. return;
  156. }
  157. jQuery("#fevent").val("SAVE_STOCKDELIVERYWILLPRICE");
  158. var url = Modular.model.PageContext.CONTEXT_ROOT + "/warehouse/purchase/StockDeliveryWillPrice_sheet.screen";
  159. var result = Modular.view.IBSheet7.doSave(sheet1, url, jQuery("#form1"), false);
  160. }
  161. // 마감유무 확인
  162. function getPmmWarehouseClose() {
  163. var f = document.form1;
  164. if(f.dateFrom.value == "") {
  165. alert("입고년월을 선택하세요.");
  166. return;
  167. }
  168. if(!sheet1.IsDataModified()) {
  169. alert("수정된 데이터가 없습니다. ");
  170. return;
  171. }
  172. f.dept_cd2.value = sheet1.GetCellValue(clickRow, "dept_cd");
  173. submitXmlRequest("/warehouse/purchase/StockDeliveryWillPrice_form.screen", "GET_PMM_WAREHOUSE_CLOSE", f, "ROWSET");
  174. }
  175. function sheet1_OnChange(Row, Col, Value, OldValue, RaiseFlag) {
  176. var columnName = sheet1.ColSaveName(0, Col);
  177. if ( columnName == "stock_pri" ) {
  178. sheet1.SetCellValue(Row, "stock_amt", sheet1.GetCellValue(Row, "stock_qty") * sheet1.GetCellValue(Row, "stock_pri"));
  179. }
  180. }
  181. function sheet1_OnSmartResize(Width, Height) {
  182. sheet1.FitColWidth();
  183. autoResize();
  184. }
  185. function autoResize(){
  186. var t1_height = document.getElementById("search-table").scrollHeight + document.getElementById("title").scrollHeight + 24;
  187. var iframeHeight= document.body.scrollHeight - t1_height;
  188. var iframeWidth= document.body.scrollWidth;
  189. sheet1.SetSheetHeight(iframeHeight);
  190. }
  191. function sheet1_OnClick(Row, Col, Value, CellX, CellY, CellW, CellH) {
  192. clickRow = Row;
  193. }
  194. function sheet1_OnSelectMenu(Text, Code) {
  195. switch(Text) {
  196. case "ExcelDown":
  197. jQuery("#btnExcel").click();
  198. break;
  199. }
  200. }
  201. document.body.onresize = addEvent( document.body.onresize, "autoResize()");
  202. </script>
  203. <modular:search id="form1">
  204. <modular:key id="fevent" />
  205. </modular:search>
  206. <form id="form1" name="form1" method="post" modular:type="search" style="width:100%;height:100%;">
  207. <input type="hidden" id="vendor_cd" name="vendor_cd"> <!-- 거래처 코드 -->
  208. <input type="hidden" id="dcerti_no" name="dcerti_no"> <!-- 사업자코드 -->
  209. <input type="hidden" id="dept_cd2" name="dept_cd2"> <!-- 사업자코드 -->
  210. <INPUT type="hidden" name="fevent" id="fevent" value="">
  211. <div align="left" id="title">
  212. <ul>
  213. <li>가입고 단가등록</li>
  214. </ul>
  215. </div>
  216. <!-- 검색조건 시작 -->
  217. <table id="search-table" class="search-form-table">
  218. <colgroup>
  219. <col width="100" />
  220. <col width="350" />
  221. <col width="100" />
  222. <col width="*" />
  223. <col width="250" />
  224. </colgroup>
  225. <tr>
  226. <th>현장</th>
  227. <td>
  228. <%=InputText.getSiteCodeNew("dept_cd", "dept_name", "", user, params.get("dept_cd"), params.get("dept_name"))%>
  229. </td>
  230. <th>입고년월</th>
  231. <td>
  232. <%= InputText.get("dateFrom", DateUtil.formatDateTime(params.get("dateFrom"), "yyyyMM", "yyyy-MM"), 10, 50, "hangule,center, desc=입고년월,ReadOnly") %>
  233. <IMG name="dateFrom_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgMCalendar('dateFrom');">
  234. <IMG name="dataClear2" id="dataClear2" src="/img/buyer/button/bt_eraser1.gif" border="0" align="absmiddle" style="cursor:pointer;">
  235. </td>
  236. <td class="button">
  237. <span class="btnSearch center"><a href="javascript:void(0);" id="btnSearch">검색</a></span>
  238. <span class="btnSearch center"><a href="javascript:void(0);" id="btnSave">저장</a></span>
  239. <span class="btnSearch center"><a href="javascript:void(0);" id="btnExcel">엑셀</a></span>
  240. </td>
  241. </tr>
  242. </table>
  243. <!-- 검색조건 종료 -->
  244. <div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 400px; overflow: auto;">
  245. <script>createIBSheet('sheet1','100%', '400px');</script>
  246. </div>
  247. </form>