SMAYA00700.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. /**
  2. * SMAYA00700_신심단체사목회 회원등록관리.xrw 에서 사용할 js
  3. * 2007-11-29 최초작성 dhkim
  4. *
  5. */
  6. var currentDate = getCurrentDate();
  7. var currentYear = currentDate.substring(0, 4);
  8. var xTreePath = '/root/main/trvecmtlist/trvecmtinfo'; //트리 인스턴스 xPath
  9. var xGridPath = '/root/main/cmntlist/cmntlistinfo'; //그리드 인스턴스 xPath
  10. var xInputPath = '/root/main/iptecmt'; //input 컴포넌트 xPath
  11. var xCondPath = '/root/main/cond'; //조회조건 인스턴스 xPath
  12. /*
  13. * 화면 오픈시 초기화 하는 펑션
  14. * 신심단체트리리스트를 조회한다.
  15. * 조건영역의 활동년도를 default 현재년도로 세팅.
  16. */
  17. function fInit() {
  18. //대상자 그리드 리스트 초기화
  19. model.removeNodeset(xGridPath);
  20. //신심단체/사목회 트리구조를 조회
  21. submit("TRAYA00701");
  22. //활동년도 저장 체크박스 설정 ...
  23. grd_cmntlist.fixedcellcheckbox(0, 1) = true;
  24. //조회조건영역 활동년도, 재등록 활동년도 초기화 default 현재년도..
  25. model.setValue(xCondPath + "/actyy", currentYear);
  26. model.setValue(xCondPath + '/rgstactyy', currentYear);
  27. model.refresh();
  28. }
  29. /**
  30. * 트리선택시 호출할 펑션
  31. * 트리선택시 조회조건영역의 사목회명과 대상자등록영역의 단체명에 선택한 사목회를 세팅
  32. * 조건영역에는 어떤 리스트도 선택될수 있지만 대상자등록영역에는 최하위레벨의 사목회만 세팅되도록 할것
  33. * 입력영역에 트리에 선택한 값을 세팅하기 전에는 반드시 입력영역을 리프레쉬한 후에 세팅하도록 한다.
  34. */
  35. function fSelectedTree() {
  36. var clscd = model.getValue(xTreePath + '[' + (trv_cmntclslist.focusIndex+1) + ']/clscd');
  37. var clsnm = model.getValue(xTreePath + '[' + (trv_cmntclslist.focusIndex+1) + ']/clsnm');
  38. var scrncd = model.getValue(xTreePath + '[' + (trv_cmntclslist.focusIndex+1) + ']/scrncd');
  39. var clsflag = model.getValue(xTreePath + '[' + (trv_cmntclslist.focusIndex+1) + ']/clsflag');
  40. //최하위레벨일때 조건영역, 인풋영역에 clscd, clsnm세팅
  41. if( (scrncd.charAt(0)) == clsflag ){
  42. //조건영역 값 세팅
  43. model.setValue(xCondPath + "/clscd", clscd);
  44. model.setValue(xCondPath + "/clsnm", clsnm);
  45. model.setValue(xCondPath + "/scrncd", scrncd);
  46. //입력영역 초기화
  47. model.resetInstanceNode(xInputPath);
  48. //입력영역 값 세팅
  49. model.setValue(xInputPath + "/clscd", clscd);
  50. model.setValue(xInputPath + "/clsnm", clsnm);
  51. model.setValue(xInputPath + "/status", 'i'); //신규등록구분
  52. model.setValue(xInputPath + "/actyy", currentYear); //활동년도에 default 현재년도 세팅
  53. model.setValue(xInputPath + "/rgstdd", currentDate); //등록일자에 default 현재일자 세팅
  54. }
  55. //최하위레벨아닐때 조건영역만 clscd, clsnm세팅
  56. else{
  57. model.setValue(xCondPath + "/clscd", clscd);
  58. model.setValue(xCondPath + "/clsnm", clsnm);
  59. model.setValue(xCondPath + "/scrncd", scrncd);
  60. }
  61. ipt_actyy.disabled = false;
  62. model.refresh();
  63. }
  64. //조회버튼 클릭시
  65. function fSearch() {
  66. //대상자 그리드 리스트, 입력영역 초기화
  67. model.removeNodeset(xGridPath);
  68. model.resetInstanceNode("/root/main/cond/rgstactyy");
  69. grd_cmntlist.fixedcellischeck(0,1) = false;
  70. var condYear = model.getValue(xCondPath + '/actyy');
  71. //사목회명 미선택시 초기화
  72. if(model.getValue(xCondPath + "/clscd") == '' || model.getValue(xCondPath + "/clscd") == 'D0000'){
  73. model.setValue(xCondPath + "/clscd", model.getValue(xTreePath + '[' + 1 + ']/clscd'));
  74. model.setValue(xCondPath + '/clsnm', model.getValue(xTreePath + '[' + 1 + ']/clsnm'));
  75. }
  76. //조회년도 미입력시 초기화
  77. if(condYear == null || condYear == '' || condYear.length != 4){
  78. model.setValue(xCondPath + '/actyy', currentYear);
  79. }
  80. //체크박스 상태 설정
  81. //grd_cmntlist.fixedcellischeck(0,1) = false;
  82. model.makeNode("/root/send/reqdata");
  83. model.copyNode("/root/send/reqdata", xCondPath + "");
  84. submit("TRAYA00702");
  85. }
  86. //리스트에서 선택시 대상자 등록부분에 셋팅
  87. function fGetCmntTrgtManInfo() {
  88. var idxRow = grd_cmntlist.row; //그리드에서 해당 회원 선택
  89. if (idxRow < 1)
  90. return;
  91. //회원정보 수정할 수 있도록 셋팅
  92. model.removenodeset(xInputPath);
  93. model.makeNode(xInputPath);
  94. model.copyNode(xInputPath, xGridPath + "[" + idxRow + "]");
  95. ipt_actyy.disabled =true;
  96. model.setValue(xInputPath + '/status', 'u');
  97. model.refresh();
  98. }
  99. //사용자 팝업
  100. function fSearchUser() {
  101. model.resetInstanceNode("/root/main/userpopupinfo");
  102. model.removeNodeset("/root/main/tempuserinfo");
  103. model.makeNode("/root/main/tempuserinfo");
  104. model.setValue("/root/main/userpopupinfo/param", "_OneS");
  105. modal("../../userdeptinfoweb/xrw/SPZSU10103_사용자부서선택조회", "", "200", "200", "SPZSU10103","/root/main/userpopupinfo","/root/main/temp");
  106. var iParam = getParameter("SPZSU10103_");
  107. setCSVToNode("/root/main/tempuserinfo", iParam);
  108. clearParameter("SPZSU10103_");
  109. var userid = model.getValue("/root/main/tempuserinfo/list/userid");
  110. var usernm = model.getValue("/root/main/tempuserinfo/list/usernm");
  111. var deptnm = model.getValue("/root/main/tempuserinfo/list/dutplcenm");
  112. if(userid == '')//temp에 값이 리턴이 안되었으면 팝업데이터를 원래상태 그대로 냅둔다.
  113. return;
  114. //팝업에서 선택된 리턴값을 인풋영역에 세팅하면서 userid에 해당하는
  115. //데이터중 팝업에서 가져오지 못한 데이터(세례명, 영명축일, 부서전화, 핸드폰번호)를 조회해 오기전
  116. //원래 있던 데이터를 초기화시킨다.
  117. model.setValue(xInputPath + '/emplno', userid);
  118. model.setValue(xInputPath + '/emplnm', usernm);
  119. model.setValue(xInputPath + '/baptnm', '');
  120. model.setValue(xInputPath + '/festivday', '');
  121. model.setValue(xInputPath + '/hpphontel', '');
  122. model.setValue(xInputPath + '/depttel', '');
  123. model.setValue(xInputPath + '/deptnm', deptnm);
  124. model.removenodeset('/root/temp');
  125. var xTempPath = '/root/temp/popdetailinfo';
  126. if(submit('TRAYA00703')){
  127. model.setValue(xInputPath + '/baptnm', model.getValue(xTempPath + '/baptnm'));
  128. model.setValue(xInputPath + '/festivday', model.getValue(xTempPath + '/fairnmdd'));
  129. model.setValue(xInputPath + '/hpphontel', model.getValue(xTempPath + '/mpphontel'));
  130. model.setValue(xInputPath + '/depttel', model.getValue(xTempPath + '/depttel'));
  131. model.refresh();
  132. }
  133. }
  134. //중복사번 체크
  135. //update저장버튼 클릭, 재등록 버튼 클릭시 둘다 중복사번체크 해야함..
  136. function isExsistEmp(emplNo, clscd, actyy){
  137. //입력한 사번 + deldd='00000000'인 사원이 이미 등록되어 있는지 조회한후 경고메세지.
  138. if(emplNo == null || emplNo == ''){
  139. emplNo = model.getValue(xInputPath + '/emplno');
  140. }
  141. if(clscd == null || clscd == ''){
  142. clscd = model.getValue(xInputPath + '/clscd');
  143. }
  144. if(actyy == null || actyy == ''){
  145. actyy = model.getValue(xInputPath + '/actyy');
  146. }
  147. model.removenodeset('/root/send/reqdata');
  148. model.makeNode('/root/send/reqdata/emplno');
  149. model.makeNode('/root/send/reqdata/clscd');
  150. model.makeNode('/root/send/reqdata/actyy');
  151. model.setValue('/root/send/reqdata/emplno', emplNo);
  152. model.setValue('/root/send/reqdata/clscd', clscd);
  153. model.setValue('/root/send/reqdata/actyy', actyy);
  154. if(submit('TRAYA00704')){
  155. return model.getValue('/root/temp/usercnt/cnt');
  156. }
  157. }
  158. //신심단체/사목회 대상자 등록 필수 저장여부 체크
  159. function fIsValid() {
  160. var actYear = model.getValue(xInputPath + '/actyy');
  161. var emplNo = model.getValue(xInputPath + '/emplno');
  162. var emplnm = model.getValue(xInputPath + '/emplnm');
  163. var clscd = model.getValue(xInputPath + '/clscd');
  164. var status = model.getValue(xInputPath + '/status');
  165. var rgstdd = model.getValue(xInputPath + '/rgstdd');
  166. if (clscd == "") {
  167. messageBox("단체명을","C002");
  168. return false;
  169. }
  170. if (actYear == "") {
  171. messageBox("활동년도를","C001");
  172. model.setFocus("ipt_actyy");
  173. return false;
  174. }/*
  175. if(actYear.lenth != 4 || isNaN(actYear)){
  176. messageBox("활동년도를 년도형식(예: 2007)에 맞게","C001");
  177. model.setFocus("ipt_actyy");
  178. return false;
  179. }
  180. if (rgstdd != '' && !isValidDateTime(rgstdd, 'YYYYMMDD')) {
  181. messageBox("등록일자를 날짜형식(예: 20071225)에 맞게","C001");
  182. model.setFocus("input6");
  183. return false;
  184. }*/
  185. if(emplNo == ''){
  186. messageBox("회원을","C002");
  187. return false;
  188. }
  189. if(status == 'i' && isExsistEmp() > 0){
  190. messageBox(emplnm + '님은 ' + actYear + '년에 이미 등록되어 있는 사원이므로 중복등록', 'E001');
  191. return false;
  192. }
  193. return true;
  194. }
  195. /**========================================================================================================================================
  196. * 심신단체사목회 회원등록관리 리스트 출력 - 추가 (2008.02.01 김다영)
  197. =========================================================================================================================================*/
  198. function fListPrnt(){
  199. exeReportPreview("RPAYA00701", "XMLSTR");
  200. }
  201. //대상자 등록 부분의 저장 버튼 클릭시
  202. function fSaveCmntRgst() {
  203. if(fIsValid()){
  204. model.copyNode('/root/send', xInputPath);
  205. if(submit('TXAYA00701')){
  206. fSearch();//재조회
  207. fSelectedTree();//저장후 인풋영역을 신규작성상태로 만들어준다.(구현할것)
  208. }
  209. }
  210. }
  211. //재등록, 삭제버튼 클릭시...
  212. //재등록할 때는 활동년도가 입력되어있지 않으면 경고메세지 출력
  213. function fInsDelCmntList(insDelGbn) {
  214. var actyy = model.getValue('/root/main/cond/rgstactyy');
  215. var clscd, emplno, emplnm;
  216. var isChecked = false;
  217. var savedata = 'clscd' //분류코드
  218. + '▦emplno' //사번
  219. + '▦actyy' //활동년도
  220. + '▦status' //상태값
  221. + '▦seqno' //일련번호
  222. + '▦jobposnm' //단체직책명
  223. + '▦rgstdd' //등록일자
  224. + '▦rem' //비고
  225. + "▩" ;
  226. for(var i = 1; i <= grd_cmntlist.rows; i++){
  227. clscd = model.getValue(xGridPath +'[' + i + ']/clscd');
  228. emplno = model.getValue(xGridPath +'[' + i + ']/emplno');
  229. emplnm = model.getValue(xGridPath +'[' + i + ']/emplnm');
  230. if(model.getValue(xGridPath +'[' + i + ']/chk') == 'true'){
  231. isChecked = true;
  232. //파리채 만들기...
  233. savedata += clscd;
  234. savedata += '▦' + emplno;
  235. if(insDelGbn == 'd')
  236. savedata += '▦' + model.getValue(xGridPath +'[' + i + ']/actyy');
  237. else if(insDelGbn == 'i')
  238. savedata += '▦' + actyy;
  239. savedata += '▦' + insDelGbn;
  240. savedata += '▦' + model.getValue(xGridPath +'[' + i + ']/seqno');
  241. savedata += '▦' + model.getValue(xGridPath +'[' + i + ']/jobposnm');
  242. savedata += '▦' + model.getValue(xGridPath +'[' + i + ']/rgstdd');
  243. savedata += '▦' + model.getValue(xGridPath +'[' + i + ']/rem');
  244. savedata += '▩';
  245. //insert하기전 사번 중복 체크
  246. if(insDelGbn == 'i' && isExsistEmp(emplno, clscd, actyy) > 0){
  247. messageBox(emplnm + '님은 ' + actyy + '년에 이미 등록되어 있는 사원이므로 중복등록', 'E001');
  248. //break;
  249. return ;
  250. }
  251. }
  252. }
  253. if(insDelGbn == 'i' && actyy == ''){
  254. messageBox("재등록할 활동년도를","C001");
  255. model.setFocus("ipt_rgstactyy");
  256. return false;
  257. }
  258. if(!isChecked){
  259. var msg = (insDelGbn == 'i')? '재등록할' : (insDelGbn == 'd')? '삭제할' : '';
  260. messageBox(msg + ' 회원을', 'C002');
  261. return false;
  262. }
  263. var btn ;
  264. if(insDelGbn == 'd')
  265. btn = messageBox("선택한 회원을 ", "Q001");
  266. else if(insDelGbn == 'i')
  267. btn = messageBox("선택한 회원을 ", "Q002");
  268. if (btn == '6') {
  269. model.removenodeset("/root/send/removedata");
  270. model.makeNode("/root/send/removedata");
  271. model.setValue("/root/send/removedata", savedata);
  272. if(submit("TXAYA00702")){
  273. fSearch();//재조회
  274. fSelectedTree();//저장후 인풋영역을 신규작성상태로 만들어준다.(구현할것)
  275. }
  276. } else if (btn == '7') {
  277. return;
  278. }
  279. }