SMMCT00205.js 11 KB

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