PayMentList.jsp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <%--
  2. - Author(s) : Woo Seokjin
  3. - Date : 2015.01.09
  4. - Description: PayMentTerm 조회
  5. --%>
  6. <%@ page contentType="text/html; charset=utf-8" %>
  7. <%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
  8. <%@ page import="com.udapsoft.waf.common.ui.*" %>
  9. <%@ page import="kr.co.hsnc.common.util.*"%>
  10. <%@ page import="kr.co.hsnc.common.sql.*" %>
  11. <%@ page import="kr.co.udapsoft.common.code.*" %>
  12. <%@ page import="com.udapsoft.waf.common.util.DateUtil"%>
  13. <%@ include file="/jsp/work/taglib.jsp" %>
  14. <jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
  15. <%
  16. ctx.init(request, response);
  17. HandlerStorage storage = ctx.getHandlerStorage();
  18. ValueObject params = storage.getParams();
  19. ValueObject user = storage.getUser();
  20. String statusSheetComboListText = (String)storage.getObject("selectText");
  21. String statusSheetComboListValue = (String)storage.getObject("selectValue");
  22. RowSet payGroup = storage.getRowSet("PAYGROUPLIST");
  23. String payGroup_cd="";
  24. String payGroup_name="";
  25. for(int i=0;i<payGroup.size();i++){
  26. if(i+1<payGroup.size()){
  27. payGroup_cd = payGroup_cd+(payGroup.getRow(i).get("CODE"))+"|";
  28. payGroup_name = payGroup_name+(payGroup.getRow(i).get("NAME"))+"|";
  29. }else{
  30. payGroup_cd = payGroup_cd+(payGroup.getRow(i).get("CODE"));
  31. payGroup_name = payGroup_name+(payGroup.getRow(i).get("NAME"));
  32. }
  33. }
  34. RowSet payTermsAll = storage.getRowSet("PAYTERMSALL");
  35. String payTermsAll_cd="";
  36. String payTermsAll_name="";
  37. for(int i=0;i<payTermsAll.size();i++){
  38. if(i+1<payTermsAll.size()){
  39. payTermsAll_cd = payTermsAll_cd+(payTermsAll.getRow(i).get("CODE"))+"|";
  40. payTermsAll_name = payTermsAll_name+(payTermsAll.getRow(i).get("NAME"))+"|";
  41. }else{
  42. payTermsAll_cd = payTermsAll_cd+(payTermsAll.getRow(i).get("CODE"));
  43. payTermsAll_name = payTermsAll_name+(payTermsAll.getRow(i).get("NAME"));
  44. }
  45. }
  46. ValueObject defaultDate = DateUtil.getDefaultPeriod();
  47. String defaultDt = defaultDate.get("START_DATE");
  48. defaultDt=defaultDt.substring(0,7);
  49. %>
  50. <script language="JavaScript">
  51. /*예약함수*/
  52. var sheet1;
  53. var sheet1Row;
  54. var sheet1PageNo = 1;
  55. var pageLastRowIndex = 1;
  56. var validationResult = false;
  57. var filterShow = false;
  58. var right_name = "<%=user.get("RIGHT_NAME")%>";
  59. function _onReady(){
  60. /**
  61. * IBSheet object initialize
  62. */
  63. gridInit(sheet1);
  64. /**
  65. * Application Initialize
  66. */
  67. $("#btnSearch").click(function() {
  68. if($("#allSearch").is(":checked")){
  69. $("#allSearchFlag").val("true");
  70. }else{
  71. $("#allSearchFlag").val("");
  72. }
  73. $("#fevent").val("SHEET_SELECT");
  74. var url = Modular.model.PageContext.CONTEXT_ROOT + "/cont/purchase/PayMentList_sheet.screen";
  75. Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 30, "");
  76. });
  77. $("#p_dept_nm").keydown(function (event){var keycode = (event.keyCode ? event.keyCode : event.which); if(keycode == 8){$("#p_dept_cd").val("");$("#p_dept_nm").val("");}});
  78. $("#p_cont_status").change(function(){$("#btnSearch").click();});
  79. $("#p_build_nm").keydown(function (event){var keycode = (event.keyCode ? event.keyCode : event.which);if(keycode == 13)$("#btnSearch").click();});
  80. $("#p_dealer_nm").keydown(function (event){var keycode = (event.keyCode ? event.keyCode : event.which);if(keycode == 13)$("#btnSearch").click();});
  81. $("#btnSearch").click();
  82. $("#dataClear").click(function(){$("#payDt").val("");});
  83. $("#btnSave").click(function() {
  84. if(!sheet1.IsDataModified()) {
  85. alert("수정된 내역이 없습니다.");
  86. return;
  87. } else {
  88. if (confirm("수정 하시겠습니까?") == true){
  89. for(i=0;i<sheet1.RowCount();i++){
  90. if(sheet1.GetCellValue(i,"STATUS")=="U"&&((sheet1.GetCellValue(i,"PAYMENT_TERMS")=="")||(sheet1.GetCellValue(i,"PAY_GROUP")==""))){
  91. alert("빈 정보가 있습니다.");
  92. sheet1.SetSelectRow(i);
  93. return;
  94. }
  95. }
  96. $("#fevent").val("UPDATE_DATA");
  97. var url = Modular.model.PageContext.CONTEXT_ROOT + "/cont/purchase/PayMentList_sheet.screen";
  98. var result = Modular.view.IBSheet7.doSave(sheet1, url, jQuery("#form1"), false);
  99. alert("수정 되었습니다.");
  100. }else{ //취소
  101. alert("취소 되었습니다.");
  102. return;
  103. }
  104. }
  105. });
  106. autoResize();
  107. }
  108. /**
  109. * IBSheet object initialize
  110. */
  111. function gridInit(sheetName){
  112. var init_sheet = {};
  113. init_sheet.Cfg = {SearchMode:2, MergeSheet:msHeaderOnly, Page:100};
  114. init_sheet.Cols = [
  115. {Header:'Del', Type:"DelCheck", SaveName:"DEL_CHECK", Width:50, Align:"Center", Hidden:"True"},
  116. {Header:'Status', Type:"Status", SaveName:"STATUS", Width:0, Align:"Center", Edit:"false", Hidden:"True"},
  117. {Header:'부서|부서', Type:"Text", SaveName:"DEPT_CD", Width:0, Align:"Center", Edit:"false", Hidden:"True"},
  118. {Header:'현장명|현장명', Type:"Text", SaveName:"DEPT_NAME", Width:150, Align:"Left", Edit:"false"},
  119. {Header:'계약번호|계약번호', Type:"Text", SaveName:"ORD_DOC_NO", Width:150, Align:"Left", Edit:"false"},
  120. {Header:'계약명|계약명', Type:"Text", SaveName:"CST_DOC_NAME", Width:200, Align:"Left", Edit:"false"},
  121. {Header:'업체명|업체명', Type:"Text", SaveName:"MEMBER_NAME", Width:150, Align:"Left", Edit:"false"},
  122. {Header:'통화|통화', Type:"Text", SaveName:"CURRENCY_GB", Width:50, Align:"Center", Edit:"false"},
  123. {Header:'계약금액|계약금액', Type:"Text", SaveName:"ORD_SUPPLY_AMT", Width:130, Align:"Right", Edit:"false"},
  124. {Header:'청구금액|청구금액', Type:"Text", SaveName:"CUR_REQ_AMT", Width:130, Align:"Right", Edit:"false"},
  125. {Header:'증빙일자|증빙일자', Type:"Text", SaveName:"TAX_DY", Width:100, Align:"Center", Edit:"false", Format:"####-##-##"},
  126. {Header:'세금계산서\n발행방법|세금계산서\n발행방법', Type:"Combo", SaveName:"TAX_METHOD_CD", Width:100, Align:"Center", Edit:"false", ComboText:"역발행|순발행|Invoice", ComboCode:"1|2|3"},
  127. {Header:'대금\n상태|대금\n상태', Type:"Combo", SaveName:"REQ_STATUS", Width:80, Align:"Center", Edit:"false", ComboText:"<%=statusSheetComboListText%>", ComboCode:"<%=statusSheetComboListValue%>"},
  128. {Header:'계약|PAY GROUP', Type:"Combo", SaveName:"CONT_PAY_GROUP", Width:100, Align:"Center", Edit:"false", ComboText:"<%=payGroup_name%>", ComboCode:"<%=payGroup_cd%>"},
  129. {Header:'계약|PAYMENT TERMS', Type:"Combo", SaveName:"CONT_PAYMENT_TERMS", Width:150, Align:"Center", Edit:"false", ComboText:"<%=payTermsAll_name%>", ComboCode:"<%=payTermsAll_cd%>"},
  130. {Header:'계약|PAYMENT TERMS NAME', Type:"Text", SaveName:"CONT_PAYMENT_TERMS_NAME", Width:100, Align:"Center", Edit:"false", Hidden:"True"},
  131. {Header:'대금|PAY GROUP', Type:"Combo", SaveName:"PAY_GROUP", Width:100, Align:"Center", Edit:"false", ComboText:"<%=payGroup_name%>", ComboCode:"<%=payGroup_cd%>"},
  132. {Header:'대금|PAYMENT TERMS', Type:"Combo", SaveName:"PAYMENT_TERMS", Width:120, Align:"Center", Edit:"false", ComboText:"<%=payTermsAll_name%>", ComboCode:"<%=payTermsAll_cd%>"},
  133. {Header:'대금|PAYMENT TERMS NAME', Type:"Text", SaveName:"PAYMENT_TERMS_NAME", Width:150, Align:"Center", Edit:"false", Hidden:"True"},
  134. {Header:'PUR_CONT_MOD_ID|PUR_CONT_MOD_ID', Type:"Text", SaveName:"PUR_CONT_MOD_ID", Width:150, Align:"Center", Edit:"false", Hidden:"True"}
  135. ];
  136. init_sheet.HeaderMode = {Sort:1};
  137. IBS_InitSheet(sheetName, init_sheet);
  138. sheetName.SetDataAutoTrim(0);
  139. sheetName.SetImageList(1,"/img/buyer/btn/btn_write.gif");
  140. sheetName.SetActionMenu("ExcelDown");
  141. setGridSize();
  142. }
  143. function sheet1_OnSearchEnd(code, message) {
  144. if(code == 0) {
  145. setGridSize();
  146. } else {
  147. //조회 에러 수행
  148. alert(message);
  149. }
  150. }
  151. function sheet1_OnSelectMenu(Text, Code) {
  152. // text 또는 code값으로 Action수행
  153. switch(Text) {
  154. case "ExcelDown":
  155. excelDown();
  156. break;
  157. }
  158. }
  159. /**
  160. * IBSheet Event Change
  161. */
  162. function sheet1_OnClick(Row, Col, Value, CellX, CellY, CellW, CellH){
  163. if(Col=="16"||Col=="17"){
  164. comboInit(Row, Col, Value);
  165. }
  166. }
  167. function sheet1_OnChange(Row, Col, Value, OldValue, RaiseFlag){
  168. if(Col=="16"||Col=="17"){
  169. comboInit(Row, Col, Value);
  170. }
  171. }
  172. /**
  173. * IBSheet size setting
  174. */
  175. function setGridSize() {sheet1.FitColWidth();}
  176. function sheet1_OnSmartResize(Width, Height) {
  177. sheet1.FitColWidth();
  178. autoResize();
  179. }
  180. function autoResize(){
  181. var t1_height = document.getElementById("search-table").scrollHeight + document.getElementById("title").scrollHeight + 24;
  182. var iframeHeight= document.body.scrollHeight - t1_height;
  183. var iframeWidth= document.body.scrollWidth;
  184. sheet1.SetSheetHeight(iframeHeight);
  185. }
  186. function comboInit(Row, Col, Value){
  187. <%
  188. String[] strArr={"01", "02", "11", "21", "22", "23", "30", "41", "42", "43", "55", "61", "71", "72", "73", "74", "91"};
  189. for(int i=0;i<strArr.length;i++){
  190. %>
  191. <%-- if(Value==<%=strArr[i]%>){
  192. var info = {"ComboCode":"<%=params.get("PAYTERMSLIST_"+strArr[i]+"_cd")%>","ComboText":"<%=params.get("PAYTERMSLIST_"+strArr[i]+"_name")%>"};
  193. sheet1.CellComboItem(Row,"PAYMENT_TERMS",info);
  194. }--%>
  195. if(sheet1.GetCellValue(Row,"PAY_GROUP")==<%=strArr[i]%>){
  196. var info = {"ComboCode":"<%=params.get("PAYTERMSLIST_"+strArr[i]+"_cd")%>","ComboText":"<%=params.get("PAYTERMSLIST_"+strArr[i]+"_name")%>"};
  197. sheet1.CellComboItem(Row,"PAYMENT_TERMS",info);
  198. }else if(sheet1.GetCellValue(Row,"PAY_GROUP")==""){
  199. var info = {"ComboCode":"","ComboText":" "};
  200. sheet1.CellComboItem(Row,"PAYMENT_TERMS",info);
  201. }
  202. <%
  203. }
  204. %>
  205. }
  206. function checkAuthority(){
  207. if((right_name=="ADMIN NEW"||right_name=="TREASURY")){
  208. $("#btnSave").show();
  209. }
  210. }
  211. function excelDown() {
  212. if(sheet1.RowCount() == 0) {
  213. alert("내역이 없습니다.");
  214. return;
  215. }
  216. var params = { FileName : "PayMentList.xls", SheetName : "PayMentList", SheetDesign:0, Merge:1, DownCols:"DEPT_NAME|ORD_DOC_NO|CST_DOC_NAME|MEMBER_NAME|CURRENCY_GB|ORD_SUPPLY_AMT|CUR_REQ_AMT|TAX_DY"+
  217. "|TAX_METHOD_CD|REQ_STATUS|CONT_PAY_GROUP|CONT_PAYMENT_TERMS|PAY_GROUP|PAYMENT_TERMS", TitleText:"구매_계약별 대금 Payment Terms", UserMerge:"0,0,1,14", AutoSizeColumn:1 } ;
  218. sheet1.Down2Excel(params);
  219. }
  220. document.body.onresize = addEvent( document.body.onresize, "autoResize()");
  221. </script>
  222. <modular:search id="form1">
  223. <modular:key id="fevent" />
  224. </modular:search>
  225. <form id="form1" name="form1" method="post" modular:type="search">
  226. <INPUT type="hidden" name="fevent" id="fevent" value="">
  227. <INPUT type="hidden" name="PUR_CONT_MOD_ID" value="">
  228. <INPUT type='hidden' name="allSearchFlag" value="">
  229. <div align="left" id="title">
  230. <ul>
  231. <li>계약별 대금 Payment Terms</li>
  232. </ul>
  233. </div>
  234. <!-- 검색조건 시작 -->
  235. <table id="search-table" class="search-form-table">
  236. <colgroup>
  237. <col width="100" />
  238. <col width="480" />
  239. <col width="100" />
  240. <col width="*" />
  241. <col width="100" />
  242. </colgroup>
  243. <tr height="25">
  244. <th>현장</th>
  245. <td>
  246. <%=InputText.getSiteCodeNew("p_dept_cd", "p_dept_nm", "", user, params.get("p_dept_cd"), params.get("p_dept_nm"))%>
  247. </td>
  248. <th>계약명</th>
  249. <td>
  250. <INPUT type="text" name="p_build_nm" class="input" value="<%= params.get("p_build_nm") %>" style="width:90%">
  251. </td>
  252. <td class="button" rowspan="2">
  253. <span class="btnSearch center" id="btnSearch"><a href="javascript:void(0);">검색</a></span>
  254. <span class="btnSearch center" id="btnSave" style="display: none"><a href="javascript:void(0);">저장</a></span>
  255. </td>
  256. </tr>
  257. <tr>
  258. <th>증빙년월</th>
  259. <td>
  260. <%= InputText.get("payDt", defaultDt, 10, 50, "hangule,center, desc=증빙일자,ReadOnly") %>
  261. <IMG name="start_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgMCalendar('payDt');">
  262. <IMG name="dataClear" id="dataClear" src="/img/buyer/button/bt_eraser1.gif" border="0" align="absmiddle" style="cursor:pointer;">
  263. </td>
  264. <th>모두 조회</th>
  265. <td>
  266. <input type="checkbox" id="allSearch">
  267. </td>
  268. </tr>
  269. </table>
  270. </form>
  271. <div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 400px; overflow: auto;">
  272. <script>createIBSheet('sheet1','100%', '400px');</script>
  273. </div>