LCList.jsp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. <%--
  2. - FileName : LCList.jsp
  3. - Author(s) : lee mi kyoung
  4. - Date : 2016.11.01
  5. -
  6. - Description: LC관리
  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 = "java.util.Date"%>
  17. <%@ page import = "java.util.*"%>
  18. <%@ include file="/jsp/work/taglib.jsp" %>
  19. <jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
  20. <%
  21. ctx.init(request, response);
  22. HandlerStorage storage = ctx.getHandlerStorage();
  23. ValueObject params = storage.getParams();
  24. ValueObject user = storage.getUser();
  25. String event = storage.getEvent();
  26. String selectText = (String)storage.getObject("selectText");
  27. String selectValue = (String)storage.getObject("selectValue");
  28. String selectLC = (String)storage.getObject("selectLC");
  29. //검색조건 작성일
  30. String initSearchDateStart = params.get("p_from_dt");
  31. String initSearchDateEnd = params.get("p_to_dt");
  32. ValueObject defaultDate = DateUtil.getDefaultPeriod();
  33. if("".equals(initSearchDateStart)){
  34. initSearchDateStart = DateUtil.getAddedDate("-12", "yyyy-mm-dd");//defaultDate.get("START_DATE");
  35. }
  36. if("".equals(initSearchDateEnd)){
  37. initSearchDateEnd = defaultDate.get("END_DATE");
  38. }
  39. %>
  40. <script type="text/javascript" src="/js/creditEvaluationPop.js"></script>
  41. <script language="javascript">
  42. /*예약함수*/
  43. var sheet1 = new ibsheetObject();
  44. var sheet1Row;
  45. var sheet1PageNo = 1;
  46. var sheet2 = new ibsheetObject();
  47. var sheet2Row;
  48. var sheet2PageNo = 1;
  49. var pageLastRowIndex = 1;
  50. var validationResult = false;
  51. var filterShow = false;
  52. $(document).on("keyup", "input:text", function(e) {
  53. if($(this).attr("numberOnly") == "true")
  54. {
  55. $(this).val( $(this).val().replace(/[^0-9]/gi,"") );
  56. }
  57. if (e.keyCode == 13)
  58. {
  59. $.searchList();
  60. }
  61. });
  62. $.gridInit = function(sheetName)
  63. {
  64. var init_sheet = {};
  65. init_sheet.Cfg = {SearchMode:2, MergeSheet:msAll, Page:100};
  66. if(sheetName.id == "sheet1") {
  67. init_sheet.Cols = [
  68. {Header:'Del', Type:"DelCheck", SaveName:"DEL_CHECK", Width:50, Align:"Center", Hidden:"False",ColMerge:"False"},
  69. {Header:'Status', Type:"Status", SaveName:"STATUS", Width:0, Align:"Center", Edit:"false", Hidden:"True"},
  70. {Header:'PUR_CONT_ID', Type:"Text", SaveName:"PUR_CONT_ID", Width:0, Align:"Center", Edit:"false", Hidden:"True" },
  71. {Header:'SEQ', Type:"Text", SaveName:"SEQ", Width:20, Align:"Center", Edit:"True", Hidden:"True" },
  72. {Header:'구매담당자|구매담당자', Type:"Text", SaveName:"CON_CHARGE_NAME", Width:60, Align:"Center", Edit:"false"},
  73. {Header:'PO No|PO No', Type:"Text", SaveName:"ORD_DOC_NO", Width:180, Align:"Left", Edit:"false"},
  74. {Header:'☞Description|☞Description', Type:"Text", SaveName:"CST_DOC_NAME", Width:180, Align:"Left", Edit:"false",ColMerge:"False", Cursor:"pointer"},
  75. {Header:'Vendor|Vendor', Type:"Text", SaveName:"CORP_KOR", Width:50, Align:"Left", Edit:"false"},
  76. {Header:'Vendor|국가', Type:"Text", SaveName:"NATION", Width:50, Align:"Left", Edit:"false"},
  77. {Header:'화폐|화폐', Type:"Text", SaveName:"CURRENCY_GB", Width:40, Align:"Center", Edit:"false", ColMerge:"False"},
  78. {Header:'금액|금액', Type:"Float", SaveName:"ORD_AMT", Width:60, Align:"Right", Edit:"false", ColMerge:"False"},
  79. {Header:'지급조건|지급조건', Type:"Text", SaveName:"PAY_CONDI", Width:60, Align:"Left", Edit:"true", ColMerge:"False"},
  80. {Header:'LC Open|금액', Type:"AutoSum", SaveName:"LC_AMT", Width:50, Align:"Right", Edit:"true", ColMerge:"False"},
  81. {Header:'LC Open|비율', Type:"Int", SaveName:"RATE", Width:40, Align:"Right", Edit:"true", Format:"#,##0", CalcLogic:"(|LC_AMT|/|ORD_AMT|)*100", ColMerge:"False"},
  82. {Header:'LC Open|Open Date', Type:"Date", SaveName:"OPEN_DATE", Width:90, Align:"Left", Edit:"true" , ColMerge:"False"},
  83. {Header:'LC Open|Expiry date', Type:"Date", SaveName:"EXPIRE_DATE", Width:90, Align:"Left", Edit:"true" , ColMerge:"False"},
  84. {Header:'LC Open|은행', Type:"Combo", SaveName:"BANK_CD", Width:100, Align:"Left", Edit:"true", ComboText:"<%=selectValue%>", ComboCode:"<%=selectText%>" , ColMerge:"False"},
  85. {Header:'LC Open|LC번호', Type:"Text", SaveName:"LC_NO", Width:200, Align:"Left", Edit:"true" , ColMerge:"False"},
  86. {Header:'LC Open|LC잔여', Type:"Float", SaveName:"LC_REMAIN", Width:50, Align:"Right", Edit:"false", ColMerge:"False"},
  87. {Header:'Project|Project', Type:"Text", SaveName:"DEPT_NAME", Width:180, Align:"Left", Edit:"false", ColMerge:"False"},
  88. ];
  89. }else{
  90. init_sheet.Cols = [
  91. {Header:'Del', Type:"DelCheck", SaveName:"DEL_CHECK", Width:40, Align:"Center", Hidden:"False",ColMerge:"False"},
  92. {Header:'Status', Type:"Status", SaveName:"STATUS", Width:0, Align:"Center", Edit:"false", Hidden:"True"},
  93. {Header:'PUR_CONT_ID', Type:"Text", SaveName:"PUR_CONT_ID", Width:40, Align:"Right", Edit:"true", Hidden:"True"},
  94. {Header:'LC_AMT', Type:"Int", SaveName:"LC_AMT", Width:40, Align:"Right", Edit:"true", Hidden:"True"},
  95. {Header:'SEQ', Type:"Text", SaveName:"SEQ", Width:40, Align:"Right", Edit:"true" , ColMerge:"False", Hidden:"True"},
  96. {Header:'LC번호', Type:"Combo", SaveName:"LC_NO", Width:100, Align:"Left", Edit:"true" , ComboText:"",ComboCode:"", ColMerge:"False"},
  97. {Header:'금액', Type:"AutoSum", SaveName:"PAY_AMT", Width:50, Align:"Right", Edit:"true" , ColMerge:"False"},
  98. {Header:'비율', Type:"Int", SaveName:"RATE", Width:40, Align:"Right", Edit:"true" , Format:"#,##0.00", CalcLogic:"(|PAY_AMT|/|LC_AMT|)*100", ColMerge:"False" },
  99. {Header:'Nego Date', Type:"Date", SaveName:"NEGO_DATE", Width:90, Align:"Center", Edit:"true" , ColMerge:"False"},
  100. {Header:'지불일', Type:"Date", SaveName:"PAY_DATE", Width:90, Align:"Center", Edit:"true" , ColMerge:"False"},
  101. {Header:'USANCE이자', Type:"Float", SaveName:"USANCE_INT", Width:90, Align:"Right", Edit:"true" , ColMerge:"False"},
  102. ];
  103. }
  104. init_sheet.HeaderMode = {Sort:1};
  105. IBS_InitSheet(sheetName, init_sheet);
  106. sheetName.SetDataAutoTrim(0);
  107. //setGridSize();
  108. }
  109. $(function(){
  110. $("#btn_search").click(function(){
  111. $.searchList();
  112. });
  113. $("#btn_excel").click(function(){
  114. var params = {FileName:"LC현황.xls",SheetName:"LC현황",Merge:1,SheetDesign:1, HiddenColumn:1};
  115. sheet1.Down2Excel (params);
  116. });
  117. $("#btn_add").click(function() {
  118. var workSheet = document.form1.work_sheet.value;
  119. if(workSheet == '1') {
  120. var rowIdx = sheet1.DataCopy();
  121. sheet1.SetCellValue(rowIdx, "SEQ", 0);
  122. sheet1.SetCellValue(rowIdx, "LC_AMT", 0);
  123. sheet1.SetCellValue(rowIdx, "RATE", 0);
  124. sheet1.SetCellValue(rowIdx, "OPEN_DATE", "");
  125. sheet1.SetCellValue(rowIdx, "EXPIRE_DATE", "");
  126. sheet1.SetCellValue(rowIdx, "BANK_CD", "");
  127. sheet1.SetCellValue(rowIdx, "LC_NO", "");
  128. }else {
  129. if (jQuery("#pur_cont_id").val().length < 1)
  130. {
  131. alert("작성할 계약목록을 선택하십시요.");
  132. return;
  133. }
  134. var rowIdx = 0;
  135. if (sheet2.LastRow() == 1){
  136. rowIdx = sheet2.DataInsert(0);
  137. var data_lc = document.form1.GET_LC.value;
  138. var data_lc_value = document.form1.GET_LC_VALUE.value;
  139. var info = {Header:'LC번호', Type:"Combo", SaveName:"LC_NO", Width:100, Align:"Left", Edit:"true" , ComboText:data_lc, ComboCode:data_lc_value, ColMerge:"False"};
  140. sheet2.InitCellProperty(rowIdx, "LC_NO", info);
  141. }else{
  142. var rowIdx = sheet2.DataCopy();
  143. }
  144. sheet2.SetCellValue(rowIdx, "PUR_CONT_ID", jQuery("#pur_cont_id").val());
  145. sheet2.SetCellValue(rowIdx, "SEQ", '');
  146. sheet2.SetCellValue(rowIdx, "PAY_AMT", 0);
  147. sheet2.SetCellValue(rowIdx, "RATE", 0);
  148. sheet2.SetCellValue(rowIdx, "NEGO_DATE", '');
  149. sheet2.SetCellValue(rowIdx, "PAY_DATE", '');
  150. sheet2.SetCellValue(rowIdx, "USANCE_INT", '');
  151. }
  152. });
  153. $("#btn_save").click(function() {
  154. if (confirm("저장하시겠습니까?")) {
  155. for (var i = 1; i < sheet2.LastRow(); i++ ){
  156. if (sheet2.GetCellValue(i, "LC_NO") == ""){
  157. alert("LC번호 지정은 필수입니다.");
  158. return ;
  159. }
  160. }
  161. jQuery("#fevent").val("SAVE_LC_LIST");
  162. var url = Modular.model.PageContext.CONTEXT_ROOT + "/payment/purchase/LCList_sheet.screen";
  163. var result = Modular.view.IBSheet7.doSave(sheet1, url, jQuery("#form1"), false);
  164. }
  165. });
  166. $.searchList = function()
  167. {
  168. $("#fevent").val("GET_LIST");
  169. var url = Modular.model.PageContext.CONTEXT_ROOT + "/payment/purchase/LCList_sheet.screen";
  170. Modular.view.IBSheet7.doSearch(sheet1, url, $("#form1"), 30, "");
  171. }
  172. });
  173. $(document).ready(function(){
  174. $.gridInit(sheet1);
  175. $.gridInit(sheet2);
  176. autoResize();
  177. });
  178. function calendar(thisDayObj){
  179. dlgCalendar(thisDayObj);
  180. }
  181. function setGridSize()
  182. {
  183. sheet1.FitColWidth();
  184. sheet2.FitColWidth();
  185. }
  186. function sheet1_OnSmartResize(Width, Height) {
  187. autoResize();
  188. }
  189. function sheet2_OnSmartResize(Width, Height) {
  190. autoResize();
  191. }
  192. function autoResize(){
  193. var t1_height = document.getElementById("search-table").scrollHeight + document.getElementById("title").scrollHeight + 24;
  194. var iframeHeight= document.body.scrollHeight - t1_height;
  195. sheet1.SetSheetHeight(iframeHeight);
  196. sheet2.SetSheetHeight(iframeHeight);
  197. }
  198. function doResult(resultObj) {
  199. try {
  200. if ( resultObj.getRequestEvent() == "GET_LC" ) {
  201. var rowSet = resultObj.getRowSet();
  202. var getData = "";
  203. var getDataValue = "";
  204. for ( var i = 0; i < rowSet.getRowSize(); i++ ){
  205. getData = getData + rowSet.getColValue( i, 1 ) + "|";
  206. getDataValue = getDataValue + rowSet.getColValue( i, 0 ) + "|";
  207. }
  208. $("#GET_LC").val(getData);
  209. $("#GET_LC_VALUE").val(getDataValue);
  210. document.form1.isSubmit = false;
  211. jQuery("#fevent").val("GET_DETAIL");
  212. var url = Modular.model.PageContext.CONTEXT_ROOT + "/payment/purchase/LCList_sheet.screen";
  213. Modular.view.IBSheet7.doSearch(sheet2, url, jQuery("#form1"), 10, "");
  214. }
  215. }
  216. catch(errorObject) {
  217. showErrorDlg("doResult()", errorObject);
  218. }
  219. }
  220. function sheet1_OnSearchEnd(code, message) {
  221. if(code == 0) {
  222. sheet1.SetColFontColor("CST_DOC_NAME", "#0000ff");
  223. var f= document.form1;
  224. jQuery("#pur_cont_id").val('');
  225. $("#fevent").val("GET_LC");
  226. submitXmlRequest("/payment/purchase/LCList_form.screen", "GET_LC", f, "ROWSET");
  227. } else {
  228. //조회 에러 수행
  229. alert(message);
  230. }
  231. }
  232. function sheet1_OnClick(Row, Col, Value, CellX, CellY, CellW, CellH) {
  233. var f= document.form1;
  234. f.work_sheet.value = '1';
  235. if(Row < 2) return; //CST_DOC_NAME
  236. if(sheet1.ColSaveName(0, Col) == "CST_DOC_NAME" ){
  237. document.form1.isSubmit = false;
  238. jQuery("#pur_cont_id").val(sheet1.GetCellValue(Row, "PUR_CONT_ID"));
  239. $("#fevent").val("GET_LC");
  240. submitXmlRequest("/payment/purchase/LCList_form.screen", "GET_LC", f, "ROWSET");
  241. }
  242. }
  243. function sheet1_OnDblClick(Row, Col, Value, CellX, CellY, CellW, CellH) {
  244. var f= document.form1;
  245. if(Row < 2) return; //CST_DOC_NAME
  246. jQuery("#pur_cont_id").val(sheet1.GetCellValue(Row, "PUR_CONT_ID"));
  247. $("#fevent").val("GET_LC");
  248. submitXmlRequest("/payment/purchase/LCList_form.screen", "GET_LC", f, "ROWSET");
  249. }
  250. function sheet2_OnClick(Row, Col, Value, CellX, CellY, CellW, CellH) {
  251. var f= document.form1;
  252. f.work_sheet.value = '2';
  253. }
  254. function sheet2_OnMouseDown(Button, Shift, X, Y) {
  255. var f= document.form1;
  256. f.work_sheet.value = '2';
  257. }
  258. function sheet1_OnSaveEnd(code, msg) {
  259. if(code >= 0) {
  260. jQuery("#fevent").val("SAVE_LC_DETAIL");
  261. var url = Modular.model.PageContext.CONTEXT_ROOT + "/payment/purchase/LCList_sheet.screen";
  262. var result = Modular.view.IBSheet7.doSave(sheet2, url, jQuery("#form1"), false);
  263. } else {
  264. alert("저장 실패");
  265. }
  266. }
  267. function sheet2_OnSaveEnd(code, msg) {
  268. if(code >= 0) {
  269. alert("저장 성공");
  270. //$.searchList();
  271. var f= document.form1;
  272. $("#fevent").val("GET_LC");
  273. submitXmlRequest("/payment/purchase/LCList_form.screen", "GET_LC", f, "ROWSET");
  274. } else {
  275. alert("저장 실패");
  276. }
  277. }
  278. function sheet2_OnSearchEnd(code, msg) {
  279. var data_lc = document.form1.GET_LC.value;
  280. var data_lc_value = document.form1.GET_LC_VALUE.value;
  281. var info = {Header:'LC번호', Type:"Combo", SaveName:"LC_NO", Width:100, Align:"Left", Edit:"true" , ComboText:data_lc, ComboCode:data_lc_value, ColMerge:"False"};
  282. var rowcnt = sheet2.RowCount();
  283. if(rowcnt > 0){
  284. for(var r=1; r < rowcnt+1; r++)
  285. {
  286. sheet2.InitCellProperty(r, "LC_NO", info);
  287. }
  288. }
  289. }
  290. document.body.onresize = addEvent( document.body.onresize, "autoResize()");
  291. </script>
  292. <modular:search id="form1">
  293. <modular:key id="fevent" />
  294. </modular:search>
  295. <form id="form1" name="form1" method="post" modular:type="search">
  296. <input type="hidden" name="fevent" id="fevent" value="">
  297. <input type="hidden" name="pur_cont_id" id="pur_cont_id" value=""/>
  298. <input type="hidden" name="work_sheet" value="">
  299. <input type="hidden" name="GET_LC" value="">
  300. <input type="hidden" name="GET_LC_VALUE" value="">
  301. <div align="left" id="title">
  302. <ul>
  303. <li>LC관리</li>
  304. </ul>
  305. </div>
  306. <!-- 검색조건 시작 -->
  307. <table id="search-table" class="search-form-table">
  308. <colgroup>
  309. <col width="100" />
  310. <col width="480" />
  311. <col width="100" />
  312. <col width="*" />
  313. <col width="150" />
  314. </colgroup>
  315. <tr height="25">
  316. <th>현장</th>
  317. <td>
  318. <%=InputText.getSiteCodeNew("p_dept_cd", "p_dept_nm", "", user, params.get("p_dept_cd"), params.get("p_dept_nm"))%>
  319. </td>
  320. <th>계약명</th>
  321. <td>
  322. <INPUT type="text" name="p_cst_doc_name" class="input" value="<%= params.get("p_cst_doc_name") %>" style="width:90%">
  323. </td>
  324. <td class="button" >
  325. <span class="btnSearch center" id="btn_search"><a href="javascript:void(0);">검색</a></span>
  326. <span class="btnSearch center" id="btn_excel"><a href="javascript:void(0);">엑셀</a></span>
  327. </td>
  328. </tr>
  329. <tr>
  330. <th>계약일</th>
  331. <td>
  332. <%= InputText.get("p_from_dt", initSearchDateStart, 15, 50, "Center, date, PerSize, readonly", "date", "") %>
  333. <a href="JavaScript:calendar('p_from_dt');"><img src="/img/buyer/button/bt_calender.gif" alt="달력" border="0" align="absmiddle" /></a>
  334. &nbsp;~&nbsp;
  335. <%= InputText.get("p_to_dt", initSearchDateEnd, 15, 50, "Center, date, PerSize, readonly", "date", "") %>
  336. <a href="JavaScript:calendar('p_to_dt');"><img src="/img/buyer/button/bt_calender.gif" alt="달력" border="0" align="absmiddle" /></a>
  337. </td>
  338. <th>업체명</th>
  339. <td>
  340. <INPUT type="text" name="p_member_name" class="input" value="<%= params.get("p_member_name") %>" style="width:90%">
  341. </td>
  342. <td class="button" >
  343. <span class="btnSearch center" id="btn_add"><a href="javascript:void(0);">추가</a></span>
  344. <span class="btnSearch center" id="btn_save"><a href="javascript:void(0);">저장</a></span>
  345. </td>
  346. </tr>
  347. </table>
  348. <TABLE border="0" cellspacing="0" cellpadding="0" width="100%">
  349. <tr>
  350. <td width="*">
  351. <div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 300px; overflow: auto;">
  352. <script>createIBSheet('sheet1','99%', '300px');</script>
  353. </div>
  354. </td>
  355. <td width="400px">
  356. <div id="sheet2_div" style="padding-top:5px; height: auto; min-height: 300px; overflow: auto;">
  357. <script>createIBSheet('sheet2','100%', '300px');</script>
  358. </div>
  359. </td>
  360. </tr>
  361. </TABLE>
  362. </form>