MRF00700.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008
  1. /**
  2. * @desc : 화면 control disabled 설정
  3. * @ 화면상태에 따른 control의 disable의 설정
  4. * @param : control id (ctrlID)
  5. * @return :
  6. * @---------------------------------------------------
  7. */
  8. function fSetCtrlDisabled(bool, updtFlag)
  9. {
  10. ipt_formfromdt.disabled = bool;
  11. ipt_formtodt.disabled = bool;
  12. ipt_formnm.disabled = bool;
  13. ipt_formextnnm.disabled = bool;
  14. ipt_formcnts.disabled = bool;
  15. ipt_rem.disabled = bool;
  16. cmb_formchosflag.disabled = bool;
  17. cmb_formkind.disabled = bool;
  18. //cmb_degnappyn.disabled = bool;
  19. cmb_userconfigyn.disabled = bool;
  20. cmb_print_only.disabled = bool;
  21. cmb_formuseflag.disabled = bool;
  22. //cmb_recreflockappyn.disabled = bool;
  23. textarea1.disabled = bool;
  24. cmb_reclistviewyn.disabled = bool;
  25. cmb_langflag.disabled = bool;
  26. // 예진서식 추가 (콤보)
  27. cmb_foctsnwyn.disabled = bool;
  28. // 공통기록여부
  29. cmb_mainyn.disabled = bool;
  30. // 인증서로딩여부
  31. cmb_certuseyn.disabled = bool;
  32. // 대상서식코드
  33. if(model.getValue("/root/main/newform/formstatus") == "0") // 수정모드 상태로 변경
  34. {
  35. ipt_srcformcd.disabled = true;
  36. }
  37. else
  38. {
  39. ipt_srcformcd.disabled = bool;
  40. }
  41. if(updtFlag == "U"){
  42. cmb_valiyn.disabled = bool;
  43. if(bool == false)
  44. ipt_formfromdt.disabled = !bool;
  45. if(!(bool)){
  46. chk_ocrflag.disabled = bool;
  47. if(model.getValue("/root/main/ocrflag") == "OCR"){
  48. cmb_formtypecls.disabled = bool;
  49. cmb_ocrtagprntyn.disabled = bool;
  50. } else {
  51. cmb_formtypecls.disabled = !(bool);
  52. cmb_ocrtagprntyn.disabled = !(bool);
  53. }
  54. cmb_formbizcls.disabled = bool;
  55. cmb_progflag.disabled = bool;
  56. }else{
  57. chk_ocrflag.disabled = bool;
  58. cmb_formbizcls.disabled = bool;
  59. cmb_formtypecls.disabled = bool;
  60. cmb_ocrtagprntyn.disabled = bool;
  61. cmb_progflag.disabled = bool;
  62. }
  63. }else {
  64. chk_ocrflag.disabled = bool;
  65. cmb_formbizcls.disabled = bool;
  66. cmb_formtypecls.disabled = !(bool);
  67. cmb_ocrtagprntyn.disabled = !(bool);
  68. cmb_progflag.disabled = bool;
  69. }
  70. btn_srchdept.disabled = bool;
  71. btn_srchuser.disabled = bool;
  72. btn_classes.disabled = bool;
  73. }
  74. function fSetValiYN()
  75. {
  76. var valiyn = model.getValue("/root/temp/valiyn");
  77. if(valiyn=='Y') // 서식유효화(무효인 서식을 유효로 바꿀 경우)
  78. {
  79. // 2009.04.14
  80. // 이경희
  81. model.setValue("/root/main/newform/formfromdt", getCurrentDate() + getCurrentTime());
  82. model.setValue("/root/main/newform/formtodt","99991231000000");
  83. model.setValue("/root/main/newform/formstatus", "1");
  84. }
  85. else if(valiyn=='N') // 서식무효화(유효인 서식을 무효로 바꿀 경우)
  86. {
  87. var strposinstcd = getUserInfo("dutplceinstcd");
  88. model.makeValue("/root/main/newform/instcd", strposinstcd);
  89. model.setValue("/root/main/newform/formfromdt", getCurrentDate() + getCurrentTime());
  90. model.setValue("/root/main/newform/formtodt", getCurrentDate() + getCurrentTime());
  91. model.setValue("/root/main/newform/formstatus", "3");
  92. // 서식을 무효화시킨 userid를 LASTRGSTDT에 저장.
  93. model.setValue("/root/main/newform/lastupdtrid", getUserId());
  94. // 서식을 무효화시킨 userid를 LASTRGSTDT에 저장.
  95. model.setValue("/root/main/newform/lastupdtrnm", getUserName());
  96. model.removeNodeset("/root/send/savedata");
  97. copyNode(model, model, "/root/send/savedata", "/root/main/newform");
  98. //copyNodeset("/root/send/savedata", "/root/main/ocrinfo", "append");
  99. model.removeNodeset("/root/main/formlist");
  100. model.removeNodeset("/root/main/formhist");
  101. }
  102. model.refresh();
  103. }
  104. function fRemoveBlank(str)
  105. {
  106. str = str.replace(/\s/g,'');
  107. return str;
  108. }
  109. function fSelectForm()
  110. {
  111. if(!isDataCell())
  112. return;
  113. iRow = grd_formlist.row;
  114. if(iRow < 1){
  115. return;
  116. }
  117. model.removeNodeset("/root/main/ocrinfo");
  118. model.copyNode("/root/main/newform", "/root/main/formlist[" + iRow + "]");
  119. var currentdt = getCurrentDateTime();
  120. currentdt = fRemoveBlank(currentdt);
  121. //var tempInterval = getTimeInterval(model.getValue("/root/main/newform/formtodt"), currentdt);
  122. if(parseInt(model.getValue("/root/main/newform/formtodt")) - parseInt(currentdt) > 0)
  123. {
  124. model.setValue("/root/temp/valiyn", "Y");
  125. }
  126. else
  127. {
  128. model.setValue("/root/temp/valiyn", "N");
  129. model.setValue("/root/temp/match_valiyn", "N");
  130. }
  131. if(model.getValue("/root/main/newform/formprogflag") == "OCR" || model.getValue("/root/main/newform/formprogflag") == "OCR(CODE)"){;
  132. //chk_ocrflag.select(0);
  133. model.setValue("/root/main/ocrflag", "OCR");
  134. cmb_formbizcls.disabled = false;
  135. cmb_formtypecls.disabled = false;
  136. cmb_ocrtagprntyn.disabled = false;
  137. btn_ocrwindow.attribute("visibility") = "visible";
  138. }else {
  139. //chk_ocrflag.deselect(0);
  140. model.setValue("/root/main/ocrflag", "");
  141. cmb_formbizcls.disabled = true;
  142. cmb_formtypecls.disabled = true;
  143. cmb_ocrtagprntyn.disabled = true;
  144. btn_ocrwindow.attribute("visibility") = "hidden";
  145. }
  146. var formcd = model.getValue("/root/main/newform/formcd");
  147. model.makeNode("/root/send/reqdata/reqdata");
  148. model.makeNode("/root/send/reqdata/reqflag");
  149. model.makeNode("/root/send/reqdata/reqfromdt");
  150. model.makeNode("/root/send/reqdata/reqprogflag");
  151. model.setValue("/root/send/reqdata/reqdata", formcd);
  152. model.setValue("/root/send/reqdata/reqflag", "formcd");
  153. /**
  154. * 수정 : 2009.09.15 안치원 TASK-2897
  155. * 내용 : 서식관리화면에서 서식조회조건으로 기관코드추가
  156. */
  157. model.makeValue("/root/send/reqdata/reqinstcd", model.getValue("/root/send/reqdata/reqinstcd"));
  158. // 2009-04-15
  159. // 이경희
  160. // OCR 데이터 조회시 기관별 서식사용일자가 formfromdt 가 되므로, instformfromdt를 formfromdt로 삽입.
  161. //model.setValue("/root/send/reqdata/reqfromdt", model.getValue("/root/main/newform/formfromdt"));
  162. model.setValue("/root/send/reqdata/reqfromdt", model.getValue("/root/main/newform/instformfromdt"));
  163. model.setValue("/root/send/reqdata/reqprogflag", model.getValue("/root/main/newform/formprogflag"));
  164. //model.setValue("/root/main/newform", "/root/send/savedata"); // 테스트
  165. fSetCtrlDisabled(true, "U");
  166. model.removeNode("/root/send/selectedHist");
  167. model.makeValue("/root/send/reqdata/selectedHist", "H");
  168. btn_hist.selected = true;
  169. submit("TRMRF00702");
  170. /////////////////////////////////////////////
  171. //2010.04.12, 주희경
  172. //서식 디자인 수정(공유해제) 중에는 서식 관리에서 서식정보 업데이트 못하도록 블러킹 추가
  173. model.makeValue("/root/send/req/formcd",formcd);
  174. submit("TRMRF02006");
  175. // 읽기전용인지 확인
  176. var readonlystatdt = model.getValue("/root/temp/forminfo/readonlylist/readonlystatdt");
  177. var readonlyuserid = model.getValue("/root/temp/forminfo/readonlylist/readonlyuserid");
  178. var userid = getUserInfo("userid");
  179. if ( readonlystatdt != "" && readonlystatdt != "-" ) //읽기전용등록일시정보가 있고 동일아이디가 아닌경우
  180. {
  181. var blokingdt = readonlystatdt.substr(0,4) + "/";
  182. blokingdt = blokingdt + readonlystatdt.substr(4,2) + "/";
  183. blokingdt = blokingdt + readonlystatdt.substr(6,2) + "/ ";
  184. blokingdt = blokingdt + readonlystatdt.substr(8,2) + ":";
  185. blokingdt = blokingdt + readonlystatdt.substr(10,2) + ":";
  186. blokingdt = blokingdt + readonlystatdt.substr(12,2);
  187. var readonlyusernm = model.getValue("/root/temp/forminfo/readonlylist/readonlyusernm");
  188. alert("["+readonlyuserid+","+readonlyusernm+"]님이 ["+blokingdt+"]부터 디자인 작업 중이므로 수정 할 수 없습니다.");
  189. btn_updtform.disabled = true;
  190. btn_saveform.disabled = true;
  191. }
  192. else
  193. {
  194. btn_updtform.disabled = false;
  195. btn_saveform.disabled = false;
  196. }
  197. /////////////////////////////////////////////
  198. var formuserid = model.getValue("/root/main/formhist/formuserid");
  199. if ( formuserid == "DEPT_BASE" && getUserInfo("posinstcd") != "001" && getUserInfo("posdeptcd") != "4130700000" ) //병원최대서식은 의료원에서만 수정 가능하도록, 2010.05.27, 주희경
  200. {
  201. btn_updtform.disabled = true;
  202. btn_saveform.disabled = true;
  203. }
  204. //model.refresh();
  205. }
  206. /**
  207. * @group :
  208. * @ver : 2009-03-03 오후 4:45:27
  209. * @by : 강지훈
  210. * @---------------------------------------------------
  211. * @type : function
  212. * @access : public
  213. * @desc : 기관별 용어 이력 리스트 조회
  214. * @param : selectedHist (H : 이력조회, I : 기관별 이력조회)
  215. * @return :
  216. * @---------------------------------------------------
  217. */
  218. function fGetFormHistList(selectedHist){
  219. var formcd = model.getValue("/root/main/newform/formcd");
  220. model.setValue("/root/temp/selectedHist", selectedHist);
  221. model.removeNodeset("/root/send");
  222. model.makeValue("/root/send/reqdata/reqdata", formcd);
  223. model.makeValue("/root/send/reqdata/reqflag", "formcd");
  224. model.makeValue("/root/send/reqdata/reqfromdt", model.getValue("/root/main/newform/formfromdt"));
  225. model.makeValue("/root/send/reqdata/reqprogflag", model.getValue("/root/main/newform/formprogflag"));
  226. model.makeValue("/root/send/reqdata/selectedHist", model.getValue("/root/temp/selectedHist"));
  227. /**
  228. * 수정 : 2009.09.15 안치원 TASK-2897
  229. * 내용 : 서식관리화면에서 서식조회조건으로 기관코드추가
  230. */
  231. model.makeValue("/root/send/reqdata/reqinstcd", model.getValue("/root/send/reqdata/reqinstcd"));
  232. // KNUH_20101119_박성호_start
  233. model.removeNodeset("/root/main/ocrinfo");
  234. // KNUH_20101119_박성호_end
  235. submit("TRMRF00702");
  236. // KNUH_20101119_박성호_start
  237. grd_ocrlist.rebuild();
  238. // KNUH_20101119_박성호_end
  239. model.refresh();
  240. }
  241. function fSelectFormHist()
  242. {
  243. if(!isDataCell())
  244. return;
  245. iRow = grd_formhist.row;
  246. if(iRow < 1){
  247. return;
  248. }
  249. model.copyNode("/root/main/newform", "/root/main/formhist[" + iRow + "]");
  250. if(parseInt(model.getValue("/root/main/newform/formtodt")) - parseInt(model.getValue("/root/main/newform/formfromdt")) > 0)
  251. model.setValue("/root/temp/valiyn", "Y");
  252. else
  253. model.setValue("/root/temp/valiyn", "N");
  254. var formcd = model.getValue("/root/main/newform/formcd");
  255. model.makeNode("/root/send/reqdata/reqdata");
  256. model.makeNode("/root/send/reqdata/reqflag");
  257. model.makeNode("/root/send/reqdata/reqfromdt");
  258. model.setValue("/root/send/reqdata/reqdata", formcd);
  259. model.setValue("/root/send/reqdata/reqflag", "formcd");
  260. model.setValue("/root/send/reqdata/reqfromdt", model.getValue("/root/main/newform/formfromdt"));
  261. if(model.getValue("/root/main/newform/formprogflag") == "OCR"){
  262. submit("TRMRF00704");
  263. }
  264. model.refresh();
  265. fSetCtrlDisabled(true, "U");
  266. }
  267. /**
  268. * @desc : 화면초기화
  269. * @ root/init/today, time에 현재 날짜와 시간 설정
  270. * @ 초기 화면의 번튼 비활성화
  271. * @param :
  272. * @return :
  273. * @---------------------------------------------------
  274. */
  275. function fInitialize(){
  276. model.setFocus("ipt_srchdata");
  277. //model.setValue("/root/main/newform/formfromdt", getDate());
  278. model.setValue("/root/main/newform/formfromdt", getCurrentDate() + getCurrentTime());
  279. fBackupNewFormData();
  280. fSetFormUsge();
  281. grd_ocrlist.removeRow();
  282. grd_ocrlist.colHidden(3) = true;
  283. grd_ocrlist.colHidden(4) = true;
  284. grd_formhist.colHidden(25) = true;
  285. grp_mngtocr.attribute("left") = "820px";
  286. grp_mngtocr.attribute("top") = "60px";
  287. btn_ocrwindow.attribute("visibility") = "hidden";
  288. chk_ocrflag.disabled = true;
  289. cmb_formbizcls.disabled = true;
  290. cmb_formtypecls.disabled = true;
  291. cmb_ocrtagprntyn.disabled = true;
  292. textarea1.disabled = true;
  293. cmb_langflag.disabled = true;
  294. cmb_reclistviewyn.disabled = true;
  295. // 예진서식 추가 (콤보)
  296. cmb_foctsnwyn.disabled = true;
  297. // 공통기록여부
  298. cmb_mainyn.disabled = true;
  299. // 대상서식코드
  300. ipt_srcformcd.disabled = true;
  301. submit("TRMRF00706");
  302. zbcfGetCodeList( new Array("M0534"), new Array("/root/init/M0534list") );
  303. /**
  304. * 수정 : 2009.09.15 안치원 TASK-2897
  305. * 내용 : 서식관리화면에서 서식조회조건으로 기관코드추가
  306. */
  307. /* 2010.05.28, 주희경 , 기관별 서식 사용이력을 볼 때 기관별로 조회가능하여야 하도록 주석처리
  308. if (getUserInfo("posinstcd") == "001" && getUserInfo("posdeptcd") == "4130700000") {
  309. cmb_cond_instcd.attribute("visibility") = "visible";
  310. } else {
  311. cmb_cond_instcd.attribute("visibility") = "hidden";
  312. }
  313. */
  314. model.setValue("/root/main/condition/reqinstcd", getUserInfo("dutplceinstcd"));
  315. model.refresh();
  316. }
  317. function fBackupNewFormData()
  318. {
  319. copyNode(model, model, "/root/temp/newform", "/root/main/newform");
  320. }
  321. function fRestoreNewFormData()
  322. {
  323. copyNode(model, model, "/root/main/newform", "/root/temp/newform");
  324. model.refresh();
  325. }
  326. /**
  327. * @desc : 서식분류코드를 main화면에 설정한다
  328. *
  329. * @param : 그리드 id (grdID)
  330. * @return :
  331. * @---------------------------------------------------
  332. */
  333. function fSetFormCls(){
  334. /*var param = getParameter("pathnm");
  335. var param2 = getParameter("pathnm", 2);
  336. var formclsnm = param.split('.');
  337. var formclscd = param2.split('.');
  338. model.setValue("/root/main/newform/formclsnm" , formclsnm[0]);
  339. model.setValue("/root/main/newform/formclsnm2", formclsnm[1]);
  340. model.setValue("/root/main/newform/formclsnm3", formclsnm[2]);
  341. model.setValue("/root/main/newform/formclsnm4", formclsnm[3]);
  342. model.setValue("/root/main/newform/formclscd" , formclscd[0]);
  343. model.setValue("/root/main/newform/formclscd2", formclscd[1]);
  344. model.setValue("/root/main/newform/formclscd3", formclscd[2]);
  345. model.setValue("/root/main/newform/formclscd4", formclscd[3]);
  346. model.refresh();*/
  347. }
  348. /**
  349. * @desc : Grid 저장 후 화면을 clear
  350. *
  351. * @param : 그리드 id (grdID)
  352. * @return :
  353. * @---------------------------------------------------
  354. */
  355. function fClrGrdStatus(grdID){
  356. var totRow = grdID.rows;
  357. for(var i = grdID.fixedRows; i < totRow; i++){
  358. var statusflag = grdID.rowstatus(i);
  359. if(statusflag == 1 || statusflag == 2){
  360. grdID.rowstatus(i) = 0;
  361. }else if(statusflag == 4){
  362. grdID.deleteItem(i);
  363. }
  364. }
  365. }
  366. /**
  367. * @desc : 서식분류 팝업창 Open
  368. *
  369. * @param :
  370. * @return :
  371. * @---------------------------------------------------
  372. */
  373. function fOpenFormClsWnd(){
  374. var xpos = event.screenX + 100;
  375. var ypos = event.screenY - 500;
  376. var scnNo;
  377. if(xpos > 1000){
  378. scnNo = 2;
  379. }else{
  380. scnNo = 1;
  381. }
  382. modal("SPMRF00701_서식분류", scnNo, xpos, ypos );
  383. fSetFormCls();
  384. }
  385. function fCreateForm()
  386. {
  387. model.resetInstanceNode("/root/main/newform");
  388. model.removeNodeset("/root/main/formhist");
  389. model.makeValue("/root/main/newform/formstatus", "0"); // 신규 서식작성
  390. // 2009.04.14
  391. // 이경희
  392. // 신규 서식의 경우 시작일자는 무조건 "일자" + "00:00.00" 으로 한다.
  393. //model.makeValue("/root/main/newform/formfromdt", getCurrentDate() + getCurrentTime());
  394. model.makeValue("/root/main/newform/formfromdt", getCurrentDate() + "000000");
  395. model.makeValue("/root/main/newform/formtodt", "99991231" + getCurrentTime());
  396. model.makeValue("/root/main/newform/formchosflag", "C");
  397. model.makeValue("/root/main/newform/formkind", "C");
  398. model.makeValue("/root/main/newform/degnappyn", "Y");
  399. model.makeValue("/root/main/newform/userconfigyn", "N"); // UserConfigYN 컬럼
  400. model.makeValue("/root/main/newform/recreflockappyn", "N");
  401. model.makeValue("/root/main/newform/sortno", "0");
  402. model.makeValue("/root/main/newform/reclistviewyn", "Y");
  403. model.makeValue("/root/main/newform/langflag", "KO");
  404. // 예진서식 노드 추가
  405. model.makeValue("/root/main/newform/foctsnwyn", "N");
  406. // mainYN 기록 노드 추가
  407. model.makeValue("/root/main/newform/mainyn", "N");
  408. // print_only 노드 추가
  409. model.makeValue("/root/main/newform/print_only", "N");
  410. // 디자인 완료 노드 추가
  411. model.makeValue("/root/main/newform/degncmpltyn", "-");
  412. // certuseyn 노드 추가
  413. model.makeValue("/root/main/newform/certuseyn", "N");
  414. fSetCtrlDisabled(false);
  415. model.setFocus("ipt_formnm");
  416. chk_ocrflag.deselect(0);
  417. btn_ocrwindow.attribute("visibility") = "hidden";
  418. cmb_formuseflag.select(0);
  419. cmb_progflag.select(0);
  420. model.removeNodeset("/root/main/ocrinfo");
  421. model.removeNodeset("/root/main/ocrreview");
  422. model.refresh();
  423. }
  424. function fModifyForm()
  425. {
  426. if(model.getValue("/root/main/newform/formcd") == ""){
  427. messageBox("수정할 서식이", "I004");
  428. return;
  429. }
  430. model.makeValue("/root/main/newform/oldformfromdt", model.getValue("/root/main/newform/formfromdt"));
  431. model.makeValue("/root/main/newform/oldformtodt", model.getValue("/root/main/newform/formtodt"));
  432. // 2009.04.14
  433. // 이경희
  434. // 예를 들어 4/1 등록한 서식이 있을 경우 4/4 에 해당 서식을 수정하면 서식의 Fromdt 가 현재일자로 수정되어
  435. // 기관별 시작일자보다 서식의 시작일자가 뒤에 위치하는 문제가 생김.
  436. //model.makeValue("/root/main/newform/formfromdt", getCurrentDate() + getCurrentTime());
  437. model.makeValue("/root/main/newform/formfromdt", model.getValue("/root/main/newform/formfromdt"));
  438. model.makeValue("/root/main/newform/formstatus", "1"); // 수정모드 상태로 변경
  439. fSetCtrlDisabled(false, "U");
  440. model.setFocus("ipt_formnm");
  441. model.refresh();
  442. }
  443. function fSaveForm()
  444. {
  445. var status = model.getValue("/root/main/newform/formstatus");
  446. var chk_formuseflag = model.getValue("/root/main/newform/formuseflag");
  447. var chk_formdeptnm = model.getValue("/root/main/newform/formdeptnm");
  448. var chk_formusernm = model.getValue("/root/main/newform/formusernm");
  449. var chk_formnm = model.getValue("/root/main/newform/formnm");
  450. var chk_ipt_srcformcd = model.getValue("/root/main/newform/srcformcd");
  451. if(status ==""){
  452. messageBox("저장할 서식이", "I004");
  453. return;
  454. }
  455. if ((chk_formuseflag == "D") && (chk_formdeptnm == "")){
  456. messageBox("서식사용부서를", "C001");
  457. return;
  458. } else if((chk_formuseflag == "I") && (chk_formdeptnm == "") && (chk_formusernm == "")){
  459. messageBox("서식사용부서와 서식사용자를", "C001");
  460. return;
  461. }else if((chk_formuseflag == "I") && (chk_formdeptnm != "") && (chk_formusernm == "")){
  462. messageBox("서식사용자를", "C001");
  463. return;
  464. }else if((chk_formuseflag == "I") && (chk_formdeptnm == "") && (chk_formusernm != "")){
  465. messageBox("서식사용부서를", "C001");
  466. return;
  467. }else if(chk_formnm == ""){
  468. messageBox("서식명칭을", "C001");
  469. return;
  470. }else if(chk_ipt_srcformcd == ""){
  471. if(status == 1)
  472. {
  473. messageBox("기본서식코드가 없습니다. 기본서식코드를 ", "C001");
  474. return;
  475. }
  476. }
  477. var struserid = getUserInfo("userid");
  478. model.makeValue("/root/main/newform/userid", struserid);
  479. if (model.getValue("/root/main/newform/formprogflag") == "OCR")
  480. {
  481. if(model.getValue("/root/main/ocrinfo/ocrfilenm") == ""){
  482. messageBox("OCR 이미지를", "C001");
  483. return;
  484. }
  485. if(model.getValue("/root/main/newform/formbizcls") == ""){
  486. messageBox("OCR 업무분류 정보를", "C001");
  487. return;
  488. }
  489. if(model.getValue("/root/main/newform/formtypecls") == ""){
  490. messageBox("OCR 분류 정보를", "C001");
  491. return;
  492. }
  493. if(model.getValue("/root/main/newform/ocrtagprntyn") == ""){
  494. messageBox("OCR Tag 출력여부를", "C001");
  495. return;
  496. }
  497. }
  498. if(status == 1)
  499. {
  500. var formfromdt = model.getValue("/root/main/newform/formfromdt");
  501. var currentDateTime = getCurrentDate() + getCurrentTime();
  502. if( (parseInt(formfromdt) - parseInt(currentDateTime)) > 0)
  503. {
  504. messageBox("미래서식의 경우는 변경이력없이 저장", "I008");
  505. }
  506. }
  507. //2009.03.11 강지훈 수정
  508. //변경이력을 남기지 않고 Update.
  509. // formstatus: 1 수정모드
  510. if(model.getValue("/root/main/newform/formstatus") == "1"){
  511. var ret = messageBox("변경 이력을 저장", "S001");
  512. // 2009.04.23 이경희
  513. // OCR 서식이면서 OCR이미지 변경없이 서식내용만 변경하는 경우
  514. // OCR 이미지 새로 등록없이 서식 내용만 업데이트함
  515. if (model.getValue("/root/main/newform/formprogflag") == "OCR")
  516. {
  517. if(ret == "7")
  518. model.setValue("/root/main/newform/formstatus", "4");
  519. }
  520. if(ret == "6"){
  521. model.removenode("/root/main/newform/histsaveyn");
  522. model.makeValue("/root/main/newform/histsaveyn", "Y");
  523. }
  524. else if(ret == "7"){
  525. model.removenode("/root/main/newform/histsaveyn");
  526. model.makeValue("/root/main/newform/histsaveyn", "N");
  527. }
  528. else{
  529. return;
  530. }
  531. }
  532. var strposinstcd = getUserInfo("dutplceinstcd");
  533. model.makeValue("/root/main/newform/instcd", strposinstcd);
  534. copyNodeset("/root/main/newform", "/root/main/ocrinfo", "append");
  535. //model.setValue("/root/main/newform/formfromdt", model.getValue("/root/main/newform/formfromdt") + getCurrentTime());
  536. //model.setValue("/root/main/newform/formtodt", model.getValue("/root/main/newform/formtodt") + "235959");
  537. model.removeNodeset("/root/send/savedata");
  538. copyNode(model, model, "/root/send/savedata", "/root/main/newform");
  539. copyNodeset("/root/send/savedata", "/root/main/ocrinfo", "append");
  540. model.removeNodeset("/root/main/formlist");
  541. model.removeNodeset("/root/main/formhist");
  542. //grd_formlist.rebuild();
  543. var valiyn = model.getValue("/root/temp/valiyn");
  544. if(valiyn == 'N') // 서식무효화
  545. {
  546. model.removeNodeset("/root/send/savedata");
  547. copyNode(model, model, "/root/send/savedata", "/root/main/newform");
  548. // 서식을 새로 등록하도록 변경
  549. model.setValue("/root/send/savedata/formstatus", '3');
  550. model.setValue("/root/temp/valiyn", "Y");
  551. }
  552. submit("TXMRF00701");
  553. //model.makeValue("/root/main/newform/formstatus", "");
  554. fRestoreNewFormData();
  555. fSetCtrlDisabled(true, "U");
  556. }
  557. function fCallClassesInfo()
  558. {
  559. model.removeNodeset("/root/send");
  560. model.makeValue("/root/send/paramindx","");
  561. model.setValue("/root/send/paramindx", model.getValue("/root/temp/condition/indxflag"));
  562. setParameter("indxflag","F");
  563. modal("SPMRF02100", 1,10, 10, "SPMRF02100", "/root/send", "/root/temp/condition/getdata");
  564. var child = "SPMRF02100";
  565. if(child != null)
  566. {
  567. //var valindxnm = getParameter("valindxnm");
  568. var depthnm1 = getParameter("depthnm1");
  569. var depthnm2 = getParameter("depthnm2");
  570. var depthnm3 = getParameter("depthnm3");
  571. var depthnm4 = getParameter("depthnm4");
  572. var depthnm5 = getParameter("depthnm5");
  573. var indxcd = getParameter("indexcode");
  574. var pathcd = getParameter("pathcd");
  575. //model.setValue("/root/main/imginfo/imgindxnm", imgindxnm);
  576. model.makeValue("/root/main/newform/depthnm1", depthnm1);
  577. model.makeValue("/root/main/newform/depthnm2", depthnm2);
  578. model.makeValue("/root/main/newform/depthnm3", depthnm3);
  579. model.makeValue("/root/main/newform/depthnm4", depthnm4);
  580. model.makeValue("/root/main/newform/depthnm5", depthnm5);
  581. model.makeValue("/root/main/newform/formclsseq", indxcd);
  582. model.makeValue("/root/main/newform/formlevlcd", pathcd);
  583. model.refresh();
  584. if(depthnm1 == "진료서식") // 대분류가 진료서식인 경우
  585. {
  586. if(depthnm2 == "공통서식") // 중분류가 공통서식인 경우
  587. {
  588. model.setValue("/root/main/newform/mainyn", "Y"); // 공통서식 Y
  589. model.setValue("/root/main/newform/foctsnwyn", "N"); // 예진서식 N
  590. }
  591. else if(depthnm2 == "예진기록") // 중분류가 예진기록인 경우
  592. {
  593. model.setValue("/root/main/newform/mainyn", "N"); // 공통서식 N
  594. model.setValue("/root/main/newform/foctsnwyn", "Y"); // 예진서식 Y
  595. }
  596. else
  597. {
  598. model.setValue("/root/main/newform/mainyn", "N"); // 공통서식 N
  599. model.setValue("/root/main/newform/foctsnwyn", "N"); // 예진서식 N
  600. }
  601. }
  602. else if(depthnm1 == "제증명") // 대분류가 제증명인 경우
  603. {
  604. model.setValue("/root/main/newform/mainyn", "N"); // 공통서식 N
  605. model.setValue("/root/main/newform/foctsnwyn", "N"); // 예진서식 N
  606. }
  607. else // 기타 서식인 경우
  608. {
  609. model.setValue("/root/main/newform/mainyn", "N"); // 공통서식 N
  610. model.setValue("/root/main/newform/foctsnwyn", "N"); // 예진서식 N
  611. }
  612. }
  613. model.refresh();
  614. }
  615. function fCallDeptInfo(){
  616. var search_condition = "deptcd";
  617. var search_term = "";
  618. var receive_deptcd_path = "/root/main/newform/formdeptcd";
  619. var receive_deptnm_path = "/root/main/newform/formdeptnm";
  620. var standard_yn = null;
  621. var ord_deptflag = null;
  622. var dutinstcd = getUserInfo("dutplceinstcd");
  623. //zbcfOpenInstDeptCodeList(search_condition, search_term, receive_deptcd_path, receive_deptnm_path, standard_yn, ord_deptflag, new Array("deptcd", "depthngnm"));
  624. //zbcfOpenInstDeptCodeList(search_condition, search_term, receive_deptcd_path, receive_deptnm_path, 'orduseyn', ord_deptflag, new Array("deptcd", "depthngnm"));
  625. //zbcfOpenAssignedInstDeptCodeList("012", search_condition, search_term, receive_deptcd_path, receive_deptnm_path, 'orduseyn', ord_deptflag, new Array("deptcd", "depthngnm"));
  626. zbcfOpenAssignedInstDeptCodeList(dutinstcd, search_condition, search_term, receive_deptcd_path, receive_deptnm_path, standard_yn, ord_deptflag, new Array("deptcd", "depthngnm"));
  627. }
  628. function fSrchForm()
  629. {
  630. var formnm = "";
  631. var reqflag = model.getValue("/root/main/condition/reqflag");
  632. if(reqflag == "formcd"){
  633. var sCode = model.getValue("/root/main/condition/reqdata");
  634. var sTmp = "";
  635. var iTmp = 0;
  636. // form코드 입력시 자릿수 채워준다
  637. var iCodeLength = sCode.length;
  638. if(iCodeLength ==0){
  639. messageBox(ipt_srchdata.label +" 서식코드 조건을", "C001");
  640. return;
  641. }
  642. else if(iCodeLength > 10){
  643. messageBox(ipt_srchdata.label +" 서식코드 자리수를 올바르게 ", "C001");
  644. return;
  645. }
  646. var temp = 10 - iCodeLength;
  647. for(var i = 1; i <= temp; i++){
  648. sTmp += "0";
  649. }
  650. sTmp = sTmp + sCode;
  651. model.setValue("/root/main/condition/reqdata",sTmp);
  652. }
  653. formnm = model.getValue("/root/main/condition/reqdata");
  654. // 유효 및 전체 조회시 검색 값이 없는 경우 검색값 요청을 하도록 수정
  655. if(formnm == "")
  656. {
  657. messageBox(ipt_srchdata.label +" 조회할 서식을 ", "C001");
  658. return;
  659. }
  660. model.setValue("/root/main/condition/reqdata",formnm.toUpperCase());
  661. // 서식관리에서 보낸 쿼리라는것을 명시
  662. model.makeValue("/root/main/condition/reqsrch", "formmaster");
  663. model.makeNode("/root/send/reqdata");
  664. model.copyNode("/root/send/reqdata", "/root/main/condition");
  665. submit("TRMRF00701");
  666. // 서식디자인 생성안한 것들을 색상으로 표시
  667. //fClassificationForm();
  668. // "/root/temp/newform"노드를 "/root/main/newform"로 복사해둠
  669. fRestoreNewFormData();
  670. }
  671. function fSetFormUsge()
  672. {
  673. var chk_formuseflag = model.getValue("/root/main/newform/formuseflag");
  674. if (chk_formuseflag == "D"){ // 부서
  675. btn_srchdept.disabled = "false";
  676. btn_srchuser.disabled = "true";
  677. } else if(chk_formuseflag == "I"){ // 개인
  678. btn_srchdept.disabled = "false";
  679. btn_srchuser.disabled = "false";
  680. }else if(chk_formuseflag == "C"){ // 공통
  681. btn_srchdept.disabled = "true";
  682. btn_srchuser.disabled = "true";
  683. model.setValue("/root/main/newform/formdeptcd", "");
  684. model.setValue("/root/main/newform/formdeptnm", "");
  685. }
  686. model.refresh();
  687. }
  688. function fClassificationForm()
  689. {
  690. // 서식을 생성하지 않은 것들을 색상으로 분류함.
  691. try
  692. {
  693. /*
  694. // 과별서식, 공통서식
  695. var srchformlist = model.instances(0).selectNodes("/root/main/formlist[formprogflag != 'OCR' and formprogflag != 'PROF(CODE)' and formprogflag != 'PROF']");
  696. //var srchformlist = model.instances(0).selectNodes("/root/main/formlist[formprogflag = '-' or (formprogflag = 'PROG' and formcd = srcformcd and formkind = 'C' and formprognm != '-']");
  697. var totalRows = grd_formlist.rows - 1;
  698. if(totalRows < 1){
  699. return;
  700. }
  701. var forminfo = "";
  702. for(var idx = 0 ; idx < totalRows; idx++)
  703. {
  704. forminfo = srchformlist.item(idx);
  705. if(forminfo != null)
  706. {
  707. var formcd = forminfo.selectSingleNode("formcd").text;
  708. if(forminfo.selectSingleNode("formdegnseq").text == ""
  709. || forminfo.selectSingleNode("formdegnseq").text == "0")
  710. {
  711. grd_formlist.rowstyle(idx + 1, "data", "background-color") = "#FFCCFF";
  712. }
  713. }
  714. }
  715. grd_formlist.refresh();
  716. */
  717. }
  718. catch(e)
  719. {
  720. return;
  721. }
  722. }
  723. function fSetFormUse()
  724. {
  725. if(fIsFutureForm() == true)
  726. {
  727. model.removeNodeset("/root/send/grdsaverslt");
  728. model.makeValue("/root/send/formuse/reqlist", getGridUpdateData(grd_formlist));
  729. //model.makeValue("/root/send/formuse", grd_formlist.getUpdateData());
  730. model.makeValue("/root/send/formuse/reqinstcd", model.getValue("/root/send/reqdata/reqinstcd"));
  731. submit("TXMRF00702");
  732. model.refresh();
  733. }
  734. fSrchForm();
  735. }
  736. function fIsFutureForm()
  737. {
  738. var totalRows = grd_formlist.rows - 1;
  739. if(totalRows < 1){
  740. return;
  741. }
  742. var srchformlist = model.instances(0).selectNodes("/root/main/formlist");
  743. var forminfo = "";
  744. for(var idx = 0 ; idx < totalRows; idx++)
  745. {
  746. forminfo = srchformlist.item(idx);
  747. if(forminfo != null)
  748. {
  749. var formcd = forminfo.selectSingleNode("formcd").text;
  750. var formfromdt = forminfo.selectSingleNode("formfromdt").text;
  751. var currentDateTime = getCurrentDate() + getCurrentTime();
  752. if( (parseInt(formfromdt) - parseInt(currentDateTime)) > 0)
  753. {
  754. messageBox("미래일자의 서식은 사용여부를 저장", "E001");
  755. return false;
  756. }
  757. }
  758. }
  759. return true;
  760. }
  761. function fPreviewFormdegn()
  762. {
  763. var row = grd_formlist.row;
  764. var formcd = model.getValue("/root/main/formlist["+row+"]/formcd");
  765. var formprogflag = model.getValue("/root/main/formlist["+row+"]/formprogflag");
  766. var formxrwyn = model.getValue("/root/main/formlist["+row+"]/formxrwyn");
  767. var formdegnseq = model.getValue("/root/main/formlist["+row+"]/formdegnseq");
  768. model.copyNode("/root/main/forminfo/formmast", "/root/main/formlist["+row+"]");
  769. if(formprogflag == "MAIN" || formprogflag == "PROF" || formprogflag == "-" || formprogflag == "PROG")
  770. {
  771. if(formxrwyn == "Y" && formdegnseq != "")
  772. {
  773. setParameter("SPMRF05500_formcd", formcd);
  774. modal("SPMRF05500", 1,10, 10, "SPMRF05500", "", "");
  775. //open("SPMRF05500", "2", 0, 0, "SPMRF05500", "", "");
  776. }
  777. else
  778. messageBox("해당 서식은 저장되지", "E007");
  779. }
  780. else
  781. {
  782. messageBox("해당 서식은 " + formprogflag + " 유형 서식", "I009");
  783. return;
  784. }
  785. }
  786. function fOcrLoad(url){
  787. f_View.ViewMode = 0;
  788. f_View.pageremove(0,0);
  789. f_View.pageappend(url,0,0);
  790. f_View.fitmode = 3;
  791. f_View.pagecurrent = 1;
  792. f_View.AutoRefresh = true;
  793. }
  794. function fOcrLoadFile(filenm){
  795. var ocrfilenm ="C:\\OCRMngt_ImgeFile\\"+filenm;
  796. f_View.ViewMode = 0;
  797. f_View.pageremove(0,0);
  798. f_View.pageappend(ocrfilenm,0,0);
  799. f_View.fitmode = 3;
  800. f_View.pagecurrent = 1;
  801. f_View.AutoRefresh = true;
  802. }
  803. function fOcrLoadTotal(fso, filenm, newCtrObj, filepath)
  804. {
  805. f_View.pageremove(0,0);
  806. f_View.pageappend(filenm,0,0);
  807. var basename;
  808. var extname;
  809. var arrayFile = "";
  810. basename = fso.getbasename(filenm);
  811. extname = fso.getextensionname(filenm);
  812. for(var page = 1; page <= f_View.pagetotal ; page++){
  813. f_View.pagecurrent = page;
  814. f_View.filesavecreate(filepath + "/temp/" + basename + "-" + page + "." + extname ,-1);
  815. Filenm = (filepath + "/temp/" + basename + "-" + page + "." + extname);
  816. grd_ocrlist.addRow(false,false);
  817. grd_ocrlist.valueMatrix(grd_ocrlist.row, grd_ocrlist.colRef("ocrfilenm")) = basename + "-" + page + "." + extname;
  818. grd_ocrlist.valueMatrix(grd_ocrlist.row, grd_ocrlist.colRef("ocrdata")) = loadGrd(Filenm);
  819. grd_ocrlist.valueMatrix(grd_ocrlist.row, grd_ocrlist.colRef("filepath")) = filepath;
  820. setImageRefInstance("/root/main/ocrinfo["+grd_ocrlist.row+"]/ocrdata");
  821. }
  822. }
  823. function loadGrd(Filenm){
  824. img.src = Filenm;
  825. return img.getBase64data()
  826. }
  827. function fDelFile(haveFile, fso){
  828. currFile = new Enumerator(haveFile.Files);
  829. for( ; !currFile.atEnd(); currFile.moveNext()){
  830. fso.DeleteFile(currFile.item().path, true);
  831. }
  832. }