MRF00900.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969
  1. /**
  2. - ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩
  3. 진료 - 누적관리( SMMRF00900_누적관리.xrw - JScript )
  4. * Version :
  5. - Ver.1.00.01
  6. * 개발자: 이경희
  7. * 최초작성일:
  8. - 2007/03/28
  9. * 수정이력:
  10. - 2008/03/19 (생성일자 오류 수정)
  11. - 2009-04-09 오전 8:48:23 강지훈 : TRMRF00901을 중앙의료원용 TRMRF00903으로 변경 TRMRF00901은 다른화면에서 사용중.
  12. - 2009-04-09 오전 8:48:23 강지훈 : TRMRF00902을 중앙의료원용 TRMRF00904으로 변경 TRMRF00902는 다른화면에서 사용중.
  13. * 기타:
  14. - ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩
  15. */
  16. var FORMMNGT_SCR_SAVE_DATA = 0; //화면에 누적리스트 저장할 데이터 (0:없음, 1:있음)
  17. /**
  18. * @desc : 화면 초기화
  19. * @
  20. * @param :
  21. * @return :
  22. * @---------------------------------------------------
  23. */
  24. function fInitialize(){
  25. model.setValue("/root/main/newgrup/grupfromdt", getCurrentDate());
  26. model.setValue("/root/main/newgrup/gruptodt","99991231");
  27. model.copyNode("/root/temp/newgrup", "/root/main/newgrup");
  28. model.setFocus("ipt_valreqdata");
  29. model.toggle("gruplist");
  30. model.refresh();
  31. }
  32. /**
  33. * @desc : ?????? ???? ?? error check
  34. * @param :
  35. * @return : 0 : error 1 : no error
  36. * @---------------------------------------------------
  37. */
  38. function fChkError(){
  39. var errcd = model.getValue("/root/temp/errmsg/errcd");
  40. if(errcd == "err01"){ // insert error
  41. var itemnm = model.getValue("/root/main/newgrup/grupnm");
  42. var useYN = messageBox(itemnm + "과 같은 이름이 있습니다. 입력", "S001");
  43. }else if(errcd == "err02"){
  44. var termnm = model.getValue("/root/main/newterm/termnm");
  45. var useYN = messageBox(termnm + "과 같은 이름이 있습니다. 입력", "S001");
  46. }
  47. if(useYN == 6){
  48. return 1;
  49. }else{
  50. return 0;
  51. }
  52. }
  53. function fSetCtrlDisabled2(bool){
  54. ipt_listnm.disabled = bool;
  55. ipt_fromdd.disabled = bool;
  56. ipt_todd.disabled = bool;
  57. //ipt_listdesc.disabled = bool;
  58. ipt_updtresncnts.disabled = bool;
  59. ipt_rem.disabled = bool;
  60. cmb_grupflag.disabled = bool;
  61. }
  62. /*
  63. ????
  64. */
  65. function removeBlank(str){
  66. str = str.replace(/\s/g,'');
  67. return str;
  68. }
  69. /**
  70. * @desc : 누적리스트 조회
  71. * @
  72. * @param :
  73. * @return :
  74. * @---------------------------------------------------
  75. */
  76. function fReqValue(condPath)
  77. {
  78. var mode = model.getValue("/root/main/condition/reqgrupflag");
  79. if(mode == "code")
  80. {
  81. model.setValue("/root/main/condition/grupcd", model.getValue("/root/main/condition/grupnm"));
  82. }
  83. fSetCtrlDisabled2(true)
  84. model.setValue("/root/main/condition/grupflag", "G");
  85. model.copyNode("/root/send/reqdata", condPath );
  86. submit("TRMRF00903");
  87. }
  88. /**
  89. * @desc :누적리스트 추가
  90. * @
  91. * @param :
  92. * @return :
  93. * @---------------------------------------------------
  94. */
  95. function fInsertGrup(){
  96. model.copyNode("/root/main/newgrup", "/root/temp/newgrup");
  97. model.refresh();
  98. // 컨트롤을 Enable 한다.
  99. fDisabledCtrlForNewGrup(false);
  100. // fucus이동
  101. model.setFocus("ipt_listnm");
  102. model.makeValue("/root/main/newgrup/status","i");
  103. }
  104. /**
  105. * @desc :누적리스트 추가
  106. * @
  107. * @param :
  108. * @return :
  109. * @---------------------------------------------------
  110. */
  111. function fUpdateGrup(){
  112. iRow = grd_gruplist.row - grd_gruplist.fixedRows + 1;
  113. if(iRow < 1){
  114. messageBox("수정할 행을 ","C002");
  115. return;
  116. }
  117. //fValiCheck();
  118. // 컨트롤을 Enable 한다.
  119. fDisabledCtrlForNewGrup(false);
  120. cmb_valiyn.disabled = false;
  121. // fucus이동
  122. model.setFocus("ipt_listnm");
  123. model.makeValue("/root/main/newgrup/status","u");
  124. //fCompareNodes 비교위해 copynode
  125. model.makeNode("/root/main/newgrup2");
  126. model.copyNode("/root/main/newgrup2","/root/main/newgrup");
  127. }
  128. /**
  129. * @desc : 버튼 disable
  130. * @
  131. * @param :
  132. * @return :
  133. * @---------------------------------------------------
  134. */
  135. function fDisabledCtrlForNewGrup(bDisable)
  136. {
  137. ipt_listnm.disabled = bDisable;
  138. ipt_fromdd.disabled = bDisable;
  139. ipt_todd.disabled = bDisable;
  140. cmb_grupflag.disabled = bDisable;
  141. //ipt_listdesc.disabled = bDisable;
  142. //cmb_valiyn.disabled = bDisable;
  143. ipt_updtresncnts.disabled = bDisable;
  144. ipt_rem.disabled = bDisable;
  145. }
  146. /**
  147. * @group :
  148. * @ver : 2007.06.13
  149. * @by :
  150. * @---------------------------------------------------
  151. * @type : function
  152. * @access : public
  153. * @desc : 두개의 노드셋을 비교한다.
  154. * @param : originalNode :
  155. * @param : copyNode :
  156. * @return : true, false
  157. * @---------------------------------------------------
  158. */
  159. function fCompareNodes1(originalNode, copyNode){
  160. var ins = document.models( 0 ).instances( 0 );
  161. var original = ins.selectSingleNode(originalNode).xml;
  162. var copy = ins.selectSingleNode(copyNode).xml;
  163. var replace = original.setReplaceWord("newgrup2","newgrup");
  164. if(replace == null || copy == null){
  165. return false;
  166. }else if (replace == copy){
  167. return true;
  168. }else{
  169. return false;
  170. }
  171. }
  172. /**
  173. * @desc : 누적리스트 저장
  174. * @
  175. * @param : grdObj 그리드 ID
  176. * @return :
  177. * @---------------------------------------------------
  178. */
  179. function fSaveGrup()
  180. {
  181. var status = model.getValue("/root/main/newgrup/status");
  182. //alert(status); // i: 신규저장, u: 수정
  183. if(status=="" || status==null ) {
  184. return;
  185. }
  186. var grupnm = model.getValue("/root/main/newgrup/grupnm");
  187. if(grupnm=="" || grupnm==null ) {
  188. messageBox("리스트명을 ","C001");
  189. return;
  190. }
  191. //수정 여부 check
  192. if(status == "u"){
  193. var compare = fCompareNodes1("/root/main/newgrup2","/root/main/newgrup");
  194. if(status=="u" && compare == true){
  195. messageBox("수정된 내용이","I004");
  196. return;
  197. }
  198. }
  199. // grd_gridlist조회 위한 grupcd
  200. var curRow = grd_gruplist.row - grd_gruplist.fixedRows + 1;
  201. model.makeValue("/root/send/reqdata/grupcd", model.getValue("/root/main/gruplist[" + curRow + "]/grupcd"));
  202. model.makeValue("/root/send/reqdata/grupflag", model.getValue("/root/main/gruplist[" + curRow + "]/grupflag"));
  203. // alert("groupcode:" + model.getValue("/root/send/reqdata/grupcd")); // 0001349001
  204. // alert("groupflag:" + model.getValue("/root/send/reqdata/grupflag")); // Y
  205. model.copyNode("/root/send/grupdata/grupmaster","/root/main/newgrup");
  206. if(status == "u"){
  207. //2009.01.21 강지훈 수정
  208. //변경이력을 남기지 않고 Update.
  209. var ret = messageBox("변경 이력을 저장", "S001");
  210. if(ret == "6"){
  211. model.makeValue("/root/send/grupdata/histsaveyn", "Y");
  212. }
  213. else if(ret == "7"){
  214. model.makeValue("/root/send/grupdata/histsaveyn", "N");
  215. }
  216. else{
  217. return;
  218. }
  219. }
  220. //fUpdateTodt();
  221. for (var i= grd_gridsublist.fixedRows; i < grd_gridsublist.rows ;i++ )
  222. {
  223. var aa = grd_gridsublist.rowstatus(i) = 1;
  224. }
  225. var saveData = grd_gridsublist.getUpdateData();
  226. model.setValue("/root/send/grupdata/savedata", saveData);
  227. if(submit("TXMRF00901"))
  228. {
  229. if(fChkError() == 1)
  230. {
  231. //저장 중 error유무 확인
  232. model.makeValue("/root/main/newgrup/procflag", "Y"); //process처리구분을 무시로 설정, 저장된다.
  233. model.refresh();
  234. model.setValue("/root/temp/errmsg/errcd","");
  235. model.copyNode("/root/send/grupdata/grupmaster","/root/main/newgrup");
  236. //fUpdateTodt();
  237. for (var i= grd_gridsublist.fixedRows; i < grd_gridsublist.rows ;i++ )
  238. {
  239. var aa = grd_gridsublist.rowstatus(i) = 1;
  240. }
  241. model.setValue("/root/send/grupdata/savedata", grd_gridsublist.getUpdateData());
  242. submit("TXMRF00901");
  243. }
  244. }
  245. // 저장후 gruplist 조회
  246. model.setValue("/root/main/condition/grupflag", model.getValue("/root/main/gruplist["+curRow+"]/grupflag"));
  247. model.copyNode("/root/send/reqdata","/root/main/condition" );
  248. model.makeValue("/root/send/reqdata/grupnm",model.getValue("/root/main/newgrup/grupnm"));
  249. model.makeValue("/root/send/reqdata/reqgrupflag", "grid");
  250. submit("TRMRF00903");
  251. grd_gruplist.row = 1;
  252. model.removeNodeset("/root/main/gridsublist");
  253. // 저장후 gridlist 조회
  254. if(status=="u" ){ // 수정만 조회
  255. model.makeValue("/root/send/reqdata/grupcd",model.getValue("/root/main/gruplist[" + grd_gruplist.row + "]/grupcd"));
  256. if(submit("TRMRF00904")== false){
  257. model.removeNodeset("/root/main/gridsublist");
  258. }
  259. }
  260. model.makeValue("/root/main/newgrup/status","");
  261. //아이템유효여부 초기화 Y
  262. cmb_valiyn.disabled = true;
  263. model.setValue("/root/temp/valiyn","Y");
  264. fDisabledCtrlForNewGrup(true);
  265. model.refresh();
  266. }
  267. /**
  268. * @desc : 누적서브리스트 조회
  269. * @
  270. * @param : grdObj 그리드 ID, condPath 조회조건 xpath
  271. * @return :
  272. * @---------------------------------------------------
  273. */
  274. function fReqGridSub(grdObj, condPath){
  275. var curRow = grdObj.row - grdObj.fixedRows + 1;
  276. model.makeValue("/root/main/condition/grupcd", model.getValue("/root/main/gruplist[" + curRow + "]/grupcd"));
  277. model.makeValue("/root/main/condition/grupflag", model.getValue("/root/main/gruplist[" + curRow + "]/grupflag"));
  278. model.refresh();
  279. model.copyNode("/root/send/reqdata", condPath);
  280. submit("TRMRF00904");
  281. }
  282. /**
  283. * @desc : 누적서브리스트 조회시 초기화
  284. * @
  285. * @param :
  286. * @return :
  287. * @---------------------------------------------------
  288. */
  289. function fReqClear(){
  290. //gridsublist초기화
  291. model.resetInstanceNode("/root/main/gridsublist");
  292. grd_gridsublist.refresh();
  293. model.toggle("gruplist");
  294. }
  295. /**
  296. * @desc : 누적서브리스트 조회, newgrup에 복사
  297. * @
  298. * @param :
  299. * @return :
  300. * @---------------------------------------------------
  301. */
  302. function fReqCopyGruplist(){
  303. model.toggle("gruplist");
  304. iRow = grd_gruplist.row;
  305. if(iRow < 1){
  306. return;
  307. }
  308. model.copyNode("/root/main/newgrup", "/root/main/gruplist[" + iRow + "]");
  309. model.refresh();
  310. fSetCtrlDisabled2(true)
  311. fReqGridSub(grd_gruplist, "/root/main/condition");
  312. }
  313. /**
  314. * @desc : 누적서브리스트 추가
  315. * @
  316. * @param : grdObj 그리드ID
  317. * @return :
  318. * @---------------------------------------------------
  319. */
  320. function fAddValueSub(grdObj){
  321. model.toggle("itemlist");
  322. model.refresh();
  323. var curRow = grdObj.row - grdObj.fixedRows + 1;
  324. var grupcd = model.getValue("/root/temp/gridsublist/grupcd");
  325. // model.setValue("/root/main/gridsublist[" + curRow + "]/grupcd", grupcd);
  326. model.setValue("/root/temp/gridsublist/rowpos", curRow);
  327. model.refresh();
  328. }
  329. /**
  330. * @desc : 밸류서브리스트 삭제
  331. * @
  332. * @param : grdObj 그리드ID
  333. * @return :
  334. * @---------------------------------------------------
  335. */
  336. function fDelValueSub(grdObj){
  337. var curRow = grdObj.row - grdObj.fixedRows + 1;
  338. if(curRow < 1){
  339. alert("삭제할 아이템을 선택하세요");
  340. return;
  341. }
  342. var statusFlag = grdObj.rowStatus(curRow);
  343. grdObj.deleteItem(curRow);
  344. model.setValue("/root/temp/gridsublist/itemremove","Y");
  345. model.refresh();
  346. }
  347. /**
  348. * @desc : 누적서브리스트 등록
  349. * @
  350. * @param : grdObj 그리드ID
  351. * @return :
  352. * @---------------------------------------------------
  353. */
  354. function fRgstGridSub(grdObj, grdObj2){
  355. var curRow = grd_itemlist.row - grd_itemlist.fixedRows + 1;
  356. var itemnm = model.getValue("/root/main/itemlist[" + curRow + "]/itemnm");
  357. var termcd = model.getValue("/root/main/itemlist[" + curRow + "]/termcd");
  358. var reprtermnm = model.getValue("/root/main/itemlist[" + curRow + "]/reprtermnm");
  359. termcd = termcd.substring(0,7);
  360. var axflag = model.getValue("/root/temp/gridsublist/axflag");
  361. var grupcd = model.getValue(grd_gruplist.attribute("nodeset") + "[" + grd_gruplist.row + "]/grupcd");
  362. // datagrid1.findRow( data명, 시작row, column위치, 대소문자 구분유무, 전체/부분일치 유무 )
  363. var rowpos = grd_gridsublist.findRow(termcd, 1, grd_gridsublist.colref("termbasecd"));
  364. if(rowpos > 0){
  365. alert( itemnm +"은 이미 존재하는 누적서브 아이템입니다.");
  366. return;
  367. }
  368. grd_gridsublist.addItem();
  369. var desCurRow = grd_gridsublist.rows - grdObj2.fixedRows;
  370. model.setValue("/root/main/gridsublist[" + desCurRow + "]/sortno", desCurRow);
  371. model.setValue("/root/main/gridsublist[" + desCurRow + "]/itemnm", itemnm);
  372. model.setValue("/root/main/gridsublist[" + desCurRow + "]/inptkind", '2');
  373. model.setValue("/root/main/gridsublist[" + desCurRow + "]/termbasecd", termcd);
  374. model.setValue("/root/main/gridsublist[" + desCurRow + "]/grupcd", grupcd);
  375. model.setValue("/root/main/gridsublist[" + desCurRow + "]/axflag", axflag);
  376. model.setValue("/root/main/gridsublist[" + desCurRow + "]/reprtermnm", reprtermnm);
  377. grd_gridsublist.refresh();
  378. }
  379. function fRgstGridSubDelay(){
  380. iRow = grd_itemlist.row;
  381. if(iRow < 1){
  382. return;
  383. }
  384. model.toggle("itemlist");
  385. model.copyNode("/root/main/newitem", "/root/main/itemlist[" + iRow + "]");
  386. model.refresh();
  387. var itemcd = model.getValue("/root/main/newitem/itemcd");
  388. model.makeNode("/root/send/reqdata/reqdata");
  389. model.makeNode("/root/send/reqdata/reqflag");
  390. model.makeValue("/root/send/reqdata/reqdata", itemcd);
  391. model.makeValue("/root/send/reqdata/reqflag", "itemcd");
  392. model.makeValue("/root/send/reqdata/reqstatusterm", "Y");
  393. model.refresh();
  394. submit("TRMRF00202");
  395. }
  396. /**
  397. * @desc : 누적서브리스트 유사어/약어 등록
  398. * @
  399. * @param : grdObj 그리드ID
  400. * @return :
  401. * @---------------------------------------------------
  402. */
  403. function fRgstItemSub(){
  404. var curRow = grd_termlist.row - grd_termlist.fixedRows + 1;
  405. //유사어 약어 dbclick시 등록
  406. var itemnm = model.getValue("/root/main/termlist[" + curRow + "]/termnm");
  407. //var itemcd = model.getValue("/root/main/termlist[" + curRow + "]/itemcd");
  408. var termcd = model.getValue("/root/main/termlist[" + curRow + "]/termcd");
  409. termcd = termcd.substring(0,7);
  410. var axflag = model.getValue("/root/temp/gridsublist/axflag");
  411. var grupcd = model.getValue(grd_gruplist.attribute("nodeset") + "[" + grd_gruplist.row + "]/grupcd");
  412. //datagrid1.findRow( data명, 시작row, column위치, 대소문자 구분유무, 전체/부분일치 유무 )
  413. var rowpos = grd_gridsublist.findRow(termcd, 1, grd_gridsublist.colref("termbasecd"));
  414. if(rowpos > 0){
  415. alert( itemnm +"과 같은 누적서브 아이템이 존재합니다.");
  416. return;
  417. }
  418. grd_gridsublist.addItem();
  419. var desCurRow = grd_gridsublist.rows - grd_gridsublist.fixedRows;
  420. model.setValue("/root/main/gridsublist[" + desCurRow + "]/sortno", desCurRow);
  421. model.setValue("/root/main/gridsublist[" + desCurRow + "]/itemnm", itemnm);
  422. model.setValue("/root/main/gridsublist[" + desCurRow + "]/termbasecd", termcd);
  423. model.setValue("/root/main/gridsublist[" + desCurRow + "]/grupcd", grupcd);
  424. model.setValue("/root/main/gridsublist[" + desCurRow + "]/axflag", axflag);
  425. model.setValue("/root/main/gridsublist[" + desCurRow + "]/inptkind", "2");
  426. grd_gridsublist.refresh();
  427. }
  428. /**
  429. * @desc : 누적서브리스트 아이템리스트 등록
  430. * @
  431. * @param : grdObj 그리드ID
  432. * @return :
  433. * @---------------------------------------------------
  434. */
  435. function fRgstItemList(){
  436. var iRow = grd_itemlist.rows;
  437. //alert(iRow);
  438. if(iRow < 1){
  439. return;
  440. }
  441. model.toggle("itemlist");
  442. model.copyNode("/root/main/newitem", "/root/main/itemlist[" + iRow + "]");
  443. model.refresh();
  444. //var itemcd = model.getValue("/root/main/newitem/itemcd");
  445. model.makeNode("/root/send/reqdata/reqdata");
  446. model.makeNode("/root/send/reqdata/reqflag");
  447. model.setValue("/root/send/reqdata/reqdata", itemcd);
  448. model.setValue("/root/send/reqdata/reqflag", "itemcd");
  449. model.refresh();
  450. submit("TRMRF00202");
  451. }
  452. /**
  453. * @desc : 누적서브리스트 등록(누적 그룹 아이템 추가 후 저장)
  454. * @
  455. * @param : grdObj 그리드ID
  456. * @return :
  457. * @---------------------------------------------------
  458. */
  459. function fSaveValueSub()
  460. {
  461. var bModified = false;
  462. //아이템 삭제 여부 확인
  463. var itemflag =model.getValue("/root/temp/gridsublist/itemremove");
  464. for(var i = 1; i <grd_gridsublist.rows; i++)
  465. {
  466. rowStatus = grd_gridsublist.rowStatus(i);
  467. if(rowStatus != "0" || itemflag=="Y") {
  468. bModified = true;
  469. break;
  470. }
  471. }
  472. //현재 row 유무 확인
  473. if(grd_gridsublist.rows == grd_gridsublist.fixedRows && itemflag=="Y") {
  474. bModified = true;
  475. }
  476. if(!bModified)
  477. return;
  478. model.copyNode("/root/send/grupdata/grupmaster", grd_gruplist.attribute("nodeset") + "[" + grd_gruplist.row + "]" );
  479. //2009.02.03 강지훈 수정
  480. //변경이력을 남기지 않고 Update.
  481. var ret = messageBox("변경 이력을 저장", "S001");
  482. if(ret == "6"){
  483. model.makeValue("/root/send/grupdata/grupmaster/histsaveyn", "Y");
  484. }
  485. else if(ret == "7"){
  486. model.makeValue("/root/send/grupdata/grupmaster/histsaveyn", "N");
  487. }
  488. else{
  489. return;
  490. }
  491. // 저장후 grupcd로 조회(TRMRF00903)
  492. var grupcd = model.getValue(grd_gruplist.attribute("nodeset") + "[" + grd_gruplist.row + "]/grupcd");
  493. grupcd++;
  494. //삭제된 row의 rowstatus값 clear시킨다
  495. grd_gridsublist.clearstatus();
  496. //var gtype = model.getValue("/root/temp/gridsublist/gridtype");
  497. var curRow = grd_gruplist.row - grd_gruplist.fixedRows + 1;
  498. var grupGridType = model.getValue(grd_gruplist.attribute("nodeset") + "[" + curRow + "]/grupflag");
  499. if(grupGridType == 'X' || grupGridType =='Y'){
  500. //조건 같은값 비교
  501. var nodeList = instance1.selectNodes("root/main/gridsublist[axflag='" + grupGridType + "']");
  502. //현재 row 유무 확인
  503. if(grd_gridsublist.rows == grd_gridsublist.fixedRows ) {
  504. var irow = "0";
  505. }
  506. else {
  507. var subAxFlag = model.getValue("root/main/gridsublist/axflag");
  508. if(grupGridType != subAxFlag)
  509. {
  510. alert("첫번째 축구분값에는 GRID항목과 같은값이 있어야합니다.");
  511. return;
  512. }
  513. if(nodeList.length != 1)
  514. {
  515. alert("누적 그룹의 축구분과 같은 값은 하나만 존재해야합니다.");
  516. return;
  517. }
  518. } // X,Y비교 종료
  519. if(grupGridType =='G'){
  520. for (var i= grd_gridsublist.fixedRows; i < grd_gridsublist.rows ;i++ )
  521. {
  522. var subAXFlag = model.getValue("root/main/gridsublist["+ i +"]/axflag");
  523. if(subAXFlag !='X')
  524. {
  525. alert("X축만 사용가능합니다.");
  526. return;
  527. }
  528. }// G 비교 종료
  529. }
  530. for (var i= grd_gridsublist.fixedRows; i < grd_gridsublist.rows ;i++ )
  531. {
  532. grd_gridsublist.rowstatus(i) = 1;
  533. }
  534. } //end if
  535. //그리드,표 일경우
  536. for (var i= grd_gridsublist.fixedRows; i < grd_gridsublist.rows ;i++ )
  537. {
  538. grd_gridsublist.rowstatus(i) = 1;
  539. }
  540. model.setValue("/root/send/grupdata/savedata", grd_gridsublist.getUpdateData());
  541. //alert( grd_gridsublist.getUpdateData() );
  542. var row = grd_gruplist.row;
  543. if(submit("TXMRF00902")!=true) {
  544. grd_gridsublist.clearstatus();
  545. }
  546. //alert(model.getValue("/root/main/gruplist[" + row + "]/grupnm"));
  547. model.setValue("/root/main/condition/grupflag", model.getValue("/root/main/gruplist["+ row +"]/grupflag"));
  548. model.copyNode("/root/send/reqdata", "/root/main/condition");
  549. model.makeValue("/root/send/reqdata/grupnm",model.getValue("/root/main/gruplist[" + row + "]/grupnm"));
  550. model.makeValue("/root/send/reqdata/grupcd",grupcd);
  551. submit("TRMRF00903");
  552. grd_gruplist.row = 1;
  553. model.setValue("/root/temp/gridsublist/itemremove","N");
  554. }
  555. /**
  556. * @desc : 누적서브리스트의 순서 변경 up / down
  557. * @
  558. * @param : grdObj 그리드ID, direcflag 방향구분(up/down)
  559. * @return :
  560. * @---------------------------------------------------
  561. */
  562. function fChgValueSubSeq(grdObj, direcflag){
  563. var srcRow = grdObj.row - grdObj.fixedRows + 1;
  564. var row = grd_gridsublist.row;
  565. //alert("row->"+row);
  566. if(direcflag == "up"){ //위로
  567. if(srcRow == 1){ //현재 위치가 맨 위일 경우
  568. return;
  569. }
  570. var desRow = srcRow - 1;
  571. grd_gridsublist.row = row-1;
  572. }else if(direcflag == "down"){ //아래로
  573. if(srcRow == grdObj.rows - grdObj.fixedRows){ //현재 위치가 맨 아래일 경우
  574. return;
  575. }
  576. var desRow = srcRow + 1;
  577. grd_gridsublist.row = row+1;
  578. }
  579. // alert("row1111->"+grd_gridsublist.row);
  580. //순서 변경시 값 뿐만 아니라, 그리드 상태값까지 이동한다.
  581. var srcflag = grdObj.rowStatus(srcRow);
  582. var desflag = grdObj.rowStatus(desRow);
  583. model.copyNode("/root/temp/tmp", "/root/main/gridsublist[" + srcRow + "]");
  584. model.copyNode("/root/main/gridsublist[" + srcRow + "]", "/root/main/gridsublist[" + desRow + "]");
  585. model.copyNode("/root/main/gridsublist[" + desRow + "]", "/root/temp/tmp");
  586. model.setValue("/root/temp/gridsublist/statusflag", desflag);
  587. grdObj.rowStatus(desRow) = srcflag;
  588. grdObj.rowStatus(srcRow) = model.getValue("/root/temp/gridsublist/statusflag");
  589. for(var i = 1; i < grdObj.rows; i++){ //다양한 case가 발생하기 때문에 전체를 update하여 순서를 재정렬.
  590. model.setValue("/root/main/gridsublist[" + i + "]/sortno", i);
  591. if(grdObj.rowStatus(i) != 1){ //신규를 제외하고 모두 update
  592. grdObj.rowstatus(i) = 2;
  593. }
  594. }
  595. model.refresh();
  596. }
  597. /**
  598. * @desc :
  599. * @
  600. * @param :
  601. * @return :
  602. * @---------------------------------------------------
  603. */
  604. function fSetCtrlDisabled3(bool){
  605. input4.disabled = bool;
  606. input9.disabled = bool;
  607. input12.disabled = bool;
  608. gridtype.disabled = bool;
  609. input5.disabled = bool;
  610. input8.disabled = bool;
  611. input7.disabled = bool;
  612. combo3.disabled = bool;
  613. }
  614. function fSetCtrlDisabled(bool){
  615. input4.disabled = bool;
  616. input9.disabled = bool;
  617. input12.disabled = bool;
  618. gridtype.disabled = bool;
  619. input5.disabled = bool;
  620. input8.disabled = bool;
  621. input7.disabled = bool;
  622. btn_rgst.disabled = bool;
  623. btn_cncl.disabled = bool;
  624. combo3.disabled = bool;
  625. btn_saveval.disabled = bool;
  626. btn_savevalsub.disabled = bool;
  627. }
  628. /**
  629. * @desc :
  630. * @
  631. * @param :
  632. * @return :
  633. * @---------------------------------------------------
  634. */
  635. function fSetBtnDisabled(statusflag){
  636. if(statusflag == 0){ //누적리스트 조회후
  637. // btn_updtval.disabled = false;
  638. }else if(statusflag == 1){ //누적리스트추가, 수정 후
  639. btn_updtval.disabled = true;
  640. btn_rgst.disabled = false;
  641. btn_cncl.disabled = false;
  642. btn_savevalsub.disabled = true;
  643. btn_saveval.disabled = false;
  644. }else if(statusflag == 2){ //누적리스트 등록
  645. btn_rgst.disabled = true;
  646. btn_cncl.disabled = true;
  647. FORMMNGT_SCR_SAVE_DATA = 1;//화면에 저장할 데이터 있음.
  648. }else if(statusflag == 3){ //누적리스트 취소
  649. btn_rgst.disabled = true;
  650. btn_cncl.disabled = true;
  651. if(FORMMNGT_SCR_SAVE_DATA == 0){ //화면에 저장할 데이터가 없으면
  652. btn_saveval.disabled = true;
  653. }else{
  654. btn_saveval.disabled = false;
  655. }
  656. }else if(statusflag == 4){ //UP, DOWN클릭 후, 아이템그리드 클릭 후
  657. btn_savevalsub.disabled = false;
  658. }else if(statusflag == 5){
  659. }
  660. }
  661. /**
  662. * @desc : 무효 아이템 수정시 valicheck변경
  663. * @
  664. * @param :
  665. * @return :
  666. * @---------------------------------------------------
  667. */
  668. function fValiCheck(){
  669. // 무효 아이템 수정시 valicheck변경
  670. var todt = model.getValue("/root/main/newgrup/gruptodt");
  671. if(getCurrentDate()+getCurrentTime > todt){
  672. model.setValue("/root/main/valicheck","Y");
  673. }
  674. }
  675. /**
  676. * @desc : 무효화된 단위 수정시 gruptodt 새로 넣어준다.
  677. * @
  678. * @param :
  679. * @return :
  680. * @---------------------------------------------------
  681. */
  682. function fUpdateTodt(){
  683. //무효화된 grupcd 수정시 gruptodt 새로 넣어준다.
  684. var valicheck = model.getValue("/root/main/valicheck");
  685. if(valicheck=="Y"){
  686. model.setValue("/root/send/grupdata/grupmaster/gruptodt","29991231000000");
  687. model.setValue("/root/main/valicheck","N");
  688. model.refresh();
  689. }
  690. }
  691. /**
  692. * @desc : gruplist 를 newgrup으로 copy
  693. * @
  694. * @param :
  695. * @return :
  696. * @---------------------------------------------------
  697. */
  698. function fCopyNewGrup(){
  699. model.copyNode("/root/main/newgrup", "/root/main/gruplist[" + iRow + "]");
  700. //유효여부 변경하기
  701. var todt = model.getValue("/root/main/gruplist[" + iRow + "]/gruptodt");
  702. var fromdt = model.getValue("/root/main/gruplist[" + iRow + "]/grupfromdt");
  703. if(fromdt <= getCurrentDate()+getCurrentTime && todt > getCurrentDate()+getCurrentTime ){
  704. model.setValue("/root/temp/valiyn","Y");
  705. } else {
  706. model.setValue("/root/temp/valiyn","N");
  707. }
  708. model.refresh();
  709. fSetCtrlDisabled2(true)
  710. cmb_valiyn.disabled = true;
  711. }
  712. /**
  713. * @desc : gridsublist 를 newitem으로 copy
  714. * @
  715. * @param :
  716. * @return :
  717. * @---------------------------------------------------
  718. */
  719. function fCopyGridSublist(){
  720. model.toggle("gruplist");
  721. var curRow = grd_gridsublist.row - grd_gridsublist.fixedRows + 1;
  722. model.setValue("/root/main/newitem/itemnm" , model.getValue("/root/main/gridsublist[" + curRow + "]/itemnm"));
  723. model.setValue("/root/main/newitem/itemcnts" , model.getValue("/root/main/gridsublist[" + curRow + "]/itemcnts"));
  724. model.setValue("/root/main/newitem/datakind" , model.getValue("/root/main/gridsublist[" + curRow + "]/datakind"));
  725. model.setValue("/root/main/newitem/cntrkind" , model.getValue("/root/main/gridsublist[" + curRow + "]/cntrkind"));
  726. model.setValue("/root/main/newitem/reprtermnm" ,model.getValue("/root/main/gridsublist[" + curRow + "]/reprtermnm"));
  727. model.setValue("/root/main/newitem/rem" , model.getValue("/root/main/gridsublist[" + curRow + "]/itemrem"));
  728. model.setValue("/root/main/newitem/updtresncnts",model.getValue("/root/main/gridsublist[" + curRow + "]/itemupdtresncnts"));
  729. var itemcd = model.getValue("/root/main/gridsublist[" + curRow + "]/itemcd");
  730. model.makeValue("/root/send/reqdata/reqdata", itemcd);
  731. model.makeValue("/root/send/reqdata/reqstatusterm", "Y");
  732. submit("TRMRF00202");
  733. model.refresh();
  734. }
  735. /**
  736. * @desc : 유사어/약어 정보 newitem으로 복사
  737. * @
  738. * @param :
  739. * @return :
  740. * @---------------------------------------------------
  741. */
  742. function fCopyTermlist(){
  743. if(grd_termlist.isCell(event.target)){
  744. iRow = grd_termlist.row;
  745. if(iRow < 1){
  746. return;
  747. }
  748. fSetCtrlitemDisabled(true);
  749. cmb_valiyn.disabled = true;
  750. model.toggle("itemlist");
  751. iRow = grd_termlist.row;
  752. model.setValue("/root/main/newitem/itemnm",model.getValue("/root/main/termlist[" + iRow + "]/termnm"));
  753. model.setValue("/root/main/newitem/itemfromdt",model.getValue("/root/main/termlist[" + iRow + "]/termfromdt"));
  754. model.setValue("/root/main/newitem/itemtodt",model.getValue("/root/main/termlist[" + iRow + "]/termtodt"));
  755. model.setValue("/root/main/newitem/updtresncnts",model.getValue("/root/main/termlist[" + iRow + "]/updtresncnts"));
  756. model.setValue("/root/main/newitem/rem",model.getValue("/root/main/termlist[" + iRow + "]/rem"));
  757. model.setValue("/root/main/newitem/termcd",model.getValue("/root/main/termlist[" + iRow + "]/termcd"));
  758. model.setValue("/root/main/newitem/fstrgstrid",model.getValue("/root/main/termlist[" + iRow + "]/fstrgstrid"));
  759. model.setValue("/root/main/newitem/repryn",model.getValue("/root/main/termlist[" + iRow + "]/repryn"));
  760. var termgubun = model.getValue("/root/main/termlist[" + iRow + "]/repryn");
  761. if (termgubun == "Y") {
  762. chkmaster.visible = false;
  763. } else {
  764. chkmaster.visible= true;
  765. }
  766. if(termgubun =="N") {
  767. model.setValue("/root/main/newitem/repryn","");
  768. }
  769. model.refresh();
  770. fSetCtrlDisabled2(true);
  771. }
  772. }