SMRIS00301.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. var isUpdated = false;
  2. /**
  3. * @desc : 화면초기화
  4. *
  5. * @param :
  6. * @return :
  7. * @author : 경북대학교
  8. * @---------------------------------------------------
  9. */
  10. var studentparam = "";
  11. function fInit(){
  12. zbcfGetCodeList(new Array("I0010" // 종결/진행/삭제
  13. ,"I0012"), // 업무구분( 수익, 비용, 첨부)
  14. new Array("/root/init/status"
  15. ,"/root/init/bizflaglist"));
  16. if (isPopup()) {
  17. var menuparam = opener.window.javascript.getParameter("SMRIS00301_menuparam");
  18. var rshid = opener.window.javascript.getParameter("SMRIS00301_rshid");
  19. var rshnm = opener.window.javascript.getParameter("SMRIS00301_rshnm");
  20. var studycd = opener.window.javascript.getParameter("SMRIS00301_studycd");
  21. model.setValue("/root/send/searchproj/rshid", rshid);
  22. model.setValue("/root/send/searchproj/rshnm", rshnm);
  23. model.setValue("/root/send/searchproj/studycd", studycd);
  24. model.setValue("/root/send/searchproj/estatus", "Y" );
  25. if (menuparam == "P") {
  26. grp_buttons.attribute("visibility")="hidden";
  27. btn_useid.attribute("visibility")="hidden";
  28. button6.attribute("visibility")="hidden";
  29. btn_comps.attribute("visibility")="hidden";
  30. btn_docu.attribute("visibility")="hidden";
  31. studentparam = "P";
  32. button8.dispatch("DOMActivate");
  33. }
  34. if (studycd != "") {
  35. fSearch();
  36. grd_proj.row = 1;
  37. fGetamtmaster();
  38. }
  39. }
  40. cbx_e.value = "Y";
  41. model.refresh();
  42. }
  43. function fSearch(){
  44. model.removenode("/root/main/studyprojinfo/studyprojlist");
  45. model.removenode("/root/main/ioamtinfo/ioamtlist");
  46. model.removenode("/root/main/ioamtdinfo/ioamtdlist");
  47. model.removenode("/root/main/attdoculst/attdoculst");
  48. submit("TRRIS00301");
  49. model.refresh();
  50. }
  51. //금액마스터
  52. function fGetamtmaster() {
  53. var idx = grd_proj.row;
  54. model.copyNode("/root/main/ioamtmain","/root/main/studyprojinfo/studyprojlist[" + idx + "]");
  55. model.makeValue("/root/send/reqdata/instcd" , model.getValue("/root/main/studyprojinfo/studyprojlist[" + idx + "]/instcd"));
  56. model.makeValue("/root/send/reqdata/projcd" , model.getValue("/root/main/studyprojinfo/studyprojlist[" + idx + "]/projcd"));
  57. model.makeValue("/root/send/reqdata/studentparam" , studentparam);
  58. var totiamt = 0;
  59. var totoamt = 0;
  60. if( submit("TRRIS00302") ){
  61. // 입금액, 지출액 계산 2013.05.23 cyw
  62. for( var i = 1; i <= grd_ioamtlist.rows-grd_ioamtlist.fixedRows; i++ ){
  63. if( model.getValue("/root/main/ioamtinfo/ioamtlist[" + i + "]/bizflag") == "I" ){
  64. totiamt = totiamt + parseInt(model.getValue("/root/main/ioamtinfo/ioamtlist[" + i + "]/totamt"));
  65. }
  66. if( model.getValue("/root/main/ioamtinfo/ioamtlist[" + i + "]/bizflag") == "O" ){
  67. totoamt = totoamt + parseInt(model.getValue("/root/main/ioamtinfo/ioamtlist[" + i + "]/totamt"));
  68. }
  69. }
  70. model.makeValue("/root/main/ioamtmain/bstotiamt" , totiamt );
  71. model.makeValue("/root/main/ioamtmain/bstotoamt" , totoamt );
  72. model.makeValue("/root/main/ioamtmain/bstotjamt" , totiamt-totoamt );
  73. }
  74. if (studentparam == "P") {
  75. button6.dispatch("DOMActivate");
  76. }
  77. model.refresh();
  78. var master = "event";
  79. fGetamtdetail(master); //입출금 상세내역 & 첨부파일 상세내역
  80. MdlLst(); // 첨부파일 중분류값 조회
  81. }
  82. function MdlLst(){
  83. model.makeValue("/root/main/ioamtmain/seqno","");
  84. model.makeValue("/root/main/ioamtmain/bsdd",getCurrentDate());
  85. model.removeNodeSet("/root/send/reqdata");
  86. model.makeValue("/root/send/reqdata/kind" , model.getValue("/root/main/ioamtmain/kind"));
  87. model.makeValue("/root/send/reqdata/bsdd" , model.getValue("/root/main/ioamtmain/bsdd"));
  88. submit("TRRIS00309");
  89. model.refresh();
  90. }
  91. function fDelMaster(bizflag){
  92. if( bizflag != "A"){
  93. var projcd = model.getValue("/root/main/ioamtmain/projcd");
  94. var bizflag = model.getValue("/root/main/ioamtmain/bizflag");
  95. var seqno = model.getValue("/root/main/ioamtmain/seqno");
  96. }
  97. else{
  98. var projcd = model.getValue("/root/main/attdoculst/attdoculst/projcd");
  99. var bizflag = model.getValue("/root/main/attdoculst/attdoculst/bizflag");
  100. var seqno = model.getValue("/root/main/attdoculst/attdoculst/seqno");
  101. }
  102. model.makeValue("/root/send/reqdata/projcd" , projcd);
  103. model.makeValue("/root/send/reqdata/bizflag" , bizflag);
  104. model.makeValue("/root/send/reqdata/seqno" ,seqno);
  105. if (projcd=="") {
  106. return;
  107. }
  108. if (bizflag=="") {
  109. return;
  110. }
  111. if (seqno=="") {
  112. messageBox("삭제대상이 아닙니다","I");
  113. return;
  114. }
  115. var vbYes = messageBox("삭제 하시겠습니까?", "Q999");
  116. if(vbYes != 6){
  117. return;
  118. }
  119. submit("TXRIS00302");
  120. var cnt = model.getValue("/root/hidden/ioamt/cnt");
  121. if (cnt > 0) {
  122. messageBox("정상적으로 삭제되었습니다!","I999");
  123. model.removeNodeset(grd_attdoculst.nodeset);
  124. }
  125. fGetamtmaster();
  126. model.refresh();
  127. }
  128. //금액 detail
  129. function fGetamtdetail(bizflag) {
  130. var idx = grd_ioamtlist.row;
  131. var projcd = model.getValue("/root/main/ioamtinfo/ioamtlist[" + idx + "]/projcd");
  132. var bizflag = model.getValue("/root/main/ioamtinfo/ioamtlist[" + idx + "]/bizflag");
  133. var seqno = model.getValue("/root/main/ioamtinfo/ioamtlist[" + idx + "]/seqno");
  134. var kind = model.getValue("/root/main/ioamtinfo/ioamtlist[" + idx + "]/kind");
  135. var bsdd = model.getValue("/root/main/ioamtinfo/ioamtlist[" + idx + "]/bsdd");
  136. var instcd = model.getValue("/root/main/ioamtinfo/ioamtlist[" + idx + "]/instcd");
  137. var status = model.getValue("/root/main/ioamtinfo/ioamtlist[" + idx + "]/status");
  138. var studycd = model.getValue("/root/main/ioamtinfo/ioamtlist[" + idx + "]/studycd");
  139. if (bsdd=="") {
  140. bsdd = getCurrentDate();
  141. }
  142. model.makeValue("/root/main/ioamtmain/bsdd",getCurrentDate());
  143. model.makeValue("/root/main/ioamtmain/bizflag",bizflag);
  144. model.makeValue("/root/main/ioamtmain/seqno",seqno);
  145. model.makeValue("/root/main/ioamtmain/status",status);
  146. model.makeValue("/root/send/reqdata/instcd" , instcd);
  147. model.makeValue("/root/send/reqdata/projcd" , projcd);
  148. model.makeValue("/root/send/reqdata/bizflag" , bizflag);
  149. model.makeValue("/root/send/reqdata/seqno" , seqno);
  150. model.makeValue("/root/send/reqdata/kind" , kind);
  151. model.makeValue("/root/send/reqdata/status" , status);
  152. //model.makeValue("/root/send/reqdata/bsdd" , bsdd);
  153. if (bizflag == "A") {
  154. submit("TRRIS00310");
  155. }
  156. else {
  157. submit("TRRIS00303");
  158. }
  159. model.refresh();
  160. }
  161. function fNewDetail(bizflag){
  162. model.makeValue("/root/main/ioamtmain/bizflag",bizflag);
  163. model.makeValue("/root/main/ioamtmain/seqno","");
  164. if (bizflag == "I" || bizflag == "O") {
  165. model.toggle("case1");
  166. btn_comps.selected = true;
  167. model.removeNodeSet("/root/send/reqdata");
  168. model.makeValue("/root/send/reqdata/kind" , model.getValue("/root/main/ioamtmain/kind"));
  169. model.makeValue("/root/send/reqdata/bsdd" , model.getValue("/root/main/ioamtmain/bsdd"));
  170. model.makeValue("/root/send/reqdata/bizflag" ,bizflag);
  171. model.makeValue("/root/send/reqdata/projcd" ,"");
  172. model.makeValue("/root/send/reqdata/seqno" ,"");
  173. submit("TRRIS00303"); //reqGetAMTdList
  174. }
  175. else if (bizflag=="A") {
  176. model.toggle("case3");
  177. btn_docu.selected = true;
  178. model.removeNodeset(grd_attdoculst.nodeset);
  179. var xreqdesc = "/root/main/attdoculst/attdoculst";
  180. var maxsize = upload1.attribute("filesize");
  181. //파일을 받아오기 위해 파일열기 팝업창을 띄운다.
  182. var fileopen = window.fileDialog("open","|","false");
  183. var pos = fileopen.lastIndexOf("\\");
  184. var filename = fileopen.substring(pos + 1);
  185. model.makeValue(xreqdesc + "/attfilenm", filename);
  186. model.makeValue(xreqdesc + "/bsdd", model.getValue("/root/main/ioamtmain/bsdd"));
  187. model.makeValue(xreqdesc + "/projcd",model.getValue("/root/main/ioamtmain/projcd"));
  188. model.makeValue(xreqdesc + "/kind", model.getValue("/root/main/ioamtmain/kind"));
  189. model.makeValue(xreqdesc + "/bigo","");
  190. model.makeValue(xreqdesc + "/bizflag",bizflag);
  191. model.makeValue(xreqdesc + "/amtcd","-");
  192. model.makeValue(xreqdesc + "/amt",0);
  193. //선택한 파일이 저장버튼을 눌렀을때 저장이 되게 하기 위해 파일 저장 인스턴스에 파일주소를 저장해 둔다.
  194. model.makeValue("/root/send/savedata/file", fileopen);
  195. //파일 크기가 너무 큰경우 메세지를 띄운다.
  196. if (!checkFileSize(upload1)){
  197. messageBox("파일 크기가 최대치(" + maxsize + "Byte)를", "E003");
  198. model.removeNodeset(grd_attdoculst.nodeset);
  199. return;
  200. }
  201. model.refresh();
  202. }
  203. model.refresh();
  204. }
  205. function fSetUserinfo(){
  206. setParameter("search_condition","usernm");
  207. setParameter("resultref","/root/send/userinfo");
  208. modal("SPZSU10100");
  209. var userinfo = model.getValue("/root/send/userinfo");
  210. userinfo = userinfo.split("|");
  211. var rshid = userinfo[2];
  212. var rshnm = userinfo[3];
  213. model.setValue("/root/send/searchproj/rshid",rshid);
  214. model.setValue("/root/send/searchproj/rshnm",rshnm);
  215. model.resetInstanceNode("/root/send/userinfo");
  216. model.refresh();
  217. }
  218. function fSave(flag) {
  219. var projcd = model.getValue("/root/main/ioamtmain/projcd");
  220. var bsdd = model.getValue("/root/main/ioamtmain/bsdd");
  221. var seqno = model.getValue("/root/main/ioamtmain/seqno");
  222. var bizflag = model.getValue("/root/main/ioamtmain/bizflag");
  223. var status = model.getValue("/root/main/ioamtmain/status");
  224. var kind = model.getValue("/root/main/ioamtmain/kind");
  225. model.makeValue("/root/send/savedata/ioamtlist/bsdd",bsdd);
  226. model.makeValue("/root/send/savedata/ioamtlist/projcd",projcd);
  227. model.makeValue("/root/send/savedata/ioamtlist/bizflag",bizflag);
  228. model.makeValue("/root/send/savedata/ioamtlist/seqno",seqno);
  229. model.makeValue("/root/send/savedata/ioamtlist/status",status);
  230. model.makeValue("/root/send/savedata/ioamtlist/kind",kind);
  231. if (flag=="IO") {
  232. // 입출금 상세내역
  233. if (grd_ioamtdlist.rows == 1 ) {
  234. return;
  235. }
  236. for (i=1; i<grd_ioamtdlist.rows ; i++) {
  237. grd_ioamtdlist.addStatus(i, "insert");
  238. }
  239. model.makeValue("/root/send/savedata/ioamtdlist", grd_ioamtdlist.getUpdateData());
  240. }
  241. else if (flag=="A") {
  242. // 문서등록내역
  243. if (grd_attdoculst.rows == 1 ) {
  244. return;
  245. }
  246. for (i=1; i<grd_attdoculst.rows ; i++) {
  247. grd_attdoculst.addStatus(i, "insert");
  248. }
  249. var seqno = model.getValue("/root/main/attdoculst/attdoculst/seqno");
  250. if (seqno !="" ) {
  251. messageBox("자료수정은 불가합니다","I");
  252. return;
  253. }
  254. model.makeValue("/root/send/savedata/attdoculst", grd_attdoculst.getUpdateData());
  255. }
  256. submit("TXRIS00301");
  257. fGetamtmaster();
  258. model.removeNodeSet("/root/send/savedata");
  259. }
  260. function fDownLoad(flag) {
  261. if(model.getValue("/root/main/attdoculst/attdoculst/seqno") == "") {
  262. return;
  263. }
  264. if(model.getValue("/root/main/attdoculst/attdoculst/attfilenm") == "") {
  265. messageBox("다운로드 할 파일을 ", "C002");
  266. return;
  267. }
  268. //파일명를 받아옴
  269. var getfilenm = model.getValue("/root/main/attdoculst/attdoculst/attfilenm");
  270. var getfilepath = model.getValue("/root/main/attdoculst/attdoculst/attfilepath");
  271. model.makeValue("/root/send/reqdata/attfilenm", getfilenm );
  272. model.makeValue("/root/send/reqdata/attfilepath", getfilepath );
  273. //파일명이 있는 경우 다운로드
  274. if(getfilenm != ""){
  275. //파일명을 받아옴
  276. var filenm = getfilenm;
  277. //파일명의 확장자만 받아옴
  278. var fileext = filenm.lastIndexOf(".");
  279. var ext = filenm.substring(fileext +1);
  280. //파일을 다운로드 하기 위해 저장할 창을 띄움
  281. var filesave = window.fileDialog("save","|",false,filenm,ext,"All Files(*.*)|*.*");
  282. //키값을 가지고 DB에 저장된 데이타를 조회하러 간다
  283. if (filesave != "") {
  284. model.download(getActionURL("TRRIS00206") + "&attfilepath=" + getfilepath + "&filepathcolnm=attfilepath", filesave);
  285. }
  286. }
  287. }