SMMNE09000.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. /*
  2. 진료과별 의사 당직 관리 (ICU/응급실/병동)(SMMNE09000.xfm - JScript )
  3. - Version :
  4. 1) : Ver.1.00.01
  5. - Create : 2013.06.04
  6. */
  7. //당직스케줄 그리드의 수정상태값
  8. var isEdited = 'N';
  9. //당직 기준시간
  10. var gDStime = '';
  11. var gDEtime = '';
  12. var gD2Stime = '';
  13. var gD2Etime = '';
  14. var gNStime = '';
  15. var gNEtime = '';
  16. //당직표 수정 권한
  17. var gModifyAuth = 'N';
  18. //화면초기화
  19. function fInit(){
  20. var curym = getCurrentDate().substring(0, 6);
  21. var worktitle = curym.substring(0, 4) + '년 ' + curym.substring(4, 6) + '월 당직현황';
  22. cpt_worktitle.text = worktitle;
  23. model.makeValue("/root/cond/srchym", curym);
  24. model.refresh();
  25. model.removenode("/root/send");
  26. model.makeValue("/root/send/srchym", curym);
  27. // 당직 기준 ICU 가져오기
  28. submit("TRMNE09003");
  29. // 당직 기준 시간 가져오기
  30. submit("TRMNE09004");
  31. gDStime = model.getValue("/root/init/dutytime/dstime");
  32. gDEtime = model.getValue("/root/init/dutytime/detime");
  33. gD2Stime = model.getValue("/root/init/dutytime/d2stime");
  34. gD2Etime = model.getValue("/root/init/dutytime/d2etime");
  35. gNStime = model.getValue("/root/init/dutytime/nstime");
  36. gNEtime = model.getValue("/root/init/dutytime/netime");
  37. var sDStime = model.getValue("/root/init/dutytime/dstimenm");
  38. var sDEtime = model.getValue("/root/init/dutytime/detimenm");
  39. var sD2Stime = model.getValue("/root/init/dutytime/d2stimenm");
  40. var sD2Etime = model.getValue("/root/init/dutytime/d2etimenm");
  41. var sNStime = model.getValue("/root/init/dutytime/nstimenm");
  42. var sNEtime = model.getValue("/root/init/dutytime/netimenm");
  43. cap_worktime.text = "※ 근무시간: DAY - " + sDStime + " ~ " + sDEtime + ", DAY2 - " + sD2Stime + " ~ " + sD2Etime + ", NIGHT - " + sNStime + " ~ " + sNEtime;
  44. //당직표 수정 가능 부서를 제외하고는 저장 기능을 제한한다.
  45. var nodeList = instance1.selectNodes("root/init/icuinfo/moddeptlist[deptcd ="+ getUserInfo("dutplcecd") +"]");
  46. if( nodeList.length > 0) {
  47. //수정가능
  48. btn_save.disabled = false;
  49. gModifyAuth = 'Y';
  50. } else {
  51. //수정불가능
  52. btn_save.disabled = true;
  53. gModifyAuth = 'N';
  54. }
  55. var sInstcd = getUserInfo("dutplceinstcd");
  56. if(sInstcd = "031") {
  57. btn_info.visible = true;
  58. } else {
  59. btn_info.visible = false;
  60. }
  61. }
  62. //당직대상자리스트를 조회한다
  63. function fGetWorkScheduleList(){
  64. var srchym = model.getValue("/root/cond/srchym");
  65. //var icutype = model.getValue("/root/cond/icutype");
  66. var gbn = model.getValue("/root/cond/gbn");
  67. var icucd = model.getValue("/root/cond/icucd").substr(0, 10);
  68. var csflag = model.getValue("/root/cond/icucd").substr(10, 1);
  69. /*
  70. //당직 기준 진료과 가져오기
  71. model.makeValue("/root/send/srchym", srchym);
  72. model.makeValue("/root/send/gbn", gbn);
  73. model.makeValue("/root/send/icucd", icucd);
  74. model.makeValue("/root/send/csflag", csflag);
  75. submit("TRMNE05401");
  76. model.removenode("/root/main/drinfo");*/
  77. var worktitle = srchym.substring(0, 4) + '년 ' + srchym.substring(4, 6) + '월 당직현황';
  78. cpt_worktitle.text = worktitle;
  79. cpt_worktitle.refresh();
  80. model.removenode("/root/send");
  81. model.makeValue("/root/send/srchym", srchym);
  82. model.makeValue("/root/send/gbn", gbn);
  83. model.makeValue("/root/send/icucd", icucd);
  84. model.makeValue("/root/send/csflag", csflag);
  85. model.makeValue("/root/send/monthcnt", getDayCountForMonth(srchym.substring(0, 4), srchym.substring(4, 6))); //조회년월의 마지막일
  86. var rslt = "";
  87. rslt = submit("TRMNE09001");
  88. if( rslt ){
  89. //글로벌변수 초기화
  90. isEdited = 'N';
  91. //당직대상자의 선택제거
  92. grd_drlist.row = 0;
  93. //당직리스트의 선택제거
  94. grd_workerlist.row = 0;
  95. //당직리스트색깔 초기화
  96. for(var i = 2; i <= grd_workerlist.rows; i++){
  97. grd_workerlist.cellstyle("background-color", i, 0, i, 7) = '#ffffff';
  98. grd_workerlist.cellStyle("background-image", i, 0, i, 7) = '';
  99. }
  100. }
  101. }
  102. //그리드가 변경상태인지 조회한다.
  103. function isScheduleRefresh(isClose){
  104. var gbn = model.getValue("/root/cond/gbn");
  105. var drStr;
  106. for(var i = 1 ; i < grd_workerlist.rows; i++){
  107. if(instance1.selectSingleNode("/root/orgscheinfo/workinfo/workerinfolist[" + i + "]") != null){
  108. if(instance1.selectSingleNode("/root/orgscheinfo/workinfo/workerinfolist[" + i + "]").xml
  109. != instance1.selectSingleNode("/root/main/workerinfo/workerinfolist[" + i + "]").xml){
  110. isEdited = 'Y';
  111. drStr += model.getValue('/root/main/workerinfo/workerinfolist[' + i + ']/workdd') + '일자 변경';
  112. break;
  113. }
  114. }
  115. }
  116. if(isEdited == 'Y'){
  117. //20090703 dhkim 창을 닫을때와 새로 조회할때의 메세지를 다르게 구성 Q003(계속진행하시겠습니까?)
  118. if(isClose){
  119. var saveYn = messageBox('수정하신 스케줄을 저장하지 않고 창을 닫으시겠습니까?', 'Q');//Q: 6:예, 7:아니오.
  120. } else{
  121. var saveYn = messageBox('수정하신 스케줄을 저장하지 않고 새로운 내역을', 'Q005');//Q005:조회하시겠습니까? 6:예, 7:아니오.
  122. }
  123. if(saveYn == 6){
  124. return 'Y';
  125. } else{
  126. return 'N';
  127. }
  128. }
  129. }
  130. function fGetDrInfo() {
  131. var orddeptcd = model.getValue("/root/cond/orddeptcd");
  132. if (orddeptcd == "" || orddeptcd == null) {
  133. messageBox("선택된 진료과가 없습니다.", "E999");
  134. return false;
  135. }
  136. model.makeNode("/root/main/drinfo");
  137. model.removenode('/root/send');
  138. model.makeValue('/root/send/drinfo/orddeptcd', orddeptcd);
  139. model.makeValue('/root/send/drinfo/srchym', model.getValue('/root/cond/srchym'));
  140. model.makeValue('/root/send/drinfo/gbn', model.getValue('/root/cond/gbn'));
  141. if(!submit("TRMNE05402")){
  142. messageBox("진료과별 당직대상자 조회를 실패하였습니다.", "E999");
  143. return false;
  144. }
  145. for(var i = 1; i <= grd_drlist.rows; i++){
  146. if (i > 1) {
  147. j = i - 1;
  148. oldposcd = model.getValue("/root/main/drinfo/drinfolist[" + j + "]/jobposcd");
  149. newposcd = model.getValue("/root/main/drinfo/drinfolist[" + i + "]/jobposcd");
  150. if (oldposcd != newposcd) {
  151. grd_drlist.cellstyle("border-bottom-color", j, 0, j, 4) = '#ff0000';
  152. } else {
  153. grd_drlist.cellstyle("border-bottom-color", j, 0, j, 4) = '#C0C0C0';
  154. }
  155. }
  156. }
  157. }
  158. /**
  159. * @desc : 이전 년버튼 클릭시 - 전년도+월로 세팅
  160. * @
  161. * @param :
  162. * @return :
  163. * @author : dhkim 20090610
  164. * @---------------------------------------------------
  165. */
  166. function fClkBfYear(srchym){
  167. var yyear = srchym.substring(0, 4);
  168. var mmont = srchym.substring(4, 6);
  169. yyear--;
  170. srchym = yyear + mmont;
  171. model.setValue('/root/cond/srchym', srchym);
  172. model.refresh();
  173. btn_search.dispatch('DOMActivate');
  174. }
  175. /**
  176. * @desc : 다음 년버튼 클릭시 - 다음년도+월로 세팅
  177. * @
  178. * @param :
  179. * @return :
  180. * @author : dhkim 20090610
  181. * @---------------------------------------------------
  182. */
  183. function fClkAfYear(srchym){
  184. var yyear = srchym.substring(0, 4);
  185. var mmont = srchym.substring(4, 6);
  186. yyear++;
  187. srchym = yyear + mmont;
  188. model.setValue('/root/cond/srchym', srchym);
  189. model.refresh();
  190. btn_search.dispatch('DOMActivate');
  191. }
  192. /**
  193. * @desc : 이전 달버튼 클릭시 - 년도+전월 세팅
  194. * @
  195. * @param :
  196. * @return :
  197. * @author : dhkim 20090610
  198. * @---------------------------------------------------
  199. */
  200. function fClkBfMonth(srchym){
  201. var yyear = srchym.substring(0, 4);
  202. var mmont = srchym.substring(4, 6);
  203. mmont = mmont.toDate('MM').getAddDate(-1, "M").getDateFormat('MM');
  204. if(mmont == '12'){
  205. yyear--;
  206. }
  207. srchym = yyear + mmont;
  208. model.setValue('/root/cond/srchym', srchym);
  209. model.refresh();
  210. btn_search.dispatch('DOMActivate');
  211. }
  212. /**
  213. * @desc : 다음 달버튼 클릭시 - 년도+다음월 세팅
  214. * @
  215. * @param :
  216. * @return :
  217. * @author : dhkim 20090610
  218. * @---------------------------------------------------
  219. */
  220. function fClkAfMonth(srchym){
  221. var yyear = srchym.substring(0, 4);
  222. var mmont = srchym.substring(4, 6);
  223. mmont = mmont.toDate('MM').getAddDate(+1, "M").getDateFormat('MM');
  224. if(mmont == '01'){
  225. yyear++;
  226. }
  227. srchym = yyear + mmont;
  228. model.setValue('/root/cond/srchym', srchym);
  229. model.refresh();
  230. btn_search.dispatch('DOMActivate');
  231. }
  232. //셀색상을 선택색으로 변경되지 않도록 원래색상으로 유지한다
  233. function fSetCellColor(clickRow, clickCol, clickColNm){
  234. var curColor = grd_workerlist.cellstyle("background-color", clickRow, clickCol, clickRow, clickCol);
  235. grd_workerlist.cellstyle("background-color", clickRow, clickCol, clickRow, clickCol) = curColor;
  236. }
  237. /**
  238. * @group :
  239. * @ver : 2009.06.11
  240. * @by : dhkim
  241. * @---------------------------------------------------
  242. * @type : function
  243. * @access : public
  244. * @desc : 당직대상자 마우스 오른쪽메뉴 mouse down
  245. * @param :
  246. * @return :
  247. * @---------------------------------------------------
  248. */
  249. function fMouseDownGridRow(){
  250. var rows = grd_workerlist.rows;
  251. var row = grd_workerlist.mouseRow-1;
  252. var col = grd_workerlist.mouseCol;
  253. if(row + 1 <= rows && rows > 2 && row > 0){
  254. if(event.button == 3){
  255. window.setPopupMenu(true, "/root/init/menu/item", "name", "func", false);
  256. }
  257. }else{
  258. window.setPopupMenu(false);
  259. }
  260. }
  261. function fSetWorkDr(setFlag){
  262. //선택된 당직대상자정보(id, nm)
  263. var drid = model.getValue('/root/main/drinfo/drinfolist[' + grd_drlist.row + ']/drid');
  264. var drnm = model.getValue('/root/main/drinfo/drinfolist[' + grd_drlist.row + ']/drnm');
  265. var orddeptcd = model.getValue('/root/main/drinfo/drinfolist[' + grd_drlist.row + ']/orddeptcd');
  266. var nzone = model.getValue('/root/main/drinfo/drinfolist[' + grd_drlist.row + ']/nzone');
  267. var hpno = model.getValue('/root/main/drinfo/drinfolist[' + grd_drlist.row + ']/hpno');
  268. var gbn = model.getValue('/root/cond/gbn');
  269. var csflag = model.getValue("/root/cond/icucd").substr(10, 1);
  270. if (drid == "" || drid == null) {
  271. messageBox("의사를 선택하세요", 'E999');
  272. return false;
  273. }
  274. //현재날짜+시간(yyyymmddhhss)
  275. var currentDD = getCurrentDateTime().replace(" ", "").substring(0, 8);
  276. var currentTM = getCurrentTime().substr(0, 4);
  277. var errYn = 'N'; //과거일자 선택여부
  278. var cells = grd_workerlist.selectedCells; //선택된 쎌의 배열
  279. var sRow, sCol, sColNm; //선택된 쎌의 row, col 값, 선택된 col의 필드명
  280. var selectedDD; //선택된일자
  281. for(var i = 0; i < cells.length; i++){
  282. sRowI = cells.item(i).row - 1;
  283. sRow = cells.item(i).row;
  284. sCol = cells.item(i).col;
  285. sColNm = grd_workerlist.colAttribute(sCol, "ref");
  286. seleDD = model.getValue('/root/main/workerinfo/workerinfolist[' + sRowI + ']/workdd');
  287. selGbn = model.getValue('/root/main/workerinfo/workerinfolist[' + sRowI + ']/gbn');
  288. selPlc = model.getValue('/root/main/workerinfo/workerinfolist[' + sRowI + ']/placecd');
  289. //현재일자보다 이전일자의 스케줄을 변경하지 못하게 blocking한다.(20140926 이윤주 처리예정)
  290. if (gModifyAuth != "Y" && seleDD < currentDD){
  291. errYn = 'Y';
  292. } else if (gModifyAuth != "Y" && seleDD == currentDD && currentTM > gNStime) {
  293. errYn = 'Y';
  294. } else if (gModifyAuth != "Y" && seleDD == currentDD && currentTM > gDStime && currentTM < gNStime && sColNm == "drnm_d") {
  295. errYn = 'Y';
  296. } else{
  297. if(sCol != 0){//일자셀 선택의 경우는 변경하지 않음
  298. //의사추가의경우
  299. if(setFlag == 'ADD'){
  300. //점검로직 추가
  301. if (fCheckValid(seleDD, selGbn, selPlc, sColNm, drid)) {
  302. //선택된 셀에 의사이름 세팅
  303. if (sColNm == "drnm_d") { //선택된 셀에 진료과 정보 세팅
  304. if (csflag == "" || csflag == null) {
  305. model.makeValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/ddeptcd', orddeptcd);
  306. }
  307. model.setValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/drnm_d', drnm);
  308. model.setValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/drid_d', drid);
  309. } else if (sColNm == "drnm_d2") { //선택된 셀에 진료과 정보 세팅
  310. if (csflag == "" || csflag == null) {
  311. model.makeValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/d2deptcd', orddeptcd);
  312. }
  313. model.setValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/drnm_d2', drnm);
  314. model.setValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/drid_d2', drid);
  315. } else if (sColNm == "drnm_n") { //선택된 셀에 진료과 정보 세팅
  316. if (csflag == "" || csflag == null) {
  317. model.makeValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/ndeptcd', orddeptcd);
  318. }
  319. model.setValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/drnm_n', drnm);
  320. model.setValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/drid_n', drid);
  321. }
  322. grd_workerlist.rowStatus(sRow) = "2";
  323. //선택된 쎌 색상 변경
  324. grd_workerlist.cellStyle('background-color', sRow, sCol) = "#F4A6EE";
  325. //지우개 이미지 삭제
  326. grd_workerlist.cellStyle("background-image", sRow, sCol) = '';
  327. }
  328. } else{ //의사삭제의경우
  329. //셀에 데이터가 세팅되어 있는경우만 삭제되게
  330. var drnm = model.getValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/' + sColNm);
  331. if(drnm != ''){
  332. //선택된 쎌에 의사이름 쎄팅
  333. model.setValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/drid' + sColNm.substring(4), '-');
  334. //선택된 쎌에 삭제 이미지 세팅
  335. grd_workerlist.cellStyle("background-image", sRow, sCol) = '../../../com/commonweb/images/icon_eraser.gif';
  336. grd_workerlist.cellStyle("background-position", sRow, sCol) = 'center';
  337. //배경색을 흰색으로 초기화
  338. grd_workerlist.cellStyle('background-color', sRow, sCol) = "#ffffff";
  339. }
  340. }
  341. }
  342. }
  343. }
  344. //과거일자만 빼고 나머지 일자는 변경가능하도록 한다
  345. if(errYn == 'Y'){
  346. messageBox('과거일자의 스케줄은 변경하실 수 없습니다.', 'E999');
  347. return false;
  348. }
  349. }
  350. function fSaveWorkDr(){
  351. model.removeNodeset("/root/send");
  352. var orddeptcd = model.getValue("/root/main/workerinfo/workerinfolist[1]/orddeptcd");
  353. var srchym = model.getValue("/root/cond/srchym");
  354. var gbn = model.getValue("/root/cond/gbn");
  355. var icucd = model.getValue("/root/cond/icucd").substr(0, 10);
  356. var csflag = model.getValue("/root/cond/icucd").substr(10, 1);
  357. var drid = "";
  358. var duty = "";
  359. sHeader = "gbn▦workdd▦duty▦drid▦orddeptcd▦placecd▦csflag▦fromtm▦totm▦bigo▩";
  360. sData = "";
  361. for(i = grd_workerlist.fixedRows; i < grd_workerlist.rows; i++) {
  362. duty = 'D';
  363. drid = grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("drid_d"));
  364. if (drid == null || drid == "") {
  365. drid = '-';
  366. }
  367. sData += grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("gbn")) + "▦"
  368. + grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("workdd")) + "▦"
  369. + duty + "▦"
  370. + drid + "▦"
  371. + grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("ddeptcd")) + "▦"
  372. + grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("placecd")) + "▦"
  373. + csflag + "▦"
  374. + gDStime + "▦"
  375. + gDEtime + "▦"
  376. + grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("bigo")) + "▩" ;
  377. }
  378. for(i = grd_workerlist.fixedRows; i < grd_workerlist.rows; i++) {
  379. duty = 'D2';
  380. drid = grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("drid_d2"));
  381. if (drid == null || drid == "") {
  382. drid = '-';
  383. }
  384. sData += grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("gbn")) + "▦"
  385. + grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("workdd")) + "▦"
  386. + duty + "▦"
  387. + drid + "▦"
  388. + grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("d2deptcd")) + "▦"
  389. + grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("placecd")) + "▦"
  390. + csflag + "▦"
  391. + gD2Stime + "▦"
  392. + gD2Etime + "▦"
  393. + grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("bigo")) + "▩" ;
  394. }
  395. for(i = grd_workerlist.fixedRows; i < grd_workerlist.rows; i++) {
  396. duty = 'N';
  397. drid = grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("drid_n"));
  398. if (drid == null || drid == "") {
  399. drid = '-';
  400. }
  401. sData += grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("gbn")) + "▦"
  402. + grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("workdd")) + "▦"
  403. + duty + "▦"
  404. + drid + "▦"
  405. + grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("ndeptcd")) + "▦"
  406. + grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("placecd")) + "▦"
  407. + csflag + "▦"
  408. + gNStime + "▦"
  409. + gNEtime + "▦"
  410. + grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("bigo")) + "▩" ;
  411. }
  412. model.makeValue("/root/send/workerlist", sHeader + sData);
  413. model.makeValue("/root/send/saveinfo/srchym", srchym);
  414. model.makeValue("/root/send/saveinfo/gbn", gbn);
  415. model.makeValue("/root/send/saveinfo/monthcnt", getDayCountForMonth(srchym.substring(0, 4), srchym.substring(4, 6)));//조회년월의 마지막일
  416. model.makeValue("/root/send/saveinfo/icucd", icucd);
  417. model.makeValue("/root/send/saveinfo/csflag", csflag);
  418. if(submit("TXMNE09001")){
  419. //당직리스트색깔 초기화
  420. for(var i = 2; i <= grd_workerlist.rows; i++){
  421. grd_workerlist.cellstyle("background-color", i, 0, i, 6) = '#ffffff';
  422. grd_workerlist.cellStyle("background-image", i, 0, i, 6) = '';
  423. }
  424. //btn_search.dispatch('DOMActivate');
  425. }
  426. }
  427. function fDelWorkDr(workdd, gbn, orddeptcd, placecd, duty) {
  428. model.makeValue("/root/send/deldata/workdd", workdd);
  429. model.makeValue("/root/send/deldata/gbn", gbn);
  430. model.makeValue("/root/send/deldata/orddeptcd", orddeptcd);
  431. model.makeValue("/root/send/deldata/placecd", placecd);
  432. model.makeValue("/root/send/deldata/duty", duty);
  433. if(submit("TXMNE09002")){
  434. btn_search.dispatch('DOMActivate');
  435. }
  436. }
  437. function fCheckValid(selDD, selGbn, selPlc, sColNm, drid) {
  438. //1. 그리드 상에 동일일자에 다른 위치에 세팅된 정보가 있는지
  439. var compDD = "";
  440. var compGbn = "";
  441. var compPlc = "";
  442. for(var i = 1; i < grd_workerlist.rows; i++) {
  443. compDD = grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("workdd"));
  444. compGbn = grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("gbn"));
  445. compPlc = grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("placecd"));
  446. if (sColNm == "drnm_d") {
  447. compDr = grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("drid_d"));
  448. }
  449. else if (sColNm == "drnm_d2") {
  450. compDr = grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("drid_d2"));
  451. }
  452. else {
  453. compDr = grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("drid_n"));
  454. }
  455. if (compDD == selDD && compDr == drid) {
  456. if (compGbn == "I") {
  457. if (compPlc != selPlc) {
  458. return false;
  459. }
  460. } else {
  461. if (compGbn != selGbn) {
  462. return false;
  463. }
  464. }
  465. }
  466. }
  467. //2. 저장된 내역 중 동일일자에 다른 위치에 등록된 정보가 있는지, 휴진내역이 있는지 점검
  468. var selDuty = sColNm.substr(5, 2).toUpperCase();
  469. selDuty = selDuty.getTrim();
  470. var fromdt, todt;
  471. model.removenodeset("/root/send/validinfo");
  472. model.makeValue("/root/send/validinfo/workdd", selDD);
  473. model.makeValue("/root/send/validinfo/gbn", selGbn);
  474. model.makeValue("/root/send/validinfo/placecd", selPlc);
  475. model.makeValue("/root/send/validinfo/duty", selDuty);
  476. model.makeValue("/root/send/validinfo/drid", drid);
  477. if (sColNm == "drnm_d") {
  478. fromtm = gDStime;
  479. totm = gDEtime;
  480. }
  481. else if (sColNm == "drnm_d2") {
  482. fromtm = gD2Stime;
  483. totm = gD2Etime;
  484. }
  485. else {
  486. fromtm = gNStime;
  487. totm = gNEtime;
  488. }
  489. model.makeValue("/root/send/validinfo/fromtm", fromtm);
  490. model.makeValue("/root/send/validinfo/totm", totm);
  491. submit("TRMNE09002");
  492. var sValidYn = model.getValue("/root/temp/validinfo/validyn");
  493. var sScheYn = model.getValue("/root/temp/validinfo/scheyn");
  494. var sHoliYn = model.getValue("/root/temp/validinfo/holiyn");
  495. if (sValidYn == "N") {
  496. if (sScheYn == "Y" && sHoliYn == "N") {
  497. messageBox("같은 일자에 등록된 당직 정보가 있습니다.", "E999");
  498. }
  499. if (sScheYn == "N" && sHoliYn == "Y") {
  500. messageBox("해당 일자에 등록된 휴진 정보가 있습니다.", "E999");
  501. }
  502. if (sScheYn == "Y" && sHoliYn == "Y") {
  503. messageBox("같은 일자에 등록된 당직정보와 해당 일자에 등록된 휴진 정보가 있습니다.", "E999");
  504. }
  505. return false;
  506. }
  507. // 과거일자 당직의 변경시 처방 유무 점검(20140926 이윤주 수정예정)
  508. var curDD = getCurrentDate();
  509. var curTM = getCurrentTime().substr(0, 4);
  510. var checkYn = "";
  511. if (selDD < curDD) {
  512. checkYn = 'Y';
  513. } else if (selDD == curDD) {
  514. if (curTM > gNStime) {
  515. checkYn = 'Y';
  516. } else if (curTM > gDStime && curTM < gNStime) {
  517. if (selDuty == 'N') {
  518. checkYn = 'N';
  519. } else {
  520. checkYn = 'Y';
  521. }
  522. } else {
  523. checkYn = 'N';
  524. }
  525. } else {
  526. checkYn = 'N';
  527. }
  528. //alert("selDD: " + selDD + ", curDD: " + curDD + ", selDuty: " + selDuty + ", curTM: " + curTM + ", gDStime: " + gDStime + ", gNStime: " + gNStime + ", checkYn: " + checkYn);
  529. if (checkYn == 'Y') {
  530. model.removenodeset("/root/send/validinfo");
  531. model.makeValue("/root/send/validinfo/workdd", selDD);
  532. model.makeValue("/root/send/validinfo/placecd", selPlc);
  533. model.makeValue("/root/send/validinfo/duty", selDuty);
  534. model.makeValue("/root/send/validinfo/drid", drid);
  535. if (sColNm == "drnm_d") {
  536. fromtm = gDStime;
  537. totm = gDEtime;
  538. } else if (sColNm == "drnm_d2") {
  539. fromtm = gD2Stime;
  540. totm = gD2Etime;
  541. } else {
  542. fromtm = gNStime;
  543. totm = gNEtime;
  544. }
  545. model.makeValue("/root/send/validinfo/fromtm", fromtm);
  546. model.makeValue("/root/send/validinfo/totm", totm);
  547. submit("TRMNE09007");
  548. var sPrcpCnt = model.getValue("/root/temp/prcpinfo/cnt");
  549. if (sPrcpCnt > 0) {
  550. if( "6" != messageBox("해당 일자에 타부서에 발행된 처방이 있습니다.\n계속 진행 하시겠습니까?", "Q999")) {
  551. return false;
  552. }
  553. }
  554. }
  555. return true;
  556. }