SPMNA02000.js 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. /***********************************************************************************************************************************************
  2. * create date : 2008.02.12
  3. * author : dhkim
  4. * file name : SPMNA02000.js
  5. * desc : 공여자팝업
  6. ***********************************************************************************************************************************************/
  7. var xDnorPath = '/root/main/dnorpopinfo';
  8. var xCondPath = '/root/cond';
  9. var xReqPath = '/root/send/reqdata';
  10. var currentDate = getCurrentDate();
  11. /*
  12. * 초기화
  13. */
  14. function finit() {
  15. zbcfGetCodeList(new Array("M0376","L0095"), new Array("/root/init/M0376list","/root/init/L0095list")); //혈액형,직업코드
  16. //플래그 초기화!
  17. opener.model.makeNode("/root/main/popupendflag");
  18. opener.model.setValue("/root/main/popupendflag", "cancel");
  19. fChangeSearchCondition( model.getValue("/root/send/srchcond") );
  20. model.refresh();
  21. //값이 부모창에서 입력되었을 경우 조회한다.
  22. if(fInputValueCheckXformsReady() ){
  23. if( submit("TRMNA02000") ){
  24. if( grd_dnorinfo.rows == 2 ){
  25. if( model.getValue("/root/send/autoflag").toUpperCase() == "Y" ){ //조회 내역이 1건일 경우 자동 화면 닫기
  26. model.setFocus("grd_dnorinfo");
  27. btn_confirm.dispatch("DOMActivate");
  28. window.close();
  29. }
  30. }
  31. if( grd_dnorinfo.rows > 1 ){
  32. model.setFocus("grd_dnorinfo");
  33. }else{
  34. if( model.getValue("/root/send/autoflag").toUpperCase() == "NON" ){ //조회 내역이 없을 경우 자동 화면 닫기
  35. //model.setFocus("grd_dnorinfo");
  36. btn_cancel.dispatch("DOMActivate");
  37. //window.close();
  38. }
  39. fChangeSearchCondition( cmb_cond.value );
  40. }
  41. }
  42. }
  43. }
  44. //창 생성시 부모창으로 부터 받은 입력값의 유효범위 체크
  45. function fInputValueCheckXformsReady(){
  46. var cond = model.getValue("/root/send/srchcond");
  47. switch(cond){
  48. case '1':
  49. //공여자등록번호 체크
  50. if(ipt_dnorno.currentText.length >= 1 ){
  51. model.setValue("/root/send/dnorno", ipt_dnorno.currentText);
  52. return (true);
  53. }else{
  54. //messageBox("공여자등록번호를 정확히", "C001");
  55. return (false);
  56. }
  57. break;
  58. case '2':
  59. //공여자이름 체크
  60. //if( ipt_dnornm.currentText.length >= 2 ) return (true);
  61. if(ipt_dnornm.currentText.length >= 2 ){
  62. model.setValue("/root/send/dnornm", ipt_dnornm.currentText);
  63. return (true);
  64. }else{
  65. //messageBox("공여자이름을 2자리 이상", "C001");
  66. return (false);
  67. }
  68. break;
  69. case '3':
  70. //공여자 주민번호 체크
  71. if( ipt_rrgstno1.currentText.length >= 1 || ipt_rrgstno2.currentText.length >= 1){
  72. model.setValue("/root/send/rrgstno1", ipt_rrgstno1.currentText);
  73. model.setValue("/root/send/rrgstno2", ipt_rrgstno2.currentText);
  74. return (true);
  75. }else{
  76. //messageBox("공여자 주민번호를", "C001");
  77. return (false);
  78. }
  79. break;
  80. case '4':
  81. //공여자이름 유효성 체크.
  82. if(ipt_dnornm.currentText.length >= 2 ){
  83. model.setValue("/root/send/dnornm", ipt_dnornm.currentText);
  84. }else{
  85. //messageBox("공여자이름을 2자리 이상", "C001");
  86. return (false);
  87. }
  88. //공여자 주민번호 체크
  89. if( ipt_rrgstno1.currentText.length >= 1 || ipt_rrgstno2.currentText.length >= 1){
  90. model.setValue("/root/send/rrgstno1", ipt_rrgstno1.currentText);
  91. model.setValue("/root/send/rrgstno2", ipt_rrgstno2.currentText);
  92. }else{
  93. //messageBox("공여자 주민번호를", "C001");
  94. return (false);
  95. }
  96. return( true );
  97. break;
  98. default :
  99. model.setFocus("cmb_cond");
  100. return( false );
  101. break;
  102. }
  103. }
  104. //입력값의 유효범위 체크
  105. function fInputValueCheck(){
  106. var cond = model.getValue("/root/send/srchcond");
  107. switch(cond){
  108. case '1':
  109. //공여자등록번호 체크
  110. if(ipt_dnorno.currentText.length >= 1 ){
  111. model.setValue("/root/send/dnorno", ipt_dnorno.currentText);
  112. return (true);
  113. }else{
  114. messageBox("공여자등록번호를 정확히", "C001");
  115. return (false);
  116. }
  117. break;
  118. case '2':
  119. //공여자이름 체크
  120. //if( ipt_dnornm.currentText.length >= 2 ) return (true);
  121. if(ipt_dnornm.currentText.length >= 2 ){
  122. model.setValue("/root/send/dnornm", ipt_dnornm.currentText);
  123. return (true);
  124. }else{
  125. messageBox("공여자이름을 2자리 이상", "C001");
  126. return (false);
  127. }
  128. break;
  129. case '3':
  130. //공여자 주민번호 체크
  131. if( ipt_rrgstno1.currentText.length >= 1 || ipt_rrgstno2.currentText.length >= 1 ){
  132. model.setValue("/root/send/rrgstno1", ipt_rrgstno1.currentText);
  133. model.setValue("/root/send/rrgstno2", ipt_rrgstno2.currentText);
  134. return (true);
  135. }else{
  136. messageBox("공여자 주민번호를", "C001");
  137. return (false);
  138. }
  139. break;
  140. case '4':
  141. //공여자이름 유효성 체크.
  142. if(ipt_dnornm.currentText.length>= 2 ){
  143. model.setValue("/root/send/dnornm", ipt_dnornm.currentText);
  144. }else{
  145. messageBox("공여자이름을 2자리 이상", "C001");
  146. return (false);
  147. }
  148. //공여자 주민번호 체크
  149. if( ipt_rrgstno1.currentText.length >= 1 || ipt_rrgstno2.currentText.length >= 1){
  150. model.setValue("/root/send/rrgstno1", ipt_rrgstno1.currentText);
  151. model.setValue("/root/send/rrgstno2", ipt_rrgstno2.currentText);
  152. }else{
  153. messageBox("공여자 주민번호를", "C001");
  154. return (false);
  155. }
  156. return( true );
  157. break;
  158. default :
  159. messageBox("검색조건이 정확히 선택되지 않았습니다. 확인 후 다시 시도해 주십시요.", "E999", "");
  160. model.setFocus("cmb_cond");
  161. return( false );
  162. break;
  163. }
  164. }
  165. //조회 조건에 맞는 input 컨트롤을 세팅해 준다.
  166. function fChangeSearchCondition( cond){
  167. switch(cond){
  168. case '1':
  169. model.makeNode("/root/send/dnorno");
  170. ipt_dnorno.attribute("visibility") = "visible";
  171. ipt_dnorno.attribute("left") = "219px";
  172. ipt_dnorno.attribute("top") = "8px";
  173. ipt_dnornm.attribute("visibility") = "hidden";
  174. ipt_rrgstno1.attribute("visibility") = "hidden";
  175. ipt_rrgstno2.attribute("visibility") = "hidden";
  176. model.setFocus("ipt_dnorno");
  177. break;
  178. case '2':
  179. model.makeNode("/root/send/dnornm");
  180. ipt_dnornm.attribute("visibility") = "visible";
  181. ipt_dnornm.attribute("left") = "219px";
  182. ipt_dnornm.attribute("top") = "8px";
  183. ipt_dnorno.attribute("visibility") = "hidden";
  184. ipt_rrgstno1.attribute("visibility") = "hidden";
  185. ipt_rrgstno2.attribute("visibility") = "hidden";
  186. model.setFocus("ipt_dnornm");
  187. break;
  188. case '3':
  189. model.makeNode("/root/send/rrgstno1");
  190. model.makeNode("/root/send/rrgstno2");
  191. ipt_rrgstno1.attribute("visibility") = "visible";
  192. ipt_rrgstno2.attribute("visibility") = "visible";
  193. ipt_rrgstno1.attribute("left") = "219px";
  194. ipt_rrgstno1.attribute("top") = "8px";
  195. ipt_rrgstno2.attribute("left") = "307px";
  196. ipt_rrgstno2.attribute("top") = "8px";
  197. ipt_dnornm.attribute("visibility") = "hidden";
  198. ipt_dnorno.attribute("visibility") = "hidden";
  199. model.setFocus("ipt_rrgstno1");
  200. break;
  201. case '4':
  202. //model.makeNode("/root/send/dnorno");
  203. model.makeNode("/root/send/dnornm");
  204. model.makeNode("/root/send/rrgstno1");
  205. model.makeNode("/root/send/rrgstno2");
  206. ipt_dnornm.attribute("visibility") = "visible";
  207. ipt_dnornm.attribute("left") = "219px";
  208. ipt_dnornm.attribute("top") = "8px";
  209. ipt_dnorno.attribute("visibility") = "hidden";
  210. ipt_rrgstno1.attribute("visibility") = "visible";
  211. ipt_rrgstno1.attribute("left") = "352px";
  212. ipt_rrgstno1.attribute("top") = "8px";
  213. ipt_rrgstno2.attribute("visibility") = "visible";
  214. ipt_rrgstno2.attribute("left") = "440px";
  215. ipt_rrgstno2.attribute("top") = "8px";
  216. model.setFocus("ipt_dnornm");
  217. break;
  218. default :
  219. //messageBox("검색조건이 정확히 선택되지 않았습니다. 확인 후 다시 시도해 주십시요.", "E999", "");
  220. break;
  221. }
  222. }
  223. /*
  224. */
  225. function fSearch() {
  226. if( fInputValueCheck() ){
  227. if( submit("TRMNA02000") ){
  228. if( grd_dnorinfo.rows > 1 ){
  229. model.setFocus("grd_dnorinfo");
  230. }else{
  231. fChangeSearchCondition( cmb_cond.value );
  232. }
  233. }
  234. }
  235. }
  236. function fdblclick() {
  237. if ( checkOpener() ) {
  238. row = grd_dnorinfo.row;
  239. if( row > 0 ){
  240. if( getNodesetCount("/root/main/dnorpopinfo/dnorpoplist") > 0 ){
  241. opener.model.copyNode("/root/main/dnorpopinfo/dnorpoplist", grd_dnorinfo.getNode( row ));
  242. opener.model.makeNode("/root/main/popupendflag");
  243. opener.model.setValue("/root/main/popupendflag", "ok");
  244. opener.model.refresh();
  245. window.close();
  246. }
  247. }
  248. } else {
  249. messageBox("상위화면이 변경되어 데이터를 가져올 수", "I004");
  250. }
  251. }
  252. function fOK() {
  253. if ( checkOpener() ) {
  254. row = grd_dnorinfo.row;
  255. opener.model.makeNode("/root/main/popupendflag");
  256. opener.model.setValue("/root/main/popupendflag", "cancel");
  257. if( row > 0 ){
  258. if( getNodesetCount("/root/main/dnorpopinfo/dnorpoplist") > 0 ){
  259. opener.model.copyNode("/root/main/dnorpopinfo/dnorpoplist", grd_dnorinfo.getNode( row ));
  260. opener.model.makeNode("/root/main/popupendflag");
  261. opener.model.setValue("/root/main/popupendflag", "ok");
  262. }
  263. //else{
  264. // opener.model.setValue("/root/main/popupendflag", "cancel");
  265. //}
  266. //opener.model.refresh();
  267. //window.close();
  268. }else {
  269. //opener.model.setValue("/root/main/popupendflag", "cancel");
  270. messageBox("행이 정확히 선택되지", "E007");
  271. //opener.model.refresh();
  272. //window.close();
  273. }
  274. } else {
  275. messageBox("상위화면이 변경되어 데이터를 가져올 수", "I004");
  276. //opener.model.setValue("/root/main/popupendflag", "cancel");
  277. //opener.model.refresh();
  278. //window.close();
  279. }
  280. opener.model.refresh();
  281. window.close();
  282. }