SMMCT00202.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. /* ---------------------------------------------------------------------
  2. 수술명단List 조회 (SMMCT00202.xfm - JScript )
  3. - Version :
  4. 1) : Ver.1.00.01
  5. : Create By taebum
  6. : 2009-09-23 오후 2:39:33
  7. ---------------------------------------------------------------------- */
  8. /**
  9. * @group :
  10. * @ver : 2009-09-15 오후 6:45:47
  11. * @by :
  12. * @---------------------------------------------------
  13. * @type : function
  14. * @access : public
  15. * @desc : 초기화
  16. * @param :
  17. * @return :
  18. * @---------------------------------------------------
  19. */
  20. function fInit(){
  21. var currDate = getCurrentDate();
  22. model.setValue("/root/main/condition/fromdd" , fCalcDate(currDate,-1));
  23. model.setValue("/root/main/condition/todd" , currDate);
  24. model.refresh();
  25. model.removeNodeSet("/root/main/opreflistinfo/opreflist");
  26. grd_opreflst.refresh();
  27. var instcd = getUserInfo("dutplceinstcd");
  28. var rslt_ref = "/root/init/orddeptlist";
  29. //model.setValue("/root/main/cond/orddeptcd", "%");
  30. model.setValue("/root/main/condition/orddrid", "");
  31. //zsdfGetCareOutOrderDepartmentList(instcd, rslt_ref, currDate);
  32. submit("TRMCT00208");
  33. //수술방 정보 조회 by 박영우 20091229
  34. fGetOproomList();
  35. addComboItem("cmb_subdept");
  36. fValueChangedSchCombo();
  37. }
  38. /*
  39. * 1달을 자동 세팅되게 하는 함수
  40. * sDate : 일자(string)
  41. * iFlag : int 1/-1 (1달 이전/이후의 날짜 계산용도)
  42. */
  43. function fCalcDate(sDt,iFlag){
  44. var sDate = sDt.toDate("YYYYMMDD").getAddDate(iFlag, "M").getAddDate(-(iFlag), "D")
  45. //alert(sDt.toDate("YYYYMMDD").getAddDate(iFlag, "M").getAddDate(-(iFlag), "D").getDayOfWeek("K")); -- 해당요일
  46. rtnDate = sDate.getFullYear();
  47. rtnDate = rtnDate.toString() + (( sDate.getMonth() + 1 > 9 ) ? sDate.getMonth() + 1 : "0" + (sDate.getMonth() + 1));
  48. rtnDate = rtnDate.toString() + (( sDate.getDate() > 9 ) ? sDate.getDate() : "0" + sDate.getDate()) ;
  49. return rtnDate;
  50. }
  51. /**
  52. * @group :
  53. * @ver : 2009-09-15 오후 6:45:47
  54. * @by :
  55. * @---------------------------------------------------
  56. * @type : function
  57. * @access : public
  58. * @desc : 조회
  59. * @param :
  60. * @return :
  61. * @---------------------------------------------------
  62. */
  63. function fClickSearchBtn(){
  64. model.resetInstanceNode("/root/send");
  65. var todd = model.getValue("/root/main/condition/todd");
  66. var fromdd = model.getValue("/root/main/condition/fromdd");
  67. var subdeptcd = model.getValue("/root/main/condition/subdeptcd");
  68. var orddrid = model.getValue("/root/main/condition/orddrid");
  69. var tab = model.getValue("/root/main/condition/tab"); //방별, 과별 선택 탭 by 박영우 20091229
  70. var oproomcd = model.getValue("/root/main/condition/oproomcd");
  71. var oppatflagcd = model.getValue("/root/main/condition/oppatflagcd"); //병동,외래구분 by 박영우 20091229
  72. var opscale = model.getValue("/root/main/condition/opscale"); //대중소 구분 by 박영우 20091229
  73. if(fromdd == "" || fromdd == "undefined" || fromdd == null){
  74. model.alert("시작일자는 필수 입력 항목입니다.");
  75. return;
  76. }
  77. if(todd == "" || todd == "undefined" || todd == null){
  78. model.alert("종료일자는 필수 입력 항목입니다.");
  79. return;
  80. }
  81. //현재시간을 비교하여 근무시간 이후일 경우 6개월이상 조회가능 하도록 설정
  82. var sCurrentTm = getCurrentTime().substr(0,4);
  83. var sCurrentDay = getCurrentDate().toDate("YYYYMMDD").getDayOfWeek("K");
  84. if(sCurrentDay == "월" || sCurrentDay == "화" || sCurrentDay == "수" ||
  85. sCurrentDay == "목" || sCurrentDay == "금"){
  86. //오후 5시 이전일 경우 조회 조건은 1달이상 조회되지 않도록 함.
  87. if(sCurrentTm < "1700"){
  88. var sSearchTerm = getDateInterval(fromdd, todd);
  89. if(sSearchTerm > 30){
  90. model.alert("근무시간에는 1달 이상 조회할 수 없습니다.");
  91. return;
  92. }
  93. }
  94. }
  95. model.setValue("/root/send/todd" , todd );
  96. model.setValue("/root/send/fromdd" , fromdd );
  97. model.setValue("/root/send/tab" , tab ); // 방별, 과별, 의사별 구분 추가 by 박영우 20091229
  98. model.setValue("/root/send/subdeptcd", subdeptcd);
  99. model.setValue("/root/send/orddrid" , orddrid );
  100. model.setValue("/root/send/oproomcd" , oproomcd );
  101. model.setValue("/root/send/oppatflagcd", oppatflagcd); //병동,외래구분 by 박영우 20091229
  102. model.setValue("/root/send/opscale" , opscale); //대중소 구분 by 박영우 20091229
  103. model.removeNodeSet("/root/main/opreflistinfo/opreflist");
  104. grd_opreflst.refresh();
  105. if(submit("TRMCT00202")){
  106. }else{
  107. model.alert("수술명단 조회 시 서버 오류가 발생되었습니다.");
  108. return;
  109. }
  110. }
  111. /**
  112. * @group :
  113. * @ver : 2009-09-15 오후 6:45:47
  114. * @by :
  115. * @---------------------------------------------------
  116. * @type : function
  117. * @access : public
  118. * @desc : 진료과 변경시 의사 조회 이벤트
  119. * @param :
  120. * @return :
  121. * @---------------------------------------------------
  122. */
  123. function fValueChangedOrddrCombo(){
  124. var sordclsdeptflag = model.getValue("/root/init/orddeptlist/dept[deptcd = '"+model.getValue("/root/main/condition/subdeptcd")+"']/ordclsdeptflag"); // 대표/분과/서브 구분
  125. var sorddeptkind = model.getValue("/root/init/orddeptlist/dept[deptcd = '"+model.getValue("/root/main/condition/subdeptcd")+"']/orddeptkind"); // 센터/대표 구분
  126. var ssupdeptcd = model.getValue("/root/init/orddeptlist/dept[deptcd = '"+model.getValue("/root/main/condition/subdeptcd")+"']/supdeptcd"); // 상위부서코드
  127. var tab = model.getValue("/root/main/condition/tab"); //방별, 과별 선택 탭 by 박영우 20091229
  128. var sorddeptflag = "";
  129. if (sorddeptkind == "C") { // 센터이면
  130. sorddeptflag = "C";
  131. } else if (sorddeptkind != "C" && sordclsdeptflag == "A") { // 센터가 아니면서 분과이면
  132. sorddeptflag = "A";
  133. } else { // 그외에 기타과
  134. sorddeptflag = "etc";
  135. }
  136. if(model.getValue("/root/main/condition/subdeptcd") == ""){
  137. model.setValue("/root/main/condition/orddrid","");
  138. cmb_orddrid.refresh();
  139. }
  140. model.makeValue("/root/send/reqdata/ordclsdeptflag", sorddeptflag);
  141. model.makeValue("/root/send/reqdata/supdeptcd", ssupdeptcd);
  142. model.makeValue("/root/send/reqdata/prcpspecflag", "Y");
  143. model.makeValue("/root/send/reqdata/orddd", getCurrentDate());
  144. model.makeValue("/root/send/reqdata/orddeptcd", model.getValue("/root/main/condition/subdeptcd"));
  145. if(tab=="D") { //과,의사별일 경우에만 의사리스트 조회 by 박영우 20091229
  146. submit("TRMNO00104"); // 의사리스트 조회
  147. addComboItem("cmb_orddrid");
  148. }
  149. }
  150. /**
  151. * @group :
  152. * @ver : 2009-12-29 오후 3:17:47
  153. * @by : 박영우
  154. * @---------------------------------------------------
  155. * @type : function
  156. * @access : public
  157. * @desc : 검색 combo 변경시 이벤트
  158. * @param :
  159. * @return :
  160. * @---------------------------------------------------
  161. */
  162. function fValueChangedSchCombo(){
  163. var sTab = model.getValue("/root/main/condition/tab");
  164. if(sTab == "R"){ //방별
  165. //combo변경시 시간 재조정 by 박영우 20091229
  166. model.removenodeset("/root/main/opreflistinfo");
  167. model.setValue("/root/main/condition/oproomcd", "");
  168. model.setValue("/root/main/condition/subdeptcd", "");
  169. model.setValue("/root/main/condition/orddrid", "");
  170. model.setValue("/root/main/condition/oppatflagcd", "");
  171. model.setValue("/root/main/condition/opscale", "");
  172. caption4.visible = true;
  173. cmb_oproom.visible = true;
  174. caption7.visible = false;
  175. cmb_subdept.visible = false;
  176. caption2.visible = false;
  177. cmb_orddrid.visible = false;
  178. grd_opreflst.colhidden(grd_opreflst.colref("oproomnm"))=false;
  179. grd_opreflst.colhidden(grd_opreflst.colref("deptengabbr"))=true;
  180. grd_opreflst.colhidden(grd_opreflst.colref("perfdrnm"))=true;
  181. model.refresh();
  182. }else if(sTab == "E"){ //과별 추가 by 박영우 20091219
  183. model.removenodeset("/root/main/opreflistinfo");
  184. model.setValue("/root/main/condition/oproomcd", "");
  185. model.setValue("/root/main/condition/subdeptcd", "");
  186. model.setValue("/root/main/condition/orddrid", "");
  187. model.setValue("/root/main/condition/oppatflagcd", "");
  188. model.setValue("/root/main/condition/opscale", "");
  189. caption4.visible = false;
  190. cmb_oproom.visible = false;
  191. caption7.visible = true;
  192. cmb_subdept.visible = true;
  193. caption2.visible = false;
  194. cmb_orddrid.visible = false;
  195. grd_opreflst.colhidden(grd_opreflst.colref("oproomnm"))=true;
  196. grd_opreflst.colhidden(grd_opreflst.colref("deptengabbr"))=false;
  197. grd_opreflst.colhidden(grd_opreflst.colref("perfdrnm"))=true;
  198. model.refresh();
  199. }else if(sTab == "D"){
  200. //combo변경시 그리드, 과별, 의사별, 시간 재조정 by 박영우 20091229
  201. model.removenodeset("/root/main/opreflistinfo");
  202. model.setValue("/root/main/condition/oproomcd", "");
  203. model.setValue("/root/main/condition/subdeptcd", "");
  204. model.setValue("/root/main/condition/orddrid", "");
  205. model.setValue("/root/main/condition/oppatflagcd", "");
  206. model.setValue("/root/main/condition/opscale", "");
  207. caption4.visible = false;
  208. cmb_oproom.visible = false;
  209. caption7.visible = true;
  210. cmb_subdept.visible = true;
  211. caption2.visible = true;
  212. cmb_orddrid.visible = true;
  213. grd_opreflst.colhidden(grd_opreflst.colref("oproomnm"))=true;
  214. grd_opreflst.colhidden(grd_opreflst.colref("deptengabbr"))=false;
  215. grd_opreflst.colhidden(grd_opreflst.colref("perfdrnm"))=false;
  216. model.refresh();
  217. }
  218. }
  219. /**
  220. * @group :
  221. * @ver : 2009-12-29 오후 2:40:39
  222. * @by : 박영우
  223. * @---------------------------------------------------
  224. * @type : function
  225. * @access : public
  226. * @desc : Excel 저장 버튼 클릭 시
  227. * @param :
  228. * @return :
  229. * @---------------------------------------------------
  230. */
  231. function fOnClickExcelBtn(){
  232. var tab = model.getValue("/root/main/condition/tab");
  233. var title = "";
  234. var fileName = "";
  235. if(tab == "R") {
  236. title = "수술명단(방별)_"+getCurrentDate();
  237. fileName = window.fileDialog("save", ",", false, title, "xls", "All Files (*.*)|*.*|Excel Files(*.xls)|*.xls");
  238. } else if(tab == "E") {
  239. title = "수술명단(과별)_"+getCurrentDate();
  240. fileName = window.fileDialog("save", ",", false, title, "xls", "All Files (*.*)|*.*|Excel Files(*.xls)|*.xls");
  241. } else {
  242. title = "수술명단(의사별)_"+getCurrentDate();
  243. fileName = window.fileDialog("save", ",", false, title, "xls", "All Files (*.*)|*.*|Excel Files(*.xls)|*.xls");
  244. }
  245. if (fileName != "" && fileName != null){
  246. grd_opreflst.saveExcel(fileName, "sheetname: "+title+"; colhiddenextend: false; rowhiddenextend: true;");
  247. var s = fileName.lastIndexOf("\\");
  248. var fileName=fileName.substring(s+1);
  249. var rmsg = messageBox("저장된 Excel을", "Q004");
  250. if( rmsg == 6 ){
  251. window.exec("excel.exe", fileName);
  252. }
  253. }
  254. }
  255. /**
  256. * @group :
  257. * @ver : 2009-12-29 오후 3:00:47
  258. * @by : 박영우
  259. * @---------------------------------------------------
  260. * @type : function
  261. * @access : public
  262. * @desc : 수술방 정보 조회
  263. * @param :
  264. * @return :
  265. * @---------------------------------------------------
  266. */
  267. function fGetOproomList(){
  268. model.setValue("/root/send/fromdd" , getCurrentDate() );
  269. //현재일자에 유효한 수술방을 조회한다.
  270. submit("TRMCT00207");
  271. addComboItem("cmb_oproom");
  272. }