SMMRI02000.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. /**
  2. * @desc : 화면 초기화
  3. * @
  4. * @param :
  5. * @return :
  6. * @author : HIT EMR Team
  7. * @---------------------------------------------------
  8. */
  9. function fInitialize(){
  10. model.removeNodeset("/root/main/unprepmngt/unprepsublist");
  11. model.refresh();
  12. grd_unpreplist.mergecells = "byrestriccol";
  13. for ( var i = 3 ; i <20; i++) {
  14. grd_unpreplist.mergecol(i)=false;
  15. }
  16. submit("TRMRI02001");
  17. fItemCheck();
  18. }
  19. /**
  20. * @desc : sort 넘버 지정
  21. * @
  22. * @param :
  23. * @return :
  24. * @author : HIT EMR Team
  25. * @---------------------------------------------------
  26. */
  27. function fSetSortNo(){
  28. /*var curRow = grd_unpreplist.row - grd_unpreplist.fixedRows + 1;
  29. if(curRow < 0){
  30. return;
  31. } */
  32. for(var j = grd_unpreplist.fixedRows; j < grd_unpreplist.rows; j++){
  33. model.setValue("/root/main/unprep/list["+ j +"]/sortno",j);
  34. model.setValue("/root/main/unprep/list["+ j +"]/jobposflag", -1);
  35. grd_unpreplist.rowStatus(j) = 1;
  36. } //end for
  37. model.makeValue("/root/temp/addflag","1");
  38. }
  39. /**
  40. * @desc : 아이템 체크
  41. * @
  42. * @param :
  43. * @return :
  44. * @author : HIT EMR Team
  45. * @---------------------------------------------------
  46. */
  47. function fItemCheck(){
  48. /*var curRow = grd_unpreplist.row - grd_unpreplist.fixedRows + 1;
  49. if(curRow < 0){
  50. return;
  51. } */
  52. var fromdd;
  53. var todd;
  54. for(var j = grd_unpreplist.fixedRows; j < grd_unpreplist.rows; j++){
  55. fromdd = model.getValue("/root/main/unprep/list["+ j +"]/unprepbasefromdd");
  56. todd = model.getValue("/root/main/unprep/list["+ j +"]/unprepbasetodd");
  57. if(todd > getCurrentDate()){
  58. model.setValue("/root/main/unprep/list["+ j +"]/check", "true");
  59. }
  60. } //end for
  61. }
  62. /**
  63. * @desc : check된 미비 기준 표시
  64. * @
  65. * @param :
  66. * @return :
  67. * @author : HIT EMR Team
  68. * @---------------------------------------------------
  69. */
  70. function fSetUnprepCheck(){
  71. //미비기준마스터테이블에서 가져온 데이터로 check표시
  72. var nodeList = model.instances(0).selectNodes("/root/main/unprep/templist");
  73. for(var i = 0; i < nodeList.length; i++)
  74. {
  75. var itemsNode = nodeList.item(i);
  76. var unprepitemcd = itemsNode.selectSingleNode("unprepitemcd").text;
  77. var degnitemlevlcd = itemsNode.selectSingleNode("degnitemlevlcd").text;
  78. var unprepbasefromdd = itemsNode.selectSingleNode("unprepbasefromdd").text;
  79. var unprepbasetodd = itemsNode.selectSingleNode("unprepbasetodd").text;
  80. var sortno = itemsNode.selectSingleNode("sortno").text;
  81. var jobposflag = itemsNode.selectSingleNode("jobposflag").text;
  82. var formcd = itemsNode.selectSingleNode("formcd").text;
  83. //alert(unprepitemcd+"-" + degnitemno +"-");
  84. model.setValue("/root/main/unprep/list[ formcd = '"+ formcd + "' and unprepitemcd = '"+ unprepitemcd + "' and degnitemlevlcd = '" + degnitemlevlcd + "' ]/check", "true");
  85. model.setValue("/root/main/unprep/list[ formcd = '"+ formcd + "' and unprepitemcd = '"+ unprepitemcd + "' and degnitemlevlcd = '" + degnitemlevlcd + "' ]/selectflag", "Y");
  86. model.setValue("/root/main/unprep/list[ formcd = '"+ formcd + "' and unprepitemcd = '"+ unprepitemcd + "' and degnitemlevlcd = '" + degnitemlevlcd + "' ]/unprepbasefromdd", unprepbasefromdd);
  87. model.setValue("/root/main/unprep/list[ formcd = '"+ formcd + "' and unprepitemcd = '"+ unprepitemcd + "' and degnitemlevlcd = '" + degnitemlevlcd + "' ]/unprepbasetodd", unprepbasetodd);
  88. model.setValue("/root/main/unprep/list[ formcd = '"+ formcd + "' and unprepitemcd = '"+ unprepitemcd + "' and degnitemlevlcd = '" + degnitemlevlcd + "' ]/sortno", sortno);
  89. model.setValue("/root/main/unprep/list[ formcd = '"+ formcd + "' and unprepitemcd = '"+ unprepitemcd + "' and degnitemlevlcd = '" + degnitemlevlcd + "' ]/jobposflag", jobposflag);
  90. }
  91. grd_unpreplist.clearStatus();
  92. model.refresh();
  93. }
  94. /**
  95. * @desc : aa
  96. * @
  97. * @param :
  98. * @return :
  99. * @author : HIT EMR Team
  100. * @---------------------------------------------------
  101. */
  102. function aa(){
  103. var iRow = grd_unpreplist.row - grd_unpreplist.fixedRows + 1;
  104. var check = model.getValue("/root/main/unprep/list[" + iRow + "]/check");
  105. alert(check +"=="+ grd_unpreplist.col);
  106. }
  107. /**
  108. * @desc : 열 상태 확인
  109. * @
  110. * @param :
  111. * @return :
  112. * @author : HIT EMR Team
  113. * @---------------------------------------------------
  114. */
  115. function fRowStatusCheck(){
  116. var iRow = grd_unpreplist.row - grd_unpreplist.fixedRows + 1;
  117. var check = model.getValue("/root/main/unprep/list[" + iRow + "]/check");
  118. var setdd = model.getValue("/root/main/unprep/list[" + iRow + "]/setdd");
  119. var todd = model.getValue("/root/main/unprep/list[" + iRow + "]/unprepbasetodd");
  120. var stat = grd_unpreplist.rowStatus(iRow);
  121. var addflag = model.getValue("/root/temp/addflag");
  122. if(addflag != "1"){
  123. // selectflag "N" 미비기준마스터테이블에 없는경우 , "Y" 조회된경우
  124. if(check == "true" && setdd == "" ){
  125. grd_unpreplist.rowStatus(iRow) = 2;
  126. model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasefromdd" , getCurrentDate());
  127. model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasetodd", "29991231");
  128. model.setValue("/root/main/unprep/list[" + iRow + "]/jobposflag", "3");
  129. // alert(1);
  130. }
  131. // 종료일자 지난경우
  132. if(check == "true" && setdd != "" && (todd <= getCurrentDate() )){
  133. //grd_unpreplist.rowStatus(iRow) = 0;
  134. model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasetodd", "29991231");
  135. model.setValue("/root/main/unprep/list[" + iRow + "]/jobposflag", "3");
  136. // alert(2);
  137. }else if(check == "true" && setdd != "" ){
  138. grd_unpreplist.rowStatus(iRow) = 0;
  139. model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasetodd", "29991231");
  140. model.setValue("/root/main/unprep/list[" + iRow + "]/jobposflag", "3");
  141. // alert(3);
  142. }
  143. if(check == "false" && setdd == ""){
  144. grd_unpreplist.rowStatus(iRow) = 0;
  145. model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasefromdd" , "");
  146. model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasetodd", "");
  147. model.setValue("/root/main/unprep/list[" + iRow + "]/jobposflag", "");
  148. // alert(4);
  149. }
  150. if(check == "false" && setdd != ""){
  151. grd_unpreplist.rowStatus(iRow) = 4;
  152. model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasetodd" , getCurrentDate());
  153. // alert(5);
  154. }
  155. }else if(addflag == "1"){
  156. if(check == "true"){
  157. fromdd = model.getValue("/root/main/unprep/list["+ iRow +"]/unprepbasefromdd");
  158. todd = model.getValue("/root/main/unprep/list["+ iRow +"]/unprepbasetodd");
  159. //alert(fromdd+"=="+todd);
  160. if(fromdd =="" && todd =="" ){
  161. model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasefromdd" , getCurrentDate());
  162. model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasetodd", "29991231");
  163. model.setValue("/root/main/unprep/list[" + iRow + "]/jobposflag", "3");
  164. }
  165. }
  166. }
  167. }
  168. /**
  169. * @desc : 그리드 상태 변경시 check
  170. * @
  171. * @param :
  172. * @return :
  173. * @author : HIT EMR Team
  174. * @---------------------------------------------------
  175. */
  176. function fGridValueChng(){
  177. var iRow = grd_unpreplist.row - grd_unpreplist.fixedRows + 1;
  178. var setdd = model.getValue("/root/main/unprep/list[" + iRow + "]/setdd");
  179. var check = model.getValue("/root/main/unprep/list[" + iRow + "]/check");
  180. if( setdd == "" && check =="false"){
  181. model.setValue("/root/main/unprep/list[" + iRow + "]/check","true");
  182. if(model.getValue("/root/main/unprep/list[" + iRow + "]/unprepbasefromdd").getTrim() == ""){
  183. model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasefromdd" , getCurrentDate());
  184. }
  185. if(model.getValue("/root/main/unprep/list[" + iRow + "]/unprepbasetodd").getTrim() == ""){
  186. model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasetodd" ,"29991231");
  187. }
  188. model.setValue("/root/main/unprep/list[" + iRow + "]/jobposflag", "3");
  189. }
  190. }
  191. /**
  192. * @desc : 미비리스트 저장
  193. * @
  194. * @param :
  195. * @return :
  196. * @author : HIT EMR Team
  197. * @---------------------------------------------------
  198. */
  199. function fSaveUnprepBase(){
  200. model.setValue("/root/send/savebase",grd_unpreplist.getUpdateData());
  201. model.removeNodeSet("/root/temp/unprepitem");
  202. var CSV = model.getValue("/root/send/savebase");
  203. model.makeNode("/root/temp/unprepitem");
  204. if(CSV != ""){
  205. setCSVToNode("/root/temp/unprepitem", CSV, "templist");
  206. }
  207. var nodeList = model.instances(0).selectNodes("/root/temp/unprepitem/templist");
  208. var iRow;
  209. var sTmp ="";
  210. var flag = false;
  211. if(nodeList.length == 0)
  212. return;
  213. for(var i = 0; i < nodeList.length; i++)
  214. {
  215. var itemsNode = nodeList.item(i);
  216. sTmp = itemsNode.selectSingleNode("unprepitemnm").text;
  217. if(sTmp.getTrim() ==""){
  218. messageBox("항목명칭을 ", "C001");
  219. flag = true;
  220. break;
  221. }
  222. }
  223. if(flag)
  224. return;
  225. model.makeValue("/root/temp/addflag",""); //서식추가, 항목추가 구분 flag
  226. submit("TXMRI02001");
  227. fItemCheck();
  228. }
  229. /**
  230. * @desc : 미비항목 한줄 추가
  231. * @
  232. * @param :
  233. * @return :
  234. * @author : HIT EMR Team
  235. * @---------------------------------------------------
  236. */
  237. function fUnprepaddRow(){
  238. var curRow = grd_unpreplist.row - grd_unpreplist.fixedRows + 1;
  239. if(curRow < 0){
  240. messageBox("항목을 추가할 행을 ","C002");
  241. return;
  242. }
  243. var iRow = grd_unpreplist.row;
  244. grd_unpreplist.insertRow(iRow ,"below");
  245. var iRow1 = grd_unpreplist.row;
  246. var formcd = model.getValue("/root/main/unprep/list["+ iRow +"]/formcd");
  247. var formnm = model.getValue("/root/main/unprep/list["+ iRow +"]/formnm");
  248. model.setValue("/root/main/unprep/list[" + iRow1 +"]/formcd", formcd);
  249. model.setValue("/root/main/unprep/list[" + iRow1 +"]/formnm", formnm);
  250. model.setValue("/root/main/unprep/list[" + iRow1 +"]/degnitemlevlcd", "0");
  251. model.setValue("/root/main/unprep/list[" + iRow1 +"]/degnitemcd", "0");
  252. model.setValue("/root/main/unprep/list[" + iRow1 +"]/sortno", "0");
  253. model.setValue("/root/main/unprep/list[" + iRow1 +"]/check", "true");
  254. model.setValue("/root/main/unprep/list[" + iRow1 +"]/unprepbasefromdd" , getCurrentDate());
  255. model.setValue("/root/main/unprep/list[" + iRow1 +"]/unprepbasetodd", "29991231");
  256. model.setValue("/root/main/unprep/list[" + iRow1 +"]/jobposflag", "3");
  257. model.makeValue("/root/temp/addflag","1");
  258. model.refresh();
  259. }
  260. /**
  261. * @desc : 미비서식 한줄 추가
  262. * @
  263. * @param :
  264. * @return :
  265. * @author : HIT EMR Team
  266. * @---------------------------------------------------
  267. */
  268. function fAddUnprepForm(){
  269. var CSV = model.getValue("/root/temp/unprepmngt");
  270. if(CSV != ""){
  271. setCSVToNode("/root/temp/unprepmngt", CSV, "unprepsublist");
  272. var formcd = model.getValue("/root/temp/unprepmngt/unprepsublist/formcd");
  273. var tmp = model.getValue("/root/main/unprep/list[ formcd = '" + formcd+ "']/formcd");
  274. if(tmp == ""){
  275. var formcd = model.getValue("/root/temp/unprepmngt/unprepsublist/formcd");
  276. model.makeValue("/root/send/reqdata/formcd", formcd);
  277. submit("TRMRI02002");
  278. fAddRow();
  279. fSetSortNo();
  280. }
  281. }
  282. }
  283. /**
  284. * @desc : 미비항목 없는경우(동의서)
  285. * @
  286. * @param :
  287. * @return :
  288. * @author : HIT EMR Team
  289. * @---------------------------------------------------
  290. */
  291. function fAddRow(){
  292. var node = instance1.selectNodes("/root/main/unprep/list");
  293. if(node.length == 0 ){
  294. grd_unpreplist.addRow(false);
  295. var formcd = model.getValue("/root/temp/unprepmngt/unprepsublist/formcd");
  296. var formnm = model.getValue("/root/temp/unprepmngt/unprepsublist/formnm");
  297. model.setValue("/root/main/unprep/list["+ 1 +"]/formcd", formcd);
  298. model.setValue("/root/main/unprep/list["+ 1 +"]/formnm", formnm);
  299. model.refresh();
  300. }
  301. }
  302. /**
  303. * @desc : 엑셀 저장
  304. * @
  305. * @param :
  306. * @return :
  307. * @author : HIT EMR Team
  308. * @---------------------------------------------------
  309. */
  310. function fSaveExcel(){
  311. var fileName = window.fileDialog("save", ",", false, "excel", "xls", "Excel Files(*.xls)|*.xls|All Files (*.*)|*.*");
  312. if (fileName != "")
  313. {
  314. grd_unpreplist.saveExcel(fileName, "SheetName", true, true, "", "", "false");
  315. }
  316. }
  317. /**
  318. * @---------------------------------------------------
  319. * @desc : 문자열 앞뒤에있는 공백 제거
  320. * @param : N/A
  321. * @return : 공백을 제거한 결과 문자열
  322. * @---------------------------------------------------
  323. */
  324. String.prototype.getTrim = function()
  325. {
  326. var startPoint = 0; // subString 하기 위한 시작 포인트
  327. var endPoint = this.length; // subString 하기 위한 끝 포인트
  328. //문자열앞에 공백문자가 들어 있는 Index 추출
  329. while( (startPoint < endPoint) && (this.charCodeAt(startPoint) == 32) )
  330. {
  331. startPoint++;
  332. }
  333. //문자열뒤에 공백문자가 들어 있는 Index 추출
  334. while( (startPoint < endPoint) && (this.charCodeAt(endPoint-1) == 32) )
  335. {
  336. endPoint--;
  337. }
  338. // 공백을 제거했으면 subString하여 결과문자열을 리턴하고 제거한 내용이 없으면 그대로 리턴
  339. return ( (startPoint > 0) || (endPoint < this.length) ) ? this.substring(startPoint, endPoint) : this;
  340. }
  341. /**
  342. * @desc : 공통미비항목 한줄 추가
  343. * @
  344. * @param :
  345. * @return :
  346. * @author : HIT EMR Team
  347. * @---------------------------------------------------
  348. */
  349. function fCommflagAddRow(){
  350. model.removeNodeset("/root/main/unprep/list");
  351. model.refresh();
  352. grd_unpreplist.addRow();
  353. var iRow = grd_unpreplist.row;
  354. model.setValue("/root/main/unprep/list[" + iRow +"]/formcd", "-");
  355. model.setValue("/root/main/unprep/list[" + iRow +"]/formnm", "-");
  356. model.setValue("/root/main/unprep/list[" + iRow +"]/degnitemlevlcd", "0");
  357. model.setValue("/root/main/unprep/list[" + iRow +"]/degnitemcd", "0");
  358. model.setValue("/root/main/unprep/list[" + iRow +"]/sortno", "0");
  359. model.setValue("/root/main/unprep/list[" + iRow +"]/check", "true");
  360. model.setValue("/root/main/unprep/list[" + iRow +"]/commflag", "true");
  361. model.setValue("/root/main/unprep/list[" + iRow +"]/unprepbasefromdd" , getCurrentDate());
  362. model.setValue("/root/main/unprep/list[" + iRow +"]/unprepbasetodd", "29991231");
  363. model.setValue("/root/main/unprep/list[" + iRow +"]/jobposflag", "3");
  364. model.makeValue("/root/temp/addflag","1");
  365. model.refresh();
  366. }
  367. /**
  368. * @desc : 미비항목 한줄삭제
  369. * @
  370. * @param :
  371. * @return :
  372. * @author : HIT EMR Team
  373. * @---------------------------------------------------
  374. */
  375. function fDelUnprepRow(){
  376. var curRow = grd_unpreplist.row - grd_unpreplist.fixedRows + 1;
  377. if(curRow < 1){
  378. alert("삭제할 아이템을 선택하세요");
  379. return;
  380. }
  381. var useYN = messageBox("선택된 미비기준을 삭제 ", "S001");
  382. if(useYN == 6 ){
  383. model.makeValue("/root/send/savedata/unprepitemcd", model.getValue("/root/main/unprep/list[" + curRow + "]/unprepitemcd"));
  384. model.makeValue("/root/send/savedata/total", model.getValue("/root/send/reqdata/total"));
  385. submit("TXMRI02002");
  386. }
  387. }