SPADT62300.js 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272
  1. /**
  2. * 파 일 명 : SPADT62300.js
  3. * 설 명 : (팝업)병동라벨출력 Javascriot
  4. * 설 계 자 : 공두경
  5. * 작 성 자 : 공두경
  6. * 수정이력 : 2007.09.17 / 최초작성 / 공두경
  7. */
  8. var sSndMsg = ""; //라벨출력내용
  9. var iPoint = 1; //라벨출력row
  10. var iCnt = 0; //라벨출력매수
  11. var iImageCnt = 0; //라벨그래픽폰트수
  12. var gTimer = null;
  13. var pg =0;
  14. var totpg =0;
  15. var totcnt =0;
  16. /**
  17. * 초기화
  18. */
  19. function fInit() {
  20. //window.minimize();
  21. var sParam = model.getAttribute("params");
  22. model.makeValue("/root/send/prcpinfo/drugdd", astfMatrixData(sParam, 1, 0));
  23. model.makeValue("/root/send/prcpinfo/drugno", astfMatrixData(sParam, 1, 1));
  24. model.makeValue("/root/send/prcpinfo/ioflag", astfMatrixData(sParam, 1, 2));
  25. model.makeValue("/root/send/prcpinfo/prcpdd", astfMatrixData(sParam, 1, 3));
  26. model.makeValue("/root/send/prcpinfo/orddd", astfMatrixData(sParam, 1, 4));
  27. model.makeValue("/root/send/prcpinfo/cretno", astfMatrixData(sParam, 1, 5));
  28. model.makeValue("/root/send/prcpinfo/prcpgenrflag", astfMatrixData(sParam, 1, 6));
  29. model.makeValue("/root/send/prcpinfo/pid", astfMatrixData(sParam, 1, 7));
  30. model.makeValue("/root/send/prcpinfo/orddeptcd", astfMatrixData(sParam, 1, 8));
  31. model.makeValue("/root/send/prcpinfo/wardcd", astfMatrixData(sParam, 1, 9));
  32. model.makeValue("/root/send/prcpinfo/lblflag", astfMatrixData(sParam, 1, 10));
  33. model.makeValue("/root/send/prcpinfo/prcpflag", astfMatrixData(sParam, 1, 11));
  34. model.makeValue("/root/send/prcpinfo/prntflag", astfMatrixData(sParam, 1, 12));
  35. model.makeValue("/root/send/prcpinfo/liquidflag", astfMatrixData(sParam, 1, 13));
  36. model.makeValue("/root/send/prcpinfo/etcdescflag", astfMatrixData(sParam, 1, 14));
  37. model.makeValue("/root/send/prcpinfo/lblkind", astfMatrixData(sParam, 1, 15));
  38. model.makeValue("/root/send/prcpinfo/outlblyn", astfMatrixData(sParam, 1, 16));
  39. model.makeValue("/root/send/prcpinfo/ptplblyn", astfMatrixData(sParam, 1, 17));
  40. model.makeValue("/root/send/prcpinfo/reprintyn", astfMatrixData(sParam, 1, 18));
  41. model.makeValue("/root/send/prcpinfo/lbltype", astfMatrixData(sParam, 1, 19));
  42. model.makeValue("/root/send/prcpinfo/drugkind", astfMatrixData(sParam, 1, 20));
  43. model.makeValue("/root/send/prcpinfo/autolblyn", astfMatrixData(sParam, 1, 21));
  44. model.refresh();
  45. submit("TRADT62301");
  46. if(model.getValue("/root/main/lbllist/lbllist["+1+"]/drugkindnm") != ""){
  47. if(model.getValue("/root/send/prcpinfo/liquidflag") == "Y" || model.getValue("/root/send/prcpinfo/outlblyn") == "Y"){
  48. fLiquidLBLPrint();
  49. } else if(model.getValue("/root/main/lbllist/lbllist["+1+"]/drugflag") == "E" || model.getValue("/root/main/lbllist/lbllist["+1+"]/drugflag") == "L"
  50. || model.getValue("/root/main/lbllist/lbllist["+1+"]/drugflag") == "G"){
  51. fBigLBLPrint();
  52. } else {
  53. fSmallLBLPrint();
  54. }
  55. }
  56. model.refresh();
  57. gTimer = window.setInterval("fStopTimer()",10000);
  58. window.close();
  59. }
  60. /**
  61. *
  62. */
  63. function fStopTimer() {
  64. window.clearinterval(gTimer);
  65. }
  66. function fSleep(numberMillis) {
  67. var now = new Date();
  68. var exitTime = now.getTime() + numberMillis;
  69. while (true) {
  70. now = new Date();
  71. if (now.getTime() > exitTime)
  72. return;
  73. }
  74. }
  75. /**
  76. * 병동 라벨출력(작은사이즈)
  77. */
  78. function fSmallLBLPrint() {
  79. /*
  80. 라벨 Sorting 로직
  81. //mgt에서 vo로 리턴
  82. 대분류
  83. - 내복약, 외용약, 주사, 항암제, TPN, 마약,
  84. 중분류
  85. - 방법코드
  86. 소분류
  87. - 내복약,외용약(방법코드), 주사,마약,항암제(mix)
  88. web js 출력로직
  89. 가. 퇴원/외래/응급실/외박/외출 : 큰사이즈라벨
  90. 외래기준
  91. 나. 그외 입원처방
  92. 1. 외용약
  93. 단독출력
  94. 2. 내복약
  95. 단독출력
  96. 따로포장
  97. 복용방법
  98. 3. 주사약
  99. 단독출력
  100. mix끼리
  101. 고가,향정,보관벙법이 실온이 아닌경우 자가주사인 경우 단독
  102. 나머지
  103. */
  104. // Comm 설정
  105. //CommAX.CommPort = "1"; // 출력 Port
  106. //CommAX.Settings = "9600,n,8,1"; // Comm 설정
  107. //CommAX.Settings = "127.0.0.1"; // Comm 설정
  108. PrnKind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/prntkind");
  109. PrnMarginLeft = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/blank/left");
  110. PrnMarginTop = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/blank/top");
  111. var commkind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/commkind")
  112. if ( PrnKind ==7 ) {
  113. CommAX.PrnKind =4;
  114. } else {
  115. CommAX.PrnKind =PrnKind;
  116. }
  117. if(commkind == "02") {
  118. CommAX.PortNm = 1;
  119. } else {
  120. CommAX.PortNm = 2;
  121. }
  122. if(commkind == "01") {
  123. CommAX.PrtNm = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/comm01/setupval");
  124. }
  125. //if ( CommAX.PortOpen() == true) {
  126. //alert("라벨 프린트 Open");
  127. //CommAX.SendMessage("^XA^SEE:UHANGUL.DAT^FS^CWQ,E:AAAAA.FNT^FS^CI26^FO100,50^AQN,40,40^FD이훈재ABCDEFGHI1234^FS^FO100,100^AQN,40,40^FD(주)한글인쇄테스트ABCDEFGHI1234^FS^FO100,150^AQN,40,40^FD A B C D E F G H I^FS^CI0^FO100,200^A0,50,50^FDPRINTING TEST^FS^FO100,250^BY2^B3N,N,100,Y,N,N^FD1232423423^FS^XZ");
  128. //CommAX.SendMessage("^XA^LH0,0^PRB^CF0,89^FO10,05^FDSH07^FS^CF0,70^FO260,05^FD10/10^FS^CF0,89^FO50,80^FD- 234567^FS^CFA20,20^FO10,150^FD1234567890^FS~DGGRAPH001,00504,021,0078000000E00000800000F01E000C00201FFC0000003C0000007007FFC00000F01E000C00201FFC000000006000003003000000C0701C00180060180C03000FFFF00FFE3003000000C0701C00180060180C0300061000061C300300000300783C003001E0101800C0007E000018300300C00300783C003001E0101800C000C30000303001FFE006006C6C006003600018006001818000603000180006006C6C006003600018006000C30000C03000180004006C6C00C0066000300020007E0001803000180004006C6C00C006600030002000180003003000181E0C0066CC0180186000600030001800060030FFFFFF0C0066CC018018600060003000181E1800207000000C00638C0300306000C00030FFFFFF0000000000000C00638C0300306000C000307000000000000000000400638C060060600180002000000000FFF00038000400638C0600606001800020007E00006060007E000600610C0C007FFC0180006000C30000006000C3000600610C0C007FFC018000600181800000400181800300600C18000060018000C001818000FFE00181800300600C18000060018000C001818000600001818000C0F03E300001F80180030000C30000600000C30000C0F03E300001F801800300007E00006060007E00000000000000000000000000003800003FF0003800000000000000000000000000^FO140,150^XGGRAPH001,1,1^FS~DGGRAPH002,00216,009,0000700000000001C00000380000000000E00000180000000000600000180000000000600FFF1807FFE0000060060E180300C03FFC60001C180000C0181C60003018000080001C600060180FFFC000186000D018070000001860018C180300000C18600307180300C006106606031801FFE006207F18001800000006006000001801860006036000001800C300061C6000001000C300FFE06000E00000C30070006000300000C31E000060003000FFFFFF000060003000700000000060003018000000000060001FFC000000000060000000000000000040^FO320,150^XGGRAPH002,1,1^FS^CFA20,20^FO10,180^FD2007-04-25^FS~DGGRAPH003,00240,010,002001E00000E0000080002001E000007007FFC0006006380000300300000060063800303003000001E00C1830183003000001E00C181818300300C003600800181BF001FFE0036008001FF830001800066018001818300018000660180018183000180018601BF0181BF000181E18601BF01FF830FFFFFF30601C1810103070000030601C180000200000006060180C0000000000006060180C0007000038007FFC0C0C000FC0007E007FFC0C0C00186000C30000600E1800303001818000600E1800303001818001F803E000303001818001F803E000186000C30000000000000FC0007E0000000000000700003800^FO140,180^XGGRAPH003,1,1^FS^CFE10,10^FO10,210^FDStomach 2/10^FS^CFA20,20^FO10,240^FDBiopsh^FS^PQ1^XZ");
  129. //CommAX.PortClose();
  130. //return;
  131. var sDD = getCurrentDate();
  132. var sTM = getCurrentTime();
  133. var reprint ="";
  134. for ( var i = 1; i <= getNodesetCount("/root/main/lbllist/lbllist") ; i++){
  135. if ( model.getValue("/root/main/lbllist/lbllist["+i+"]/lblgrup") != "DI" && model.getValue("/root/main/lbllist/lbllist["+i+"]/lblgrup") != "DS" ){
  136. totcnt++;
  137. }
  138. }
  139. for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
  140. if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblprnttims")>0 ){
  141. reprint ="(재)";
  142. }
  143. //시작(X, Y)
  144. sSndMsg += astfStartFormat(0, 0, "S");
  145. //라벨이름(내복약/주사약/마약)
  146. sSndMsg += astfPrintOut(20, 25, 21, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm"),"");
  147. //if(PrnKind == "2" || PrnKind == "7") {
  148. //출력일자
  149. sSndMsg += astfPrintOut(190, 25, 21, "출력:"+fPrntTime(sDD, sTM),"");
  150. //출력일자
  151. sSndMsg += astfPrintOut(190, 55, 21, "처방:"+fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"), "MD"),"");
  152. //} else {
  153. //출력일자
  154. // sSndMsg += astfPrintOut(220, 25, 21, "출 력 : "+fPrntTime(sDD, sTM),"");
  155. //출력일자
  156. // sSndMsg += astfPrintOut(220, 55, 21, "처 방 : "+fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"), "MD"),"");
  157. //}
  158. //병실
  159. sSndMsg += astfPrintOut(20, 80, 31, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/roomcd"),"");
  160. //환자이름
  161. sSndMsg += astfPrintOut(120, 80, 31, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm"),"");
  162. //환자번호
  163. sSndMsg += astfPrintOut(240, 80, 31, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/pid")+" ("+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno")+reprint+")","");
  164. //선그리기
  165. sSndMsg += astfGraphicBox(5, 120, 465, 0, 4);
  166. var sDrugKindcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  167. var sMixno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpmixno");
  168. if(sDrugKindcd == "[내복약]"){
  169. if(model.getValue("/root/send/prcpinfo/lbltype") == "Y"){
  170. fInUseDrugLBL2();
  171. } else {
  172. fInUseDrugLBL();
  173. }
  174. } else if(sDrugKindcd == "[외용약]"){
  175. //fExUseDrugLBL();
  176. if(model.getValue("/root/send/prcpinfo/lbltype") == "Y"){
  177. fInUseDrugLBL2();
  178. } else {
  179. fInUseDrugLBL();
  180. }
  181. } else if(sDrugKindcd == "[주사약]"){
  182. //alert(sMixno);
  183. if(sMixno != "-"){
  184. fMixLBL();
  185. } else {
  186. fInjDrugLBL();
  187. }
  188. }
  189. CommAX.SendMsg(sSndMsg);
  190. fSleep(500);
  191. sSndMsg = "";
  192. }
  193. //CommAX.PortClose();
  194. model.refresh();
  195. //}
  196. }
  197. /**
  198. * mix 라벨
  199. */
  200. function fMixLBL() {
  201. var sMixno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpmixno");
  202. var cnt = 0;
  203. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  204. sMixno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpmixno");
  205. var qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
  206. var dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
  207. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
  208. var tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  209. var dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  210. if(PrnKind == "2") {
  211. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  212. prcpnm = prcpnm.substr(0,7);
  213. } else {
  214. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  215. }
  216. if(sMixno1 == sMixno2){
  217. //
  218. sSndMsg += astfPrintOut(20, 140+(cnt*30), 24, model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd"),"");
  219. //
  220. sSndMsg += astfPrintOut(170, 140+(cnt*30), 11, prcpnm.substr(0,7),"");
  221. //
  222. sSndMsg += astfPrintOut(360, 140+(cnt*30), 2, dayqty+qtyunit,"");
  223. //
  224. sSndMsg += astfPrintOut(430, 140+(cnt*30), 2, tims,"");
  225. //
  226. sSndMsg += astfPrintOut(460, 140+(cnt*30), 2, dayno,"");
  227. cnt++;
  228. } else {
  229. j--;
  230. break;
  231. }
  232. if(cnt == 5){
  233. break;
  234. }
  235. }
  236. iPoint = j;
  237. //종료(매수)
  238. sSndMsg += astfEndFormat(0);
  239. }
  240. /**
  241. * 내복약 라벨
  242. */
  243. function fInUseDrugLBL() {
  244. // var sSumCls1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  245. var sMthdcd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  246. var qty = "";
  247. var dayqty = "";
  248. var qtyunit = "";
  249. var tims = "";
  250. var dayno = "";
  251. var cnt = 0;
  252. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  253. if(cnt != 0 && fChkIndependDrug(j)){
  254. break;
  255. }
  256. // sSumCls2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/sumcls");
  257. sMthdcd2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthdcd");
  258. qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
  259. dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
  260. qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
  261. tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  262. dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  263. if(PrnKind == "2") {
  264. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  265. prcpnm = prcpnm.substr(0,7);
  266. } else {
  267. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  268. }
  269. if((sMthdcd1 == sMthdcd2)){
  270. //
  271. sSndMsg += astfPrintOut(20, 140+(cnt*30), 24, model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd"),"");
  272. //
  273. sSndMsg += astfPrintOut(165, 140+(cnt*30), 11, prcpnm.substr(0,7),"");
  274. if( model.getValue("/root/main/lbllist/lbllist["+j+"]/lblgrup") == "DS"){
  275. //
  276. sSndMsg += astfPrintOut(360, 140+(cnt*30), 2, dayqty+qtyunit,"");
  277. //
  278. sSndMsg += astfPrintOut(430, 140+(cnt*30), 2, tims,"");
  279. //
  280. sSndMsg += astfPrintOut(460, 140+(cnt*30), 2, dayno,"");
  281. } else {
  282. //
  283. sSndMsg += astfPrintOut(360, 140+(cnt*30), 2, dayqty,"");
  284. //
  285. sSndMsg += astfPrintOut(430, 140+(cnt*30), 2, tims,"");
  286. //
  287. sSndMsg += astfPrintOut(460, 140+(cnt*30), 2, dayno,"");
  288. }
  289. cnt++;
  290. } else {
  291. break;
  292. }
  293. if(cnt == fMthdnmLength(iPoint) || fChkIndependDrug(j)){
  294. j++;
  295. break;
  296. }
  297. }
  298. iPoint = j-1;
  299. //보관방법 고가 출력
  300. var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd");
  301. var sExpnyn = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/expnyn");
  302. var sExpnnm = "";
  303. if(sExpnyn == "Y") sExpnnm = "고가";
  304. //if(sKeepmthd != "" && sExpnnm != ""){
  305. // sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+sExpnnm+">","");
  306. //} else
  307. if(sKeepmthd != ""){
  308. sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+">","");
  309. }
  310. if(sExpnnm != ""){
  311. sSndMsg += astfPrintOut(135, 180, 3, "<"+sExpnnm+">","");
  312. }
  313. /*
  314. if(sKeepmthd != "" && sExpnnm != ""){
  315. sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+sExpnnm+">","");
  316. } else if(sKeepmthd != ""){
  317. sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+">","");
  318. } if(sExpnnm != ""){
  319. sSndMsg += astfPrintOut(20, 180, 3, "<"+sExpnnm+">","");
  320. }*/
  321. //용법의 길이에 따라 찍는 위치를 달리한다(용법찍을 공간을 확보)
  322. var iYPoint = 0;
  323. if( fMthdnmLength(iPoint) == 4){
  324. iYPoint = 280;
  325. } else {
  326. iYPoint = 245;
  327. }
  328. if( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblgrup") == "DS"){
  329. sSndMsg += astfPrintOut(20, iYPoint, 3, "1일 "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims")+"회 "
  330. +qty+qtyunit+" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno")+"일분","");
  331. } else {
  332. sSndMsg += astfPrintOut(20, iYPoint, 3, "1일 "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims")+"회 "
  333. +model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno")+"일분","");
  334. }
  335. //
  336. sSndMsg += fMthdnm(iPoint);
  337. //종료(매수)
  338. sSndMsg += astfEndFormat(0);
  339. }
  340. /**
  341. * 내복약 라벨 - 한장에 모든 용법 약을 ...
  342. */
  343. function fInUseDrugLBL2() {
  344. // var sSumCls1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  345. var sMthdcd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  346. var qty = "";
  347. var dayqty = "";
  348. var qtyunit = "";
  349. var tims = "";
  350. var dayno = "";
  351. var cnt = 0;
  352. var chk = false;
  353. totpg = Math.ceil(totcnt / 6 );
  354. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  355. if(cnt != 0 && model.getValue("/root/main/lbllist/lbllist["+j+"]/lblgrup") == "DI" ) {
  356. break;
  357. }
  358. //if(cnt != 0 && fChkIndependDrug(j)){
  359. // break;
  360. //}
  361. // sSumCls2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/sumcls");
  362. sMthdcd2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthdcd");
  363. qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
  364. dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
  365. qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
  366. tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  367. dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  368. if(PrnKind == "2") {
  369. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  370. prcpnm = prcpnm.substr(0,7);
  371. } else {
  372. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  373. }
  374. //if((sMthdcd1 == sMthdcd2)){
  375. //
  376. if( model.getValue("/root/main/lbllist/lbllist["+j+"]/lblgrup") == "DT"){ //PTP는 * 표시
  377. sSndMsg += astfPrintOut(20, 140+(cnt*30), 24, "*","");
  378. }
  379. sSndMsg += astfPrintOut(30, 140+(cnt*30), 24, model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd"),"");
  380. //
  381. sSndMsg += astfPrintOut(165, 140+(cnt*30), 11, prcpnm.substr(0,7),"");
  382. if( model.getValue("/root/main/lbllist/lbllist["+j+"]/lblgrup") == "DS"){
  383. //
  384. sSndMsg += astfPrintOut(360, 140+(cnt*30), 2, dayqty+qtyunit,"");
  385. //
  386. sSndMsg += astfPrintOut(430, 140+(cnt*30), 2, tims,"");
  387. //
  388. sSndMsg += astfPrintOut(460, 140+(cnt*30), 2, dayno,"");
  389. } else {
  390. //
  391. sSndMsg += astfPrintOut(360, 140+(cnt*30), 2, dayqty,"");
  392. //
  393. sSndMsg += astfPrintOut(430, 140+(cnt*30), 2, tims,"");
  394. //
  395. sSndMsg += astfPrintOut(460, 140+(cnt*30), 2, dayno,"");
  396. }
  397. cnt++;
  398. //} else {
  399. // break;
  400. //}
  401. //if(cnt == fMthdnmLength(iPoint) || fChkIndependDrug(j)){
  402. // j++;
  403. // break;
  404. //}
  405. if(cnt == 6){
  406. pg++;
  407. sSndMsg += astfPrintOut(430,320, 2, pg+ "/" + totpg ,"");
  408. j++;
  409. chk=true;
  410. break;
  411. }
  412. }
  413. if ( chk == false ){
  414. pg++;
  415. if( model.getValue("/root/main/lbllist/lbllist["+(j-1)+"]/lblgrup") != "DI" ) {
  416. sSndMsg += astfPrintOut(430,320, 2, pg+"/" +totpg ,"");
  417. }
  418. }
  419. iPoint = j-1;
  420. //보관방법 고가 출력
  421. /*var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd");
  422. var sExpnyn = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/expnyn");
  423. var sExpnnm = "";
  424. if(sExpnyn == "Y") sExpnnm = "고가";
  425. //if(sKeepmthd != "" && sExpnnm != ""){
  426. // sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+sExpnnm+">","");
  427. //} else
  428. if(sKeepmthd != ""){
  429. sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+">","");
  430. }
  431. if(sExpnnm != ""){
  432. sSndMsg += astfPrintOut(135, 180, 3, "<"+sExpnnm+">","");
  433. }*/
  434. /*
  435. if(sKeepmthd != "" && sExpnnm != ""){
  436. sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+sExpnnm+">","");
  437. } else if(sKeepmthd != ""){
  438. sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+">","");
  439. } if(sExpnnm != ""){
  440. sSndMsg += astfPrintOut(20, 180, 3, "<"+sExpnnm+">","");
  441. }*/
  442. //용법의 길이에 따라 찍는 위치를 달리한다(용법찍을 공간을 확보)
  443. //var iYPoint = 0;
  444. //if( fMthdnmLength(iPoint) == 4){
  445. // iYPoint = 280;
  446. //} else {
  447. // iYPoint = 245;
  448. //}
  449. //if( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblgrup") == "DS"){
  450. // sSndMsg += astfPrintOut(20, iYPoint, 3, "1일 "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims")+"회 "
  451. // +qty+qtyunit+" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno")+"일분","");
  452. //} else {
  453. // sSndMsg += astfPrintOut(20, iYPoint, 3, "1일 "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims")+"회 "
  454. // +model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno")+"일분","");
  455. //}
  456. //
  457. //sSndMsg += fMthdnm(iPoint);
  458. //종료(매수)
  459. sSndMsg += astfEndFormat(0);
  460. }
  461. /**
  462. * 외용약 라벨
  463. */
  464. function fExUseDrugLBL() {
  465. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  466. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  467. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  468. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  469. if(PrnKind == "2") {
  470. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
  471. prcpnm = prcpnm.substr(0,7);
  472. } else {
  473. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
  474. }
  475. //
  476. sSndMsg += astfPrintOut(20, 140, 24, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd"),"");
  477. //
  478. sSndMsg += astfPrintOut(165, 140, 11, prcpnm.substr(0,7),"");
  479. //
  480. sSndMsg += astfPrintOut(360, 140, 2, dayqty,"");
  481. //
  482. sSndMsg += astfPrintOut(430, 140, 2, tims,"");
  483. //
  484. sSndMsg += astfPrintOut(460, 140, 2, dayno,"");
  485. sSndMsg += astfPrintOut(20, 280, 3, "1일 "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims")+"회 "
  486. +model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno")+"일분","");
  487. //
  488. sSndMsg += fMthdnm(iPoint);
  489. //종료(매수)
  490. sSndMsg += astfEndFormat(0);
  491. }
  492. /**
  493. * 주사약 라벨
  494. */
  495. function fInjDrugLBL() {
  496. var sSumCls1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  497. var cnt = 0;
  498. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  499. if(cnt != 0 && fChkIndependInj(j)){
  500. //주사가 뭉쳐서 나오다가 단독주사를 만날경우 단독주사는 출력하지 아니함.
  501. break;
  502. }
  503. sSumCls2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/sumcls");
  504. var qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
  505. var dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
  506. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
  507. var tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  508. var dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  509. if(PrnKind == "2") {
  510. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  511. prcpnm = prcpnm.substr(0,7);
  512. } else {
  513. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  514. }
  515. //
  516. sSndMsg += astfPrintOut(20, 140+(cnt*30), 24, model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd"),"");
  517. //
  518. sSndMsg += astfPrintOut(165, 140+(cnt*30), 11, prcpnm.substr(0,7),"");
  519. //
  520. sSndMsg += astfPrintOut(360, 140+(cnt*30), 2, fChkFloat(dayqty)+qtyunit,"");
  521. //
  522. sSndMsg += astfPrintOut(430, 140+(cnt*30), 2, tims,"");
  523. //
  524. sSndMsg += astfPrintOut(460, 140+(cnt*30), 2, dayno,"");
  525. cnt++;
  526. if(cnt == 5 || fChkIndependInj(j)){
  527. j++;
  528. break;
  529. }
  530. }
  531. iPoint = j-1;
  532. //보관방법 고가 출력
  533. var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd");
  534. var sExpnyn = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/expnyn");
  535. var sExpnnm = "";
  536. if(sExpnyn == "Y") sExpnnm = "고가";
  537. //if(sKeepmthd != "" && sExpnnm != ""){
  538. // sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+sExpnnm+">","");
  539. //} else
  540. if(sKeepmthd != ""){
  541. sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+">","");
  542. }
  543. if(sExpnnm != ""){
  544. sSndMsg += astfPrintOut(135, 180, 3, "<"+sExpnnm+">","");
  545. }
  546. //종료(매수)
  547. sSndMsg += astfEndFormat(0);
  548. }
  549. /**
  550. * 내복약 단독라벨 검증작업
  551. */
  552. function fChkIndependDrug(cnt) {
  553. var sLBLGrup = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/lblgrup");
  554. var sSnglyn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/atcifsnglyn");
  555. var sDrugindependpackflag = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/drugindependpackflag");
  556. var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/keepmthd");
  557. var sExpnyn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/expnyn");
  558. var sRst = false;
  559. if(sLBLGrup == "DS" || sLBLGrup == "DI" || sLBLGrup == "DT" || sLBLGrup == "DX") sRst = true;
  560. if(sSnglyn == "Y") sRst = true;
  561. if(sDrugindependpackflag == "Y") sRst = true;
  562. if(sExpnyn == "Y") sRst = true;
  563. if(sKeepmthd != "") sRst = true;
  564. return sRst;
  565. }
  566. /**
  567. * 주사약 단독라벨 검증작업
  568. */
  569. function fChkIndependInj(cnt) {
  570. var sLBLGrup = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/lblgrup");
  571. var sExp = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/expnyn");
  572. var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/keepmthd");
  573. var sSelfprcpflag = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/selfprcpflag");
  574. var sDrugindependpackflag = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/drugindependpackflag");
  575. var sRst = false;
  576. if(sLBLGrup == "IH" || sLBLGrup == "IO" || sLBLGrup == "IS" || sLBLGrup == "IX") sRst = true;
  577. if(sExp == "Y" || sKeepmthd != "" || sSelfprcpflag == "Y") sRst = true;
  578. if(sDrugindependpackflag == "Y") sRst = true;
  579. return sRst;
  580. }
  581. /**
  582. * 용법 생성
  583. */
  584. function fMthdnm(iPoint) {
  585. var sMthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1");
  586. var sMthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2");
  587. var sMthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  588. var sMthd4 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  589. var sTemp = "";
  590. var sRst = "";
  591. if(sMthd1 != "") sTemp += sMthd1 + " ";
  592. if(sMthd2 != "") sTemp += sMthd2 + " ";
  593. if(sMthd3 != "") sTemp += sMthd3 + " ";
  594. if(sMthd4 != "") sTemp += sMthd4;
  595. if(sTemp.length > 28){
  596. var sTemp1 = sTemp.substr(0, 26);
  597. var sTemp2 = sTemp.substr(26, sTemp.length);
  598. sRst = astfPrintOut(20, 285, 28, sTemp1,"");
  599. sRst += astfPrintOut(20, 320, 28, sTemp2,"");
  600. } else if(sTemp.length > 24){
  601. sRst = astfPrintOut(20, 320, 29, sTemp,"");
  602. } else if(sTemp.length > 22){
  603. sRst = astfPrintOut(20, 320, 3, sTemp,"");
  604. } else if(sTemp.length > 21){
  605. sRst = astfPrintOut(20, 320, 3, sTemp,"");
  606. } else if(sTemp.length <= 21){
  607. sRst = astfPrintOut(20, 320, 3, sTemp,"");
  608. }
  609. return sRst;
  610. }
  611. /**
  612. * 용법 길이
  613. */
  614. function fMthdnmLength(iPoint) {
  615. var sMthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1");
  616. var sMthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2");
  617. var sMthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  618. var sMthd4 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  619. var sTemp = "";
  620. var sRst = "4"; //병동라벨은 기본 4줄까지 약처방이 출력된다.
  621. if(sMthd1 != "") sTemp += sMthd1 + " ";
  622. if(sMthd2 != "") sTemp += sMthd2 + " ";
  623. if(sMthd3 != "") sTemp += sMthd3 + " ";
  624. if(sMthd4 != "") sTemp += sMthd4;
  625. if(sTemp.length > 28){
  626. sRst = "3"; //복용방법이 길경우 3줄까지 약처방을 출력한다.
  627. }
  628. return sRst;
  629. }
  630. /**
  631. * 응급실/퇴원/외박/외출 라벨출력(큰사이즈)
  632. */
  633. function fBigLBLPrint() {
  634. /*
  635. 라벨 Sorting 로직
  636. //mgt에서 vo로 리턴
  637. 대분류
  638. - 내복약, 외용약, 주사, 항암제, TPN, 마약,
  639. 중분류
  640. - 방법코드
  641. 소분류
  642. - 내복약,외용약(방법코드), 주사,마약,항암제(mix)
  643. web js 출력로직
  644. 1 약종류(내복약/주사약/외용약)
  645. 1.1 방법코드
  646. 1.2 처방수량
  647. */
  648. // Comm 설정
  649. //CommAX.CommPort = "1"; // 출력 Port
  650. //CommAX.Settings = "9600,n,8,1"; // Comm 설정
  651. //CommAX.Settings = "127.0.0.1"; // Comm 설정
  652. PrnKind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/prntkind");
  653. var commkind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/commkind")
  654. CommAX.PrnKind =PrnKind;
  655. if(commkind == "02") {
  656. CommAX.PortNm = 1;
  657. } else {
  658. CommAX.PortNm = 2;
  659. }
  660. if(commkind == "01") {
  661. CommAX.PrtNm = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/comm01/setupval");
  662. }
  663. var reprint="";
  664. //if ( CommAX.PortOpen() == true) {
  665. //alert("라벨 프린트 Open");
  666. //CommAX.SendMessage("^XA^SEE:UHANGUL.DAT^FS^CWQ,E:AAAAA.FNT^FS^CI26^FO100,50^AQN,40,40^FD이훈재ABCDEFGHI1234^FS^FO100,100^AQN,40,40^FD(주)한글인쇄테스트ABCDEFGHI1234^FS^FO100,150^AQN,40,40^FD A B C D E F G H I^FS^CI0^FO100,200^A0,50,50^FDPRINTING TEST^FS^FO100,250^BY2^B3N,N,100,Y,N,N^FD1232423423^FS^XZ");
  667. //CommAX.SendMessage("^XA^LH0,0^PRB^CF0,89^FO10,05^FDSH07^FS^CF0,70^FO260,05^FD10/10^FS^CF0,89^FO50,80^FD- 234567^FS^CFA20,20^FO10,150^FD1234567890^FS~DGGRAPH001,00504,021,0078000000E00000800000F01E000C00201FFC0000003C0000007007FFC00000F01E000C00201FFC000000006000003003000000C0701C00180060180C03000FFFF00FFE3003000000C0701C00180060180C0300061000061C300300000300783C003001E0101800C0007E000018300300C00300783C003001E0101800C000C30000303001FFE006006C6C006003600018006001818000603000180006006C6C006003600018006000C30000C03000180004006C6C00C0066000300020007E0001803000180004006C6C00C006600030002000180003003000181E0C0066CC0180186000600030001800060030FFFFFF0C0066CC018018600060003000181E1800207000000C00638C0300306000C00030FFFFFF0000000000000C00638C0300306000C000307000000000000000000400638C060060600180002000000000FFF00038000400638C0600606001800020007E00006060007E000600610C0C007FFC0180006000C30000006000C3000600610C0C007FFC018000600181800000400181800300600C18000060018000C001818000FFE00181800300600C18000060018000C001818000600001818000C0F03E300001F80180030000C30000600000C30000C0F03E300001F801800300007E00006060007E00000000000000000000000000003800003FF0003800000000000000000000000000^FO140,150^XGGRAPH001,1,1^FS~DGGRAPH002,00216,009,0000700000000001C00000380000000000E00000180000000000600000180000000000600FFF1807FFE0000060060E180300C03FFC60001C180000C0181C60003018000080001C600060180FFFC000186000D018070000001860018C180300000C18600307180300C006106606031801FFE006207F18001800000006006000001801860006036000001800C300061C6000001000C300FFE06000E00000C30070006000300000C31E000060003000FFFFFF000060003000700000000060003018000000000060001FFC000000000060000000000000000040^FO320,150^XGGRAPH002,1,1^FS^CFA20,20^FO10,180^FD2007-04-25^FS~DGGRAPH003,00240,010,002001E00000E0000080002001E000007007FFC0006006380000300300000060063800303003000001E00C1830183003000001E00C181818300300C003600800181BF001FFE0036008001FF830001800066018001818300018000660180018183000180018601BF0181BF000181E18601BF01FF830FFFFFF30601C1810103070000030601C180000200000006060180C0000000000006060180C0007000038007FFC0C0C000FC0007E007FFC0C0C00186000C30000600E1800303001818000600E1800303001818001F803E000303001818001F803E000186000C30000000000000FC0007E0000000000000700003800^FO140,180^XGGRAPH003,1,1^FS^CFE10,10^FO10,210^FDStomach 2/10^FS^CFA20,20^FO10,240^FDBiopsh^FS^PQ1^XZ");
  668. //CommAX.PortClose();
  669. //return;
  670. //페이지번호 조회(입원쪽은 전부 페이지번호 안넣기로 함 2.14 공두경)
  671. /*var iPageCnt = 0;
  672. for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
  673. if( fChkSumcls(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls"))){
  674. //단독라벨출력
  675. } else {
  676. //일반라벨출력
  677. var drugkind1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  678. var dayno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  679. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1");
  680. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2");
  681. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3");
  682. var cnt = 0;
  683. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  684. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  685. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  686. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  687. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  688. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  689. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  690. && !fChkSumcls(model.getValue("/root/main/lbllist/lbllist["+j+"]/sumcls"))){
  691. cnt++;
  692. } else {
  693. break;
  694. }
  695. if(cnt == 10){
  696. j++;
  697. break;
  698. }
  699. }
  700. iPoint = j-1;
  701. }
  702. iPageCnt++;
  703. }
  704. var iTotalPageNum = iPageCnt;
  705. iPageCnt = 0;
  706. */
  707. for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
  708. if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblprnttims")>0 ){
  709. reprint ="(재)";
  710. }
  711. //시작(X, Y)
  712. sSndMsg += astfStartFormat(0, 0, "B");
  713. //iPageCnt++;
  714. //////////////////////////////////////////////////
  715. // 라벨 상단내용 //
  716. /////////////////////////////////////////////////
  717. //병실
  718. sSndMsg += astfPrintOut(30, 30, 6, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/roomcd"),"");
  719. //환자명
  720. sSndMsg += astfPrintOut(180, 30, 6, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm").substring(0,5),"");
  721. //바코드(변환)
  722. sSndMsg += astfBarCode_Code39(390, 40, "N", 70, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode"));
  723. //환자번호
  724. sSndMsg += astfPrintOut(30, 85, 3, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/pid") ,"");
  725. //투약번호=>20091014 이선경 : 크고 진하게 변경
  726. sSndMsg += astfPrintOut(130, 85, 6, " (" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno") + ")","");
  727. //성별나이
  728. sSndMsg += astfPrintOut(280, 85, 3, reprint+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sexage"),"");
  729. //처방과약어명
  730. sSndMsg += astfPrintOut(30, 135, 3, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/deptengabbr"),"");
  731. //의사명
  732. sSndMsg += astfPrintOut(120, 135, 3, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/orddrnm"),"");
  733. //처방일자
  734. sSndMsg += astfPrintOut(270, 135, 3, fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd")),"");
  735. //페이지수
  736. //sSndMsg += astfPrintOut(430, 135, 3, iPageCnt+"/"+iTotalPageNum,"");
  737. //바코드
  738. sSndMsg += astfPrintOut(510, 130, 3, "*"+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode")+"*","");
  739. //선그리기
  740. sSndMsg += astfGraphicBox(5, 180, 815, 0, 4);
  741. sSndMsg += astfPrintOut(20, 600, 2, "*의약품은 그 특성상 보관및관리가 엄격해야하므로, ");
  742. sSndMsg += astfPrintOut(20, 630, 2, " 일단 조제투약된 약은 반납할 수 없습니다.");
  743. //////////////////////////////////////////////////
  744. // 라벨 하단내용 //
  745. /////////////////////////////////////////////////
  746. if( fChkSumcls(iPoint)){
  747. //단독라벨출력
  748. fIndependPrint();
  749. } else {
  750. //일반라벨출력
  751. fGnrlPrint();
  752. }
  753. //종료(매수)
  754. sSndMsg += astfEndFormat(0);
  755. CommAX.SendMsg(sSndMsg);
  756. fSleep(500);
  757. sSndMsg = "";
  758. }
  759. //CommAX.PortClose();
  760. model.refresh();
  761. //}
  762. }
  763. /**
  764. *
  765. */
  766. function fIndependPrint() {
  767. //약종류(내복약/주사약/외용약)
  768. sSndMsg += astfPrintOut(30, 230, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm"),"");
  769. //라벨내용
  770. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  771. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  772. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  773. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  774. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  775. if (drugkindnm == "[주사약]"){
  776. //용법2
  777. sSndMsg += astfPrintOut(30, 300, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),"");
  778. } else if (drugkindnm == "[외용약]"){
  779. //sSndMsg += astfPrintOut(210, 230, 7, "1일 "+tims+"회 "+fChkFloat(qty)+"개씩 "+dayno+"일분","");
  780. //용법1
  781. sSndMsg += astfPrintOut(30, 300, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  782. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3"),"");
  783. //용법2
  784. sSndMsg += astfPrintOut(30, 370, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),"");
  785. } else if (drugkindnm == "[내복약]"){
  786. sSndMsg += astfPrintOut(210, 230, 7, "1일 "+tims+"회 "+fChkFloat(qty)+"포[정]씩 "+dayno+"일분","");
  787. //용법1
  788. sSndMsg += astfPrintOut(30, 300, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  789. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3"),"");
  790. //용법2
  791. sSndMsg += astfPrintOut(30, 370, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),"");
  792. }
  793. var lblcnts1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblcnts1");
  794. lblcnts1 = lblcnts1.setReplaceWord("~", "-"); //20090728
  795. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd")
  796. +" "+parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty"))
  797. +" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
  798. if(lblcnts1.length > 28){
  799. //주의사항
  800. sSndMsg += astfPrintOut(30, 450, 5, lblcnts1.substring(0,24),"");
  801. sSndMsg += astfPrintOut(30, 510, 5, lblcnts1.substring(24,lblcnts1.length),"");
  802. //약정보
  803. sSndMsg += astfPrintOut(30, 570, 4, val, "");
  804. } else {
  805. //주의사항
  806. sSndMsg += astfPrintOut(30, 450, 5, lblcnts1,"");
  807. //약정보
  808. sSndMsg += astfPrintOut(30, 510, 4, val, "");
  809. }
  810. }
  811. /**
  812. *
  813. */
  814. function fGnrlPrint() {
  815. var cnt = 0;
  816. var drugcnt = 0;
  817. //약종류(내복약/주사약/외용약)
  818. sSndMsg += astfPrintOut(30, 220, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm"),"");
  819. //라벨내용
  820. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  821. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  822. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  823. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  824. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  825. //약코드 출력
  826. var drugkind1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  827. var dayno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  828. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1");
  829. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2");
  830. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3");
  831. var mthdcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  832. if (drugkindnm == "[주사약]"){
  833. //용법2
  834. sSndMsg += astfPrintOut(30, 290, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),"");
  835. } else if (drugkindnm == "[외용약]"){
  836. //sSndMsg += astfPrintOut(210, 220, 7, "1일 "+tims+"회 "+qty+"개씩 "+dayno+"일분","");
  837. //용법1
  838. sSndMsg += astfPrintOut(30, 290, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  839. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3"),"");
  840. //용법2
  841. sSndMsg += astfPrintOut(30, 360, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),"");
  842. } else if (drugkindnm == "[내복약]"){
  843. var lbltims =0;
  844. lbl_tims = mthd2.split(",");
  845. if ( mthdcd == "ZZZ" ){
  846. lbltims = tims;
  847. } else if ( mthd3.indexOf("취침") > -1 ) {
  848. lbltims = lbl_tims.length +1;
  849. } else if(mthd2.indexOf("마다") > -1){
  850. lbltims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  851. } else {
  852. lbltims = lbl_tims.length;
  853. }
  854. tims = lbltims;
  855. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  856. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  857. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  858. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  859. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  860. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  861. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  862. && !fChkSumcls(j)){
  863. drugcnt++;
  864. } else {
  865. break;
  866. }
  867. }
  868. if ( drugcnt == 1 ){
  869. if(lbltims == 1) {
  870. if(mthd2.indexOf("마다") == -1) {
  871. sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회"+fChkFloat(qty)+"포[정]씩 "+dayno+"일분","");
  872. prcpqty = prcpqty * lbltims;
  873. } else {
  874. sSndMsg += astfPrintOut(210, 220, 7, "1일 "+tims+ "회"+fChkFloat(qty)+"포[정]씩 "+dayno+"일분","");
  875. prcpqty = prcpqty * tims;
  876. }
  877. } else {
  878. sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회"+fChkFloat(qty)+"포[정]씩 "+dayno+"일분","");
  879. prcpqty = prcpqty * lbltims;
  880. }
  881. } else {
  882. if(lbltims == 1) {
  883. if(mthd2.indexOf("마다") == -1) {
  884. sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회 1포씩 "+dayno+"일분","");
  885. } else {
  886. sSndMsg += astfPrintOut(210, 220, 7, "1일 "+tims+ "회 1포씩 "+dayno+"일분","");
  887. }
  888. } else {
  889. sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회 1포씩 "+dayno+"일분","");
  890. }
  891. }
  892. //용법1
  893. //if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") =="취침전에" ){
  894. // sSndMsg += astfPrintOut(30, 290, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  895. // + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3"),"");
  896. //} else {
  897. sSndMsg += astfPrintOut(30, 290, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2")
  898. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3"),"");
  899. //}
  900. //용법2
  901. sSndMsg += astfPrintOut(30, 360, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),"");
  902. }
  903. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  904. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  905. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  906. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  907. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  908. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  909. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  910. && !fChkSumcls(j)){
  911. //if(model.getValue("/root/main/lbllist/lbllist["+j+"]/fst_prnt") == "Y"){
  912. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims") ;
  913. prcpqty = Math.ceil( prcpqty * tims*1000)/1000;
  914. var val = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd")
  915. +" "+prcpqty
  916. +" "+(model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm")).substring(0,6);
  917. sSndMsg += astfPrintOut(30+((cnt%2)*380), 440+((parseInt(cnt/2, 10))*40), 2, val, "");
  918. //}
  919. cnt++;
  920. } else {
  921. break;
  922. }
  923. if(cnt == 8){
  924. j++;
  925. break;
  926. }
  927. }
  928. iPoint = j-1;
  929. }
  930. /**
  931. *
  932. */
  933. function fDateFormat(sDD, sYMD) {
  934. if(sYMD == "MD"){
  935. return sDD.substr(4,2)+"/"+sDD.substr(6,2);
  936. } else {
  937. return sDD.substr(0,4)+"/"+sDD.substr(4,2)+"/"+sDD.substr(6,2);
  938. }
  939. }
  940. /**
  941. *
  942. */
  943. function fPrntTime(sDD, sTM) {
  944. //if(PrnKind == "2" || PrnKind == "7" ) {
  945. return sDD.substr(4,2)+"/"+sDD.substr(6,2)+" "+sTM.substr(0,2)+":"+sTM.substr(2,2);
  946. //} else {
  947. // return sDD.substr(4,2)+" / "+sDD.substr(6,2)+" "+sTM.substr(0,2)+":"+sTM.substr(2,2)+":"+sTM.substr(4,2);
  948. //}
  949. }
  950. /**
  951. *
  952. */
  953. function fChkFloat(qty) {
  954. var fQty = parseFloat(qty);
  955. var fRst = "";
  956. if(fQty%1 == 0){
  957. fRst = parseInt(qty);
  958. } else {
  959. fRst = qty;
  960. }
  961. return fRst;
  962. }
  963. /**
  964. *
  965. */
  966. function fChkSumcls(cnt) {
  967. var chk = false;
  968. var sSumcls = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/sumcls");
  969. var sSnglyn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/atcifsnglyn");
  970. var sDrugindependpackflag = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/drugindependpackflag");
  971. if(sSumcls == "DI" || sSumcls == "DS"|| sSumcls == "DX"|| sSumcls == "DT" || sSumcls == "DM" || sSumcls == "IH"|| sSumcls == "IO"
  972. || sSumcls == "IS"|| sSumcls == "IX"|| sSumcls == "X" || sSumcls == "I"){
  973. chk = true;
  974. }
  975. if ( sSumcls == "D" && sSnglyn =="Y" ) {
  976. chk = true;
  977. }
  978. if ( sDrugindependpackflag =="Y"){
  979. chk = true;
  980. }
  981. return chk;
  982. }
  983. /**
  984. * 물약라벨출력
  985. */
  986. function fLiquidLBLPrint() {
  987. // Comm 설정
  988. //CommAX.CommPort = "1"; // 출력 Port
  989. //CommAX.Settings = "9600,n,8,1"; // Comm 설정
  990. //CommAX.Settings = "127.0.0.1"; // Comm 설정
  991. PrnKind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/prntkind");
  992. PrnMarginLeft = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/blank/left");
  993. PrnMarginTop = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/blank/top");
  994. var commkind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/commkind")
  995. if ( PrnKind ==7 ) {
  996. CommAX.PrnKind =4;
  997. } else {
  998. CommAX.PrnKind =PrnKind;
  999. }
  1000. if(commkind == "02") {
  1001. CommAX.PortNm = 1;
  1002. } else {
  1003. CommAX.PortNm = 2;
  1004. }
  1005. if(commkind == "01") {
  1006. CommAX.PrtNm = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/comm01/setupval");
  1007. }
  1008. var reprint ="";
  1009. //if ( CommAX.PortOpen() == true) {
  1010. for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
  1011. if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblprnttims")>0 ){
  1012. reprint ="(재)";
  1013. }
  1014. //시작(X, Y)
  1015. sSndMsg += astfStartFormat(0, 0, "S");
  1016. //////////////////////////////////////////////////
  1017. // 라벨 상단내용 //
  1018. /////////////////////////////////////////////////
  1019. //병실
  1020. //sSndMsg += astfPrintOut(50, 30, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/roomcd"),"");
  1021. //환자명
  1022. //sSndMsg += astfPrintOut(50, 85, 6, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm"),"");
  1023. //내복약
  1024. //sSndMsg += astfPrintOut(250, 30, 3, "내복약","");
  1025. //처방일자
  1026. //sSndMsg += astfPrintOut(250, 70, 3, fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd")),"");
  1027. //환자번호(투약번호)
  1028. //sSndMsg += astfPrintOut(250, 110, 3, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/pid")+ " ( "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno")+reprint+" )","");
  1029. //선그리기
  1030. //sSndMsg += astfGraphicBox(5, 145, 465, 0, 4);
  1031. var sDD = getCurrentDate();
  1032. var sTM = getCurrentTime();
  1033. //라벨이름(내복약/주사약/마약)
  1034. sSndMsg += astfPrintOut(20, 25, 20, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm"),"");
  1035. //if(PrnKind == "2" || PrnKind == "7" ) {
  1036. //출력일자
  1037. sSndMsg += astfPrintOut(190, 25, 21, "출력:"+fPrntTime(sDD, sTM),"");
  1038. //출력일자
  1039. sSndMsg += astfPrintOut(190, 55, 21, "처방:"+fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"), "MD"),"");
  1040. //} else {
  1041. //출력일자
  1042. // sSndMsg += astfPrintOut(220, 25, 21, "출 력 : "+fPrntTime(sDD, sTM),"");
  1043. //출력일자
  1044. // sSndMsg += astfPrintOut(220, 55, 21, "처 방 : "+fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"), "MD"),"");
  1045. //}
  1046. //병실
  1047. sSndMsg += astfPrintOut(20, 80, 31, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/roomcd"),"");
  1048. //환자이름
  1049. sSndMsg += astfPrintOut(120, 80, 31, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm"),"");
  1050. //환자번호
  1051. sSndMsg += astfPrintOut(240, 80, 31, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/pid")+" ("+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno")+reprint+")","");
  1052. //선그리기
  1053. sSndMsg += astfGraphicBox(5, 120, 465, 0, 4);
  1054. //////////////////////////////////////////////////
  1055. // 라벨 하단내용 //
  1056. /////////////////////////////////////////////////
  1057. //라벨내용
  1058. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  1059. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqtyunit");
  1060. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  1061. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  1062. var qty = Math.ceil(dayqty / tims * 1000)/1000 ;
  1063. var totqty = parseInt(dayqty)*parseInt(dayno);
  1064. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1");
  1065. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2");
  1066. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  1067. //용법
  1068. if ( mthd1 == "" && mthd2 == "" && mthd3 == "" ){
  1069. //1일 X회 Xml씩 X일분
  1070. sSndMsg += astfPrintOut(40, 126, 27, "1일 "+tims+"회 "+qty+qtyunit+"씩 "+dayno+"일분","");
  1071. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/abbrnm");
  1072. if (val.length > 17) {
  1073. sSndMsg += astfPrintOut(40, 171, 27, val.substring(0,17) ,"");
  1074. sSndMsg += astfPrintOut(40, 210, 27, val.substring(17,val.length) ,"");
  1075. } else {
  1076. sSndMsg += astfPrintOut(40, 210, 27, val ,"");
  1077. }
  1078. } else {
  1079. //1일 X회 Xml씩 X일분
  1080. var val = mthd1 + " " + mthd2 + " " + mthd3;
  1081. if (val.length > 17) {
  1082. sSndMsg += astfPrintOut(40, 126, 27, "1일 "+tims+"회 "+qty+qtyunit+"씩 "+dayno+"일분","");
  1083. sSndMsg += astfPrintOut(40, 171, 27, val.substring(0,17) ,"");
  1084. sSndMsg += astfPrintOut(40, 210, 27, val.substring(17,val.length) ,"");
  1085. } else {
  1086. sSndMsg += astfPrintOut(40, 165, 27, "1일 "+tims+"회 "+qty+qtyunit+"씩 "+dayno+"일분","");
  1087. sSndMsg += astfPrintOut(40, 210, 27, val ,"");
  1088. }
  1089. }
  1090. //용법
  1091. //sSndMsg += astfPrintOut(40, 210, 27, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/abbrnm"),"");
  1092. //약품코드 + 총용량
  1093. //sSndMsg += astfPrintOut(40, 255, 27, "[ "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd")+" ] "+totqty,"");
  1094. //약품코드 + 총용량 + 약품명
  1095. var prcpnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
  1096. if(PrnKind == "2") {
  1097. var val = "[ "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd")+" ] "+
  1098. parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty")) + " " +
  1099. prcpnm;
  1100. sSndMsg += astfPrintOut(20, 255, 27, val,"");
  1101. } else {
  1102. if(prcpnm.length > 12) {
  1103. prcpnm = prcpnm.substring(0,12);
  1104. }
  1105. sSndMsg += astfPrintOut(20, 255, 27, "[ "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd")+" ] "+
  1106. parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty")) + " " +
  1107. prcpnm,"");
  1108. }
  1109. //보관방법
  1110. var lblcnts1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblcnts1");
  1111. lblcnts1 = lblcnts1.setReplaceWord("~", "-"); //20090728
  1112. if ( lblcnts1 == "" ) {
  1113. if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd") != ""){
  1114. sSndMsg += astfPrintOut(40, 300, 27, "< "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd")+" >","");
  1115. }
  1116. } else {
  1117. if(lblcnts1.length > 17){
  1118. //주의사항
  1119. sSndMsg += astfPrintOut(20, 285, 3, lblcnts1.substring(0,17),"");
  1120. sSndMsg += astfPrintOut(20, 315, 3, lblcnts1.substring(17,lblcnts1.length),"");
  1121. } else {
  1122. //주의사항
  1123. sSndMsg += astfPrintOut(40, 300, 27, lblcnts1,"");
  1124. }
  1125. }
  1126. //종료(매수)
  1127. sSndMsg += astfEndFormat(0);
  1128. CommAX.SendMsg(sSndMsg);
  1129. fSleep(500);
  1130. sSndMsg = "";
  1131. }
  1132. //CommAX.PortClose();
  1133. model.refresh();
  1134. //}
  1135. }