SMMNR022.js 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. /*
  2. 약물계산식관리(SMMNR02200.xfm - JScript )
  3. - Version :
  4. 1) : Ver.1.00.01
  5. */
  6. var xItemListPath = "/root/main/iteminfo/itemlist"; // SET 그룹 정보
  7. var xElmtListPath = "/root/main/elmtinfo/elmtlist"; // SET 진술문 정보
  8. /**
  9. * @group :
  10. * @ver : 2007.05.29
  11. * @by : 이은영
  12. * @---------------------------------------------------
  13. * @type : function
  14. * @access : public
  15. * @desc : 화면 초기화
  16. * @param : pFlag
  17. * @return :
  18. * @---------------------------------------------------
  19. */
  20. function fInitialize(){
  21. model.removenodeset(xItemListPath);
  22. model.removenodeset(xElmtListPath);
  23. fSrchItemList("item");
  24. model.refresh();
  25. }
  26. /**
  27. * @group :
  28. * @ver : 2007.05.29
  29. * @by : 이은영
  30. * @---------------------------------------------------
  31. * @type : function
  32. * @access : public
  33. * @desc : 그리드 팝업메뉴 SETTING
  34. * @param : pFlag
  35. * @return :
  36. * @---------------------------------------------------
  37. */
  38. function fSettingPopUpMenu(pFlag){
  39. if(event.button == 3){
  40. switch(pFlag){
  41. case "item" :
  42. if(grd_itemlist.isCell(event.target) && grd_itemlist.mouseRow >= 0){
  43. window.setPopupMenu(true, "/root/temp/popmenu/iteminfo/menu", "name", "func", false);
  44. }else{
  45. window.setPopupMenu(false);
  46. }
  47. break;
  48. case "elmt" :
  49. if(grd_elmtlist.isCell(event.target) && grd_elmtlist.mouseRow >= 0){
  50. window.setPopupMenu(true, "/root/temp/popmenu/elmtinfo/menu", "name", "func", false);
  51. }else{
  52. window.setPopupMenu(false);
  53. }
  54. break;
  55. }
  56. }
  57. }
  58. /**
  59. * @group :
  60. * @ver : 2007.05.29
  61. * @by : 이은영
  62. * @---------------------------------------------------
  63. * @type : function
  64. * @access : public
  65. * @desc : 항목 추가
  66. * @param :
  67. * @return :
  68. * @---------------------------------------------------
  69. */
  70. function fAddItem(){
  71. grd_itemlist.addRow();
  72. var iRow = grd_itemlist.rows - grd_itemlist.fixedrows;
  73. model.setValue(xItemListPath+"["+iRow+"]/supcd","*");
  74. model.setValue(xItemListPath+"["+iRow+"]/refseq",0);
  75. }
  76. /**
  77. * @group :
  78. * @ver : 2007.05.29
  79. * @by : 이은영
  80. * @---------------------------------------------------
  81. * @type : function
  82. * @access : public
  83. * @desc : 항목 삭제
  84. * @param :
  85. * @return :
  86. * @---------------------------------------------------
  87. */
  88. function fDelItem(){
  89. var iRow = grd_itemlist.row;
  90. if(iRow < 1) return;
  91. var sStatus = grd_itemlist.rowstatus(iRow);
  92. if(sStatus != 2 && sStatus != 4){
  93. grd_itemlist.deleteItem(iRow);
  94. }else{
  95. grd_itemlist.rowstatus(iRow) = 4;
  96. }
  97. }
  98. /**
  99. * @group :
  100. * @ver : 2007.05.29
  101. * @by : 이은영
  102. * @---------------------------------------------------
  103. * @type : function
  104. * @access : public
  105. * @desc : 요소 추가
  106. * @param :
  107. * @return :
  108. * @---------------------------------------------------
  109. */
  110. function fAddElmt(){
  111. var iItemRow = grd_itemlist.row;
  112. if(iItemRow<1){
  113. messageBox("항목을 먼저","C002");
  114. return;
  115. }
  116. var sItemCD = model.getValue(xItemListPath+"["+iItemRow+"]/itemcd");
  117. if(sItemCD == ""){
  118. messageBox( "계산항목을 먼저 저장해야 합니다. 요소를 추가할 수", "I004");
  119. return;
  120. }
  121. grd_elmtlist.addRow();
  122. var iRow = grd_elmtlist.rows - grd_elmtlist.fixedrows;
  123. model.setValue(xElmtListPath+"["+iRow+"]/supcd",sItemCD);
  124. model.setValue(xElmtListPath+"["+iRow+"]/refseq",0);
  125. }
  126. /**
  127. * @group :
  128. * @ver : 2007.05.29
  129. * @by : 이은영
  130. * @---------------------------------------------------
  131. * @type : function
  132. * @access : public
  133. * @desc : 요소 삭제
  134. * @param :
  135. * @return :
  136. * @---------------------------------------------------
  137. */
  138. function fDelElmt(){
  139. var iRow = grd_elmtlist.row;
  140. if(iRow < 1) return;
  141. var sStatus = grd_elmtlist.rowstatus(iRow);
  142. if(sStatus == 1 || sStatus == 3){
  143. grd_elmtlist.deleteItem(iRow);
  144. }else{
  145. grd_elmtlist.rowstatus(iRow) = 4;
  146. }
  147. }
  148. /**
  149. * @group :
  150. * @ver : 2007.05.29
  151. * @by : 이은영
  152. * @---------------------------------------------------
  153. * @type : function
  154. * @access : public
  155. * @desc : 항목 조회
  156. * @param : pFlag (item : 항목, elmt : 요소)
  157. * @return :
  158. * @---------------------------------------------------
  159. */
  160. function fSrchItemList(pFlag){
  161. model.removenode("/root/send");
  162. if(pFlag == "item"){
  163. model.removenodeset(xElmtListPath);
  164. grd_elmtlist.rebuild();
  165. model.makeValue("/root/send/supcd","*");
  166. if(submit("TRMNR02201")){
  167. model.setValue("/root/main/itemcalform","");
  168. tar_calform.refresh();
  169. }
  170. }else{
  171. var iRow = grd_itemlist.row;
  172. var sItemCD = model.getValue(xItemListPath+"["+iRow+"]/itemcd");
  173. if(sItemCD == ""){
  174. model.removenodeset(xElmtListPath);
  175. grd_elmtlist.rebuild();
  176. return;
  177. }
  178. model.makeValue("/root/send/supcd",model.getValue(xItemListPath+"["+iRow+"]/itemcd"));
  179. if(submit("TRMNR02202")){
  180. model.setValue("/root/main/itemcalform",model.getValue(xItemListPath+"["+iRow+"]/calform"));
  181. model.refresh();
  182. }
  183. }
  184. }
  185. /**
  186. * @group :
  187. * @ver : 2007.05.29
  188. * @by : 이은영
  189. * @---------------------------------------------------
  190. * @type : function
  191. * @access : public
  192. * @desc : 항목 저장
  193. * @param : pFlag (item : 항목, elmt : 요소)
  194. * @return :
  195. * @---------------------------------------------------
  196. */
  197. function fSaveItemList(pFlag){
  198. model.removenode("/root/send");
  199. switch(pFlag){
  200. case "item" :
  201. if(fChkItemInfo(pFlag)) return;
  202. model.makeValue("/root/send/itemlist", grd_itemlist.getUpdateData());
  203. model.makeValue("/root/send/supcd","*");
  204. submit("TXMNR02201");
  205. break;
  206. case "elmt" :
  207. var iItemRow = grd_itemlist.row;
  208. var sItemCD = model.getValue(xItemListPath+"["+iItemRow+"]/itemcd");
  209. var sStatus = grd_itemlist.rowstatus(iItemRow);
  210. var iElmtStatus = 0;
  211. if(sStatus == 1 || sStatus == 3){
  212. messageBox( "계산항목을 먼저 저장해야 합니다. 요소 저장을 할 수", "I004");
  213. return;
  214. }
  215. var sItemCalForm = model.getValue("/root/main/itemcalform");
  216. // 계산식 검증
  217. var sTmpItemCalForm = sItemCalForm;
  218. var sElmtNM = "";
  219. for(var iRow=grd_elmtlist.fixedrows; iRow<= grd_elmtlist.rows-grd_elmtlist.fixedrows; iRow++){
  220. iElmtStatus = grd_elmtlist.rowstatus(iRow);
  221. if(iElmtStatus == 4) continue;
  222. sElmtNM = model.getValue(xElmtListPath+"["+iRow+"]/itemnm");
  223. while(sTmpItemCalForm.indexOf(sElmtNM) >= 0){
  224. sTmpItemCalForm = sTmpItemCalForm.replace(sElmtNM,1);
  225. }
  226. }
  227. // 계산식에 사용할 수 있는 특수기호, 숫자 제외하기
  228. if(sTmpItemCalForm.replace(/[\+,\-,\/,\*,\(,\), ,0-9,\n]/g,"") != ""){
  229. messageBox( "계산식이 잘못 되었습니다. 다시", "C001");
  230. return;
  231. }
  232. // 계산식에서 줄바꿈 문자 빼주기
  233. sTmpItemCalForm = sTmpItemCalForm.replace(/\n/g,"");
  234. if(model.getValue(xItemListPath+"["+iItemRow+"]/calform") != sItemCalForm){
  235. if(sStatus == 0 || sStatus == 4){
  236. grd_itemlist.rowstatus(iItemRow) = 2;
  237. }
  238. model.setValue(xItemListPath+"["+iItemRow+"]/calform", sItemCalForm);
  239. }
  240. model.makeValue("/root/send/itemlist", grd_itemlist.getUpdateData());
  241. model.makeValue("/root/send/elmtlist", grd_elmtlist.getUpdateData());
  242. model.makeValue("/root/send/supcd", sItemCD);
  243. if(submit("TXMNR02202")){
  244. copyNodesetType(xItemListPath,"/root/temp/iteminfo/itemlist","replace");
  245. copyNodesetType(xElmtListPath,"/root/temp/iteminfo/elmtlist","replace");
  246. grd_elmtlist.rebuild();
  247. grd_itemlist.rebuild();
  248. iItemRow = grd_itemlist.findRow(sItemCD,1,4);
  249. grd_itemlist.row = iItemRow;
  250. model.setValue("/root/main/itemcalform",model.getValue(xItemListPath+"["+iItemRow+"]/calform"));
  251. tar_calform.refresh();
  252. }
  253. break;
  254. }
  255. }
  256. /**
  257. * @group :
  258. * @ver : 2007.05.29
  259. * @by : 이은영
  260. * @---------------------------------------------------
  261. * @type : function
  262. * @access : public
  263. * @desc : 빈 항목명이 있는지 체크
  264. * @param : pFlag (item : 항목, elmt : 요소)
  265. * @return :
  266. * @---------------------------------------------------
  267. */
  268. function fChkItemInfo(pFlag){
  269. switch(pFlag){
  270. case "item" :
  271. for(var iRow=grd_itemlist.fixedrows; iRow<=grd_itemlist.rows-grd_itemlist.fixedrows; iRow++){
  272. if(model.getValue(xItemListPath+"["+iRow+"]/itemnm") == ""){
  273. messageBox("항목명은","I003");
  274. return true;
  275. }
  276. }
  277. break;
  278. }
  279. return false;
  280. }
  281. function fChangedGridRow(pFlag){
  282. var iRow = 0;
  283. var iStatus = 0;
  284. switch(pFlag){
  285. case "item" :
  286. iRow = grd_itemlist.row;
  287. iStatus = grd_itemlist.rowstatus(iRow);
  288. if(iStatus == 1 || iStatus == 3) return;
  289. grd_itemlist.rowstatus(iRow) = 2;
  290. break;
  291. }
  292. }