MMR04800M.js.soonsu 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. var instance;
  2. var uInfo;
  3. var pid = "";
  4. function fInitalize()
  5. {
  6. model.setValue("/root/main/patinfo/patinfolist/pid" , model.getProperty("pid"));
  7. model.setValue("/root/main/patinfo/patinfolist/hngnm", model.getProperty("hngnm"));
  8. model.setValue("/root/main/cond/orddeptnm", model.getProperty("deptnm"));
  9. model.setValue("/root/main/cond/orddrnm", model.getProperty("medispclnm"));
  10. model.setValue("/root/main/cond/sexage", model.getProperty("sexage"));
  11. model.setValue("/root/main/cond/wardroomnm", model.getProperty("wardroomnm"));
  12. instance = model.instances.item(0);
  13. uInfo = getUserInfos();
  14. uInfo = uInfo.split("|");
  15. model.makeValue("/root/init/uid", uInfo[0]);
  16. model.makeValue("/root/init/udeptcd", uInfo[8]);
  17. model.setValue("/root/init/reqmedireclist/diffdt", 12);
  18. fAddDateReq("today");
  19. var srchcond = model.getValue("/root/envinit/srchcond/answcnt");
  20. var srchday = model.getValue("/root/envinit/srchday/answcnt");
  21. switch(srchcond)
  22. {
  23. case "001" :
  24. model.setValue("/root/init/schkind", "2");
  25. break;
  26. case "002" :
  27. model.setValue("/root/init/schkind", "3");
  28. break;
  29. case "003" :
  30. model.setValue("/root/init/schkind", "1");
  31. break;
  32. case "" :
  33. model.setValue("/root/init/schkind", "2");
  34. break;
  35. }
  36. radio1.refresh();
  37. switch(srchday)
  38. {
  39. case "001" :
  40. model.setValue("/root/init/reqmedireclist/diffdt", "1");
  41. break;
  42. case "002" :
  43. model.setValue("/root/init/reqmedireclist/diffdt", "3");
  44. break;
  45. case "003" :
  46. model.setValue("/root/init/reqmedireclist/diffdt", "6");
  47. break;
  48. case "004" :
  49. model.setValue("/root/init/reqmedireclist/diffdt", "12");
  50. break;
  51. case "005" :
  52. model.setValue("/root/init/reqmedireclist/diffdt", "-");
  53. break;
  54. }
  55. combo4.refresh();
  56. combo4.dispatch("xforms-value-changed");
  57. pid = model.getProperty("pid");
  58. if ( !isNull ( pid ) )
  59. {
  60. model.setValue("/root/main/patinfo/patinfolist/pid", pid);
  61. fPidKeyPress();
  62. fSelect_sub();
  63. }
  64. if (isPopup())
  65. {
  66. var list = getGlobalVariable("emr_gsv_cmmsrckcond");
  67. if(list != "" && list != null){
  68. model.removeNodeset("/root/send");
  69. setCSVToNode("/root",list,"send");
  70. }
  71. } else {
  72. }
  73. grd_smmlist.autoresize = true;
  74. model.refresh();
  75. }
  76. function fSrchClick()
  77. {
  78. if (isPopup()) {
  79. fSelect_Pop();
  80. } else {
  81. fSelect_sub();
  82. }
  83. }
  84. function fAddrow()
  85. {
  86. var nodelistSmm = instance.selectNodes("/root/main/smmlist");
  87. var nodelength = nodelistSmm.length;
  88. var smmcnts = model.getValue("/root/main/smmlist[1]/smmcnts");
  89. if(smmcnts != "" || nodelength == 0)
  90. {
  91. if (nodelength == 0)
  92. {
  93. grd_smmlist.addRow();
  94. }
  95. else
  96. {
  97. grd_smmlist.insertRow(1);
  98. }
  99. model.setValue("/root/main/smmlist[1]/smmdd", getCurrentDate());
  100. grd_smmlist.setRow(1);
  101. grd_smmlist.setCol(3);
  102. }
  103. }
  104. function fSelect_sub()
  105. {
  106. var srchpid = model.getValue("/root/main/patinfo/patinfolist/pid");
  107. if (srchpid != "")
  108. {
  109. model.removeNodeset("/root/main/smmlist");
  110. model.removeNodeset("/root/send");
  111. model.makeValue("/root/send/pid", srchpid);
  112. model.makeValue("/root/send/validyn", "Y");
  113. model.makeValue("/root/send/schkind", model.getValue("/root/init/schkind"));
  114. model.makeValue("/root/send/getyn", "Y");
  115. model.makeValue("/root/send/fromdd", model.getValue("/root/init/reqmedireclist/recfromdt"));
  116. model.makeValue("/root/send/todd", model.getValue("/root/init/reqmedireclist/rectodt"));
  117. model.makeValue("/root/send/allyn", model.getValue("/root/init/allyn"));
  118. var offset = parseInt(model.getValue("root/page/curpage"));
  119. if(offset == 1)
  120. {
  121. offset = offset - 1;
  122. }
  123. else
  124. {
  125. offset = (offset - 1) * 10;
  126. }
  127. model.makeValue("/root/send/reqdata/offset", String(offset));
  128. model.makeValue("/root/send/reqdata/pagesize", model.getValue("root/page/pagesize"));
  129. submit("TRMOB00009");
  130. var maxpage = parseInt(model.getValue("/root/main/smmlistcnt/maxcnt"));
  131. if(maxpage < 10)
  132. {
  133. model.setValue("/root/page/maxpage", "1");
  134. }
  135. else
  136. {
  137. maxpage = (maxpage / 10) - ((maxpage % 10) / 10) + 1;
  138. model.setValue("/root/page/maxpage", String(maxpage));
  139. }
  140. var reqnodeList = instance1.selectNodes("/root/send");
  141. model.refresh();
  142. }
  143. else
  144. {
  145. messageBox("ȯ�ڹ�ȣ�� ", "I004");
  146. return;
  147. }
  148. }
  149. function fSelect_Pop()
  150. {
  151. var srchpid = model.getValue("/root/main/patinfo/patinfolist/pid");
  152. if (srchpid != "")
  153. {
  154. model.removeNodeset("/root/main/smmlist");
  155. model.makeValue("/root/send/pid", srchpid);
  156. model.makeValue("/root/send/getyn", "Y");
  157. model.makeValue("/root/send/schkind", model.getValue("/root/init/schkind"));
  158. model.makeValue("/root/send/validyn", model.getValue("/root/init/validyn"));
  159. model.makeValue("/root/send/fromdd", model.getValue("/root/init/reqmedireclist/recfromdt"));
  160. model.makeValue("/root/send/todd", model.getValue("/root/init/reqmedireclist/rectodt"));
  161. model.makeValue("/root/send/allyn", model.getValue("/root/init/allyn"));
  162. var offset = parseInt(model.getValue("root/page/curpage"));
  163. if(offset == 1)
  164. {
  165. offset = offset - 1;
  166. }
  167. else
  168. {
  169. offset = (offset - 1) * 10;
  170. }
  171. model.makeValue("/root/send/reqdata/offset", String(offset));
  172. model.makeValue("/root/send/reqdata/pagesize", model.getValue("root/page/pagesize"));
  173. submit("TRMOB00009");
  174. var maxpage = parseInt(model.getValue("/root/main/smmlistcnt/maxcnt"));
  175. if(maxpage < 10)
  176. {
  177. model.setValue("/root/page/maxpage", "1");
  178. }
  179. else
  180. {
  181. maxpage = (maxpage / 10) - ((maxpage % 10) / 10) + 1;
  182. model.setValue("/root/page/maxpage", String(maxpage));
  183. }
  184. var reqnodeList = instance1.selectNodes("/root/send");
  185. if (reqnodeList.length > 0)
  186. {
  187. }
  188. model.refresh();
  189. }
  190. else
  191. {
  192. messageBox("ȯ�ڹ�ȣ�� ", "I004");
  193. return;
  194. }
  195. }
  196. function fResizeGrup(flag, heig, wid)
  197. {
  198. body.setAttribute("height", heig);
  199. body.setAttribute("width", wid);
  200. var titHeight = parseInt(grup_title.attribute["height"]);
  201. var tTop = parseInt(grup_top.attribute["top"]);
  202. var tHeight = parseInt(grup_top.attribute["height"]);
  203. var bTop = parseInt(grup_body.attribute["top"]);
  204. var bHeight = parseInt(grup_body.attribute["height"]);
  205. var mTop = parseInt(grup_bottom.attribute["top"]);
  206. var mHeight = parseInt(grup_bottom.attribute["height"]);
  207. if(flag == "1")
  208. {
  209. btn_excel.setAttribute("left", wid - 4 - 56 + "px");
  210. grup_title.setAttribute("width", wid - 2);
  211. grup_top.setAttribute("top", 0);
  212. grup_top.setAttribute("height", 0);
  213. grup_top.setAttribute("width", 0);
  214. grup_top.setAttribute("visibility", "hidden");
  215. grup_body.setAttribute("left", 0);
  216. grup_body.setAttribute("top", tTop);
  217. grup_body.setAttribute("height", (heig - (tHeight + mHeight) + 1));
  218. grup_body.setAttribute("width", wid - 2);
  219. grd_smmlist.setAttribute("left", 0);
  220. grd_smmlist.setAttribute("border-style", "none");
  221. grd_smmlist.setAttribute("height", (heig - (tHeight + mHeight) + 1));
  222. grd_smmlist.setAttribute("width", wid - 2);
  223. grup_bottom.setAttribute("left", 0);
  224. grup_bottom.setAttribute("top", (heig - mHeight - 2));
  225. grup_bottom.setAttribute("width", wid - 2);
  226. line12.setAttribute("x1", "1px");
  227. line12.setAttribute("x2", wid - 2 + "px");
  228. line12.setAttribute("y1", "24px");
  229. line12.setAttribute("y2", "24px");
  230. line1.setAttribute("x1", "1px");
  231. line1.setAttribute("x2", wid - 2 + "px");
  232. line1.setAttribute("y1", "0px");
  233. line1.setAttribute("y2", "0px");
  234. line2.setAttribute("x1", "1px");
  235. line2.setAttribute("x2", wid - 2 + "px");
  236. line2.setAttribute("y1", "0px");
  237. line2.setAttribute("y2", "0px");
  238. btn_save.setAttribute("left", wid - 4 - 56 + "px");
  239. btn_del.setAttribute("left", wid - 6 - 112 + "px");
  240. btn_end.setAttribute("left", wid - 8 - 168 + "px");
  241. }
  242. model.refresh();
  243. }
  244. function fClickPop()
  245. {
  246. modal("../../../emr/medirecweb/xrw/SSMMR04800_�������.xrw", 1, 0, 0, "", "", "");
  247. if(opener.window.getParameter("SSMMP04800_rtn") == "Y")
  248. fSelect_sub();
  249. g_changeYn = "N";
  250. }
  251. function fChkAuth(selrow)
  252. {
  253. var recudpcd = model.getValue("/root/main/smmlist[" + selrow + "]/recdeptcd");
  254. var rtn = true;
  255. if(recudpcd != uInfo[8])
  256. {
  257. rtn = false;
  258. }
  259. return rtn;
  260. }
  261. function fClose()
  262. {
  263. var updateData = grd_smmlist.getUpdateData();
  264. var updateData = updateData.split("��");
  265. if (updateData.length > 3 && (isPopup()))
  266. {
  267. var rtn = messageBox("ȯ�ڿ�࿡ ����� ������ �ֽ��ϴ� ", "Q002");
  268. if (rtn == 6)
  269. fSave();
  270. }
  271. }
  272. function fPidKeyPress()
  273. {
  274. var pid = model.getValue("/root/main/patinfo/patinfolist/pid");
  275. model.makeValue("/root/send/srchcond", "1");
  276. model.makeValue("/root/send/pid", pid);
  277. if(pid.length >= 1 )
  278. {
  279. if(submit("TRPMC02500"))
  280. {
  281. if( getNodesetCount("/root/main/patinfo/patinfolist") > 0 )
  282. {
  283. if (isPopup())
  284. {
  285. }
  286. else
  287. {
  288. }
  289. }
  290. else
  291. {
  292. model.resetInstanceNode("/root/main/patinfo/patinfolist");
  293. messageBox("��� ȯ�� ��ȣ �Դϴ�.", "E999", "");
  294. model.refresh();
  295. }
  296. }
  297. }
  298. else
  299. {
  300. messageBox("ȯ�ڵ�Ϲ�ȣ�� ��Ȯ��", "C001");
  301. }
  302. }
  303. function fPnmKeyPress()
  304. {
  305. model.makeValue("/root/send/srchcond", "2");
  306. model.makeValue("/root/send/hngnm", ipt_hngnm.m_heControl.value);
  307. inputEnterKey("btn_pinfosearch", "DOMActivate");
  308. }
  309. function fPopPtinfo()
  310. {
  311. modal("SPPMC02500", "1","150", "150", "SPPMC02500", "/root/send", "/root/send");
  312. model.resetInstanceNode("/root/send");
  313. fSelect_Pop();
  314. }
  315. function fPopCommUse()
  316. {
  317. setParameter("comn_chosflag", "C")
  318. setParameter("comn_formprogflag", "A")
  319. setParameter("openmode", "select");
  320. modal("SPMRF04900");
  321. var rtn = getParameter("comncnts");
  322. setParameter("comncnts", "");
  323. var re = /��/i;
  324. var re1 = /��/i;
  325. rtn = rtn.replace(re, "");
  326. rtn = rtn.replace(re1, "");
  327. var reccnts = model.getValue("/root/main/smmlist[" + grd_smmlist.row + "]/smmcnts");
  328. if (rtn == "")
  329. {
  330. return;
  331. }
  332. if (reccnts == "")
  333. {
  334. model.setValue("/root/main/smmlist[" + grd_smmlist.row + "]/smmcnts", rtn);
  335. fAddrow();
  336. }
  337. else
  338. {
  339. model.setValue("/root/main/smmlist[" + grd_smmlist.row + "]/smmcnts", reccnts + " " + rtn);
  340. grd_smmlist.addStatus(grd_smmlist.row, "update");
  341. }
  342. model.refresh();
  343. }
  344. function fAddDateReq(diffFlag)
  345. {
  346. var frdd = model.getValue("/root/init/reqmedireclist/recfromdt");
  347. var todd = model.getValue("/root/init/reqmedireclist/rectodt");
  348. var srcdd = new Date();
  349. var destdd = new Date();
  350. var diffdt;
  351. if (diffFlag == "next")
  352. {
  353. srcdd = todd.toDate();
  354. srcdd = srcdd.getAddDate(1, "D");
  355. frdd = srcdd.getDateFormat();
  356. diffdt = parseInt(model.getValue("/root/init/reqmedireclist/diffdt")) * 1;
  357. destdd = srcdd.getAddDate(diffdt, "M");
  358. todd = destdd.getDateFormat();
  359. model.makeValue("/root/init/allyn", "N");
  360. }
  361. else if (diffFlag == "back")
  362. {
  363. srcdd = frdd.toDate();
  364. srcdd = srcdd.getAddDate(-1, "D");
  365. todd = srcdd.getDateFormat();
  366. diffdt = parseInt(model.getValue("/root/init/reqmedireclist/diffdt")) * -1;
  367. destdd = srcdd.getAddDate(diffdt, "M");
  368. frdd = destdd.getDateFormat();
  369. model.makeValue("/root/init/allyn", "N");
  370. }
  371. else if (diffFlag == "today")
  372. {
  373. todd = getCurrentDate();
  374. var today = new Date();
  375. var frday = new Date();
  376. var diffdt = parseInt(model.getValue("/root/init/reqmedireclist/diffdt")) * -1;
  377. frday = today.getAddDate(diffdt , "M");
  378. frdd = frday.getDateFormat();
  379. model.makeValue("/root/init/allyn", "N");
  380. }
  381. else
  382. {
  383. if (model.getValue("/root/init/reqmedireclist/diffdt") != "-")
  384. {
  385. var today = todd.toDate();
  386. var frday = new Date();
  387. var diffdt = parseInt(model.getValue("/root/init/reqmedireclist/diffdt")) * -1;
  388. frday = today.getAddDate(diffdt , "M");
  389. frdd = frday.getDateFormat();
  390. button2.setDisabled(false);
  391. ipt_formrecdtfr.setDisabled(false);
  392. ipt_formrecdtto.setDisabled(false);
  393. button6.setDisabled(false);
  394. button3.setDisabled(false);
  395. model.makeValue("/root/init/allyn", "N");
  396. }
  397. else
  398. {
  399. button2.setDisabled(true);
  400. ipt_formrecdtfr.setDisabled(true);
  401. ipt_formrecdtto.setDisabled(true);
  402. button6.setDisabled(true);
  403. button3.setDisabled(true);
  404. model.makeValue("/root/init/allyn", "Y");
  405. }
  406. }
  407. model.setValue("/root/init/reqmedireclist/recfromdt", frdd);
  408. model.setValue("/root/init/reqmedireclist/rectodt", todd);
  409. ipt_formrecdtfr.refresh();
  410. ipt_formrecdtto.refresh();
  411. }