SMADT30600.js 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110
  1. /**
  2. * 파 일 명 : SMADT30600.js
  3. * 설 명 : 마약향정처방바코드전용관리 Javascriot
  4. * 설 계 자 : 공두경
  5. * 작 성 자 : 공두경
  6. * 수정이력 : 2007.08.10 / 최초작성 / 공두경
  7. */
  8. /**
  9. * 초기화
  10. */
  11. function fInit() {
  12. caption1.text="";
  13. grd_narclist.fixedcellcheckbox(0,1) = true;
  14. grd_sprelist.fixedcellcheckbox(0,1) = true;
  15. grd_outnarc.fixedcellcheckbox(0,1) = true;
  16. //구분 초기화(전체)
  17. model.setValue("/root/temp/srchinfo/narcflag", "M");
  18. model.setValue("/root/temp/srchinfo/srchdrugkind", "T");
  19. model.setValue("/root/temp/srchinfo/drugflag", "I");
  20. // fChkIOTotal();
  21. model.setValue("/root/temp/srchinfo/narcstat", "T");
  22. // rdo_cncl.disabled = true;
  23. model.setValue("/root/temp/srchinfo/cnclstat", "");
  24. // rdo_rtn.disabled = true;
  25. model.setValue("/root/temp/srchinfo/rtnstat", "");
  26. model.setValue("/root/temp/srchinfo/narctypeflag", "T");
  27. model.setValue("/root/temp/srchinfo/srchioflag", "I");
  28. fChgIOFlag();
  29. //토글초기화
  30. model.setValue("/root/temp/srchinfo/srchroot", "M");
  31. model.toggle("case1");
  32. //조회날짜 초기화
  33. model.setValue("/root/temp/srchinfo/fst_dd", getCurrentDate());
  34. model.setValue("/root/temp/srchinfo/last_dd", getCurrentDate());
  35. //병동 Combo 조회
  36. model.setValue("/root/send/srchcond/deptflag", "W");
  37. submit("TRADT30101");
  38. //astfAddCombo("/root/temp/srchcond", "ward", "wardcd,wardnm", ",");
  39. //로그인 사용자 셋팅
  40. var userid = getUserId();
  41. //model.setValue("/root/temp/srchinfo/srchid", userid);
  42. //fChgUserID();
  43. model.refresh();
  44. model.setFocus("input1");
  45. gTimer1 = window.setInterval("fClearUserID()",90000);
  46. }
  47. /**
  48. * 마약리스트 조회
  49. */
  50. function fGetNarcData() {
  51. grd_narclist.fixedcellischeck(0, 1) = false;
  52. grd_outnarc.fixedcellischeck(0, 1) = false;
  53. model.copyNode("/root/send/srchinfo","/root/temp/srchinfo");
  54. submit("TRADT30102");
  55. }
  56. /**
  57. * 바코드 변경시
  58. */
  59. function fChgBarcode() {
  60. var iRowNo = 0;
  61. var sBar = model.getValue("/root/temp/srchinfo/barcode");
  62. if(sBar.length >= 21){
  63. if(model.getValue("/root/temp/userinfo/userinfo/userid") == ""){
  64. messageBox("사용자ID가 없습니다. 사용자ID부터","C001");
  65. model.setValue("/root/temp/srchinfo/srchid","");
  66. model.setValue("/root/temp/srchinfo/barcode","");
  67. model.refresh();
  68. model.setFocus("input1");
  69. } else if(sBar.substr(0,1) != "M"){
  70. messageBox("바코드 정보가 다릅니다. 바코드를 다시","C001");
  71. model.setValue("/root/temp/srchinfo/barcode","");
  72. model.setFocus("input9");
  73. } else {
  74. //해당 바코드를 확인 처리 하기전 노드를 백업하여 기존에 이미 확인한 리스트들이 사라지지 않도록 한다.
  75. model.removenode("/root/temp/bknarclist");
  76. model.makeNode("/root/temp/bknarclist");
  77. model.copyNode("/root/temp/bknarclist", "/root/main/narclist");
  78. //바코드로 먼저 해당처방을 조회함
  79. fGetNarcData();
  80. //바코드로 Acting처리가 가능한 처방인지 체크함
  81. //바코드로 처리가능한 Acting : 조제완료, 불출, 잔량반납확인, 반환확인
  82. //바코드로 조회시 데이터는 한건만 조회됨.
  83. if(sBar.substr(2,1) == "O" || sBar.substr(2,1) == "E" || sBar.substr(2,1) == "D"){
  84. if(model.getValue("/root/temp/srchinfo/srchroot") == "M"){
  85. if(model.getValue("/root/main/narclist/narclist["+1+"]/narcstat")=="4"){
  86. //바코드로 취소는 불가능 조회만가능
  87. model.setValue("/root/main/narclist/narclist["+1+"]/sel","Y");
  88. fNarcActing("Drug");
  89. fSetNarcNodes("ADD");
  90. return;
  91. }
  92. }
  93. }
  94. fSetNarcNodes("ADD");
  95. model.setValue("/root/temp/srchinfo/barcode","");
  96. model.refresh();
  97. }
  98. } else {
  99. messageBox("바코드 정보가 다릅니다.\n다시","C001");
  100. model.setValue("/root/temp/srchinfo/barcode","");
  101. model.setFocus("input9");
  102. }
  103. model.refresh();
  104. }
  105. /**
  106. * 마약 Acting 버튼 클릭시
  107. */
  108. function Old_fNarcActing(sActing) {
  109. if(model.getValue("/root/temp/userinfo/userinfo/userid") == ""){
  110. messageBox("사용자ID가 없습니다. 사용자ID를 먼저","C001");
  111. model.setValue("/root/temp/srchinfo/srchid","");
  112. model.setFocus("input1");
  113. model.refresh();
  114. return;
  115. }
  116. var iActing_Cnt = 0;
  117. var sActing_nm = "";
  118. var sActingAfter = "";
  119. //액팅전 체크표시 cash
  120. fChkCash("before");
  121. model.removeNodeset("/root/send/narcinfo/narclist");
  122. for(var i = grd_narclist.fixedRows; i < grd_narclist.rows; i++){
  123. var sel = model.getValue("/root/main/narclist/narclist["+i+"]/sel");
  124. var sNarcStat = model.getValue("/root/main/narclist/narclist["+i+"]/narcstat");
  125. var sCnclStat = model.getValue("/root/main/narclist/narclist["+i+"]/cnclstat");
  126. var sRtnStat = model.getValue("/root/main/narclist/narclist["+i+"]/rtnstat");
  127. var sDrugFlag = model.getValue("/root/main/narclist/narclist["+i+"]/drugflag");
  128. var sReturnFlag = model.getValue("/root/main/narclist/narclist["+i+"]/returnflag");
  129. var sDrugKind = model.getValue("/root/main/narclist/narclist["+i+"]/drugkind");
  130. var sIOflag = model.getValue("/root/main/narclist/narclist["+i+"]/ioflag");
  131. var sPrcphistcd = model.getValue("/root/main/narclist/narclist["+i+"]/prcphistcd");
  132. if(sel == 'Y'){
  133. if(sActing == "Prcp"){
  134. //이선경 2008-07-23 start
  135. if(sCnclStat != ""){
  136. if(messageBox("반환된 처방입니다. 조제완료를", "Q002") == "7") {
  137. return;
  138. }
  139. }
  140. //이선경 2008-07-23 end
  141. if(sNarcStat == "2"){
  142. messageBox("마약처방전이 출력되지","E007");
  143. return;
  144. }
  145. if(parseInt(sNarcStat, 10) > 3){
  146. messageBox("이미 조제완료된 처방","E008");
  147. return;
  148. }
  149. if(sNarcStat == "3"){
  150. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  151. sActing_nm = "조제완료";
  152. iActing_Cnt++;
  153. } else {
  154. sActing_nm = "조제완료";
  155. }
  156. } else if(sActing == "PrcpCncl"){
  157. //이선경 2008-07-23 start
  158. if(sCnclStat != ""){
  159. if(messageBox("반환된 처방입니다. 조제취소를", "Q002") == "7") {
  160. return;
  161. }
  162. }
  163. //이선경 2008-07-23 end
  164. if(sNarcStat == "4"){
  165. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  166. iActing_Cnt++;
  167. }
  168. sActing_nm = "조제취소";
  169. } else if(sActing == "Drug"){
  170. //이선경 2008-07-23 start
  171. if(sCnclStat != ""){
  172. if(messageBox("반환된 처방입니다. 불출확인를", "Q002") == "7") {
  173. return;
  174. }
  175. }
  176. //이선경 2008-07-23 end
  177. if(sNarcStat == "4"){
  178. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  179. iActing_Cnt++;
  180. }
  181. sActing_nm = "불출";
  182. } else if(sActing == "DrugCncl"){
  183. //이선경 2008-07-23 start
  184. if(sCnclStat != ""){
  185. if(messageBox("반환된 처방입니다. 불출취소를", "Q002") == "7") {
  186. return;
  187. }
  188. }
  189. //이선경 2008-07-23 end
  190. if(sNarcStat == "5"){
  191. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  192. iActing_Cnt++;
  193. }
  194. sActing_nm = "불출취소";
  195. } else if(sActing == "Spre"){
  196. if(sRtnStat == "1"){
  197. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  198. iActing_Cnt++;
  199. if((sCnclStat == "1" || (sIOflag == "O" && (sDrugKind == "N" || sDrugKind == "Y") && sReturnFlag == "Y"))
  200. && model.getValue("/root/main/narclist/narclist["+i+"]/rtndt") != ""){
  201. var vb_prcpcd = model.getValue("/root/main/narclist/narclist["+i+"]/prcpcd");
  202. var vb_Chk = messageBox(vb_prcpcd+"마약에 대해 반환확인 데이터가 존재합니다.\n반환확인을 ", "Q004");
  203. if(vb_Chk == 6){
  204. model.makeValue("/root/send/narcinfo/narclist["+getNodesetCount("/root/send/narcinfo/narclist")+"]/acting_after", "Rtn");
  205. }
  206. }
  207. }
  208. sActing_nm = "잔량반납확인";
  209. } else if(sActing == "Rtn"){
  210. /*
  211. 1. 입원 약주사, 외래주사는 간호사가 반환신청을 함
  212. 2. 퇴원/외박/외출은 약국에서 반환을 수행(삭제, 간호에서 반환신청해야함)
  213. 3. 외래 원내 약/외용약은 약국에서 반환을 수행
  214. */
  215. //이선경 2008-07-23 start
  216. if(sCnclStat == "1" && sPrcphistcd == "E" && sDrugFlag !="L" && sDrugFlag != 'G'){
  217. messageBox("간호투약확인후 반환확인을 ", "C002");
  218. return;
  219. }
  220. //이선경 2008-07-23 end
  221. if(sCnclStat == "1"){
  222. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  223. iActing_Cnt++;
  224. /*} else if((sDrugFlag == "L" || sDrugFlag == "G") && (parseInt(sNarcStat,10) < 6 ) && sReturnFlag == "Y"){
  225. if(model.getValue("/root/main/narclist/narclist["+i+"]/rtnqty") != ""){
  226. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  227. iActing_Cnt++;
  228. } else {
  229. messageBox("반환량이 없습니다. 반환량을","C001");
  230. return;
  231. }*/
  232. if(sRtnStat == "1" && model.getValue("/root/main/narclist/narclist["+i+"]/rtndt") != ""){
  233. var vb_Chk = messageBox("잔량확인 데이터가 존재합니다.\n잔랑반납확인을 ", "Q004");
  234. if(vb_Chk == 6){
  235. model.makeValue("/root/send/narcinfo/narclist["+getNodesetCount("/root/send/narcinfo/narclist")+"]/acting_after", "Spre");
  236. }
  237. }
  238. } else if(sIOflag == "O" && (sDrugKind == "N" || sDrugKind == "Y") && sReturnFlag == "Y"){
  239. if(model.getValue("/root/main/narclist/narclist["+i+"]/rtnqty") == "" || model.getValue("/root/main/narclist/narclist["+i+"]/rtnqty") == "0"){
  240. messageBox("반환량이 없습니다. 반환량을","C001");
  241. return;
  242. }
  243. if(isNaN(model.getValue("/root/main/narclist/narclist["+i+"]/rtnqty"))){
  244. messageBox("반환량은 숫자로","C001");
  245. model.setValue("/root/main/narclist/narclist["+i+"]/rtnqty", "");
  246. return;
  247. }
  248. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  249. iActing_Cnt++;
  250. if(sRtnStat == "1" && model.getValue("/root/main/narclist/narclist["+i+"]/rtndt") != ""){
  251. var vb_prcpcd = model.getValue("/root/main/narclist/narclist["+i+"]/prcpcd");
  252. var vb_Chk = messageBox(vb_prcpcd+"마약에 대해 잔량확인 데이터가 존재합니다.\n잔랑반납확인을 ", "Q004");
  253. if(vb_Chk == 6){
  254. model.makeValue("/root/send/narcinfo/narclist["+getNodesetCount("/root/send/narcinfo/narclist")+"]/acting_after", "Spre");
  255. }
  256. }
  257. }
  258. sActing_nm = "반환확인";
  259. }
  260. }
  261. }
  262. if(iActing_Cnt == 0 && model.getValue("/root/temp/srchinfo/barcode") == ""){
  263. messageBox("선택된 데이터중에 "+sActing_nm+"할 데이터가 없거나 \n선택된 데이터가","I004");
  264. return;
  265. } else if(iActing_Cnt == 0 && model.getValue("/root/temp/srchinfo/barcode") != ""){
  266. messageBox("이미","I001");
  267. model.setValue("/root/temp/srchinfo/barcode","");
  268. model.setFocus("input9");
  269. model.refresh();
  270. return;
  271. }
  272. if(sActing == "Prcp" && model.getValue("/root/temp/srchinfo/srchioflag") == "I"){
  273. if ( model.getValue("/root/send/lblskip") != "Y" ){
  274. fNarcLBLPrint("Prnt");
  275. }
  276. }
  277. model.copyNode("/root/send/narcinfo/srchinfo","/root/temp/srchinfo");
  278. model.copyNode("/root/send/narcinfo/userinfo","/root/temp/userinfo/userinfo");
  279. model.makeValue("/root/send/narcinfo/srchinfo/acting", sActing);
  280. submit("TXADT30102"); //라벨 출력 횟수 저장
  281. submit("TXADT30101");
  282. //액팅전 체크표시 다시 표시
  283. grd_narclist.fixedcellischeck(0, 1) = false;
  284. grd_outnarc.fixedcellischeck(0, 1) = false;
  285. fChkCash("after");
  286. model.setValue("/root/temp/srchinfo/barcode","");
  287. model.setFocus("input9");
  288. model.refresh();
  289. }
  290. /**
  291. * 마약 Acting 버튼 클릭시 -- 2009-05-20 김귀남 변경
  292. */
  293. function fNarcActing(sActing) {
  294. if(model.getValue("/root/temp/userinfo/userinfo/userid") == ""){
  295. messageBox("사용자ID가 없습니다. 사용자ID를 먼저","C001");
  296. model.setValue("/root/temp/srchinfo/srchid","");
  297. model.setFocus("ipt_srchid");
  298. model.refresh();
  299. return;
  300. }
  301. var iActing_Cnt = 0; // 행위 구분을 위한 카운트값
  302. var sActing_nm = ""; // 해당 행위의 명칭
  303. var sActingAfter = "";
  304. var selCnt = 0;
  305. //액팅전 체크표시 cash
  306. fChkCash("before");
  307. model.removeNodeset("/root/send/narcinfo/narclist");
  308. // **** 체크박스 선택 값 카운트 Start ****
  309. for(var i = grd_narclist.fixedRows; i < grd_narclist.rows; i++){
  310. var sel = model.getValue("/root/main/narclist/narclist["+i+"]/sel");
  311. var sNarcStat = model.getValue("/root/main/narclist/narclist["+i+"]/narcstat");
  312. if(sel == "Y" && sNarcStat != "1") selCnt++; // 선택된 값(sel == "Y") 들 중 미신청 값은 제외
  313. }
  314. if(selCnt == 0) {
  315. messageBox("선택된 데이터가","I004");
  316. return;
  317. }
  318. // **** 체크박스 선택 값 카운트 End ****
  319. for(var i = grd_narclist.fixedRows; i < grd_narclist.rows; i++){
  320. var sel = model.getValue("/root/main/narclist/narclist["+i+"]/sel"); // 선택여부
  321. var sNarcStat = model.getValue("/root/main/narclist/narclist["+i+"]/narcstat"); // 불출상태
  322. var sCnclStat = model.getValue("/root/main/narclist/narclist["+i+"]/cnclstat"); // 반환상태
  323. var sRtnStat = model.getValue("/root/main/narclist/narclist["+i+"]/rtnstat"); // 반납상태
  324. var sDrugFlag = model.getValue("/root/main/narclist/narclist["+i+"]/drugflag"); // 마약/향정구분
  325. var sReturnFlag = model.getValue("/root/main/narclist/narclist["+i+"]/returnflag"); // 반납여부
  326. var sDrugKind = model.getValue("/root/main/narclist/narclist["+i+"]/drugkind"); // 발생구분
  327. var sIOflag = model.getValue("/root/main/narclist/narclist["+i+"]/ioflag"); // 입원/외래구분
  328. var sPrcphistcd = model.getValue("/root/main/narclist/narclist["+i+"]/prcphistcd"); // 처방상태
  329. var sPid = model.getValue("/root/main/narclist/narclist["+i+"]/pid"); // 환자번호
  330. var sPrcpcd = model.getValue("/root/main/narclist/narclist["+i+"]/prcpcd"); // 약품코드
  331. var sDrugno = model.getValue("/root/main/narclist/narclist["+i+"]/drugno"); // 약품코드
  332. var sMsg = "*투약번호 : "+sDrugno+" *환자번호 : "+ sPid+ " *약품코드 : "+ sPrcpcd + "\n";
  333. //=========================================== 제한조건 체크 Start ================================================//
  334. // 변수명 parameter 명칭 동작가능상태 //
  335. //------------------------------------------------------------------------------------------------------------//
  336. // sCnclStat 1. 7 : 반환종료 sCnclStat == "7" ( 진행불가 ) //
  337. //------------------------------------------------------------------------------------------------------------//
  338. // sActing - 1. Prcp : 조제확인 sNarcStat == "3" [출력완료] //
  339. // 2. PrcpCncl : 조제취소 sNarcStat == "4" [조제완료] //
  340. // 3. Drug : 불출확인 sNarcStat == "4" [조제완료] //
  341. // 4. DrugCncl : 불출취소 sNarcStat == "5" [불출] //
  342. // 5. Rtn : 반환확인 sCnclStat == "1" [반환신청] //
  343. // 6. RtnCncl : 반환취소 (2009-05-05 추가) sCnclStat == "2" [반환확인] //
  344. // 7. Spre : 잔량확인 sRtnStat == "1" [잔량신청] //
  345. // 8. SpreCncl : 잔량취소 (2009-05-05 추가) sRtnStat == "2" [잔량확인] //
  346. //============================================================================================================//
  347. if(sel == 'Y'){
  348. // *** 반환종료 *** 처방 메시지 처리 (진행불가) Start
  349. if(sCnclStat == "7" && (sNarcStat == "3" || sNarcStat == "4")){
  350. //메세지처리 반환종료 된 처방입니다.
  351. messageBox(sMsg+"반환 종료 되었습니다. 반환처방전을 출력","I008");
  352. return;
  353. } else if(sCnclStat == "7" && sNarcStat == "2"){
  354. //메세지처리 : 반환종료되었습니다.
  355. messageBox(sMsg+"반환","I002");
  356. return;
  357. }
  358. // *** 반환종료 *** 처방 메시지 처리 (진행불가) End
  359. if(sActing == "Prcp"){ // ***조제확인*** 출력완료 일 때만 기능 동작
  360. //이선경 2008-07-23 start
  361. /*
  362. if(sCnclStat != ""){
  363. if(messageBox("반환된 처방입니다. 조제완료를", "Q002") == "7") {
  364. return;
  365. }
  366. }
  367. */
  368. // 한영현/간호 ITC 협의사항 - 'D'인 처방도 정상적인 흐름으로 처리 후 다시 반환처리 - 2009.06.04 (목) 김귀남
  369. //이선경 2008-07-23 end
  370. if(sNarcStat == "2"){ // [불출신청] 상태일 때
  371. messageBox("마약처방전이 출력되지","E007");
  372. return;
  373. }
  374. if(parseInt(sNarcStat, 10) > 3){ // [출력완료] 상태 이상일 때
  375. messageBox("이미 조제완료된 처방","E008");
  376. return;
  377. }
  378. if(sNarcStat == "3"){ // [출력완료] 일 때만 기능 동작
  379. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  380. sActing_nm = "조제완료";
  381. iActing_Cnt++;
  382. } else { // 불출상태가 [미신청]일때
  383. sActing_nm = "조제완료";
  384. }
  385. } else if(sActing == "PrcpCncl"){ // ***조제취소***
  386. //이선경 2008-07-23 start
  387. if(sCnclStat != ""){
  388. if(messageBox("반환된 처방입니다. 조제취소를", "Q002") == "7") {
  389. return;
  390. }
  391. }
  392. //이선경 2008-07-23 end
  393. if(sNarcStat == "4"){ // [조제완료] 상태일 때
  394. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  395. iActing_Cnt++;
  396. }
  397. sActing_nm = "조제취소";
  398. } else if(sActing == "Drug"){ // ***불출확인***
  399. //이선경 2008-07-23 start
  400. /*
  401. if(sCnclStat != ""){
  402. if(messageBox("반환된 처방입니다. 불출확인를", "Q002") == "7") {
  403. return;
  404. }
  405. }
  406. */
  407. // 한영현/간호 ITC 협의사항 - 'D'인 처방도 정상적인 흐름으로 처리 후 다시 반환처리 - 2009.06.04 (목) 김귀남
  408. //이선경 2008-07-23 end
  409. if(sNarcStat == "4"){ // [조제완료] 상태일 때
  410. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  411. iActing_Cnt++;
  412. }
  413. sActing_nm = "불출";
  414. } else if(sActing == "DrugCncl"){ // ***불출취소***
  415. //이선경 2008-07-23 start
  416. if(sCnclStat != ""){
  417. if(messageBox("반환된 처방입니다. 불출취소를", "Q002") == "7") {
  418. return;
  419. }
  420. }
  421. //이선경 2008-07-23 end
  422. if(sNarcStat == "5"){ // [불출] 상태일 때
  423. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  424. iActing_Cnt++;
  425. }
  426. sActing_nm = "불출취소";
  427. } else if(sActing == "Spre"){ // ***잔량확인***
  428. if(sRtnStat == "1"){ // [잔량신청] 일 때
  429. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  430. iActing_Cnt++;
  431. // [반환신청] 이거나 [외래] 경구약 혹은 외용제이면서 처방상태(sReturnFlag)가 [D/C]일 경우
  432. // 반환일시가 존재할때.
  433. if((sCnclStat == "1" || (sIOflag == "O" && (sDrugKind == "N" || sDrugKind == "Y") && sReturnFlag == "Y"))
  434. && model.getValue("/root/main/narclist/narclist["+i+"]/rtndt") != ""){
  435. var vb_prcpcd = model.getValue("/root/main/narclist/narclist["+i+"]/prcpcd");
  436. var vb_Chk = messageBox(vb_prcpcd+"마약에 대해 반환확인 데이터가 존재합니다.\n반환확인을 ", "Q004");
  437. if(vb_Chk == 6){
  438. model.makeValue("/root/send/narcinfo/narclist["+getNodesetCount("/root/send/narcinfo/narclist")+"]/acting_after", "Rtn");
  439. }
  440. }
  441. }
  442. sActing_nm = "잔량반납확인";
  443. } else if(sActing == "SpreCncl"){ // ***잔량취소***
  444. if(sRtnStat == "2"){ // [잔량확인] 일 때
  445. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  446. iActing_Cnt++;
  447. }
  448. sActing_nm = "잔량취소";
  449. } else if(sActing == "Rtn"){ // ***반환확인***
  450. /*
  451. 1. 입원 약주사, 외래주사는 간호사가 반환신청을 함
  452. 2. 퇴원/외박/외출은 약국에서 반환을 수행(삭제, 간호에서 반환신청해야함)
  453. 3. 외래 원내 약/외용약은 약국에서 반환을 수행
  454. */
  455. //이선경 2008-07-23 start
  456. if( sIOflag !="O" && sCnclStat == "1" && sPrcphistcd == "E" && sDrugFlag !="L" && sDrugFlag != 'G'){
  457. //messageBox("간호투약확인후 반환확인을 ", "C002");
  458. //return;
  459. }
  460. //이선경 2008-07-23 end
  461. if(sCnclStat == "1"){ // [반환신청]상태일 때 (입원/외래 공통)
  462. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  463. iActing_Cnt++;
  464. /*} else if((sDrugFlag == "L" || sDrugFlag == "G") && (parseInt(sNarcStat,10) < 6 ) && sReturnFlag == "Y"){
  465. if(model.getValue("/root/main/narclist/narclist["+i+"]/rtnqty") != ""){
  466. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  467. iActing_Cnt++;
  468. } else {
  469. messageBox("반환량이 없습니다. 반환량을","C001");
  470. return;
  471. }*/
  472. if(model.getValue("/root/main/narclist/narclist["+i+"]/rtnqty") != ""){
  473. } else {
  474. messageBox("반환량이 없습니다. 반환량을","C001");
  475. return;
  476. }
  477. if(sRtnStat == "1" && model.getValue("/root/main/narclist/narclist["+i+"]/rtndt") != ""){
  478. var vb_Chk = messageBox("잔량확인 데이터가 존재합니다.\n잔랑반납확인을 ", "Q004");
  479. if(vb_Chk == 6){
  480. model.makeValue("/root/send/narcinfo/narclist["+getNodesetCount("/root/send/narcinfo/narclist")+"]/acting_after", "Spre");
  481. }
  482. }
  483. } else if(sIOflag == "O" && (sDrugKind == "N" || sDrugKind == "Y") && sReturnFlag == "Y"){ // [외래] 경구/외용약이면서 prcphistcd가 D,C 일 때
  484. if(model.getValue("/root/main/narclist/narclist["+i+"]/rtnqty") == "" ){
  485. messageBox("반환량이 없습니다. 반환량을","C001");
  486. return;
  487. }
  488. if(isNaN(model.getValue("/root/main/narclist/narclist["+i+"]/rtnqty"))){
  489. messageBox("반환량은 숫자로","C001");
  490. model.setValue("/root/main/narclist/narclist["+i+"]/rtnqty", "");
  491. return;
  492. }
  493. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  494. iActing_Cnt++;
  495. if(sRtnStat == "1" && model.getValue("/root/main/narclist/narclist["+i+"]/rtndt") != ""){
  496. var vb_prcpcd = model.getValue("/root/main/narclist/narclist["+i+"]/prcpcd");
  497. var vb_Chk = messageBox(vb_prcpcd+"마약에 대해 잔량확인 데이터가 존재합니다.\n잔랑반납확인을 ", "Q004");
  498. if(vb_Chk == 6){
  499. model.makeValue("/root/send/narcinfo/narclist["+getNodesetCount("/root/send/narcinfo/narclist")+"]/acting_after", "Spre");
  500. }
  501. }
  502. }
  503. sActing_nm = "반환확인";
  504. } else if(sActing == "RtnCncl"){ // ***반환취소***
  505. if(sCnclStat == "2"){ // [반환확인] 일 때
  506. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  507. iActing_Cnt++;
  508. }
  509. sActing_nm = "반환취소";
  510. }
  511. }
  512. }
  513. //=========================================== 제한조건 체크 Start ===========================================
  514. if(iActing_Cnt == 0 && model.getValue("/root/temp/srchinfo/barcode") == ""){
  515. messageBox("선택된 데이터중에 ["+sActing_nm+"]할 데이터가 없거나 \n선택된 데이터가","I004");
  516. return;
  517. } else if(iActing_Cnt == 0 && model.getValue("/root/temp/srchinfo/barcode") != ""){
  518. messageBox("이미","I001");
  519. model.setValue("/root/temp/srchinfo/barcode","");
  520. model.setFocus("input9");
  521. model.refresh();
  522. return;
  523. }
  524. if(sActing == "Prcp" && model.getValue("/root/temp/srchinfo/srchioflag") == "I" && model.getValue("/root/temp/srchinfo/drugflag") != "L"){
  525. if ( model.getValue("/root/send/lblskip") != "Y" ){
  526. fNarcLBLPrint("Prnt");
  527. }
  528. }
  529. model.copyNode("/root/send/narcinfo/srchinfo","/root/temp/srchinfo");
  530. model.copyNode("/root/send/narcinfo/userinfo","/root/temp/userinfo/userinfo");
  531. model.makeValue("/root/send/narcinfo/srchinfo/acting", sActing);
  532. if(sActing == "Prcp" && model.getValue("/root/temp/srchinfo/srchioflag") == "I" && model.getValue("/root/temp/srchinfo/drugflag") != "L"){
  533. if ( model.getValue("/root/send/lblskip") != "Y" ){
  534. submit("TXADT30102"); //라벨 출력 횟수 저장
  535. }
  536. }
  537. submit("TXADT30101");
  538. //액팅전 체크표시 다시 표시
  539. grd_narclist.fixedcellischeck(0, 1) = false;
  540. grd_outnarc.fixedcellischeck(0, 1) = false;
  541. fChkCash("after");
  542. model.setValue("/root/temp/srchinfo/barcode","");
  543. model.setFocus("input9");
  544. model.refresh();
  545. }
  546. /**
  547. * 마약처방전 출력
  548. */
  549. function fNarcPrint() {
  550. if(model.getValue("/root/temp/userinfo/userinfo/userid") == ""){
  551. messageBox("사용자ID가 없습니다. 사용자ID를 먼저","C001");
  552. model.setValue("/root/temp/srchinfo/barcode","");
  553. model.setFocus("input9");
  554. model.refresh();
  555. return;
  556. }
  557. //액팅전 체크표시 cash
  558. fChkCash("before");
  559. for(var i = grd_narclist.fixedRows; i < grd_narclist.rows; i++){
  560. var sel = model.getValue("/root/main/narclist/narclist["+i+"]/sel");
  561. var narcstat = model.getValue("/root/main/narclist/narclist["+i+"]/narcstat");
  562. var cnclstat = model.getValue("/root/main/narclist/narclist["+i+"]/cnclstat");
  563. var ioflag = model.getValue("/root/main/narclist/narclist["+i+"]/ioflag");
  564. /*이선경 2008-07-23 start
  565. if(sel == 'Y' && narcstat != "1"){
  566. *///이선경 2008-07-23 end
  567. if(sel == 'Y'){
  568. model.copyNode("/root/send/prntinfo","/root/main/narclist/narclist["+i+"]");
  569. model.makeValue("/root/send/prntinfo/prntid", model.getValue("/root/temp/userinfo/userinfo/userid"));
  570. if(cnclstat != ""){
  571. if(ioflag == "I"){
  572. if(cnclstat == "1" || cnclstat == "2"){
  573. model.makeValue("/root/send/prntinfo/prntflag", "D");
  574. } else {
  575. //메세지처리 간호에서 반환신청해야 합니다.
  576. messageBox("간호에서 반환신청 이후만 출력","I006");
  577. continue;
  578. }
  579. } else {
  580. if(cnclstat == "0"){
  581. //반환확인후 출력가능합니다.
  582. messageBox("반환확인후 출력","I006");
  583. continue;
  584. } else {
  585. model.makeValue("/root/send/prntinfo/prntflag", "D");
  586. }
  587. }
  588. } else {
  589. if(narcstat == "1"){
  590. //불출신청이 되어야 출력가능합니다.
  591. messageBox("불출신청 되야 출력","I006");
  592. continue;
  593. } else {
  594. model.makeValue("/root/send/prntinfo/prntflag", "O");
  595. }
  596. }
  597. submit("TRADT30103");
  598. if(model.getValue("/root/main/prntlist/patinfo/drugno") != ""){
  599. exeReportPreview("RFADT30100", "XMLSTR", "", "", "true","","","","","true");
  600. }
  601. }
  602. }
  603. fGetNarcData();
  604. //액팅전 체크표시 다시 표시
  605. fChkCash("after");
  606. }
  607. /**
  608. * 마약라벨 출력
  609. */
  610. function fNarcLBLPrint(chk) {
  611. var reprint="";
  612. for(var i = grd_narclist.fixedRows; i < grd_narclist.rows; i++){
  613. var sel = model.getValue("/root/main/narclist/narclist["+i+"]/sel");
  614. var sNarcStat = model.getValue("/root/main/narclist/narclist["+i+"]/narcstat");
  615. //model.removeNodeset("/root/send/narcinfo/narclist");
  616. if(sel == 'Y' && ((chk == "Prnt" && sNarcStat == "3") || (chk == "Reprnt" && parseInt(sNarcStat,10) > 3))){
  617. // Comm 설정
  618. CommAX.CommPort = "1"; // 출력 Port
  619. CommAX.Settings = "9600,n,8,1"; // Comm 설정
  620. var sSndMsg = ""; //라벨출력내용
  621. if ( model.getValue("/root/main/narclist/narclist["+i+"]/lblprnttims")>0 ){
  622. reprint ="(재)";
  623. }
  624. //astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  625. if ( CommAX.PortOpen() == true) {
  626. //시작(X, Y)
  627. sSndMsg += astfStartFormat(0, 0);
  628. //라벨이름
  629. sSndMsg += astfPrintOut(50, 40, 10, "마 약","");
  630. //처방일자
  631. sSndMsg += astfPrintOut(245, 40, 34, fGetDateString(model.getValue("/root/main/narclist/narclist["+i+"]/prcpdd")),"");
  632. //환자번호
  633. sSndMsg += astfPrintOut(245, 75, 34, model.getValue("/root/main/narclist/narclist["+i+"]/pid"),"");
  634. //병실
  635. sSndMsg += astfPrintOut(35, 120, 3, model.getValue("/root/main/narclist/narclist["+i+"]/roomcd"),"");
  636. //환자이름+투약번호
  637. var sPid_Drugno = model.getValue("/root/main/narclist/narclist["+i+"]/patnm")
  638. + " (" + model.getValue("/root/main/narclist/narclist["+i+"]/drugno")+reprint + ")";
  639. sSndMsg += astfPrintOut(210, 120, 3, sPid_Drugno,"");
  640. //선그리기
  641. sSndMsg += astfGraphicBox(10, 155, 450, 0, 3);
  642. //마약코드
  643. sSndMsg += astfPrintOut(30, 170, 3, model.getValue("/root/main/narclist/narclist["+i+"]/prcpcd"),"");
  644. //일용량
  645. sSndMsg += astfPrintOut(250, 170, 4, model.getValue("/root/main/narclist/narclist["+i+"]/prcpvol")+model.getValue("/root/main/narclist/narclist["+i+"]/prcpvolunit"),"");
  646. //일수량
  647. sSndMsg += astfPrintOut(360, 170, 4, model.getValue("/root/main/narclist/narclist["+i+"]/dayprcpqty")+model.getValue("/root/main/narclist/narclist["+i+"]/prcpqtyunit"),"");
  648. //마약명칭
  649. sSndMsg += astfPrintOut(30, 210, 28, "("+model.getValue("/root/main/narclist/narclist["+i+"]/drugnm")+")","");
  650. // 바코드(21자리) : 마약구분(1)+입원/외래구분(1)+반납구분(1)+처방일자(8)+처방번호(10)
  651. var narcflag = model.getValue("/root/main/narclist/narclist["+i+"]/narcflag");
  652. var ioflag = model.getValue("/root/main/narclist/narclist["+i+"]/ioflag");
  653. var returnflag = model.getValue("/root/main/narclist/narclist["+i+"]/returnflag");
  654. if(returnflag ==""){
  655. returnflag = "O";
  656. } else {
  657. returnflag = "D";
  658. }
  659. var prcpdd = model.getValue("/root/main/narclist/narclist["+i+"]/prcpdd");
  660. var prcpno = model.getValue("/root/main/narclist/narclist["+i+"]/prcpno");
  661. var iLen = prcpno.length;
  662. for(var j=iLen; j<10; j++) {
  663. prcpno = "0" + prcpno;
  664. }
  665. var sResult = narcflag+ioflag+returnflag+prcpdd+prcpno;
  666. //바코드(변환)
  667. sSndMsg += astfBarCode_Code39(60, 245, "N", 50, sResult, "S");
  668. //처방입력일시
  669. sSndMsg += astfPrintOut(30, 310, 28, "처방입력일시 : "+fGetDateString(model.getValue("/root/main/narclist/narclist["+i+"]/rgstdt")),"");
  670. sSndMsg += astfEndFormat(0);
  671. CommAX.SendMessage(sSndMsg);
  672. sSndMsg = "";
  673. gTimer = window.setInterval("fStopTimer()",10000);
  674. CommAX.PortClose();
  675. model.refresh();
  676. }
  677. }
  678. }
  679. //submit("TXADT30102");
  680. }
  681. /**
  682. *
  683. */
  684. function fStopTimer() {
  685. window.clearinterval(gTimer);
  686. }
  687. function fGetDateString( s ){
  688. var dates = "";
  689. if(s.length >8){
  690. dates = s.substring(0,4) +"/" +s.substring(4,6)+"/" +s.substring(6,8)+" "+s.substring(8,10)+":"+s.substring(10,12)+":"+s.substring(12,14);
  691. } else {
  692. dates = s.substring(0,4) +"/" +s.substring(4,6)+"/" +s.substring(6,8);
  693. }
  694. return dates;
  695. }
  696. /**
  697. * 반환량입력시
  698. */
  699. function fIptRtnCnts() {
  700. var RtnCnts = model.getValue("/root/main/narclist/narclist["+grd_outnarc.row+"]/rtnqty");
  701. var RtnCnfmDt = model.getValue("/root/main/rtnlist/rtnlist["+grd_outnarc.row+"]/rtncnfmdt");
  702. if(RtnCnts != ""){
  703. //반납의뢰인 약품만 반납처리함
  704. if(RtnCnfmDt != ""){
  705. messageBox("반환완료된 약품","E008");
  706. return;
  707. }
  708. //반납량을 입력하지 않았을 경우
  709. if(RtnCnts == "0"){
  710. messageBox("반환량을","C001");
  711. model.setValue("/root/main/narclist/narclist["+grd_outnarc.row+"]/rtnqty", "");
  712. return;
  713. }
  714. if(isNaN(RtnCnts)){
  715. messageBox("반환량은 숫자로","C001");
  716. model.setValue("/root/main/narclist/narclist["+grd_outnarc.row+"]/rtnqty", "");
  717. return;
  718. }
  719. model.setValue("/root/main/narclist/narclist["+grd_outnarc.row+"]/sel", "Y");
  720. grd_outnarc.row++;
  721. grd_outnarc.isSelected(grd_outnarc.row) = true;
  722. model.refresh();
  723. }
  724. }
  725. /**
  726. * 병동/외래구분 체크시
  727. */
  728. function fChkIOFlag() {
  729. var chk = model.getValue("/root/temp/srchinfo/srchioflag");
  730. if(chk.length == 7){
  731. model.setValue("/root/temp/srchinfo/iototalflag", "T");
  732. } else {
  733. model.setValue("/root/temp/srchinfo/iototalflag", "");
  734. }
  735. model.refresh();
  736. }
  737. function fClearUserID(){
  738. if(model.getValue("/root/temp/userinfo/userinfo/userid") != ""){
  739. model.removeNodeset("/root/temp/srchinfo/srchid");
  740. model.makeNode("/root/temp/srchinfo/srchid");
  741. model.removeNodeset("/root/temp/userinfo/userinfo/userid");
  742. model.makeNode("/root/temp/userinfo/userinfo/userid");
  743. var sUserid = model.getValue("/root/temp/srchinfo/srchid");
  744. model.setValue("/root/temp/userinfo/userinfo/userid","");
  745. model.refresh();
  746. //if(sUserid.length == 8 || sUserid.length == 9 || sUserid.length == 10){
  747. model.setValue("/root/send/userinfo/userid", sUserid);
  748. submit("TRADT30104");
  749. model.removeNodeset("/root/temp/userinfo/userinfo");
  750. model.makeNode("/root/temp/userinfo/userinfo");
  751. model.removeNodeset("/root/temp/userinfo/userinfo/userid");
  752. model.makeValue("/root/temp/userinfo/userinfo/userid", "");
  753. model.removeNodeset("/root/temp/userinfo/userinfo/usernm");
  754. model.makeValue("/root/temp/userinfo/userinfo/usernm", "");
  755. //처방리스트들도 같이 삭제.
  756. model.removeNodeset("/root/main/narclist/narclist");
  757. model.setValue("/root/temp/srchinfo/srchid","");
  758. model.setValue("/root/temp/userinfo/userinfo/usernm", "");
  759. model.refresh();
  760. model.setFocus("input1");
  761. model.refresh();
  762. }
  763. }
  764. /**
  765. * userid 변경시
  766. */
  767. function fChgUserID() {
  768. var sUserid = model.getValue("/root/temp/srchinfo/srchid");
  769. model.setValue("/root/temp/userinfo/userinfo/userid","");
  770. model.refresh();
  771. //if(sUserid.length == 8 || sUserid.length == 9 || sUserid.length == 10){
  772. model.setValue("/root/send/userinfo/userid", sUserid);
  773. submit("TRADT30104");
  774. if(model.getValue("/root/temp/userinfo/userinfo/userid") == ""){
  775. messageBox("사용자ID 정보가 없습니다.\n다시","C001");
  776. model.removeNodeset("/root/temp/userinfo/userinfo");
  777. model.makeNode("/root/temp/userinfo/userinfo");
  778. model.removeNodeset("/root/temp/userinfo/userinfo/userid");
  779. model.makeValue("/root/temp/userinfo/userinfo/userid", "");
  780. model.removeNodeset("/root/temp/userinfo/userinfo/usernm");
  781. model.makeValue("/root/temp/userinfo/userinfo/usernm", "");
  782. model.setValue("/root/temp/srchinfo/srchid","");
  783. model.setValue("/root/temp/userinfo/userinfo/usernm", "");
  784. model.refresh();
  785. model.setFocus("input1");
  786. } else {
  787. model.setValue("/root/temp/srchinfo/srchid","");
  788. //처방리스트 리셋
  789. model.removeNodeset("/root/main/narclist/narclist");
  790. //model.setFocus("input1");
  791. model.refresh();
  792. model.setFocus("input9");
  793. }
  794. //} else {
  795. //messageBox("사용자ID 정보가 다릅니다.\n다시","C001");
  796. //model.setValue("/root/temp/srchinfo/srchid","");
  797. //model.setFocus("input1");
  798. //}
  799. model.refresh();
  800. }
  801. /**
  802. * 약제 담당자 id인지 체크
  803. **/
  804. function fChgUserIDPharm() {
  805. var sUserid = model.getValue("/root/temp/srchinfo/phamid");
  806. model.setValue("/root/send/userinfo/userid", sUserid);
  807. submit("TRADT30104");
  808. if(model.getValue("/root/temp/userinfo/userinfo/grupjoblncd") != "15"){
  809. messageBox("약제 담당자 ID가 아닙니다.\n다시","C001");
  810. model.setValue("/root/temp/srchinfo/phamid","");
  811. model.refresh();
  812. model.setFocus("input3");
  813. } else {
  814. model.setValue("/root/temp/srchinfo/phamid","");
  815. model.refresh();
  816. group4.visible = false;
  817. if ( gTimer1 != null ){
  818. window.clearinterval(gTimer1);
  819. }
  820. window.close() ;
  821. }
  822. }
  823. /**
  824. * 토글클릭시
  825. */
  826. function fClickToggle(chk) {
  827. if(chk == "1"){
  828. model.setValue("/root/temp/srchinfo/srchroot", "M");
  829. } else if(chk == "2"){
  830. model.setValue("/root/temp/srchinfo/srchroot", "R");
  831. }
  832. fChgSwitch();
  833. fGetNarcData();
  834. }
  835. /**
  836. * 입원외래구분 클릭시
  837. */
  838. function fChgIOFlag() {
  839. var ioflag = model.getValue("/root/temp/srchinfo/srchioflag");
  840. if(ioflag == "O"){
  841. model.setValue("/root/temp/srchinfo/drugflag", "");
  842. //rdo_drugflag.visible = false;
  843. } else if(ioflag == "I"){
  844. model.setValue("/root/temp/srchinfo/drugflag", "I");
  845. //rdo_drugflag.visible = true;
  846. }
  847. fChgSwitch();
  848. fGetNarcData();
  849. }
  850. /**
  851. * switch case변경
  852. */
  853. function fChgSwitch() {
  854. var srchroot = model.getValue("/root/temp/srchinfo/srchroot");
  855. var ioflag = model.getValue("/root/temp/srchinfo/srchioflag");
  856. var drugflag = model.getValue("/root/temp/srchinfo/drugflag");
  857. if(srchroot == "M"){
  858. if(ioflag == "O"){
  859. model.toggle("case3");
  860. } else {
  861. if(drugflag == "L"){
  862. model.toggle("case3");
  863. } else {
  864. model.toggle("case1");
  865. }
  866. }
  867. } else if(srchroot == "R"){
  868. model.toggle("case2");
  869. }
  870. model.refresh();
  871. }
  872. /**
  873. * 환자별 조회인지 체크
  874. */
  875. function fChkPatSearch(param_grid) {
  876. var pid = model.getValue("/root/temp/srchinfo/pid");
  877. if(pid != "" && param_grid.rows != 0){
  878. for(var i = param_grid.fixedRows; i < param_grid.rows; i++){
  879. if(model.getValue("/root/main/narclist/narclist["+i+"]/narcstat") != "1"){
  880. model.setValue("/root/main/narclist/narclist["+i+"]/sel", "Y");
  881. }
  882. }
  883. model.refresh();
  884. }
  885. }
  886. /**
  887. * 액팅후 체크표시 cach
  888. */
  889. function fChkCash(chk) {
  890. var pid = model.getValue("/root/temp/srchinfo/pid");
  891. var param_grid = "";
  892. if(switch1.selectedIndex == 0){
  893. param_grid = grd_narclist;
  894. } else {
  895. param_grid = grd_outnarc;
  896. }
  897. if(pid != "" && param_grid.rows != 0){
  898. if(chk == "before"){
  899. model.removeNodeset("/root/temp/chkcashinfo/narclist");
  900. for(var i = param_grid.fixedRows; i < param_grid.rows; i++){
  901. if(model.getValue("/root/main/narclist/narclist["+i+"]/sel") == "Y"){
  902. astfCopyNodeSet("/root/temp/chkcashinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  903. }
  904. }
  905. } else if (chk == "after"){
  906. for(var a = 1; a <= getNodesetCount("/root/temp/chkcashinfo/narclist"); a++){
  907. var cash_prcpdd = model.getValue("/root/temp/chkcashinfo/narclist["+a+"]/prcpdd");
  908. var cash_prcpno = model.getValue("/root/temp/chkcashinfo/narclist["+a+"]/prcpno");
  909. for(var b = param_grid.fixedRows; b < param_grid.rows; b++){
  910. var search_prcpdd = model.getValue("/root/main/narclist/narclist["+b+"]/prcpdd");
  911. var search_prcpno = model.getValue("/root/main/narclist/narclist["+b+"]/prcpno");
  912. if(cash_prcpdd == search_prcpdd && cash_prcpno == search_prcpno){
  913. model.setValue("/root/main/narclist/narclist["+b+"]/sel", "Y");
  914. }
  915. }
  916. }
  917. } else {
  918. }
  919. model.refresh();
  920. }
  921. }
  922. /**
  923. * 백업해 두었던 노드들을 다시 추가 한다.
  924. */
  925. function fSetNarcNodes(pFlag) {
  926. var iDeleteNode = 0;
  927. var sChkYn = "";
  928. var iRowNo = 0;
  929. if(getNodesetCount("/root/temp/bknarclist/narclist") >= 1) {
  930. if(pFlag == "ADD") {
  931. model.removenode("/root/temp/bknarclist2");
  932. model.makeNode("/root/temp/bknarclist2");
  933. model.copyNode("/root/temp/bknarclist2", "/root/main/narclist");
  934. iRowNo = getNodesetCount("/root/main/narclist/narclist");
  935. for(var iRNo = 1 ; iRNo <= getNodesetCount("/root/temp/bknarclist/narclist") ; iRNo++) {
  936. sChkYn = "Y";
  937. //중복처방은 복사하지 않음.
  938. for(var iNo = 1 ; iNo <= getNodesetCount("/root/main/narclist/narclist") ; iNo++) {
  939. if((model.getValue("/root/main/narclist/narclist["+ iNo +"]/prcpdd") == model.getValue("/root/temp/bknarclist/narclist["+ iRNo +"]/prcpdd"))
  940. && (model.getValue("/root/main/narclist/narclist["+ iNo +"]/prcpno") == model.getValue("/root/temp/bknarclist/narclist["+ iRNo +"]/prcpno"))) {
  941. sChkYn = "N";
  942. break;
  943. }
  944. }
  945. if(sChkYn == "Y") {
  946. iRowNo++;
  947. model.makeNode("/root/temp/bknarclist2/narclist["+ iRowNo +"]");
  948. model.copyNode("/root/temp/bknarclist2/narclist["+ iRowNo +"]", "/root/temp/bknarclist/narclist["+ iRNo +"]");
  949. }
  950. }
  951. model.copyNode("/root/main/narclist", "/root/temp/bknarclist2");
  952. model.removenode("/root/temp/bknarclist2");
  953. } if(pFlag == "COPY") {
  954. model.copyNode("/root/main/narclist", "/root/temp/bknarclist");
  955. }
  956. }
  957. model.refresh();
  958. }