SMMND02100.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. /*
  2. 환자별 투석 history 조회(SMMND02100.xrw - JScript )
  3. - Version :
  4. 1) : Ver.1.00.01
  5. */
  6. /**
  7. * @group :
  8. * @ver : 2007.06.20
  9. * @by : 김진아
  10. * @---------------------------------------------------
  11. * @type : function
  12. * @access : public
  13. * @desc : 화면 초기화
  14. * @param :
  15. * @return :
  16. * @---------------------------------------------------
  17. */
  18. function fDone(){
  19. //**그리드 초기화**//
  20. model.removeNodeset("/root/main/pathistlist/pathistinfo");
  21. var sCurrentDate = getCurrentDate(); // 현재일자
  22. model.setValue("/root/main/condition/srchfromdd", (sCurrentDate.substr(0,4)-1)+sCurrentDate.substr(4,4));
  23. model.setValue("/root/main/condition/srchtodd" , sCurrentDate);
  24. //**공통코드 가져오기**//
  25. zbcfGetCodeList( new Array ( "M0133" // 도관관리 부위
  26. , "M0134" // 도관관리 종류1
  27. , "M0135" // 도관관리 종류2
  28. , "M0136" // 혈액투석도관 제거이유
  29. , "M0138" // 동정맥루 부위
  30. , "M0137" // 동정맥루 종류
  31. , "M0139" // 동정맥루 사용혈관
  32. , "M0140" // 시술종류
  33. , "M0141" // 시술원인
  34. , "M0345" // 혈액투석액
  35. , "M0127" // 투석기
  36. , "M0128" // 용적
  37. , "M0142" // Cath.종류
  38. , "M0144" // 복막투석도관 제거사유
  39. , "M0145" // 감염종류
  40. , "M0146" // 원인균
  41. , "M0147" // 예후
  42. , "M0131" // 복막투석액 회사명
  43. , "M0132" // 복막투석액
  44. )
  45. , new Array ( "/root/init/M0133list" // 도관관리 부위
  46. , "/root/init/M0134list" // 도관관리 종류1
  47. , "/root/init/M0135list" // 도관관리 종류2
  48. , "/root/init/M0136list" // 혈액투석도관 제거이유
  49. , "/root/init/M0138list" // 동정맥루 부위
  50. , "/root/init/M0137list" // 동정맥루 종류
  51. , "/root/init/M0139list" // 동정맥루 사용혈관
  52. , "/root/init/M0140list" // 시술종류
  53. , "/root/init/M0141list" // 시술원인
  54. , "/root/init/M0345list" // 혈액투석액
  55. , "/root/init/M0127list" // 투석기
  56. , "/root/init/M0128list" // 용적
  57. , "/root/init/M0142list" // Cath.종류
  58. , "/root/init/M0144list" // 복막투석도관 제거사유
  59. , "/root/init/M0145list" // 감염종류
  60. , "/root/init/M0146list" // 원인균
  61. , "/root/init/M0147list" // 예후
  62. , "/root/init/M0131list" // 복막투석액 회사명
  63. , "/root/init/M0132list" // 복막투석액
  64. )
  65. );
  66. //** 상단환자 화면설정 **//
  67. var node = getGlobalVariable("paminfo");
  68. setCSVToNode("/root/temp/paminfo", node);
  69. if(getNodesetCount("/root/temp/paminfo/list") > 0) {
  70. var sSelPid = model.getValue("/root/temp/paminfo/list/pid"); // 등록번호
  71. model.setValue("/root/main/condition/pid", sSelPid);
  72. }
  73. if(model.getValue("/root/main/condition/pid")!=""){
  74. fSrchPatHistList(); // 환자별 투석 History 리스트 조회
  75. }
  76. }
  77. /**
  78. * @group :
  79. * @ver : 2007.06.20
  80. * @by : 김진아
  81. * @---------------------------------------------------
  82. * @type : function
  83. * @access : public
  84. * @desc : 환자별 투석 History 리스트 조회
  85. * @param :
  86. * @return :
  87. * @---------------------------------------------------
  88. */
  89. function fSrchPatHistList(){
  90. if(model.getValue("/root/main/condition/pid") == "") {
  91. fClearChildNode("/root/main/condition");
  92. var sCurrentDate = getCurrentDate(); // 현재일자
  93. model.setValue("/root/main/condition/srchfromdd", (sCurrentDate.substr(0,4)-1)+sCurrentDate.substr(4,4));
  94. model.setValue("/root/main/condition/srchtodd" , sCurrentDate);
  95. model.refresh();
  96. messageBox("등록번호는", "I003", "");
  97. fClearChildNode("/root/main/patbaselist/patbaseinfo");
  98. model.removeNodeset("/root/main/pathistlist");
  99. model.refresh();
  100. return;
  101. }
  102. // 조회기간 체크
  103. if(model.getValue("/root/main/condition/srchfromdd") > model.getValue("/root/main/condition/srchtodd")) {
  104. messageBox("예약일자 기간이 올바르지 않습니다.", "E");
  105. var sCurrentDate = getCurrentDate(); // 현재일자
  106. model.setValue("/root/main/condition/srchfromdd", (sCurrentDate.substr(0,4)-1)+sCurrentDate.substr(4,4));
  107. model.setValue("/root/main/condition/srchtodd" , sCurrentDate);
  108. model.refresh();
  109. }
  110. model.removenode("/root/send");
  111. model.makeNode ("/root/send");
  112. model.makeValue ("/root/send/reqdata/pid ", model.getValue("/root/main/condition/pid ")); // 등록번호
  113. model.makeValue ("/root/send/reqdata/hngnm ", model.getValue("/root/main/condition/hngnm ")); // 환자명
  114. model.makeValue ("/root/send/reqdata/srchfromdd", model.getValue("/root/main/condition/srchfromdd")); // 조회기간(시작)
  115. model.makeValue ("/root/send/reqdata/srchtodd ", model.getValue("/root/main/condition/srchtodd ")); // 조회기간(끝)
  116. model.removeNodeset("/root/main/pathistlist");
  117. model.removeNodeset("/root/main/patbaselist");
  118. submit("TRMND02101");
  119. // if(model.getValue("/root/main/pathistlist/pathistinfo/recdd") == ""){
  120. // model.removeNodeset("/root/main/pathistlist");
  121. // }
  122. // 환자명 설정
  123. model.makeValue("/root/main/condition/hngnm", model.getValue("/root/main/patbaselist/patbaseinfo/hngnm"));
  124. // 그리드Merge설정
  125. for(var i=2;i<grd_pathistinfo.cols;i++){
  126. grd_pathistinfo.mergecol(i) = false;
  127. }
  128. grd_pathistinfo.mergeCells = "bycol";
  129. model.refresh();
  130. }
  131. function fUseridPopup(pPath, pNodeID, pNodeNM, pNodeRrgsNo1, pNodeRrgsNo2, pDOC) {
  132. model.removeNodeset("/root/properties/parameters/SendData/SendDatavalue");
  133. model.removeNodeset("/root/main/pathistlist");
  134. modal("SMMNE03700", 1, event.screenX-100, event.screenY-100, "SMMNE03700", "/root/main/condition/pid", "/root/init/searchitem");
  135. var pParam = model.getValue("/root/properties/parameters/SendData/SendDatavalue");
  136. var pParamValue = pParam.split("|");
  137. model.setValue("/root/main/condition/pid", pParamValue[0]);
  138. }
  139. /************************************************************************************************************************/
  140. /**
  141. * @group :
  142. * @ver :
  143. * @by : 김기용, KJA 여러개의 그리드를 한 Sheet저장으로 수정
  144. * @---------------------------------------------------------------
  145. * @type : function
  146. * @access : public
  147. * @desc : 그리드 별 엑셀저장
  148. * @param :
  149. * @return :
  150. * @---------------------------------------------------------------
  151. */
  152. function saveExcelAll() {
  153. var paramLen = saveExcelAll.arguments.length;
  154. // 마지막 인자가 Boolean일 경우 처리
  155. var extendsCaptionBool;
  156. if( typeof(saveExcelAll.arguments[paramLen - 1]) == "boolean" ) {
  157. extendsCaptionBool = saveExcelAll.arguments[paramLen - 1];
  158. paramLen = paramLen - 1;
  159. }
  160. else{
  161. extendsCaptionBool = false;
  162. }
  163. var tmpParamArray = new Array();
  164. if( extendsCaptionBool ) {
  165. for( var i = 0; i < paramLen; i++ ) {
  166. tmpParamArray[i] = saveExcelAll.arguments[i];
  167. }
  168. saveExcelAllWithCaption(tmpParamArray);
  169. }
  170. else{
  171. for( var i = 0; i < paramLen; i++ ) {
  172. tmpParamArray[i] = saveExcelAll.arguments[i];
  173. }
  174. saveExcelAllWithNotCaption(tmpParamArray);
  175. }
  176. }
  177. function saveExcelAllWithCaption( sheetArray ) {
  178. // alert(gridCaptionArray);
  179. var fileName = window.fileDialog("save", ",", false, "excel", "xls", "All Files (*.*)|*.*|Excel Files(*.xls)|*.xls");
  180. if( fileName == "" )
  181. return;
  182. var sheetArrayLen = sheetArray.length;
  183. var gridId;
  184. var gridObj;
  185. for( var i = 0; i < sheetArray.length; i++ ) {
  186. gridId = sheetArray[i].split("|")[0];
  187. gridObj = document.all.item(gridId);
  188. // saveText() 함수는 Caption저장이 불가능 하여 SaveExcel()을 이용한다.
  189. gridObj.saveExcel("C:\\Temp\\tmp_TFExcel_" + i +".xls");
  190. }
  191. // excel application 실행함
  192. tfexcel.launchnewinstance(0);
  193. //실행된 excel application에서 새로운 workbook을 생성
  194. tfexcel.createworkbook();
  195. tfexcel.activatesheet(1);
  196. var sheetName;
  197. var nResult;
  198. //수정부분////////////////////////////////////////////////////////////////////////////////////////
  199. for( var i = 0; i < sheetArrayLen; i++ )
  200. {
  201. sheetName = sheetArray[1].split("|")[1];
  202. if( i > 1 ) {
  203. nResult = tfexcel.activatesheet(1);
  204. tfexcel.sheetname(1) = sheetName;
  205. }
  206. else {
  207. nResult = tfexcel.activatesheet(1);//tfexcel.addsheet(i+1, sheetName);
  208. }
  209. if( nResult < 0 ) {
  210. messageBox(sheetName + " 저장을", "E009");
  211. // alert(sheetName + " 오류발생");
  212. return;
  213. }
  214. tfexcel.loadCSV("C:\\Temp\\tmp_TFExcel_" + i + ".xls");
  215. }
  216. //여기까지//////////////////////////////////////////////////////////////////////////////////////////
  217. tfexcel.loadCSV("C:\\Temp\\tmp_TFExcel.xls");
  218. //workbook을 저장.
  219. tfexcel.save(fileName);
  220. //excel application을 종료. excel application 생성 후 반드시 close해야함.
  221. tfexcel.close();
  222. var fso = new ActiveXObject("Scripting.FileSystemObject");
  223. for( var i = 0; i < sheetArrayLen; i++ ) {
  224. fso.DeleteFile("C:\\Temp\\tmp_TFExcel_" + i + ".xls");
  225. }
  226. var rmsg = messageBox("저장된 Excel을", "Q004");
  227. // var rmsg = window.alert("저장된 Excel을 실행하시겠습니까?", "알림", 36);
  228. if( rmsg == 6 )
  229. window.exec("excel.exe", '\"' + fileName + '\"');
  230. }
  231. function saveExcelAllWithNotCaption( sheetArray ) {
  232. // alert(gridCaptionArray);
  233. var fileName = window.fileDialog("save", ",", false, "excel", "xls", "All Files (*.*)|*.*|Excel Files(*.xls)|*.xls");
  234. if( fileName == "" )
  235. return;
  236. // excel application 실행함
  237. tfexcel.launchnewinstance(0);
  238. // 실행된 excel application에서 새로운 workbook을 생성
  239. tfexcel.createworkbook();
  240. // var sheetArray = new Array("grd_bizprescondstats|업무현황", "grd_patprescondstats|환자현황", "grd_hdstatsinfo|혈액투석현황", "grd_pdstatsinfo|복막투석현황", "grd_pdbizstatsinfo|복막투석업무현황");
  241. var sheetArrayLen = sheetArray.length;
  242. var gridId;
  243. var gridObj;
  244. var sheetName;
  245. var nResult;
  246. for( var i = 0; i < sheetArrayLen; i++ ) {
  247. gridId = sheetArray[i].split("|")[0];
  248. gridObj = document.all.item(gridId);
  249. sheetName = sheetArray[i].split("|")[1];
  250. if( i > 1 ) {
  251. nResult = tfexcel.activatesheet(i+1);
  252. tfexcel.sheetname(i+1) = sheetName;
  253. }
  254. else {
  255. nResult = tfexcel.addsheet(i+1, sheetName);
  256. }
  257. if( nResult < 0 ) {
  258. messageBox(sheetName + " 저장을", "E009");
  259. // alert(sheetName + " 오류발생");
  260. return;
  261. }
  262. gridObj.saveText("C:\\Temp\\tmp_TFExcel.csv", "\n", ",", '\:', true);
  263. tfexcel.loadCSV("C:\\Temp\\tmp_TFExcel.csv");
  264. }
  265. //workbook을 저장.
  266. tfexcel.save(fileName);
  267. //excel application을 종료. excel application 생성 후 반드시 close해야함.
  268. tfexcel.close();
  269. // CSV File 삭제
  270. var fso = new ActiveXObject("Scripting.FileSystemObject");
  271. fso.DeleteFile("C:\\Temp\\tmp_TFExcel.csv");
  272. var rmsg = messageBox("저장된 Excel을", "Q004");
  273. // var rmsg = window.alert("저장된 Excel을 실행하시겠습니까?", "알림", 36);
  274. if( rmsg == 6 )
  275. window.exec("excel.exe", '\"' + fileName + '\"');
  276. }
  277. function createTFExcel(tfExcelID, parentObj) {
  278. if( parentObj == null )
  279. parentObj = body;
  280. var tfExcelObj = parentObj.createChild("xforms:object", "id:" + tfExcelID + "; clsid:{fe8d1001-6a9d-424d-ae2a-301493bb12da}; left:100px; top:100px; width:100px; height:100px; ");
  281. return tfExcelObj;
  282. }
  283. /************************************************************************************************************************/