SMMRC03500.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. /**
  2. * @desc : Source Node의 갯수를 구한다.
  3. * @
  4. * @param : path - node path
  5. * @return :
  6. * @authur : 김선태 2007. 5. 8
  7. * @---------------------------------------------------
  8. */
  9. function getNodeSetCnt(path)
  10. {
  11. var insXml = model.instances(0);
  12. var nodeList = insXml.selectNodes(path);
  13. return nodeList.length;
  14. }
  15. /**
  16. * @desc : Source Node의 child nodelist를 Destination의 nodelist로 append한다.
  17. *
  18. * @param : strDest - 도착node path
  19. * : strSrc - 출발node path
  20. * @return : void
  21. * @authur : 이상현 2007. 3. 27
  22. * @---------------------------------------------------
  23. */
  24. function addCopyNodeset(strDest, strSrc, mode, destModel, srcModel) {
  25. if( destModel == null || destModel =="" )
  26. destModel = document.models.item(0);
  27. if( srcModel == null || srcModel =="" )
  28. srcModel = document.models.item(0);
  29. var srcNodeList = srcModel.instances(0).selectNodes(strSrc);
  30. var srcNode;
  31. var pDestNode = destModel.instances.item(0).selectSingleNode(strDest).parentNode;
  32. if( mode == "replace" || mode == null ) {
  33. destModel.removeNodeset(strDest);
  34. while( srcNode = srcNodeList.nextNode() ) {
  35. pDestNode.appendChild(srcNode.cloneNode(true));
  36. }
  37. }
  38. else if( mode == "after" ) {
  39. while( srcNode = srcNodeList.nextNode() ) {
  40. pDestNode.appendChild(srcNode.cloneNode(true));
  41. }
  42. }
  43. else if( mode == "before" ) {
  44. var destNode;
  45. for( var i = srcNodeList.length - 1; i >= 0; i-- ) {
  46. destNode = destModel.instances.item(0).selectSingleNode(strDest + "[1]");
  47. pDestNode.insertBefore(srcNodeList.item(i).cloneNode(true), destNode);
  48. }
  49. }
  50. }
  51. /**
  52. * @desc : 사용자의 권한을 체크하여 버튼셋팅.
  53. * btn_r 조회버튼, btn_x 저장 및 수정 버튼, btn_p : 출력버튼
  54. * @return : void
  55. * @authur : 김선태 2007. 5. 8
  56. */
  57. function fchkAuth()
  58. {
  59. for(var i=0; i<= document.controls.length-1 ; i++){
  60. if(document.controls.item(i).elementName == "xforms:button"){
  61. if(document.controls.item(i).attribute("id").substr(0,6) == "btn_r_"){
  62. document.controls.item(i).disabled = !checkAuth("R");
  63. }
  64. if(document.controls.item(i).attribute("id").substr(0,6) == "btn_x_"){
  65. document.controls.item(i).disabled = !checkAuth("X");
  66. }
  67. if(document.controls.item(i).attribute("id").substr(0,6) == "btn_p_"){
  68. document.controls.item(i).disabled = !checkAuth("P");
  69. }
  70. if(document.controls.item(i).attribute("id").substr(0,6) == "btn_e_"){
  71. document.controls.item(i).disabled = !checkAuth("P");
  72. }
  73. }
  74. }
  75. }
  76. /**
  77. * @desc : 폼초기화
  78. * @
  79. * @param :
  80. * @return :
  81. * @authur : 이은영 2008.03.18
  82. * @---------------------------------------------------
  83. */
  84. function fFormInit()
  85. {
  86. // 대출목록을 먼저 보여준다.
  87. btn_rendlsit.dispatch("onclick");
  88. // 버튼권한체크
  89. fchkAuth();
  90. model.removeNodeset("/root/main/rendlist");
  91. model.removeNodeset("/root/main/unrtnlist");
  92. model.removeNodeset("/root/main/rtnlist");
  93. model.removeNodeset("/root/main/chrtstatlist");
  94. //공통코드 가져오기...
  95. //M0424:차트상태코드
  96. zbcfGetCodeList(new Array("M0424"), new Array("/root/init/M0424"));
  97. // 대출용도, 대출과, 차트과, 차트담당자, 보관장소
  98. model.makeValue("/root/send/reqdata/ioflag" , "I");
  99. model.makeValue("/root/send/reqdata/useyn" , "");
  100. model.makeValue("/root/send/reqdata/allwardyn", "");
  101. model.refresh();
  102. submit("TRMRC00100");
  103. var today = getCurrentDate();
  104. var valitodd = (today.toDate()).getAddDate(-14); // 디폴트는 몇일 이전 기준으로 보여주나??
  105. valitodd = valitodd.getDateFormat();
  106. model.setValue("/root/condition/rendlist/fromrenddd" , today);
  107. model.setValue("/root/condition/rendlist/torenddd" , today);
  108. model.setValue("/root/condition/rendlist/fromdschdd" , today);
  109. model.setValue("/root/condition/rendlist/todschdd" , today);
  110. model.setValue("/root/condition/rendlist/rendcd" , "ALL");
  111. model.setValue("/root/condition/rendlist/appdeptcd" , "ALL");
  112. model.setValue("/root/condition/rtnlist/fromrtndd" , today);
  113. model.setValue("/root/condition/rtnlist/tortndd" , today);
  114. model.setValue("/root/condition/rtnlist/fromrenddd" , today);
  115. model.setValue("/root/condition/rtnlist/torenddd" , today);
  116. model.setValue("/root/condition/rtnlist/rendcd" , "ALL");
  117. model.setValue("/root/condition/rtnlist/appdeptcd" , "ALL");
  118. model.setValue("/root/condition/unrtnlist/fromrtnschedd" , today);
  119. model.setValue("/root/condition/unrtnlist/tortnschedd" , today);
  120. model.setValue("/root/condition/unrtnlist/fromrenddd" , today);
  121. model.setValue("/root/condition/unrtnlist/torenddd" , today);
  122. model.setValue("/root/condition/unrtnlist/rendcd" , "ALL");
  123. model.setValue("/root/condition/unrtnlist/appdeptcd" , "ALL");
  124. model.refresh();
  125. }
  126. /**
  127. * @desc : 등록된 환자번호인지 체킹한다..
  128. * @
  129. * @param : iptObj - 환자번호 입력 컨트롤 (pid)
  130. * @return :
  131. * @authur : 이은영 2008.09.17
  132. * @---------------------------------------------------
  133. */
  134. function fGetPidNo(iptObj, ref)
  135. {
  136. var chkyn = model.getValue(ref);
  137. if (chkyn == "Y") {
  138. if (iptObj.currentText.length > 0) {
  139. var pid = iptObj.currentText;
  140. pid = getCretCheckNo(pid, getUserInfo("dutplceinstcd"));
  141. model.makeValue(iptObj.attribute("ref"), pid);
  142. iptObj.refresh();
  143. }
  144. }
  145. }
  146. /**
  147. * @desc : 환자등록번호 조회 팝업
  148. * @
  149. * @param : refPid - 환자번호 node path
  150. * @ refPnm - 환자명 node path
  151. * @return :
  152. * @authur : 이은영 2008.03.18
  153. * @---------------------------------------------------
  154. */
  155. function fGetPid(refPid, refPnm)
  156. {
  157. //조회건수가 1건일 경우 팝업창을 바로 닫는다.
  158. model.makeValue("/root/hidden/tmp/pidpopupinfo/checkfnexam", "1");
  159. model.makeValue("/root/hidden/tmp/pidpopupinfo/autoflag", "N");
  160. if( model.getValue("/root/hidden/tmp/pidpopupinfo/srchcond") == '' ){
  161. model.makeValue("/root/hidden/tmp/pidpopupinfo/srchcond", '2');
  162. }
  163. modal("SPPMC02500", "1","150", "150", "SPPMC02500", "/root/hidden/tmp/pidpopupinfo", "/root/send");
  164. model.resetInstanceNode("/root/source");
  165. //환자번호 copy
  166. var popupendflag = model.getValue("/root/main/popupendflag");
  167. if (popupendflag == "ok")
  168. {
  169. model.makeValue(refPid, model.getValue("/root/main/patinfo/patinfolist/pid"));
  170. if (refPnm == null) { refPnm = "" }
  171. if (refPnm != "") {
  172. model.makeValue(refPnm, model.getValue("/root/main/patinfo/patinfolist/hngnm"));
  173. }
  174. model.refresh();
  175. }
  176. }
  177. /**
  178. * @desc : 사용자 조회
  179. * @
  180. * @param : refUserid - 대출자 ID, refUserDeptcd - 소속부서코드 ( posdeptcd )
  181. * @return :
  182. * @authur : 이은영 2008.03.18
  183. * @---------------------------------------------------
  184. */
  185. function fGetUserid(refUserid, refUsernm)
  186. {
  187. model.removenode("/root/hidden/tmp/tempuserinfo/list");
  188. model.reset("/root/hidden/tmp/tempuserinfo");
  189. var user = model.getValue(refUserid);
  190. var flag = "userid";
  191. if(isNaN(user)){
  192. flag = "usernm";
  193. }
  194. model.setValue("/root/hidden/tmp/userpopupinfo/param", "_OneS");
  195. model.setValue("/root/hidden/tmp/userpopupinfo/flag", flag);
  196. model.setValue("/root/hidden/tmp/userpopupinfo/searchitem", user);
  197. modal("SPZSU10103", "", "200", "200", "SPZSU10103","/root/hidden/tmp/userpopupinfo","/root/main/temp");
  198. var iParam = getParameter("SPZSU10103_");
  199. setCSVToNode("/root/hidden/tmp/tempuserinfo", iParam);
  200. clearParameter("SPZSU10103_");
  201. model.refresh();
  202. //fSearch는 인적사항 화면을 임포트 해간 화면에서 구현해 주어야 하는 함수이다.
  203. if( getNodesetCount("/root/hidden/tmp/tempuserinfo/list") > 0 ){
  204. var userid = model.getValue("/root/hidden/tmp/tempuserinfo/list/userid");
  205. var usernm = model.getValue("/root/hidden/tmp/tempuserinfo/list/usernm");
  206. model.makeValue(refUserid, userid);
  207. if (refUsernm == null) { refUsernm = ""; }
  208. if (refUsernm != "") {
  209. model.makeValue(refUsernm, usernm);
  210. }
  211. model.refresh();
  212. }
  213. }
  214. /**
  215. * @desc : 대출목록 조회
  216. * @
  217. * @param :
  218. * @return :
  219. * @authur : 이은영 2008.03.18
  220. * @---------------------------------------------------
  221. */
  222. function fGetLendList()
  223. {
  224. model.copyNode("/root/send/reqdata", "/root/condition/rendlist");
  225. submit("TRMRC03501");
  226. // 2008.01.02. 대출목록 조회 총건수..
  227. model.setValue ("/root/hidden/rendcnt", grd_rendlist.rows - 1);
  228. cap_lendlist.refresh();
  229. }
  230. /**
  231. * @desc : 미반납목록 조회
  232. * @
  233. * @param :
  234. * @return :
  235. * @authur : 이은영 2008.03.18
  236. * @---------------------------------------------------
  237. */
  238. function fGetUnRtnList()
  239. {
  240. model.copyNode("/root/send/reqdata", "/root/condition/unrtnlist");
  241. submit("TRMRC03502");
  242. // 2008.01.02. 미반납목록 조회 총건수..
  243. model.setValue ("/root/hidden/unrtncnt", grd_unrtnlist.rows - 1);
  244. cap_unrtnlist.refresh();
  245. }
  246. /**
  247. * @desc : 반납목록 조회
  248. * @
  249. * @param :
  250. * @return :
  251. * @authur : 이은영 2008.03.18
  252. * @---------------------------------------------------
  253. */
  254. function fGetRtnList()
  255. {
  256. model.copyNode("/root/send/reqdata", "/root/condition/rtnlist");
  257. submit("TRMRC03503");
  258. // 2008.01.02. 미반납목록 조회 총건수..
  259. model.setValue ("/root/hidden/rtncnt", grd_rtnlist.rows - 1);
  260. cap_rtnlist.refresh();
  261. }
  262. /**
  263. * @desc : 분실차트 조회
  264. * @
  265. * @param :
  266. * @return :
  267. * @authur : 이은영 2008.06.11
  268. * @---------------------------------------------------
  269. */
  270. function fGetCherStatList()
  271. {
  272. model.copyNode("/root/send/reqdata", "/root/condition/chrtstatlist");
  273. submit("TRMRC03504");
  274. // 2008.01.02. 차트 리스트 조회 총건수..
  275. model.setValue ("/root/hidden/chrtstatcnt", grd_chrtstat.rows - 1);
  276. cap_chrtstat.refresh();
  277. }
  278. /**
  279. * @desc : 대출목록 - 대출일자 기간 콤보 보여줄까? 말까?
  280. * @
  281. * @param :
  282. * @return :
  283. * @authur : 이은영 2008.05.30
  284. * @---------------------------------------------------
  285. */
  286. function fLendTermDisabled()
  287. {
  288. var lendtermdisabled = lendterm_disabled.value;
  289. if (lendtermdisabled == "Y") {
  290. var today = getCurrentDate();
  291. model.setValue("/root/condition/rendlist/fromrenddd", today);
  292. model.setValue("/root/condition/rendlist/torenddd" , today);
  293. ipt_fromrenddd.disabled = false;
  294. ipt_torenddd.disabled = false;
  295. } else {
  296. model.setValue("/root/condition/rendlist/fromrenddd", "");
  297. model.setValue("/root/condition/rendlist/torenddd" , "");
  298. ipt_fromrenddd.disabled = true;
  299. ipt_torenddd.disabled = true;
  300. }
  301. ipt_fromrenddd.refresh();
  302. ipt_torenddd.refresh();
  303. }
  304. /**
  305. * @desc : 대출목록 - 퇴원일자 기간 콤보 보여줄까? 말까?
  306. * @
  307. * @param :
  308. * @return :
  309. * @authur : 이은영 2008.05.30
  310. * @---------------------------------------------------
  311. */
  312. function fDschTermDisabled()
  313. {
  314. var dschtermdisabled = dschterm_disabled.value;
  315. if (dschtermdisabled == "Y") {
  316. var today = getCurrentDate();
  317. model.setValue("/root/condition/rendlist/fromdschdd", today);
  318. model.setValue("/root/condition/rendlist/todschdd" , today);
  319. ipt_fromdschdd.disabled = false;
  320. ipt_todschdd.disabled = false;
  321. } else {
  322. model.setValue("/root/condition/rendlist/fromdschdd", "");
  323. model.setValue("/root/condition/rendlist/todschdd" , "");
  324. ipt_fromdschdd.disabled = true;
  325. ipt_todschdd.disabled = true;
  326. }
  327. ipt_fromdschdd.refresh();
  328. ipt_todschdd.refresh();
  329. }
  330. /**
  331. * @desc : 미반납목록 - 대출일자 기간 콤보 보여줄까? 말까?
  332. * @
  333. * @param :
  334. * @return :
  335. * @authur : 이은영 2008.05.30
  336. * @---------------------------------------------------
  337. */
  338. function fUnRtnLendTermDisabled()
  339. {
  340. var lendtermdisabled = unrtnlendterm_disabled.value;
  341. if (lendtermdisabled == "Y") {
  342. var today = getCurrentDate();
  343. model.setValue("/root/condition/unrtnlist/fromrenddd", today);
  344. model.setValue("/root/condition/unrtnlist/torenddd" , today);
  345. ipt_unrtnfromrenddd.disabled = false;
  346. ipt_unrtntorenddd.disabled = false;
  347. } else {
  348. model.setValue("/root/condition/unrtnlist/fromrenddd", "");
  349. model.setValue("/root/condition/unrtnlist/torenddd" , "");
  350. ipt_unrtnfromrenddd.disabled = true;
  351. ipt_unrtntorenddd.disabled = true;
  352. }
  353. ipt_unrtnfromrenddd.refresh();
  354. ipt_unrtntorenddd.refresh();
  355. }
  356. /**
  357. * @desc : 미반납목록 - 반납예정일자 기간 콤보 보여줄까? 말까?
  358. * @
  359. * @param :
  360. * @return :
  361. * @authur : 이은영 2008.05.30
  362. * @---------------------------------------------------
  363. */
  364. function fRtnScheTermDisabled()
  365. {
  366. var rtnschetermdisabled = rtnscheterm_disabled.value;
  367. if (rtnschetermdisabled == "Y") {
  368. var today = getCurrentDate();
  369. model.setValue("/root/condition/unrtnlist/fromrtnschedd", today);
  370. model.setValue("/root/condition/unrtnlist/tortnschedd" , today);
  371. ipt_fromrtnschedd.disabled = false;
  372. ipt_tortnschedd.disabled = false;
  373. } else {
  374. model.setValue("/root/condition/unrtnlist/fromrtnschedd", "");
  375. model.setValue("/root/condition/unrtnlist/tortnschedd" , "");
  376. ipt_fromrtnschedd.disabled = true;
  377. ipt_tortnschedd.disabled = true;
  378. }
  379. ipt_fromrtnschedd.refresh();
  380. ipt_tortnschedd.refresh();
  381. }
  382. /**
  383. * @desc : 반납목록 - 대출일자 기간 콤보 보여줄까? 말까?
  384. * @
  385. * @param :
  386. * @return :
  387. * @authur : 이은영 2008.05.30
  388. * @---------------------------------------------------
  389. */
  390. function fRtnLendTermDisabled()
  391. {
  392. var lendtermdisabled = rtnlendterm_disabled.value;
  393. if (lendtermdisabled == "Y") {
  394. var today = getCurrentDate();
  395. model.setValue("/root/condition/rtnlist/fromrenddd", today);
  396. model.setValue("/root/condition/rtnlist/torenddd" , today);
  397. ipt_rtnfromrenddd.disabled = false;
  398. ipt_rtntorenddd.disabled = false;
  399. } else {
  400. model.setValue("/root/condition/rtnlist/fromrenddd", "");
  401. model.setValue("/root/condition/rtnlist/torenddd" , "");
  402. ipt_rtnfromrenddd.disabled = true;
  403. ipt_rtntorenddd.disabled = true;
  404. }
  405. ipt_rtnfromrenddd.refresh();
  406. ipt_rtntorenddd.refresh();
  407. }
  408. /**
  409. * @desc : 반납목록 - 반납일자 기간 콤보 보여줄까? 말까?
  410. * @
  411. * @param :
  412. * @return :
  413. * @authur : 이은영 2008.05.30
  414. * @---------------------------------------------------
  415. */
  416. function fRtnRtnTermDisabled()
  417. {
  418. var rtntermdisabled = rtnrtnlendterm_disabled.value;
  419. if (rtntermdisabled == "Y") {
  420. var today = getCurrentDate();
  421. model.setValue("/root/condition/rtnlist/fromrtndd" , today);
  422. model.setValue("/root/condition/rtnlist/tortndd" , today);
  423. ipt_rtnfromrtndd.disabled = false;
  424. ipt_rtntortndd.disabled = false;
  425. } else {
  426. model.setValue("/root/condition/rtnlist/fromrtndd" , "");
  427. model.setValue("/root/condition/rtnlist/tortndd" , "");
  428. ipt_rtnfromrtndd.disabled = true;
  429. ipt_rtntortndd.disabled = true;
  430. }
  431. ipt_rtnfromrtndd.refresh();
  432. ipt_rtntortndd.refresh();
  433. }
  434. /**
  435. * @desc : excel 저장 하기
  436. * @
  437. * @param :
  438. * @return :
  439. * @authur : 이은영 2008.07.14
  440. * @---------------------------------------------------
  441. */
  442. function fExcel(gridObj, title){
  443. if (title == null) { title = "" }
  444. var fileName = window.fileDialog("save", ",", false, title + "_" + getCurrentDate(), "xls", "Excel Files(*.xls)|*.xls|All Files (*.*)|*.*");
  445. if (fileName != "") {
  446. gridObj.saveExcel(fileName, "SheetName", true, true, "", "", true);
  447. }
  448. }