SMADT30200.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785
  1. /**
  2. * 파 일 명 : SMADT30200.js
  3. * 설 명 : 마약향정처방관리 Javascriot
  4. * 설 계 자 : 김치국
  5. * 작 성 자 : 김치국
  6. * 수정이력 : 2015.04.22
  7. */
  8. var sNarc_Menu_Param = "";
  9. var sNarc_Dept_Param = "";
  10. var sSMADT30400_Fromdd = "";
  11. /**
  12. * 초기화
  13. */
  14. function fInit() {
  15. var instcd =getUserInfo("dutplceinstcd");
  16. grd_narclist.fixedcellcheckbox(0,1) = true;
  17. //화면구성용 파라미터
  18. sNarc_Menu_Param = getScreenMenuParameter(); // I: 입원 O:외래
  19. //sNarc_Menu_Param = "O";
  20. //상단에서 정보 조회
  21. var node = getGlobalVariable("paminfo");
  22. setCSVToNode("/root/temp/topinfo", node);
  23. if(sNarc_Menu_Param.length > 1){
  24. sNarc_Dept_Param = sNarc_Menu_Param.substr(1,sNarc_Menu_Param.length);
  25. sNarc_Menu_Param = sNarc_Menu_Param.substr(0,1);
  26. }
  27. // 화면구성
  28. //alert(opener.javascript.getParameter("Narc_Menu_Param"));
  29. if (sNarc_Menu_Param == "I") {
  30. model.setValue("/root/temp/srchinfo/srchioflag","I");
  31. } else if(sNarc_Menu_Param == "O"){
  32. model.setValue("/root/temp/srchinfo/srchioflag","O");
  33. } else {
  34. sNarc_Menu_Param = model.getAttribute("Narc_Menu_Param");
  35. if(sNarc_Menu_Param.length > 1){
  36. sNarc_Dept_Param = sNarc_Menu_Param.substr(2,sNarc_Menu_Param.length);
  37. sNarc_Menu_Param = sNarc_Menu_Param.substr(0,1);
  38. }
  39. if (sNarc_Menu_Param == "I") {
  40. model.setValue("/root/temp/srchinfo/srchioflag","I");
  41. } else if(sNarc_Menu_Param == "O"){
  42. model.setValue("/root/temp/srchinfo/srchioflag","O");
  43. } else {
  44. sNarc_Menu_Param = model.getValue("/root/temp/topinfo/list/ioflag");
  45. if (sNarc_Menu_Param == "I") {
  46. model.setValue("/root/temp/srchinfo/srchioflag","I");
  47. } else if(sNarc_Menu_Param == "O"){
  48. model.setValue("/root/temp/srchinfo/srchioflag","O");
  49. } else {
  50. model.setValue("/root/temp/srchinfo/srchioflag","I");
  51. }
  52. }
  53. }
  54. fChgIOFlag();
  55. model.makeValue("/root/hidden/narc_dept", sNarc_Dept_Param);
  56. //마취과, 내시경실 불출부서코드 조회
  57. var narc_dept = "";
  58. if(sNarc_Dept_Param != "") {
  59. submit("TRADT30407");
  60. narc_dept = model.getValue("/root/init/execdeptlist/dept/deptcd");
  61. }
  62. if(sNarc_Dept_Param == "op"){
  63. //마취과에서 연 팝업일경우 불출신청부서 셋팅 N002
  64. //model.setValue("/root/temp/srchinfo/drugdeptcd", "3073100000");
  65. model.setValue("/root/temp/srchinfo/drugdeptcd", narc_dept);
  66. } else if (sNarc_Dept_Param == "esop") {
  67. model.setValue("/root/temp/srchinfo/srchdrugdeptflag", "Y");
  68. cap_n003.value = model.getValue("/root/init/execdeptlist/dept/deptnm"); // 20100114_laboru
  69. //model.setValue("/root/temp/srchinfo/drugdeptcd", "2010302030");
  70. model.setValue("/root/temp/srchinfo/drugdeptcd", narc_dept);
  71. // 2011.03.22 pymi
  72. //내시경실 메뉴는 무조건 외래에 부서는 내시경 검사실로 세팅
  73. if(model.getValue("/root/temp/srchinfo/srchioflag") == "O") {
  74. model.setValue("/root/temp/srchinfo/srchdutplcecd", narc_dept);
  75. }
  76. // (e)
  77. }
  78. model.setAttribute("Narc_Menu_Param", "");
  79. //구분 초기화(전체)
  80. model.setValue("/root/temp/srchinfo/narcflag", "M");
  81. model.setValue("/root/temp/srchinfo/srchdrugkind", "I");
  82. model.setValue("/root/temp/srchinfo/drugflag", "I");
  83. // fChkIOTotal();
  84. model.setValue("/root/temp/srchinfo/narcstat", "T");
  85. // rdo_cncl.disabled = true;
  86. model.setValue("/root/temp/srchinfo/cnclstat", "");
  87. // rdo_rtn.disabled = true;
  88. model.setValue("/root/temp/srchinfo/rtnstat", "");
  89. model.setValue("/root/temp/srchinfo/narctypeflag", "T");
  90. model.setValue("/root/temp/srchinfo/srchioflag", "I");
  91. model.setValue("/root/temp/srchinfo/drugkind", "I");
  92. fChgIOFlag();
  93. //토글초기화
  94. //model.setValue("/root/temp/srchinfo/srchroot", "M");
  95. //model.toggle("case1");
  96. //조회날짜 초기화
  97. //model.setValue("/root/temp/srchinfo/fst_dd", getCurrentDate());
  98. //model.setValue("/root/temp/srchinfo/last_dd", getCurrentDate());
  99. //카덱스에서 시작일자를 넘겨줌_20090513_SMY
  100. sSMADT30400_Fromdd = model.getAttribute("SMADT30400_Fromdd");
  101. if(sSMADT30400_Fromdd != ""){
  102. model.setValue("/root/temp/srchinfo/fst_dd", sSMADT30400_Fromdd);
  103. }else{
  104. model.setValue("/root/temp/srchinfo/fst_dd", getCurrentDate());
  105. }
  106. model.setValue("/root/temp/srchinfo/last_dd", getCurrentDate());
  107. model.setAttribute("SMADT30400_Fromdd", "");
  108. //로그인 사용자 셋팅
  109. var userid = getUserId();
  110. model.setValue("/root/temp/srchinfo/srchid", userid);
  111. fChgUserID();
  112. fGetNarcData();
  113. //환자별 조회라면 체크 표시
  114. //fChkPatSearch(); // -- 오류 발생으로 인한 자동체크 기능 막음(간호 마약/항정약 처방관리 화면에서 쓰던 로직을 그대로 반영해서 발생 _2015.12.31_by.Shaun
  115. model.setValue("/root/temp/userinfo/userinfo/userdeptcd", getUserInfo("dutplcecd"));
  116. model.setValue("/root/temp/userinfo/userinfo/userdeptnm", getUserInfo("dutplcenm"));
  117. model.setValue("/root/temp/srchinfo/drugdeptcd", model.getValue("/root/temp/userinfo/userinfo/userdeptcd"));
  118. model.setValue("/root/temp/srchinfo/drugdeptnm", model.getValue("/root/temp/userinfo/userinfo/userdeptnm"));
  119. model.refresh();
  120. }
  121. /**
  122. * 병동변경시 병실 조회
  123. */
  124. function fSrchRoomCD(){
  125. model.setValue("/root/temp/srchinfo/srchpid", "");
  126. model.setValue("/root/temp/srchinfo/srchpatnm", "");
  127. model.setValue("/root/temp/srchinfo/srchroomcd", "");
  128. model.setValue("/root/send/srchcond/wardcd", model.getValue("/root/temp/srchinfo/srchward"));
  129. model.setValue("/root/send/srchcond/deptflag", "2");
  130. submit("TRADT30404");
  131. }
  132. /**
  133. * 마약리스트 조회
  134. */
  135. function fGetNarcData() {
  136. initGridStyle("grd_narclist");
  137. grd_narclist.fixedcellischeck(0, 1) = false;
  138. model.removeNode("/root/send/srchinfo");
  139. model.makeNode("/root/send/srchinfo");
  140. model.copyNode("/root/send/srchinfo","/root/temp/srchinfo");
  141. if( model.getValue("/root/temp/srchinfo/prtab") == "Y") { // 향정반환반납장부 출력조건 2009.05.18 pymi
  142. model.setValue("/root/send/srchinfo/cnclflag", "Y");
  143. model.setValue("/root/send/srchinfo/rtnflag", "Y");
  144. model.setValue("/root/send/srchinfo/rtnstat", "T");
  145. model.setValue("/root/send/srchinfo/cnclstat", "T");
  146. model.setValue("/root/send/srchinfo/narcstat", "");
  147. }
  148. // (e)
  149. // alert("row:226 Call");
  150. submit("TRADT30105");
  151. submit("TRADT30402");
  152. //fBtnDisable();
  153. ///2015년 5월11 일 김치국
  154. for(var i = grd_narclist.fixedRows; i < grd_narclist.rows; i++){
  155. // if ( model.getValue("/root/main/narclist/narclist["+(i-1)+"]/narcflag") =="H" ){
  156. // grd_narclist.isReadOnly( i, grd_narclist.colRef("sel") )=false;
  157. // } else {
  158. // grd_narclist.isReadOnly( i, grd_narclist.colRef("sel") )=false;
  159. // }
  160. // if ( model.getValue("/root/main/narclist/narclist["+(i-1)+"]/prcpkindcd") =="35" ){
  161. // grd_narclist.cellStyle("background-color", i, grd_narclist.colRef("drugnm")) = "#c8e67b";
  162. // }
  163. if(fChkEndYN(i)) {
  164. grd_narclist.isReadOnly( i, grd_narclist.colRef("sel"))=true;
  165. } else {
  166. grd_narclist.isReadOnly( i, grd_narclist.colRef("sel"))=false;
  167. }
  168. // grd_narclist.refresh();
  169. }
  170. ///////
  171. //색깔처리
  172. setCellStyle("grd_narclist" , "6" , "0" , "cnclstat", "equal");
  173. setCellStyle("grd_narclist" , "6" , "0" , "rtnstat", "equal");
  174. grd_narclist.refresh();
  175. }
  176. function fChkEndYN(row){
  177. //더이상 진행될 처방이 아닌 경우 선택박스 비활성화_20090509_SMY
  178. var narcstat = model.getValue("/root/main/narclist/narclist["+(row)+"]/narcstat"); //불출상태
  179. var cnclstat = model.getValue("/root/main/narclist/narclist["+(row)+"]/cnclstat"); //반환상태
  180. var rtnstat = model.getValue("/root/main/narclist/narclist["+(row)+"]/rtnstat"); //잔량반납상태
  181. var narcflag = model.getValue("/root/main/narclist/narclist["+(row)+"]/narcflag"); //불출상태
  182. var drugno = model.getValue("/root/main/narclist/narclist["+(row)+"]/drugno"); //투약번호
  183. var vname = model.getValue("/root/main/narclist/narclist["+(row)+"]/patnm"); //불출상태
  184. /* 진행완료 상태의 항목들 선택박스 비활성화
  185. 1. 부서확인 (정상종료의 경우)
  186. 2. 반환확인 (부서확인 이후 반환신청이 가능, 잔량 없을 경우)
  187. 3. 잔량확인 (정상종료이면서 잔량이 생성된 처방인 경우)
  188. 4. 반환확인 & 잔량확인 (PO의 경우 횟수처방이 가능하기 때문에 부분 반환이 가능함. 반환량과 잔량이 동시에 생성될 수 있음)
  189. 5. 반환종료 (불출 이전에 DC된 경우 * 단, all 반환일때만)
  190. 6. 향정의 경우 미신청이면서 투약번호가 없을때 (향정은 약국에서만 마감가능하고, 간호에서 미신청일때도 투약기록 가능)
  191. * 과거 처방중 투약번호가 있으면서 미신청인 항목이 존재하기 때문에 투약번호 존재여부 조건을 줌. */
  192. // if( (narcstat == "6" && cnclstat == "" && rtnstat == "")
  193. // || (narcstat == "6" && rtnstat == "")
  194. // || (cnclstat == "" && rtnstat == "2") || (cnclstat == "2" && rtnstat == "2")
  195. // || (cnclstat == "7")
  196. // || (narcflag == "H" && narcstat == "1" && drugno == '')){
  197. // return true;
  198. // }else return false;
  199. if(
  200. (narcstat != "6" )
  201. || ((narcstat == "6" && cnclstat == "2") || (narcstat == "6" && cnclstat == "7") )
  202. || (narcstat == "6" && rtnstat == "2")
  203. //(narcstat == "6" && cnclstat == "" && rtnstat == "")
  204. // || (narcstat == "6" && cnclstat == "" && rtnstat == "1")
  205. // || (narcstat == "6" && rtnstat == "1")
  206. // || (cnclstat == "2" && rtnstat == "")
  207. // || (cnclstat == "" && rtnstat == "2") || (cnclstat == "2" && rtnstat == "2")
  208. // || (cnclstat == "7")
  209. // || (narcflag == "H" && narcstat == "1" && drugno == ''))
  210. ){
  211. return true;
  212. }else return false; ///-- alert(row + ":"+vname+" ok");
  213. }
  214. /**
  215. * 바코드 변경시
  216. */
  217. function fChgBarcode() {
  218. model.setValue("/root/temp/srchinfo/srchpid", "");
  219. model.setValue("/root/temp/srchinfo/srchpatnm", "");
  220. model.setValue("/root/temp/srchinfo/srchward", "");
  221. model.setValue("/root/temp/srchinfo/srchroomcd", "");
  222. var sBar = model.getValue("/root/temp/srchinfo/barcode");
  223. if(sBar.length >= 21){
  224. if(model.getValue("/root/temp/userinfo/userinfo/userid") == ""){
  225. messageBox("사용자ID가 없습니다. 사용자ID부터","C001");
  226. //model.setValue("/root/temp/srchinfo/srchid","");
  227. model.setFocus("input1");
  228. } else if(sBar.substr(0,1) != "M"){
  229. messageBox("바코드 정보가 다릅니다. 바코드를 다시","C001");
  230. model.setValue("/root/temp/srchinfo/barcode","");
  231. model.setFocus("input9");
  232. } else {
  233. //바코드로 먼저 해당처방을 조회함
  234. fGetNarcData();
  235. //바코드로 Acting처리가 가능한 처방인지 체크함
  236. //바코드로 처리가능한 Acting : 부서확인
  237. //바코드로 조회시 데이터는 한건만 조회됨.
  238. if(model.getValue("/root/main/narclist/narclist["+1+"]/narcstat")=="5"){
  239. //불출상태가 아니면 부서확인을 할수없음.조회만가능
  240. //반환바코드는 약국에서 출력하므로 로직에서 제외함
  241. model.setValue("/root/main/narclist/narclist["+1+"]/sel","Y");
  242. fNarcActing("acpt");
  243. }
  244. }
  245. } else {
  246. messageBox("바코드 정보가 다릅니다.\n다시","C001");
  247. model.setValue("/root/temp/srchinfo/barcode","");
  248. model.setFocus("input9");
  249. }
  250. model.refresh();
  251. }
  252. function fCountStat(sActing){
  253. if(sActing == "drug") narcstat = "2"; // 불출신청
  254. if(sActing == "drugcncl") narcstat = "1"; // 불출취소
  255. if(sActing == "acpt") narcstat = ""; // 부서확인
  256. if(sActing == "rtn") narcstat = ""; // 반환신청
  257. if(sActing == "spre") narcstat = ""; // 잔량확인
  258. if(sActing == "sprein") narcstat = ""; // 잔량신청
  259. for(var i=grd_narclist.fixedRows; i < grd_narclist.rows; i++){
  260. }
  261. }
  262. /**
  263. * 마약 Acting 버튼 클릭시
  264. */
  265. function fNarcActing(sActing) {
  266. if(model.getValue("/root/temp/userinfo/userinfo/userid") == ""){
  267. messageBox("사용자ID가 없습니다. 사용자ID를","C001");
  268. model.setValue("/root/temp/srchinfo/barcode","");
  269. model.setFocus("input1");
  270. model.refresh();
  271. return;
  272. }
  273. if(model.getValue("/root/temp/srchinfo/drugdeptcd") == ""){
  274. messageBox("잔량신청부서가 없습니다. 잔량신청부서를","C001");
  275. model.setValue("/root/temp/srchinfo/barcode","");
  276. model.setFocus("input1");
  277. model.refresh();
  278. return;
  279. }
  280. model.removeNodeset("/root/send/narcinfo/narclist");
  281. var iSel_Cnt = 0;
  282. var iActing_Cnt = 0;
  283. var sActing_nm = "";
  284. var sActing_After = "";
  285. var iRtn_Cnt = 0;
  286. var iRtn_Chk = 0;
  287. var issmsg = "";
  288. //액팅전 체크표시 cash
  289. fChkCash("before");
  290. for(var i=grd_narclist.fixedRows; i < grd_narclist.rows; i++){
  291. var sel = model.getValue("/root/main/narclist/narclist["+(i)+"]/sel");
  292. var sNarcStat = model.getValue("/root/main/narclist/narclist["+(i)+"]/narcstat");
  293. var sCnclStat = model.getValue("/root/main/narclist/narclist["+(i)+"]/cnclstat");
  294. var sRtnStat = model.getValue("/root/main/narclist/narclist["+(i)+"]/rtnstat");
  295. var ioflag = model.getValue("/root/temp/srchinfo/srchioflag");
  296. var sInclprcpcd = model.getValue("/root/main/narclist/narclist["+(i)+"]/inclprcpcd");
  297. var issdeptcd = model.getValue("/root/main/narclist/narclist["+(i)+"]/issdeptcd");
  298. var deptchgyn = model.getValue("/root/main/narclist/narclist["+(i)+"]/deptchgyn");
  299. var vprcpcd = model.getValue("/root/main/narclist/narclist["+(i)+"]/prcpcd");
  300. if(sel == 'Y'){
  301. if ( sActing =="rtn" ){
  302. //alert("spre");
  303. if(sCnclStat != "0" || sNarcStat == "5"){
  304. //alert("rtn");
  305. sActing="spre";
  306. }
  307. }
  308. iSel_Cnt++;
  309. if(sActing == "drug"){
  310. if(sNarcStat == "1"){
  311. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+(i-1)+"]");
  312. //model.makeValue("/root/send/narcinfo/narclist["+getNodesetCount("/root/send/narcinfo/narclist")+"]/acting_after", "-");
  313. iActing_Cnt++;
  314. //수행부서와 다른 부서의 간호사가 불출신청을 할 경우 안내 팝업(M-SET제외)_20090509_SMY
  315. //if((sInclprcpcd == "-" || sInclprcpcd == "") && issdeptcd != getUserInfo("dutplcecd")){
  316. if(deptchgyn == "Y" && issdeptcd != getUserInfo("dutplcecd")){
  317. issmsg = "Y";
  318. }
  319. }
  320. sActing_nm = "불출신청";
  321. } else if(sActing == "drugcncl"){
  322. if(sNarcStat == "2"){
  323. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+(i-1)+"]");
  324. //model.makeValue("/root/send/narcinfo/narclist["+getNodesetCount("/root/send/narcinfo/narclist")+"]/acting_after", "-");
  325. iActing_Cnt++;
  326. }
  327. sActing_nm = "불출취소";
  328. } else if(sActing == "acpt"){
  329. if(sNarcStat == "5"){
  330. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+(i-1)+"]");
  331. //model.makeValue("/root/send/narcinfo/narclist["+getNodesetCount("/root/send/narcinfo/narclist")+"]/acting_after", "-");
  332. iActing_Cnt++;
  333. }
  334. sActing_nm = "부서확인";
  335. } else if(sActing == "spre"){
  336. if(sRtnStat == "1" && sNarcStat == "6"){
  337. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+(i-1)+"]");
  338. iActing_Cnt++;
  339. if(sCnclStat == "0" && sNarcStat != "5"){
  340. var vb_prcpcd = model.getValue("/root/main/narclist/narclist["+(i-1)+"]/prcpcd");
  341. model.makeValue("/root/send/narcinfo/narclist["+getNodesetCount("/root/send/narcinfo/narclist")+"]/acting_after", "rtn");
  342. } else {
  343. model.makeValue("/root/send/narcinfo/narclist["+getNodesetCount("/root/send/narcinfo/narclist")+"]/acting_after", "-");
  344. }
  345. }
  346. sActing_nm = "반납/반환신청";
  347. if(sNarcStat != "6"){
  348. iRtn_Cnt++;
  349. }
  350. } else if(sActing == "sprein"){
  351. var Pprcpvol = model.getValue("/root/main/narclist/narclist["+(i)+"]/prcpvol");
  352. var Psprevol = model.getValue("/root/main/narclist/narclist["+(i)+"]/sprevol");
  353. var totdrugqty = model.getValue("/root/main/narclist/narclist["+(i)+"]/totdrugqty");
  354. if ( Psprevol == 0 ) {
  355. for(var i=grd_narclist.fixedRows; i < grd_narclist.rows; i++){
  356. var sel = model.getValue("/root/main/narclist/narclist["+(i)+"]/sel");
  357. if(sel == 'Y'){
  358. model.setValue("/root/main/narclist/narclist["+(i)+"]/rtnstat","");
  359. }
  360. }
  361. messageBox("신청잔량이 0","I009");
  362. return;
  363. }
  364. //alert(parseFloat(Pprcpvol));
  365. //alert(parseFloat(Psprevol) * parseFloat(totdrugqty));
  366. if ( parseFloat(Pprcpvol) <= (parseFloat(Psprevol) * parseFloat(totdrugqty)) ) {
  367. for(var i=grd_narclist.fixedRows; i < grd_narclist.rows; i++){
  368. var sel = model.getValue("/root/main/narclist/narclist["+(i)+"]/sel");
  369. if(sel == 'Y'){
  370. model.setValue("/root/main/narclist/narclist["+(i)+"]/rtnstat","");
  371. }
  372. }
  373. messageBox(vprcpcd +"코드가 총용량보다 잔량신청량이 작아야","I006");
  374. return;
  375. }
  376. var PRtncnts = model.getValue("/root/main/narclist/narclist["+(i)+"]/rtncnts");
  377. if ( PRtncnts == "") {
  378. for(var i=grd_narclist.fixedRows; i < grd_narclist.rows; i++){
  379. var sel = model.getValue("/root/main/narclist/narclist["+(i)+"]/sel");
  380. if(sel == 'Y'){
  381. model.setValue("/root/main/narclist/narclist["+(i)+"]/rtnstat","");
  382. }
  383. }
  384. messageBox("잔량신청 사유가 있어야 ","I006");
  385. return;
  386. }
  387. if(sRtnStat == "1" && sNarcStat == "6"){
  388. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+(i)+"]");
  389. iActing_Cnt++;
  390. if(sCnclStat == "0" && sNarcStat != "5"){
  391. var vb_prcpcd = model.getValue("/root/main/narclist/narclist["+(i)+"]/prcpcd");
  392. model.makeValue("/root/send/narcinfo/narclist["+getNodesetCount("/root/send/narcinfo/narclist")+"]/acting_after", "rtn");
  393. } else {
  394. model.makeValue("/root/send/narcinfo/narclist["+getNodesetCount("/root/send/narcinfo/narclist")+"]/acting_after", "-");
  395. }
  396. }
  397. sActing_nm = "반납/반환신청";
  398. if(sNarcStat != "6"){
  399. iRtn_Cnt++;
  400. }
  401. } else if(sActing == "SpreCncl"){ // ***잔량신청 취소***
  402. if(sRtnStat == "1" ){ // [잔량신청 취소] 일 때
  403. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+i+"]");
  404. //alert(model.getValue("/root/main/narclist/narclist["+(i)+"]/sprevol"));
  405. iActing_Cnt++;
  406. }
  407. sActing_nm = "잔량신청취소";
  408. } else if(sActing == "rtn"){
  409. if(sCnclStat == "0" && sNarcStat != "5"){
  410. astfCopyNodeSet("/root/send/narcinfo/narclist", "/root/main/narclist/narclist["+(i-1)+"]");
  411. iActing_Cnt++;
  412. if(sRtnStat == "0" && sNarcStat == "6"){
  413. var vb_prcpcd = model.getValue("/root/main/narclist/narclist["+(i-1)+"]/prcpcd");
  414. model.makeValue("/root/send/narcinfo/narclist["+getNodesetCount("/root/send/narcinfo/narclist")+"]/acting_after", "spre");
  415. } else {
  416. model.makeValue("/root/send/narcinfo/narclist["+getNodesetCount("/root/send/narcinfo/narclist")+"]/acting_after", "-");
  417. if(model.getValue("/root/main/narclist/narclist["+(i-1)+"]/returnqty") == ""){
  418. iRtn_Chk = 2;
  419. }
  420. }
  421. }
  422. sActing_nm = "반납/반환신청";
  423. if(sNarcStat == "5"){
  424. iRtn_Cnt++;
  425. }
  426. }
  427. }
  428. }
  429. if(iSel_Cnt == 0){
  430. messageBox("선택된 데이터가","I004");
  431. return;
  432. } else if(iActing_Cnt == 0){
  433. if (iRtn_Cnt != 0){
  434. //if(ioflag == "O") { //주석처리_20090512_SMY
  435. messageBox("부서확인 이후에 "+sActing_nm+"이","I006");
  436. return;
  437. //}
  438. } else if(iRtn_Chk == 2){
  439. messageBox("투약기록에서 반환처리 이후에 "+sActing_nm+"이","I006");
  440. return;
  441. }
  442. /*else if(model.getValue("/root/temp/srchinfo/barcode") == ""){
  443. messageBox("선택된 데이터중에 "+sActing_nm+"할 데이터가","I004");
  444. return;
  445. } else if(model.getValue("/root/temp/srchinfo/barcode") != ""){
  446. messageBox("이미","I001");
  447. model.setValue("/root/temp/srchinfo/barcode","");
  448. model.setFocus("input9");
  449. model.refresh();
  450. return;
  451. }*/
  452. }
  453. // debugger;
  454. var msg_val = 6;
  455. if(sActing == "drug"){
  456. //msg_val = messageBox(model.getValue("/root/temp/srchinfo/drugdeptnm")+"(으)로 불출신청","S001");
  457. //수행부서와 다른 부서의 간호사가 불출신청을 할 경우 안내 팝업(M-SET제외)_20090509_SMY
  458. if(issmsg == "Y"){
  459. msg_val = messageBox("수행부서가 "+ getUserInfo("dutplcenm") + "(으)로 변경되어 신청됩니다.","I");
  460. }
  461. msg_val = 6;
  462. } else if(sActing == "spre"){
  463. msg_val = messageBox(model.getValue("/root/temp/srchinfo/drugdeptnm")+"(으)로 잔량확인","Q003");
  464. } else if(sActing == "sprein"){
  465. // msg_val = messageBox(model.getValue("/root/temp/srchinfo/drugdeptnm")+"(으)로 잔량신청","Q003");
  466. msg_val = messageBox("마약,향정 잔량신청을 ","Q003");
  467. } else if(sActing == "rtn"){
  468. msg_val = messageBox(model.getValue("/root/temp/srchinfo/drugdeptnm")+"(으)로 반환신청","Q003");
  469. }
  470. if(msg_val == 6){
  471. model.copyNode("/root/send/narcinfo/srchinfo","/root/temp/srchinfo");
  472. model.copyNode("/root/send/narcinfo/userinfo","/root/temp/userinfo/userinfo");
  473. model.makeValue("/root/send/narcinfo/srchinfo/acting", sActing);
  474. // alert("SMADT30200.JS Row:463 TXADT30401 Call ");
  475. if(sActing == "SpreCncl"){
  476. if(submit("TXADT30101")) {
  477. // alert("SMADT30200.JS Row:463 TXADT30101 Call ");
  478. grd_narclist.fixedcellischeck(0, 1) = false;
  479. var count = model.getValue("/root/main/narclist/ret/count");
  480. messageBox(iActing_Cnt+"건의 데이터가 "+sActing_nm,"I001");
  481. grd_narclist.rebuildStyle();
  482. }
  483. } else {
  484. if(submit("TXADT30401")) {
  485. // alert("SMADT30200.JS Row:463 TXADT30401 Call ");
  486. grd_narclist.fixedcellischeck(0, 1) = false;
  487. var count = model.getValue("/root/main/narclist/ret/count");
  488. messageBox(iActing_Cnt+"건의 데이터가 "+sActing_nm,"I001");
  489. grd_narclist.rebuildStyle();
  490. }
  491. }
  492. //submit("TXADT30101"); TXADT30401
  493. }
  494. //액팅전 체크표시 다시 표시
  495. fChkCash("after");
  496. //재조회_20090512_SMY
  497. fGetNarcData();
  498. }
  499. /**
  500. * userid 변경시
  501. */
  502. function fChgUserID() {
  503. var sUserid = model.getValue("/root/temp/srchinfo/srchid");
  504. //----------------(20100621:경북대)
  505. //if(sUserid.length == 8 || sUserid.length == 9 || sUserid.length == 10){
  506. //----------------(20100621)
  507. model.setValue("/root/send/userinfo/userid", sUserid);
  508. submit("TRADT30403");
  509. if(model.getValue("/root/temp/userinfo/userinfo/userid") == ""){
  510. messageBox("사용자ID 정보가 없습니다.\n다시","C001");
  511. //model.setValue("/root/temp/srchinfo/srchid","");
  512. model.setFocus("input1");
  513. } else {
  514. //model.setValue("/root/temp/srchinfo/srchid","");
  515. model.setFocus("input1");
  516. model.refresh();
  517. model.setFocus("input9");
  518. }
  519. //----------------(20100621:경북대)
  520. //} else {
  521. // messageBox("사용자ID 정보가 다릅니다.\n다시","C001");
  522. // //model.setValue("/root/temp/srchinfo/srchid","");
  523. // model.setFocus("input1");
  524. //}
  525. //----------------(20100621:경북대)
  526. model.refresh();
  527. }
  528. //외래 부서구분 변경시
  529. function fChgOutDept() {
  530. var sDeptcd = model.getValue("/root/temp/srchinfo/srchdutplcenm");
  531. model.setValue("/root/send/dutdeptinfo/deptcd", sDeptcd);
  532. submit("TRADT30405");
  533. if(model.getValue("/root/temp/dutdeptinfo/dept/deptcd") == ""){
  534. messageBox("조회된 부서 정보가 없습니다.\n다시","C001");
  535. model.setValue("/root/temp/srchinfo/srchdutplcenm","");
  536. model.setFocus("input2");
  537. } else {
  538. rdo_dutdept.visible = true;
  539. if(getNodesetCount("/root/temp/dutdeptinfo/dept") == 1 ){
  540. model.setValue("/root/temp/srchinfo/srchdutplcenm",model.getValue("/root/temp/dutdeptinfo/dept/deptnm"));
  541. model.setValue("/root/temp/srchinfo/srchdutplcecd",model.getValue("/root/temp/dutdeptinfo/dept/deptcd"));
  542. rdo.dutdept.visible = false;
  543. }
  544. }
  545. model.refresh();
  546. }
  547. /**
  548. * 입원외래구분 변경시
  549. */
  550. function fChgIOFlag(){
  551. var ioflag = model.getValue("/root/temp/srchinfo/srchioflag");
  552. // 화면구성
  553. if (ioflag == "I") {
  554. model.setValue("/root/temp/srchinfo/srchioflag","I");
  555. model.toggle("case3");
  556. model.setValue("/root/temp/srchinfo/drugkind", "I");
  557. rdo_drugkind.visible = true;
  558. combo5.visible = true;
  559. combo4.visible = true;
  560. caption7.text = '병동 :';
  561. caption6.visible = true;
  562. combo1.visible = false;
  563. //병동 Combo 조회
  564. model.makeValue("/root/send/srchcond/deptflag", "W");
  565. model.makeValue("/root/send/srchcond/narcflag", "M");
  566. submit("TRADT30401");
  567. model.copyNode("/root/temp/drugdeptinfo","/root/temp/srchcond"); //불출신청부서 셋팅
  568. astfAddCombo("/root/temp/srchcond", "dept", "deptcd,deptnm", ",");
  569. model.refresh();
  570. //상단에서 정보 조회
  571. //var node = getGlobalVariable("paminfo");
  572. //setCSVToNode("/root/temp/topinfo", node);
  573. if(model.getValue("/root/temp/topinfo/list/wardcd") != ""){
  574. model.setValue("/root/temp/srchinfo/srchward", model.getValue("/root/temp/topinfo/list/wardcd"));
  575. model.refresh();
  576. if(combo1.label == ""){
  577. model.setValue("/root/temp/srchinfo/srchward", "");
  578. } else {
  579. fSrchRoomCD();
  580. model.setValue("/root/temp/srchinfo/srchroomcd", model.getValue("/root/temp/topinfo/list/roomcd"));
  581. model.refresh();
  582. if(combo3.label == "") model.setValue("/root/temp/srchinfo/srchroomcd", "");
  583. }
  584. }
  585. combo2.select(1);//그외 적용일자
  586. } else if(ioflag == "O"){
  587. model.setValue("/root/temp/srchinfo/srchioflag","O");
  588. model.toggle("case4");
  589. rdo_drugkind.visible = false;
  590. //
  591. combo5.visible = false;
  592. combo4.visible = false;
  593. caption7.text = '부서 :';
  594. caption6.visible = false;
  595. combo1.visible = true;
  596. model.setValue("/root/temp/srchinfo/drugkind", "I"); //외래는 주사만 보여짐
  597. //
  598. //외래용 시행부서 조회
  599. model.makeValue("/root/send/dutdeptinfo/deptcd", "");
  600. submit("TRADT30405");
  601. model.copyNode("/root/temp/drugdeptinfo","/root/temp/dutdeptinfo"); //불출신청부서 셋팅
  602. astfAddCombo("/root/temp/dutdeptinfo", "dept", "deptcd,deptnm", ",전체");
  603. var dutplcecd = getUserInfo("dutplcecd");
  604. var dutplcenm = getUserInfo("dutplcenm");
  605. model.setValue("/root/temp/srchinfo/srchdutplcecd", dutplcecd);
  606. model.setValue("/root/temp/srchinfo/srchdutplcenm", dutplcenm);
  607. if(combo4.label == ""){
  608. model.setValue("/root/temp/srchinfo/srchdutplcecd", "");
  609. }
  610. if(model.getValue("/root/temp/topinfo/list/pid") != ""){
  611. model.setValue("/root/temp/srchinfo/srchpid",model.getValue("/root/temp/topinfo/list/pid"));
  612. model.setValue("/root/temp/srchinfo/srchpatnm",model.getValue("/root/temp/topinfo/list/hngnm"));
  613. }
  614. if(model.getValue("/root/temp/srchinfo/narcflag") == "H") {
  615. combo2.select(2);//외래향정일때 실시일자
  616. } else {
  617. combo2.select(1);//그외 적용일자
  618. }
  619. //외래일경우 병동은 클리어
  620. model.setValue("/root/temp/srchinfo/srchward", "");
  621. model.setValue("/root/temp/srchinfo/srchdeptcd", "");
  622. }
  623. if(model.getValue("/root/temp/topinfo/list/pid") != ""){
  624. model.setValue("/root/temp/srchinfo/srchpid",model.getValue("/root/temp/topinfo/list/pid"));
  625. model.setValue("/root/temp/srchinfo/srchpatnm",model.getValue("/root/temp/topinfo/list/hngnm"));
  626. } else {
  627. model.setValue("/root/temp/srchinfo/srchward", getUserInfo("dutplcecd"));
  628. }
  629. model.refresh();
  630. }
  631. /**
  632. * 환자별 조회인지 체크
  633. */
  634. function fChkPatSearch() {
  635. var pid = model.getValue("/root/temp/srchinfo/srchpid");
  636. if(pid != "" && grd_narclist.rows != 0){
  637. for(var i = grd_narclist.fixedRows; i < grd_narclist.rows; i++){
  638. if ( model.getValue("/root/main/narclist/narclist["+(i-1)+"]/prcpno")== model.getValue("/root/temp/srchinfo/chkprcpno") ){
  639. if(!fChkEndYN(i)) model.setValue("/root/main/narclist/narclist["+(i-1)+"]/sel", "Y"); // 2009-06-09 김귀남
  640. }
  641. }
  642. model.refresh();
  643. }
  644. }
  645. /**
  646. * 액팅후 체크표시 cach
  647. */
  648. function fChkCash(chk) {
  649. var pid = model.getValue("/root/temp/srchinfo/srchpid");
  650. if(pid != "" && grd_narclist.rows != 0){
  651. if(chk == "before"){
  652. model.removeNodeset("/root/temp/chkcashinfo/narclist");
  653. for(var i = grd_narclist.fixedRows; i < grd_narclist.rows; i++){
  654. if(model.getValue("/root/main/narclist/narclist["+(i-1)+"]/sel") == "Y"){
  655. astfCopyNodeSet("/root/temp/chkcashinfo/narclist", "/root/main/narclist/narclist["+(i-1)+"]");
  656. }
  657. }
  658. } else if (chk == "after"){
  659. for(var a = 1; a <= getNodesetCount("/root/temp/chkcashinfo/narclist"); a++){
  660. var cash_prcpdd = model.getValue("/root/temp/chkcashinfo/narclist["+a+"]/prcpdd");
  661. var cash_prcpno = model.getValue("/root/temp/chkcashinfo/narclist["+a+"]/prcpno");
  662. for(var b = grd_narclist.fixedRows; b < grd_narclist.rows; b++){
  663. var search_prcpdd = model.getValue("/root/main/narclist/narclist["+b+"]/prcpdd");
  664. var search_prcpno = model.getValue("/root/main/narclist/narclist["+b+"]/prcpno");
  665. if(cash_prcpdd == search_prcpdd && cash_prcpno == search_prcpno){
  666. model.setValue("/root/main/narclist/narclist["+b+"]/sel", "Y");
  667. }
  668. }
  669. }
  670. } else {
  671. }
  672. model.refresh();
  673. }
  674. }
  675. /**
  676. * 마약/향정체크시 버튼 변경
  677. */
  678. function fBtnDisable(){
  679. if(model.getValue("/root/temp/srchinfo/narcflag") != "M"){
  680. btn_drug.disabled = true; // 불출신청 비활성화
  681. btn_drugcncl.disabled = true; // 불출취소 비활성화
  682. }else{
  683. btn_drug.disabled = false; // 불출신청 활성화
  684. btn_drugcncl.disabled = false; // 불출취소 활성화
  685. }
  686. model.refresh();
  687. }