SMADT20300.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785
  1. /**
  2. * 파 일 명 : SMADT20300.js
  3. * 설 명 : 특조 처방전/조제표/집계표/라벨 출력 Javascriot
  4. * 설 계 자 : 이훈재
  5. * 작 성 자 : 이훈재
  6. * 수정이력 : 2006.9.29 / 최초작성 / 이훈재
  7. */
  8. //조회조건에 맞는 데이터가 있는지를 chk
  9. var chk_drugno = 0;
  10. var chk_wardcd = 0;
  11. var chk_pid = 0;
  12. var chk_cnt = 0;
  13. /**
  14. * 초기화
  15. */
  16. function fInit() {
  17. //특수조제실분리
  18. var drugflag = getScreenMenuParameter();
  19. model.setValue("/root/hidden/srchinfo/drugflag", drugflag);
  20. if(drugflag == "" || drugflag == "null") {
  21. model.setValue("/root/hidden/srchinfo/drugflag", "S");
  22. }
  23. grd_prcplist.fixedcellcheckbox(0,grd_prcplist.colRef("sel")) = true;
  24. grd_sumlist.fixedcellcheckbox(0,grd_sumlist.colRef("sel")) = true;
  25. model.setValue("/root/hidden/srchinfo/drugdd", getCurrentDate());
  26. model.setValue("/root/hidden/srchinfo/drugkindall", "Y");
  27. model.setValue("/root/hidden/srchinfo/drugkind", "D|B|T|C|1");
  28. model.setValue("/root/hidden/srchinfo/instcd", getUserInfo("dutplceinstcd"));
  29. if(model.getValue("/root/hidden/srchinfo/instcd") == ""){
  30. model.setValue("/root/hidden/srchinfo/instcd", "012");
  31. }
  32. if(model.getValue("/root/hidden/srchinfo/ioflag") == "O") {
  33. ipt_wardnm.visible = "false";
  34. button7.visible = "false";
  35. chk_ward.visible = "false";
  36. } else if(model.getValue("/root/hidden/srchinfo/ioflag") == "I") {
  37. ipt_wardnm.visible = "true";
  38. button7.visible = "true";
  39. }
  40. //병동 Combo 조회
  41. model.makeValue("/root/send/deptinfo/deptflag", "W");
  42. submit("TRADT10203");
  43. astfAddCombo("/root/hidden/deptlist", "ward", "wardcd,wardnm", "T,전체");
  44. //model.refresh();
  45. //caption19.text = caption19.text + "(" + combo1.label + ")";
  46. //바코드프린터설정 초기화
  47. model.setValue("/root/send/scrnid", getScreenID());
  48. submit("TRLLC90101", false);
  49. var comm = model.getValue("/root/main/barcdprntsetup/prntsetupinfo/setupinfo/comm02/comm");
  50. var prntkind = model.getValue("/root/main/barcdprntsetup/prntsetupinfo/setupinfo/prntkind");
  51. if(comm == "2") {
  52. model.setValue("/root/main/barcdprntsetup/prntsetupinfo/setupinfo/comm02/comm", "1");
  53. }
  54. if(prntkind == "1") {
  55. model.setValue("/root/main/barcdprntsetup/prntsetupinfo/setupinfo/prntkind", "5");
  56. }
  57. // 20101021_laboru_경북대병원_실출고부서 셋팅
  58. submit("TRADT01106");
  59. combo3.select(2);
  60. chk_cnt++
  61. model.makeValue("/root/send/suminfo/mstocdeptcd", model.getValue("/root/hidden/prcpsrch/stocdeptcd"));
  62. combo3.refresh();
  63. model.refresh();
  64. //1일기준인지 1회기준인지 체크하여 컬럼을 hidden
  65. var colHidnValue = grdBaseColHidn("D");
  66. //1회 기준
  67. if( colHidnValue == "C") {
  68. grd_prcplist.colHidden(grd_prcplist.colRef("prcpvol")) = true;
  69. grd_prcplist.colHidden(grd_prcplist.colRef("prcpqty")) = true;
  70. } else {
  71. grd_prcplist.colHidden(grd_prcplist.colRef("prcpvol2")) = true;
  72. grd_prcplist.colHidden(grd_prcplist.colRef("prcpqty2")) = true;
  73. }
  74. }
  75. /**
  76. * 특수조제 마감
  77. */
  78. function fHosSpSum() {
  79. var prcpflag = model.getValue("/root/hidden/srchinfo/prcpflag");
  80. var prcpdd = model.getValue("/root/hidden/srchinfo/drugdd");
  81. var instcd = model.getValue("/root/hidden/srchinfo/instcd");
  82. var drugkind = model.getValue ("/root/hidden/srchinfo/drugkind");
  83. var chk ="";
  84. if(model.getValue("/root/init/autoflag") != "1") {
  85. chk = messageBox("마감을", "Q004");
  86. } else {
  87. chk = 6;
  88. }
  89. if(chk == 6){
  90. model.setValue ( "/root/send/suminfo/drugkind", model.getValue ("/root/hidden/srchinfo/drugkind"));
  91. model.setValue("/root/send/suminfo/prcpdd", prcpdd);
  92. model.setValue("/root/send/suminfo/prcpflag", prcpflag);
  93. model.setValue("/root/send/suminfo/instcd", instcd);
  94. model.setValue("/root/send/suminfo/drugflag", model.getValue("/root/hidden/srchinfo/drugflag"));
  95. model.setValue("/root/send/suminfo/pid", model.getValue("/root/hidden/srchinfo/pid"));
  96. model.setValue("/root/send/suminfo/wardcd", model.getValue("/root/hidden/srchinfo/wardcd"));
  97. //각구분별 마감.( 동시 마감시 구분별 같은 번호가 생성되어 문제됨 )
  98. if ( drugkind.indexOf("D") >-1 ){
  99. model.setValue("/root/send/suminfo/kindd","N");
  100. model.setValue("/root/send/suminfo/kindb","N");
  101. model.setValue("/root/send/suminfo/kindt","N");
  102. model.setValue("/root/send/suminfo/kindc","N");
  103. model.setValue("/root/send/suminfo/kind1","N");
  104. model.setValue("/root/send/suminfo/kindd","");
  105. model.refresh();
  106. submit("TXADT10201");
  107. }
  108. if ( drugkind.indexOf("B") >-1 ){
  109. model.setValue("/root/send/suminfo/kindd","N");
  110. model.setValue("/root/send/suminfo/kindb","N");
  111. model.setValue("/root/send/suminfo/kindt","N");
  112. model.setValue("/root/send/suminfo/kindc","N");
  113. model.setValue("/root/send/suminfo/kind1","N");
  114. model.setValue("/root/send/suminfo/kindb","");
  115. model.refresh();
  116. submit("TXADT10201");
  117. }
  118. if ( drugkind.indexOf("T") >-1 ){
  119. model.setValue("/root/send/suminfo/kindd","N");
  120. model.setValue("/root/send/suminfo/kindb","N");
  121. model.setValue("/root/send/suminfo/kindt","N");
  122. model.setValue("/root/send/suminfo/kindc","N");
  123. model.setValue("/root/send/suminfo/kind1","N");
  124. model.setValue("/root/send/suminfo/kindt","");
  125. model.refresh();
  126. submit("TXADT10201");
  127. }
  128. if ( drugkind.indexOf("C") >-1 ){
  129. model.setValue("/root/send/suminfo/kindd","N");
  130. model.setValue("/root/send/suminfo/kindb","N");
  131. model.setValue("/root/send/suminfo/kindt","N");
  132. model.setValue("/root/send/suminfo/kindc","N");
  133. model.setValue("/root/send/suminfo/kind1","N");
  134. model.setValue("/root/send/suminfo/kindc","");
  135. model.refresh();
  136. submit("TXADT10201");
  137. }
  138. if ( drugkind.indexOf("1") >-1 ){
  139. model.setValue("/root/send/suminfo/kindd","N");
  140. model.setValue("/root/send/suminfo/kindb","N");
  141. model.setValue("/root/send/suminfo/kindt","N");
  142. model.setValue("/root/send/suminfo/kindc","N");
  143. model.setValue("/root/send/suminfo/kind1","N");
  144. model.setValue("/root/send/suminfo/kind1","");
  145. model.refresh();
  146. submit("TXADT10201");
  147. }
  148. }
  149. }
  150. /**
  151. * 마감리스트 조회
  152. */
  153. function fSrchsumData() {
  154. // 20110823_laboru_무균조제 구분 flag 추가
  155. model.removeNodeset("/root/hidden/srchinfo/srchmugyunflag");
  156. var s = model.getValue("/root/hidden/srchinfo/drugkind");
  157. if(s.search("C") >= 0 ) {
  158. model.makeValue("/root/hidden/srchinfo/srchmugyunflag","Y");
  159. }
  160. model.copyNode("/root/send/sumlistinfo", "/root/hidden/srchinfo");
  161. model.setValue("/root/send/sumlistinfo/drugkind", fChkDrugkind(model.getValue("/root/send/sumlistinfo/drugkind")));
  162. submit("TRADT20302");
  163. }
  164. /**
  165. * 처방 상세조회
  166. */
  167. function fSrchPrcpData() {
  168. if ( (grd_sumlist.iscell(event.target) && model.getValue("/root/main/sumlist/sumlist/sumdd") != "" && grd_sumlist.row >0) || model.getValue("/root/init/autoflag") == "1" ){
  169. if(grd_sumlist.col != 0 && model.getValue("/root/init/autoflag") != "1"){
  170. if ( model.getValue("/root/main/sumlist/sumlist[" + grd_sumlist.row + "]/sel")=="Y"){
  171. model.setValue("/root/main/sumlist/sumlist[" + grd_sumlist.row + "]/sel", "N");
  172. } else {
  173. model.setValue("/root/main/sumlist/sumlist[" + grd_sumlist.row + "]/sel", "Y");
  174. }
  175. }
  176. model.refresh();
  177. model.removeNodeset("/root/send/srchinfo/sumlist");
  178. var cnt = 0;
  179. for(var i = grd_sumlist.fixedRows; i < grd_sumlist.rows; i++){
  180. if(model.getValue("/root/main/sumlist/sumlist["+i+"]/sel") == "Y"){
  181. astfCopyNodeSet("/root/send/srchinfo/sumlist", "/root/main/sumlist/sumlist["+i+"]");
  182. model.makeValue("/root/send/srchinfo/sumlist[" + (cnt+1) + "]/drugflag", model.getValue("/root/hidden/srchinfo/drugflag"));
  183. model.makeValue("/root/send/srchinfo/sumlist[" + (cnt+1) + "]/pid", model.getValue("/root/hidden/srchinfo/pid"));
  184. cnt++;
  185. }
  186. }
  187. if(cnt == 0){
  188. model.removeNodeset("/root/main/masterinfo/grid1");
  189. model.refresh();
  190. } else {
  191. nodeList = instance1.selectNodes("/root/send/srchinfo/sumlist");
  192. var rCSV = getNodeListCSV(nodeList);
  193. model.setValue("/root/send/data1",rCSV);
  194. submit("TRADT20301");
  195. }
  196. for ( i = 1; i<grd_prcplist.rows ; i++){
  197. model.setValue("/root/main/masterinfo/grid1["+i+"]/sel","Y");
  198. }
  199. model.refresh();
  200. } else if(grd_sumlist.fixedcellischeck(0,1) == true){ // 전체 선택
  201. if(grd_sumlist.row > 0){
  202. if ( model.getValue("/root/main/sumlist/sumlist[" + grd_sumlist.row + "]/sel")=="Y"){
  203. model.setValue("/root/main/sumlist/sumlist[" + grd_sumlist.row + "]/sel", "N");
  204. } else {
  205. model.setValue("/root/main/sumlist/sumlist[" + grd_sumlist.row + "]/sel", "Y");
  206. }
  207. }
  208. model.refresh();
  209. model.removeNodeset("/root/send/srchinfo/sumlist");
  210. var cnt = 0;
  211. for(var i = grd_sumlist.fixedRows; i < grd_sumlist.rows; i++){
  212. if(model.getValue("/root/main/sumlist/sumlist["+i+"]/sel") == "Y"){
  213. astfCopyNodeSet("/root/send/srchinfo/sumlist", "/root/main/sumlist/sumlist["+i+"]");
  214. model.makeValue("/root/send/srchinfo/sumlist[" + (cnt+1) + "]/drugflag", model.getValue("/root/hidden/srchinfo/drugflag"));
  215. model.makeValue("/root/send/srchinfo/sumlist[" + (cnt+1) + "]/pid", model.getValue("/root/hidden/srchinfo/pid"));
  216. cnt++;
  217. }
  218. }
  219. if(cnt == 0){
  220. model.removeNodeset("/root/main/masterinfo/grid1");
  221. model.refresh();
  222. } else {
  223. nodeList = instance1.selectNodes("/root/send/srchinfo/sumlist");
  224. var rCSV = getNodeListCSV(nodeList);
  225. model.setValue("/root/send/data1",rCSV);
  226. submit("TRADT20301");
  227. }
  228. for ( i = 1; i<grd_prcplist.rows ; i++){
  229. model.setValue("/root/main/masterinfo/grid1["+i+"]/sel","Y");
  230. }
  231. model.refresh();
  232. } else if(grd_sumlist.fixedcellischeck(0,1) == false) { // 전체 해제
  233. model.removeNodeset("/root/send/srchinfo/sumlist");
  234. var cnt = 0;
  235. for(var i = grd_sumlist.fixedRows; i < grd_sumlist.rows; i++){
  236. if(model.getValue("/root/main/sumlist/sumlist["+i+"]/sel") == "Y"){
  237. astfCopyNodeSet("/root/send/srchinfo/sumlist", "/root/main/sumlist/sumlist["+i+"]");
  238. model.makeValue("/root/send/srchinfo/sumlist[" + (cnt+1) + "]/drugflag", model.getValue("/root/hidden/srchinfo/drugflag"));
  239. model.makeValue("/root/send/srchinfo/sumlist[" + (cnt+1) + "]/pid", model.getValue("/root/hidden/srchinfo/pid"));
  240. cnt++;
  241. }
  242. }
  243. if(cnt == 0){
  244. model.removeNodeset("/root/main/masterinfo/grid1");
  245. model.refresh();
  246. } else {
  247. nodeList = instance1.selectNodes("/root/send/srchinfo/sumlist");
  248. var rCSV = getNodeListCSV(nodeList);
  249. model.setValue("/root/send/data1",rCSV);
  250. submit("TRADT20301");
  251. }
  252. for ( i = 1; i<grd_prcplist.rows ; i++){
  253. model.setValue("/root/main/masterinfo/grid1["+i+"]/sel","Y");
  254. }
  255. model.refresh();
  256. }
  257. }
  258. function fSrchPrcpDataRe() {
  259. if ( model.getValue("/root/main/sumlist/sumlist/sumdd") != "" && grd_sumlist.row >0){
  260. model.removeNodeset("/root/send/srchinfo/sumlist");
  261. var cnt = 0;
  262. for(var i = grd_sumlist.fixedRows; i < grd_sumlist.rows; i++){
  263. if(model.getValue("/root/main/sumlist/sumlist["+i+"]/sel") == "Y"){
  264. astfCopyNodeSet("/root/send/srchinfo/sumlist", "/root/main/sumlist/sumlist["+i+"]");
  265. model.makeValue("/root/send/srchinfo/sumlist[" + (cnt+1) + "]/drugflag", model.getValue("/root/hidden/srchinfo/drugflag"));
  266. model.makeValue("/root/send/srchinfo/sumlist[" + (cnt+1) + "]/pid", model.getValue("/root/hidden/srchinfo/pid"));
  267. cnt++;
  268. }
  269. }
  270. if(cnt == 0){
  271. model.removeNodeset("/root/main/masterinfo/grid1");
  272. model.refresh();
  273. } else {
  274. nodeList = instance1.selectNodes("/root/send/srchinfo/sumlist");
  275. var rCSV = getNodeListCSV(nodeList);
  276. model.setValue("/root/send/data1",rCSV);
  277. submit("TRADT20301");
  278. }
  279. }
  280. }
  281. /**
  282. * 처방전/라벨 출력
  283. */
  284. function fPrcpMPSPrint() {
  285. //처방전 및 라벨 출력
  286. var chk_mpsflag = model.getValue("/root/hidden/srchinfo/mpsflag");
  287. var chk_lblyn = model.getValue("/root/hidden/srchinfo/lblyn");
  288. // 20100324_laboru_처방구분, 등록번호, D#, Mix, 약품코드 차례로 다를때 라벨 출력하기 위함.
  289. var drugno ="";
  290. var tmpdrugno ="";
  291. var prcpflagnm = "";
  292. var pid="";
  293. var tmppid="";
  294. var prcpmixno = "";
  295. var tmpprcpmixno = "";
  296. var tmpprcpflagnm = "";
  297. var prtldg = "";
  298. var tmpprtldg = "";
  299. var prcpcd = "";
  300. var tmpprcpcd = "";
  301. var autoyn = model.getValue("/root/init/autoflag"); //자동출력 여부
  302. var lblprnttims = 0;//라벨출력횟수
  303. var prnttims = 0;//처방전 출력횟수
  304. var spclblflag = "Y"; // 20100324_laboru_특조실 라벨 출력 일때.
  305. //처방전 출력 데이터 조회
  306. var cnt = 0;
  307. for(var i = grd_prcplist.fixedRows; i < grd_prcplist.rows; i++){
  308. if(model.getValue("/root/main/masterinfo/grid1["+i+"]/sel") == "Y"){
  309. prnttims = model.getValue("/root/main/masterinfo/grid1["+i+"]/prnttims");
  310. lblprnttims = model.getValue("/root/main/masterinfo/grid1["+i+"]/lblprnttims");
  311. model.copyNode("/root/send/prcpinfo", "/root/main/masterinfo/grid1["+i+"]");
  312. var drugno = model.getValue("/root/send/prcpinfo/drugno");
  313. var wardcd = model.getValue("/root/send/prcpinfo/wardcd");
  314. var pid = model.getValue("/root/send/prcpinfo/pid");
  315. // 20100322_laboru
  316. var prcpmixno = model.getValue("/root/send/prcpinfo/prcpmixno");
  317. var prcpflagnm = model.getValue("/root/send/prcpinfo/prcpflagnm");
  318. var prtldg = model.getValue("/root/send/prcpinfo/prtldg");
  319. var prcpcd = model.getValue("/root/send/prcpinfo/prcpcd");
  320. if (tmpdrugno != drugno ){
  321. model.makeValue("/root/send/prcpinfo/drugflag", model.getValue("/root/hidden/srchinfo/drugflag"));
  322. //처방전 출력
  323. if (chk_mpsflag != "" ) {
  324. if(autoyn != "1" || prnttims == 0) { //자동출력은 처음 한번만
  325. fHosInMPSPrint();
  326. fSleep(2000);
  327. }
  328. }
  329. tmpdrugno=drugno;
  330. }
  331. // 20100324_laboru_라벨 출력 처방구분
  332. if(prcpflagnm != tmpprcpflagnm ) {
  333. if (chk_lblyn != "" ) {
  334. if(autoyn != "1" || lblprnttims == 0 ) { //자동출력은 처음 한번만
  335. fHosInLBLPrint();
  336. fSleep(2000);
  337. }
  338. }
  339. cnt++;
  340. } else if(pid != tmppid) { // 환자번호
  341. if (chk_lblyn != "" ) {
  342. if(autoyn != "1" || lblprnttims == 0 ) { //자동출력은 처음 한번만
  343. fHosInLBLPrint();
  344. fSleep(2000);
  345. }
  346. }
  347. cnt++;
  348. } else if(prtldg != tmpprtldg) { // D#
  349. if (chk_lblyn != "" ) {
  350. if(autoyn != "1" || lblprnttims == 0 ) { //자동출력은 처음 한번만
  351. fHosInLBLPrint();
  352. fSleep(2000);
  353. }
  354. }
  355. cnt++;
  356. } else if(prcpmixno != tmpprcpmixno) { // Mix
  357. if (chk_lblyn != "" ) {
  358. if(autoyn != "1" || lblprnttims == 0 ) { //자동출력은 처음 한번만
  359. fHosInLBLPrint();
  360. fSleep(2000);
  361. }
  362. }
  363. cnt++;
  364. } else if(prcpcd != tmpprcpcd && prcpmixno == "-") { // 약품코드
  365. if (chk_lblyn != "" ) {
  366. if(autoyn != "1" || lblprnttims == 0 ) { //자동출력은 처음 한번만
  367. fHosInLBLPrint();
  368. fSleep(2000);
  369. }
  370. }
  371. cnt++;
  372. } else if(prcpmixno == "-" ) { // prcpmixno 가 "-" 이면서 같은 약품 코드라도 각각 출력. mix 번호가 있고 같은 약품 코드인 경우는 Mix Case 에 걸림.
  373. if (chk_lblyn != "" ) {
  374. if(autoyn != "1" || lblprnttims == 0 ) { //자동출력은 처음 한번만
  375. fHosInLBLPrint();
  376. fSleep(2000);
  377. }
  378. }
  379. cnt++;
  380. }
  381. // 20100324_laboru_전 상태 기억
  382. tmpprcpflagnm = prcpflagnm;
  383. tmppid = pid;
  384. tmpprtldg = prtldg;
  385. tmpprcpmixno = prcpmixno;
  386. tmpprcpcd = prcpcd;
  387. }
  388. }
  389. if( cnt == 0){
  390. messageBox("처방전을 출력할 환자리스트가 없거나 선택된 환자가", "I004");
  391. }
  392. }
  393. /**
  394. * 처방전 출력
  395. */
  396. function fHosInMPSPrint() {
  397. var sParam = "";
  398. sParam = "drugdd▦drugno▦ioflag▦prcpdd▦orddd▦cretno▦prcpgenrflag▦pid▦orddeptcd▦wardcd▦lblflag▦prcpflag▦prntflag▦drugflag▩";
  399. sParam += model.getValue("/root/send/prcpinfo/drugdd")+"▦"+
  400. model.getValue("/root/send/prcpinfo/drugno")+"▦"+
  401. model.getValue("/root/send/prcpinfo/ioflag")+"▦"+
  402. model.getValue("/root/send/prcpinfo/prcpdd")+"▦"+
  403. model.getValue("/root/send/prcpinfo/orddd")+"▦"+
  404. model.getValue("/root/send/prcpinfo/cretno")+"▦"+
  405. model.getValue("/root/send/prcpinfo/prcpgenrflag")+"▦"+
  406. model.getValue("/root/send/prcpinfo/pid")+"▦"+
  407. model.getValue("/root/send/prcpinfo/orddeptcd")+"▦"+
  408. model.getValue("/root/send/prcpinfo/wardcd")+"▦"+
  409. model.getValue("/root/send/prcpinfo/lblflag")+"▦"+
  410. model.getValue("/root/send/prcpinfo/prcpflag")+"▦"+
  411. model.getValue("/root/send/prcpinfo/prntflag")+"▦"+
  412. model.getValue("/root/send/prcpinfo/drugflag")+"▩";
  413. model.setAttribute("params", sParam);
  414. modal("SPADT63200",0,200,200,"","");
  415. model.setAttribute("params", "");
  416. }
  417. /**
  418. * 라벨 출력
  419. */
  420. function fHosInLBLPrint() {
  421. var sParam = "";
  422. // 20100323_laboru_prcpno, prcpmixno, spclblflag 추가
  423. sParam = "drugdd▦drugno▦ioflag▦prcpdd▦orddd▦cretno▦prcpgenrflag▦pid▦orddeptcd▦wardcd▦lblflag▦prcpflag▦prntflag▦drugflag▦prcpno▦prcpmixno▦spclblflag▩";
  424. sParam += model.getValue("/root/send/prcpinfo/drugdd")+"▦"+
  425. model.getValue("/root/send/prcpinfo/drugno")+"▦"+
  426. model.getValue("/root/send/prcpinfo/ioflag")+"▦"+
  427. model.getValue("/root/send/prcpinfo/prcpdd")+"▦"+
  428. model.getValue("/root/send/prcpinfo/orddd")+"▦"+
  429. model.getValue("/root/send/prcpinfo/cretno")+"▦"+
  430. model.getValue("/root/send/prcpinfo/prcpgenrflag")+"▦"+
  431. model.getValue("/root/send/prcpinfo/pid")+"▦"+
  432. model.getValue("/root/send/prcpinfo/orddeptcd")+"▦"+
  433. model.getValue("/root/send/prcpinfo/wardcd")+"▦"+
  434. model.getValue("/root/send/prcpinfo/lblflag")+"▦"+
  435. model.getValue("/root/send/prcpinfo/prcpflag")+"▦"+
  436. model.getValue("/root/send/prcpinfo/prntflag")+"▦"+
  437. model.getValue("/root/send/prcpinfo/drugflag")+"▦";
  438. // 20100322_laboru_mix 번호 있을때 없을때 구분.
  439. if(model.getValue("/root/send/prcpinfo/prcpmixno") == "-") {
  440. sParam += model.getValue("/root/send/prcpinfo/prcpno")+"▦"+""+"▦"+"Y"+"▦"+"▩";
  441. } else {
  442. sParam += ""+"▦"+model.getValue("/root/send/prcpinfo/prcpmixno")+"▦"+"N"+"▦"+"▩";
  443. }
  444. model.setAttribute("params", sParam);
  445. model.copyNode("/root/init/barcdprntsetup", "/root/main/barcdprntsetup");
  446. //modal("SPADT63300",0,200,200,"SPADT63300","/root/init/barcdprntsetup","/root/init/barcdprntsetup");
  447. modal("SPADT63300",0,200,200,"SPADT63300","/root","/root"); // 20101220 wify 경북대병원 라벨출력방식 rexpert로 변경
  448. //alert("SMADT20300.js row:503");
  449. //modal("SPADT63300",0,200,200,"SPADT63300","/root","/root"); // 20101220 wify 경북대병원 라벨출력방식 rexpert로 변경
  450. //modal("SPADT63303",0,200,200,"SPADT63303","/root","/root"); // 2015년 3월17일 항암주사라벨 출력 김치국
  451. model.setAttribute("params", "");
  452. // submit("TRADT10205");
  453. }
  454. /**
  455. * 집계표 출력
  456. */
  457. function fSumPrint() {
  458. model.removeNodeset("/root/send/srchinfo/sumlist");
  459. var cnt = 0;
  460. var cntD = 0;
  461. var cntB = 0;
  462. var cntT = 0;
  463. var cnt1 = 0;
  464. var cntC = 0;
  465. var sumcls = "";
  466. for(var i = grd_prcplist.fixedRows; i < grd_prcplist.rows; i++){
  467. if(model.getValue("/root/main/masterinfo/grid1["+i+"]/sel") == "Y"){
  468. astfCopyNodeSet("/root/send/srchinfo/sumlist", "/root/main/masterinfo/grid1["+i+"]");
  469. cnt++;
  470. if(model.getValue("/root/main/masterinfo/grid1["+i+"]/sumcls") == "D"){
  471. cntD++;
  472. } else if(model.getValue("/root/main/masterinfo/grid1["+i+"]/sumcls") == "B"){
  473. cntB++;
  474. } else if(model.getValue("/root/main/masterinfo/grid1["+i+"]/sumcls") == "T"){
  475. cntT++;
  476. } else if(model.getValue("/root/main/masterinfo/grid1["+i+"]/sumcls") == "1"){
  477. cnt1++;
  478. } else {
  479. cntC++;
  480. }
  481. }
  482. }
  483. model.refresh();
  484. if(cnt == 0){
  485. messageBox("마감리스트에서 출력할 데이터를", "C002");
  486. } else {
  487. // 20100205 이선경 수정 : 마감일자로도 조회되도록 적용일자, 마감일자 구분자 셋팅
  488. model.makeValue("/root/send/srchinfo/sumlist/timeflag", model.getValue("/root/hidden/srchinfo/timeflag"));
  489. if(cntD > 0) {
  490. model.setValue("/root/send/srchinfo/sumlist/sumcls", "D");
  491. submit("TRADT20303");
  492. if(getNodesetCount("/root/main/sumprintlist/sumlist") > 0) {
  493. exeReportPreview("RPADT20302", "XMLSTR", "", "", "true","","","","","true");
  494. }
  495. }
  496. if(cntB > 0) {
  497. model.setValue("/root/send/srchinfo/sumlist/sumcls", "B");
  498. submit("TRADT20303");
  499. if(getNodesetCount("/root/main/sumprintlist/sumlist") > 0) {
  500. exeReportPreview("RPADT20302", "XMLSTR", "", "", "true","","","","","true");
  501. }
  502. }
  503. if(cntT > 0) {
  504. model.setValue("/root/send/srchinfo/sumlist/sumcls", "T");
  505. submit("TRADT20303");
  506. if(getNodesetCount("/root/main/sumprintlist/sumlist") > 0) {
  507. exeReportPreview("RPADT20302", "XMLSTR", "", "", "true","","","","","true");
  508. }
  509. }
  510. if(cnt1 > 0) {
  511. model.setValue("/root/send/srchinfo/sumlist/sumcls", "1");
  512. submit("TRADT20303");
  513. if(getNodesetCount("/root/main/sumprintlist/sumlist") > 0) {
  514. exeReportPreview("RPADT20302", "XMLSTR", "", "", "true","","","","","true");
  515. }
  516. }
  517. if(cntC > 0) {
  518. model.setValue("/root/send/srchinfo/sumlist/sumcls", "C");
  519. submit("TRADT20303");
  520. if(getNodesetCount("/root/main/sumprintlist/sumlist") > 0) {
  521. exeReportPreview("RPADT20302", "XMLSTR", "", "", "true","","","","","true");
  522. }
  523. }
  524. }
  525. }
  526. /**
  527. * 조제표 출력
  528. */
  529. function fPrcpListPrnt() {
  530. var ioflag = "";
  531. var sumcls = "";
  532. //var cnt = 0;
  533. var cntD = 0;
  534. var cntB = 0;
  535. var cntT = 0;
  536. var cnt1 = 0;
  537. var cntC = 0;
  538. //2010-03-20 TPN 조제표 코드별 집계 표시
  539. model.removeNodeset("/root/temp/prntdrugsumlist");
  540. for(var i = grd_prcplist.fixedRows; i < grd_prcplist.rows; i++){
  541. if(model.getValue("/root/main/masterinfo/grid1["+i+"]/sel") == "Y"){
  542. //ioflag = model.getValue("/root/main/sumlist/sumlist["+i+"]/ioflag");
  543. sumcls = model.getValue("/root/main/masterinfo/grid1["+i+"]/sumcls");
  544. /*
  545. if(sumcls == "D"){
  546. //항암제 조제표
  547. if(ioflag == "I"){
  548. exeReportPreview("RPADT20303", "XML", "/root/main/sumlist/sumlist["+i+"]", "", "true","","","","","true");
  549. cnt++;
  550. } else {
  551. exeReportPreview("RPADT20304", "XML", "/root/main/sumlist/sumlist["+i+"]", "", "true","","","","","true");
  552. cnt++;
  553. }
  554. } else {
  555. //항암제 이외의 조제표
  556. exeReportPreview("RPADT20305", "XML", "/root/main/sumlist/sumlist["+i+"]", "","true","","","","","true");
  557. cnt++;
  558. }
  559. */
  560. if(sumcls == "D") {
  561. //항암제 조제표 개수
  562. cntD++;
  563. } else if(sumcls == "B") {
  564. //소아TPN 조제표 개수
  565. cntB++;
  566. } else if(sumcls == "T") {
  567. //TPN 조제표 개수
  568. cntT++;
  569. } else if(sumcls == "1") {
  570. //면역억제제 조제표 개수
  571. cnt1++;
  572. } else {
  573. //무균조제 조제표 개수
  574. cntC++;
  575. }
  576. //2010-03-20 TPN 조제표 코드별 집계 표시([특조완료]인경우만 Count) Start
  577. if ( (sumcls == "T") || (sumcls == "B") ) { //TPN(T) 및 소아TPN(B)일경우만 해당
  578. var Tmpdrugstat = model.getValue("/root/main/masterinfo/grid1["+i+"]/drugstat");
  579. var Tmpdrugstatnm = model.getValue("/root/main/masterinfo/grid1["+i+"]/drugstatnm");
  580. if( Tmpdrugstat != "ND" && Tmpdrugstatnm != "반환" ) { //조제보유 및 반환이 아닌경우만 Count
  581. var Tmp_sumclsPath = "";
  582. if (sumcls == "T") Tmp_sumclsPath = "/root/temp/prntdrugsumlist/sumclsT";
  583. if (sumcls == "B") Tmp_sumclsPath = "/root/temp/prntdrugsumlist/sumclsB";
  584. Tmp_drugcd = model.getValue("/root/main/masterinfo/grid1["+i+"]/prcpcd");
  585. Tmp_prcpqty = model.getValue("/root/main/masterinfo/grid1["+i+"]/prcpqty");
  586. var rowcnt = getNodesetCount(Tmp_sumclsPath + "/prntdrugsum");
  587. var TmpTotCnt = 0;
  588. var drugcnt = 0;
  589. if ( Number(rowcnt) > 0) {
  590. for(var j = 1; j <= rowcnt; j++){
  591. if ( model.getValue (Tmp_sumclsPath + "/prntdrugsum[" + j + "]/drugcd") == Tmp_drugcd ) { //동일코드 있을경우 갯수 더하기
  592. drugcnt = Number(model.getValue (Tmp_sumclsPath + "/prntdrugsum[" + j + "]/sum")) + Number(Tmp_prcpqty);
  593. model.makeValue (Tmp_sumclsPath + "/prntdrugsum[" + j + "]/sum" , drugcnt);
  594. TmpTotCnt ++;
  595. }
  596. }
  597. }
  598. if ((sumcls == "B") && (Number(rowcnt) ==0) ) { //소악TPN에 [DLMCT1]란 빈공란 추가
  599. model.makeValue(Tmp_sumclsPath + "/prntdrugsum[1]/drugcd" , "DLMCT1");
  600. model.makeValue(Tmp_sumclsPath + "/prntdrugsum[1]/sum" , "");
  601. rowcnt++;
  602. }
  603. if (TmpTotCnt == 0 ) { //해당되는 코드가 없을 경우는 생성.
  604. model.makeValue(Tmp_sumclsPath + "/prntdrugsum["+ (Number(rowcnt)+1) +"]/drugcd" , Tmp_drugcd);
  605. model.makeValue(Tmp_sumclsPath + "/prntdrugsum["+ (Number(rowcnt)+1) +"]/sum" , Tmp_prcpqty);
  606. }
  607. }
  608. }
  609. //2010-03-20 TPN 조제표 코드별 집계 표시([특조완료]인경우만 Count) End
  610. }
  611. }
  612. if(cntD == 0 && cntT == 0 && cntB == 0 && cntC == 0 && cnt1 == 0){
  613. messageBox("마감리스트에서 출력할 데이터를", "C002");
  614. }
  615. if(cntD > 0) {
  616. exeReportPreview("RPADT20303", "XMLSTR", "", "", "true","","","","","true", "", "");
  617. }
  618. if(cntB > 0) {
  619. exeReportPreview("RPADT20305", "XMLSTR", "", "","true","","","","","true", "", "");
  620. }
  621. if(cntT > 0) {
  622. exeReportPreview("RPADT20308", "XMLSTR", "", "","true","","","","","true", "", "");
  623. }
  624. if(cnt1 > 0) {
  625. exeReportPreview("RPADT20310", "XMLSTR", "", "","true","","","","","true", "", "");
  626. }
  627. if(cntC > 0) {
  628. exeReportPreview("RPADT20309", "XMLSTR", "", "","true","","","","","true", "", "");
  629. }
  630. }
  631. /**
  632. * 반환리스트 출력
  633. */
  634. function fRtnListPrnt() {
  635. if(model.getValue("/root/hidden/srchinfo/ioflag") == "I"){
  636. model.removeNodeset("/root/hidden/rtninfo");
  637. astfCopyNodeSet("/root/hidden/rtninfo", "/root/hidden/srchinfo");
  638. var matrix_val = model.getValue("/root/hidden/rtninfo/drugkind");
  639. var col_data = "";
  640. var drugkind = "";
  641. var col_flag = "|";
  642. col_data = matrix_val.split(col_flag); //구분자를 통한 array 생성
  643. var chk = col_data.length;
  644. for(var i=0; i < chk; i++){
  645. if ( drugkind == "" ) {
  646. drugkind = "'" + col_data[i] + "'";
  647. } else {
  648. drugkind += ",'" + col_data[i] + "'";
  649. }
  650. }
  651. model.setValue("/root/hidden/rtninfo/drugkind", drugkind);
  652. //1일기준인지 1회기준인지 체크하여 컬럼을 hidden
  653. var colHidnValue = grdBaseColHidn("D");
  654. if( colHidnValue == "C") {//1회 기준
  655. model.makeValue("/root/hidden/rtninfo/prcpqtychk", 'Y');
  656. }
  657. exeReportPreview("RPADT20306", "XML", "/root/hidden/rtninfo", "", "");
  658. exeReportPreview("RPADT20307", "XML", "/root/hidden/rtninfo", "", "");
  659. } else {
  660. }
  661. }
  662. /**
  663. * 처방구분 만들기
  664. */
  665. function fChkDrugkind(sDrugkind) {
  666. var arrVal = sDrugkind.split("|");
  667. var dk_val = "";
  668. for( var i = 0; i< arrVal.length; i++ ) {
  669. if(dk_val == ""){
  670. if(arrVal[i] == "T"){
  671. dk_val = "T|Q";
  672. } else {
  673. dk_val = arrVal[i];
  674. }
  675. } else {
  676. if(arrVal[i] == "T"){
  677. dk_val += "|T|Q";
  678. } else {
  679. dk_val += "|"+arrVal[i];
  680. }
  681. }
  682. }
  683. return dk_val;
  684. }
  685. function fSleep(numberMillis) {
  686. var now = new Date();
  687. var exitTime = now.getTime() + numberMillis;
  688. while (true) {
  689. now = new Date();
  690. if (now.getTime() > exitTime)
  691. return;
  692. }
  693. }