SMMNR024.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. /*
  2. (carerecweb/xrw/SMMNR024_중증도및위험사정분류도구관리.xrw - JScript )
  3. - Version :
  4. 1) : Ver.1.00.01
  5. */
  6. var xClsListPath = "/root/main/detlgrup/detlgruplist"
  7. var xlrgListPath = "/root/main/lrggrup/lrggruplist"
  8. var xCondPath = "/root/main/cond";
  9. var xClsListBKPath = "/root/hidden/main/detlgrup/detlgruplist";
  10. /**
  11. * @group :
  12. * @ver : 2007.03.31
  13. * @by : 정찬성
  14. * @---------------------------------------------------
  15. * @type : function
  16. * @access : public
  17. * @desc : 중증도및 위험사정 분류도구 조회
  18. * @param :
  19. * @return :
  20. * @---------------------------------------------------
  21. */
  22. function fSearch(){
  23. var iRow = grd_detlgrup.row;
  24. var clsflag = model.getValue("/root/main/cond/clsflag");
  25. var recflag = model.getValue("/root/main/cond/recflag");
  26. var prestdt = model.getValue("/root/main/cond/prestdt");
  27. if(clsflag == null || clsflag == ''){
  28. clsflag = '1';
  29. }
  30. if(recflag == null || recflag == ''){
  31. recflag = '1';
  32. }
  33. if(prestdt == null || prestdt == ''){
  34. prestdt = getCurrentDate();
  35. }
  36. //recflag에 따라 낙상및 욕창의 경우 default clsflag값을 설정한다.
  37. if(recflag == '2'){//낙상위험사정
  38. if(clsflag != '1' && clsflag != '2'){//1. 아동, 2. 성인 이 선택되지 않으면 default세팅
  39. clsflag = '1';
  40. }
  41. }else if(recflag == '3'){//욕창위험사정
  42. clsflag = '1';//욕창은 무조건 1임.
  43. }
  44. model.removenode("/root/send");
  45. model.makeValue("/root/main/cond/clsflag", clsflag);
  46. model.makeValue("/root/main/cond/recflag", recflag);
  47. model.makeValue("/root/main/cond/prestdt", prestdt);
  48. model.makeValue("/root/main/cond/supcd", "00000000");
  49. model.makeNode("/root/send");
  50. model.copyNode("/root/send", xCondPath);
  51. if(submit("TRMNR02404")){
  52. model.copyNode("/root/hidden/main", "/root/main");
  53. fMakeTreeView();
  54. }
  55. grd_detlgrup.row = 1;
  56. }
  57. /**
  58. * @group :
  59. * @ver : 2007.03.27
  60. * 2008.06.19 dhkim수정
  61. * @by : 정찬성
  62. * @---------------------------------------------------
  63. * @type : function
  64. * @access : public
  65. * @desc : 그리드를 트리구조로 만들어준다.
  66. * @param :
  67. * @return :
  68. * @---------------------------------------------------
  69. */
  70. function fMakeTreeView(){
  71. var sRowCnt = grd_detlgrup.rows-grd_detlgrup.fixedRows;
  72. var depth;
  73. for(var i=1; i<= sRowCnt; i++){
  74. depth = model.getValue(xClsListPath+"["+i+"]/depth");
  75. grd_detlgrup.outlinelevel(i) = depth;//depth별로 레벨을 지정한다.
  76. // grd_detlgrup.colDisabled(11) = true ;//시작일자 컬럼을 Non-Edit처리한다.
  77. }
  78. grd_detlgrup.OutlineCol = 3; //트리구조로 보여줄 col인덱스설정
  79. grd_detlgrup.OutlineBar = 4; //트리의 스타일 설정
  80. grd_detlgrup.TreeColor = "gray"; //트리색 설정
  81. model.refresh();
  82. }
  83. /**
  84. * @group :
  85. * @ver : 2007.03.30
  86. * @by : 정찬성
  87. * @---------------------------------------------------
  88. * @type : function
  89. * @access : public
  90. * @desc : 설명
  91. * @param :
  92. * @return :
  93. * @---------------------------------------------------
  94. */
  95. function fSave(){
  96. if(fIsValid()){
  97. model.removenode("/root/send");
  98. model.makeValue("/root/send/detlgrup", grd_detlgrup.getupdatedataAll("i"));
  99. model.makeValue("/root/send/lrggrupcd", model.getValue(xCondPath+"/lrggrupcd"));
  100. model.makeValue("/root/send/clsflag", model.getValue("/root/main/cond/clsflag"));
  101. model.makeValue("/root/send/recflag", model.getValue("/root/main/cond/recflag"));
  102. model.makeValue("/root/send/todd2", model.getValue("/root/main/cond/todd"));
  103. if(submit("TXMNR02402")){
  104. model.copyNode("/root/hidden/main","/root/main");
  105. fSearch();
  106. }
  107. grd_detlgrup.row = 1;
  108. }
  109. }
  110. /**
  111. * @group :
  112. * @ver : 2008.06.19
  113. * @by : dhkim
  114. * @---------------------------------------------------
  115. * @type : function
  116. * @access : public
  117. * @desc : 분류도구를 저장하기 전에 유효성을 체크한다.
  118. * @param :
  119. * @return : true/false
  120. * @---------------------------------------------------
  121. */
  122. function fIsValid(){
  123. var saveyn = 0 ;
  124. var sRowCnt = grd_detlgrup.rows-grd_detlgrup.fixedrows;
  125. //추가된 내역 없음
  126. if(sRowCnt <= 0){
  127. return false;
  128. }
  129. var fromdd, todd;
  130. for(var i=1; i<= sRowCnt; i++){
  131. fromdd = parseInt(model.getValue(xClsListPath+"["+i+"]/fromdd"));
  132. todd = parseInt(model.getValue(xClsListPath+"["+i+"]/todd"));
  133. if(model.getValue(xClsListPath+"["+i+"]/hngnm") == ""){
  134. messageBox(i + "번째의 분류도구명을","C001");
  135. return false;
  136. }
  137. if(fromdd > todd){
  138. messageBox(i + "번째의 시작일자를 종료일자보다 이후날짜로 입력","E001");
  139. return false;
  140. }
  141. if(model.getValue(xClsListPath+"["+i+"]/stat") != "-") {
  142. saveyn = 1 ;
  143. }
  144. }
  145. //수정된 내역이 없음 리턴
  146. if(saveyn <= 0 ){
  147. return false;
  148. }
  149. return true;
  150. }
  151. /**
  152. * @group :
  153. * @ver : 2008.06.19
  154. * @by : dhkim
  155. * @---------------------------------------------------
  156. * @type : function
  157. * @access : public
  158. * @param :
  159. * @return :
  160. * @desc : 1차분류를 추가한다.
  161. * @---------------------------------------------------
  162. */
  163. function fAddRowLevelOne(){
  164. fSetAddRowValues('1');
  165. grd_detlgrup.topRow = grd_detlgrup.row;
  166. }
  167. /**
  168. * @group :
  169. * @ver : 2008.06.19
  170. * @by : dhkim
  171. * @---------------------------------------------------
  172. * @type : function
  173. * @access : public
  174. * @param :
  175. * @return :
  176. * @desc : 2차분류를 추가한다.
  177. * @---------------------------------------------------
  178. */
  179. function fAddRowLevelTwo(){
  180. var iRow = grd_detlgrup.row;
  181. var supcd = model.getValue(xClsListPath+"[" + iRow + "]/supcd");
  182. var clstlcd = model.getValue(xClsListPath+"[" + iRow + "]/clstlcd");
  183. if(clstlcd == null){
  184. clstlcd = '';
  185. }
  186. if(iRow < 1 || supcd != "00000000" || (supcd == '00000000' && clstlcd == '')){
  187. messageBox("1차 분류항목을 선택하지 않아 2차분류를 추가", "E001");
  188. return;
  189. }
  190. var curRow = fSetAddRowValues('2');
  191. fMakeTreeView();
  192. grd_detlgrup.topRow = curRow;
  193. }
  194. /**
  195. * @group :
  196. * @ver : 2008.06.19
  197. * @by : dhkim
  198. * @---------------------------------------------------
  199. * @type : function
  200. * @access : public
  201. * @param : levelFlag 1 : 1차분류추가할때, 2: 2차분류추가할때
  202. * @return : curRow 현재 선택된 행
  203. * @desc : 그리드 행추가후 value를 setting한다.
  204. * @---------------------------------------------------
  205. */
  206. function fSetAddRowValues(levelFlag){
  207. var clsflag, recflag, depth, clstlcd ;
  208. var curRow = grd_detlgrup.row;
  209. //1차분류추가할때
  210. if(levelFlag == '1'){
  211. clsflag = model.getValue('/root/main/cond/clsflag');
  212. recflag = model.getValue('/root/main/cond/recflag');
  213. depth = '1';
  214. clstlcd = '00000000';
  215. grd_detlgrup.addRow();
  216. }
  217. //2차분류추가할때
  218. else if(levelFlag == '2'){
  219. clstlcd = model.getValue(xClsListPath+"["+curRow+"]/clstlcd");
  220. clsflag = model.getValue(xClsListPath+"["+curRow+"]/clsflag");
  221. recflag = model.getValue(xClsListPath+"["+curRow+"]/recflag");
  222. depth = Number(model.getValue(xClsListPath+"["+curRow+"]/depth")) + 1;
  223. grd_detlgrup.insertItem(curRow, 'after');
  224. }
  225. //행추가후 set
  226. curRow = grd_detlgrup.row;
  227. model.setValue('/root/main/detlgrup/detlgruplist[' + curRow + ']/stat', 'i');//그리드상태
  228. model.setValue('/root/main/detlgrup/detlgruplist[' + curRow + ']/basepnt', '0');//기준점수
  229. model.setValue('/root/main/detlgrup/detlgruplist[' + curRow + ']/cnfmyn', 'Y');//확인yn
  230. model.setValue('/root/main/detlgrup/detlgruplist[' + curRow + ']/timsinptyn', 'N');//횟수yn
  231. model.setValue('/root/main/detlgrup/detlgruplist[' + curRow + ']/cmtinptyn', 'Y');//서술yn
  232. model.setValue('/root/main/detlgrup/detlgruplist[' + curRow + ']/inptchkflag', 'Y');//필수입력
  233. model.setValue('/root/main/detlgrup/detlgruplist[' + curRow + ']/sortseq', '0');//정렬순서
  234. model.setValue('/root/main/detlgrup/detlgruplist[' + curRow + ']/fromdd', getCurrentDate());//시작일자
  235. model.setValue('/root/main/detlgrup/detlgruplist[' + curRow + ']/todd', '99991231');//종료일자
  236. model.setValue('/root/main/detlgrup/detlgruplist[' + curRow + ']/recflag', recflag);//recflag
  237. model.setValue('/root/main/detlgrup/detlgruplist[' + curRow + ']/clsflag', clsflag);//clsflag
  238. model.setValue('/root/main/detlgrup/detlgruplist[' + curRow + ']/supcd', clstlcd);//supcd
  239. model.setValue('/root/main/detlgrup/detlgruplist[' + curRow + ']/depth', depth);//depth
  240. return curRow;
  241. }
  242. /**
  243. * @group :
  244. * @ver : 2007.04.02
  245. * @by : 정찬성
  246. * @---------------------------------------------------
  247. * @type : function
  248. * @access : public
  249. * @desc : 설명 grid
  250. * @param :
  251. * @return :
  252. * @---------------------------------------------------
  253. */
  254. function fCloseGroup(){
  255. var sDepth = 0;
  256. for(var i = grd_detlgrup.fixedRows; i <= grd_detlgrup.rows; i++){
  257. sDepth=model.getValue(xClsListPath+"["+i+"]/depth");
  258. if(sDepth > 1){
  259. grd_detlgrup.rowhidden(i)=true
  260. }
  261. }
  262. grd_detlgrup.refresh();
  263. }
  264. /**
  265. * @group :
  266. * @ver : 2007.04.02
  267. * @by : 정찬성
  268. * @---------------------------------------------------
  269. * @type : function
  270. * @access : public
  271. * @desc : 설명 grid
  272. * @param :
  273. * @return :
  274. * @---------------------------------------------------
  275. */
  276. function fOpenGroup(){
  277. for(var i = grd_detlgrup.fixedRows; i <= grd_detlgrup.rows; i++){
  278. grd_detlgrup.rowhidden(i)=false
  279. }
  280. grd_detlgrup.refresh();
  281. }
  282. /**
  283. * @group :
  284. * @ver : 2007.03.28
  285. * @by : 정찬성
  286. * @---------------------------------------------------
  287. * @type : function
  288. * @access : public
  289. * @desc : 설명
  290. * @param :2차분류추가
  291. * @return :
  292. * @---------------------------------------------------
  293. */
  294. function fAddInfLevlItem(){
  295. var iRow = grd_detlgrup.row;
  296. var supcd = model.getValue(xClsListPath+"["+iRow+"]/supcd");
  297. if(iRow < 1 || supcd != "00000000" ){
  298. messageBox("1차 분류 항목이 선택되지 ", "E007");
  299. return;
  300. }
  301. var sDepth = model.getValue(xClsListPath+"["+iRow+"]/depth");
  302. var sSupCd = model.getValue(xClsListPath+"["+iRow+"]/grupcd");
  303. var sGrupFlag = model.getValue(xClsListPath+"["+iRow+"]/grupflag");
  304. if(model.getValue(xClsListPath+"[grupcd='"+sSupCd+"']/stat") == "I"){
  305. messageBox("1차 분류가 저장되지 ", "E007");
  306. return;
  307. }
  308. /* 2차 분류 추가시 refseq 셋팅 시작 */
  309. var vargrupcd = model.getValue(xClsListPath+"["+iRow+"]/grupcd");
  310. var cntgrupcd = 0 ;
  311. for(var i=1; i<= grd_detlgrup.rows; i++){
  312. if(vargrupcd == model.getValue(xClsListPath+"["+i+"]/supcd")){
  313. cntgrupcd++ ;
  314. }
  315. }
  316. /* 2차 분류 추가시 refseq 셋팅 끝 */
  317. grd_detlgrup.insertitem(iRow,"after");
  318. iRow++;
  319. model.setValue(xClsListPath+"["+iRow+"]/refseq",cntgrupcd+1); //2차 분류 reqseq 셋팅
  320. model.setValue(xClsListPath+"["+iRow+"]/stat","I"); //
  321. model.setValue(xClsListPath+"["+iRow+"]/depth",++sDepth); // depth
  322. model.setValue(xClsListPath+"["+iRow+"]/supcd",sSupCd); //
  323. model.setValue(xClsListPath+"["+iRow+"]/todd", "99991231"); //
  324. model.setValue(xClsListPath+"["+iRow+"]/grupflag", 1); //
  325. model.setValue(xClsListPath+"["+iRow+"]/cnfmyn",'Y'); //
  326. model.setValue(xClsListPath+"["+iRow+"]/timsinptyn", 'Y'); //
  327. model.setValue(xClsListPath+"["+iRow+"]/cmtinptyn",'Y'); //
  328. model.setValue(xClsListPath+"["+iRow+"]/inptchkflag", 'Y'); //
  329. model.setValue(xClsListPath+"["+iRow+"]/fromdd", getCurrentDate());
  330. model.setValue(xClsListPath+"["+iRow+"]/basepnt", 0); // //
  331. if((iRow-1) <= 0 ) {
  332. model.setValue(xClsListPath+"["+iRow+"]/clsflag",model.getValue("root/main/cond/clsflag"));
  333. model.setValue(xClsListPath+"["+iRow+"]/recflag",model.getValue("root/main/cond/recflag"));
  334. } else {
  335. model.setValue(xClsListPath+"["+iRow+"]/clsflag",model.getValue("/root/main/detlgrup/detlgruplist"+"["+ (iRow-1) +"]/clsflag"));
  336. model.setValue(xClsListPath+"["+iRow+"]/recflag",model.getValue("/root/main/detlgrup/detlgruplist"+"["+ (iRow-1) +"]/recflag"));
  337. }
  338. grd_detlgrup.rebuild();
  339. fMakeTreeView(); //
  340. }