SPPMB01002_병원달력.xrw 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. <?xml version="1.0" encoding="EUC-KR"?>
  2. <?xml-stylesheet href="../../../com/commonweb/css/common.css" type="text/css" ?>
  3. <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2002/01/xforms" xmlns:ev="http://www.w3.org/2001/xml-events">
  4. <xhtml:head>
  5. <xhtml:title>병원달력</xhtml:title>
  6. <model id="model1">
  7. <instance id="instance1">
  8. <root xmlns="">
  9. <hidden>
  10. <calendar>
  11. <year/>
  12. <month/>
  13. <weeklist>
  14. <list>
  15. <sun/>
  16. <mon/>
  17. <tue/>
  18. <wed/>
  19. <thu/>
  20. <fri/>
  21. <sat/>
  22. <sun_memo/>
  23. <mon_memo/>
  24. <tue_memo/>
  25. <wed_memo/>
  26. <thu_memo/>
  27. <fri_memo/>
  28. <sat_memo/>
  29. </list>
  30. </weeklist>
  31. </calendar>
  32. </hidden>
  33. </root>
  34. </instance>
  35. <submission id="TRPMB01001" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/send" resultref="/root/hidden/calendarinfo"/>
  36. <script type="javascript" ev:event="xforms-ready">
  37. <![CDATA[
  38. initCalendar();
  39. //2008-10-04 이동식 추가
  40. fChangeButtonColor();
  41. //END..
  42. ]]>
  43. </script>
  44. </model>
  45. <script type="javascript" src="../../../com/commonweb/js/common.js"/>
  46. <script type="javascript" src="../../../com/commonweb/js/tfHelper.js"/>
  47. <script type="javascript" src="../../../com/commonweb/js/dateHelper.js"/>
  48. <script type="javascript">
  49. <![CDATA[
  50. var beforeId = "";
  51. //2007-10-04 이동식 추가
  52. function fChangeButtonColor(){
  53. var curMonth = model.getValue("/root/hidden/calendar/month");
  54. //alert( curMonth );
  55. switch( curMonth ){
  56. case '01' : //button1.attribute("class") = "btn5_letter2";
  57. btn_jan.disabled = true;
  58. beforeId = 'btn_jan';
  59. break;
  60. case '02' : //button2.attribute("class") = "btn5_letter2";
  61. btn_feb.disabled = true;
  62. beforeId = 'btn_feb';
  63. break;
  64. case '03' : //button3.attribute("class") = "btn5_letter2";
  65. btn_mar.disabled = true;
  66. beforeId = 'btn_mar';
  67. break;
  68. case '04' : //button4.attribute("class") = "btn5_letter2";
  69. btn_apr.disabled = true;
  70. beforeId = 'btn_apr';
  71. break;
  72. case '05' : //button5.attribute("class") = "btn5_letter2";
  73. btn_may.disabled = true;
  74. beforeId = 'btn_may';
  75. break;
  76. case '06' : //button6.attribute("class") = "btn5_letter2";
  77. btn_jun.disabled = true;
  78. beforeId = 'btn_jun';
  79. break;
  80. case '07' : //button7.attribute("class") = "btn5_letter2";
  81. btn_jul.disabled = true;
  82. beforeId = 'btn_jul';
  83. break;
  84. case '08' : //button8.attribute("class") = "btn5_letter2";
  85. btn_aug.disabled = true;
  86. beforeId = 'btn_aug';
  87. break;
  88. case '09' : //button9.attribute("class") = "btn5_letter2";
  89. btn_sep.disabled = true;
  90. beforeId = 'btn_sep';
  91. break;
  92. case '10' : //button10.attribute("class") = "btn5_letter2";
  93. btn_oct.disabled = true;
  94. beforeId = 'btn_oct';
  95. break;
  96. case '11' : //button11.attribute("class") = "btn5_letter2";
  97. btn_nov.disabled = true;
  98. beforeId = 'btn_nov';
  99. break;
  100. case '12' : //button12.attribute("class") = "btn5_letter2";
  101. btn_dec.disabled = true;
  102. beforeId = 'btn_dec';
  103. break;
  104. }
  105. }
  106. function initCalendar() {
  107. if( model.getValue("/root/hidden/calendar/year") == "" || model.getValue("/root/hidden/calendar/month") == "" ){
  108. var curDate = getCurrentDate().toDate();
  109. model.setValue("/root/hidden/calendar/year", curDate.getDateFormat('YYYY'));
  110. model.setValue("/root/hidden/calendar/month", curDate.getDateFormat('MM'));
  111. model.refresh();
  112. setCalendar(curDate);
  113. }
  114. }
  115. function fGetHospitalCalendar(){
  116. var dd = (model.getValue("/root/hidden/calendar/year")).concat(model.getValue("/root/hidden/calendar/month"));
  117. model.makeNode("/root/send/date");
  118. model.setValue("/root/send/date",dd);
  119. if (submit("TRPMB01001") == true) return true;
  120. else return false;
  121. }
  122. function setCalendar(dateObj) {
  123. //서버로 자료 요청
  124. if ( fGetHospitalCalendar() != true ){
  125. messageBox("병원일정 데이터를 가져올 수", "I004");
  126. }
  127. // 그리드 초기화
  128. model.removeNodeset("/root/hidden/calendar/weeklist/list");
  129. //grd_calendar.rebuild()
  130. dateObj.setDate(1);
  131. var startDay = dateObj.getDay();
  132. var days = dateObj.getMonthDay();
  133. var rows = Math.ceil( ( startDay + days ) / 7 );
  134. for( var i = 0; i < rows; i++ )
  135. grd_calendar.addRow(false);
  136. grd_calendar.rebuild();
  137. grd_calendar.rebuildStyle();
  138. var rowIndex = grd_calendar.fixedRows;
  139. var colIndex = startDay;
  140. var dutflag = '';
  141. for( var i = 1; i <= days; i++ ) {
  142. //write date
  143. grd_calendar.valueMatrix(rowIndex, colIndex) = i;
  144. grd_calendar.cellStyle("font-weight", rowIndex, colIndex) = "bold";
  145. //write memo
  146. grd_calendar.valueMatrix(rowIndex , colIndex + 7) = fGetCalendarMemo( i );
  147. dutflag = model.getValue("/root/hidden/calendarinfo/calendarinfolist[" + i +"]/dutflag");
  148. if( dutflag == '8' ){ //'0' 평일, '4' 토요일, '8' 휴일
  149. fSetTextColor(rowIndex, colIndex, '#ff0000');
  150. }
  151. colIndex++;
  152. if( colIndex == 7 ) {
  153. colIndex = 0;
  154. rowIndex++;
  155. }
  156. }
  157. grd_calendar.resizeCells();
  158. }
  159. function setCalendar2(dateObj) {
  160. // 그리드 초기화
  161. model.removeNodeset("/root/hidden/calendar/weeklist/list");
  162. //grd_calendar.rebuild()
  163. dateObj.setDate(1);
  164. var startDay = dateObj.getDay();
  165. var days = dateObj.getMonthDay();
  166. var rows = Math.ceil( ( startDay + days ) / 7 );
  167. for( var i = 0; i < rows; i++ )
  168. grd_calendar.addRow(false);
  169. grd_calendar.rebuild();
  170. grd_calendar.rebuildStyle();
  171. var rowIndex = grd_calendar.fixedRows;
  172. var colIndex = startDay;
  173. var ampmflag = '';
  174. var dutflag = '';
  175. for( var i = 1; i <= days; i++ ) {
  176. //write date
  177. grd_calendar.valueMatrix(rowIndex, colIndex) = i;
  178. grd_calendar.cellStyle("font-weight", rowIndex, colIndex) = "bold";
  179. //write memo
  180. grd_calendar.valueMatrix(rowIndex , colIndex + 7) = fGetCalendarMemo( i );
  181. ampmflag = model.getValue("/root/hidden/calendarinfo/calendarinfolist[" + i +"]/ampmflag");
  182. dutflag = model.getValue("/root/hidden/calendarinfo/calendarinfolist[" + i +"]/dutflag");
  183. if( ampmflag == '1' ){
  184. fSetBGColor(rowIndex, colIndex, '#ffff99');
  185. }else if( ampmflag == '10' ){
  186. fSetBGColor(rowIndex, colIndex, '#ccffff');
  187. }else if( ampmflag == '100' ) {
  188. fSetBGColor(rowIndex, colIndex, '#ff99cc');
  189. }else if( ampmflag == '11' || ampmflag == '110' || ampmflag == '101' || ampmflag == '111' ){
  190. fSetBGColor(rowIndex, colIndex, '#ffcc99');
  191. }
  192. if( dutflag == '8' ){
  193. fSetTextColor(rowIndex, colIndex, '#ff0000');
  194. }
  195. colIndex++;
  196. if( colIndex == 7 ) {
  197. colIndex = 0;
  198. rowIndex++;
  199. }
  200. }
  201. grd_calendar.resizeCells();
  202. }
  203. //그리드의 배경색상을 변경한다.
  204. function fSetBGColor(calRow, calCol, bgColor) {
  205. //var calRow = gridObj.row;
  206. //var calCol = gridObj.col;
  207. if( calCol < 7 ){
  208. //calCol = calCol + 7;
  209. grd_calendar.cellStyle("background-color", calRow, calCol) = bgColor;
  210. grd_calendar.cellStyle("background-color", calRow, calCol + 7) = bgColor;
  211. }else{
  212. //calCol = calCol - 7;
  213. grd_calendar.cellStyle("background-color", calRow, calCol) = bgColor;
  214. grd_calendar.cellStyle("background-color", calRow, calCol - 7) = bgColor;
  215. }
  216. //grd_calendar.rebuildStyle();
  217. //grd_calendar.cellStyle("background-color", calRow, calCol) = bgColor;
  218. }
  219. //그리드의 폰트 색상을 변경한다.
  220. function fSetTextColor(calRow, calCol, bgColor) {
  221. if( calCol < 7 ){
  222. //calCol = calCol + 7;
  223. grd_calendar.cellStyle("color", calRow, calCol) = bgColor;
  224. grd_calendar.cellStyle("color", calRow, calCol + 7) = bgColor;
  225. }else{
  226. //calCol = calCol - 7;
  227. grd_calendar.cellStyle("color", calRow, calCol) = bgColor;
  228. grd_calendar.cellStyle("color", calRow, calCol - 7) = bgColor;
  229. }
  230. //grd_calendar.rebuildStyle();
  231. }
  232. function setCellColor(calRow, calCol) {
  233. //var calRow = grdObj.row;
  234. //var calCol = grdObj.col;
  235. var isMonth = model.getValue("/root/hidden/calendar/month");
  236. var isYear = model.getValue("/root/hidden/calendar/year");
  237. var isDate = (isYear+isMonth+1).toDate();
  238. setCalendar2(isDate);
  239. if( calCol < 7 ){
  240. //calCol = calCol + 7;
  241. grd_calendar.cellStyle("background-color", calRow, calCol) = "#daa7d9";
  242. grd_calendar.cellStyle("background-color", calRow, calCol + 7) = "#daa7d9";
  243. }else{
  244. //calCol = calCol - 7;
  245. grd_calendar.cellStyle("background-color", calRow, calCol) = "#daa7d9";
  246. grd_calendar.cellStyle("background-color", calRow, calCol - 7) = "#daa7d9";
  247. }
  248. //gridObj.rebuildStyle();
  249. //gridObj.cellStyle("background-color", calRow, calCol) = "#daa7d9";
  250. }
  251. //해당 일자의 병원 일정 정보를 얻어 온다
  252. function fGetCalendarMemo( i )
  253. {
  254. var holiflag = "";
  255. var holinm = "";
  256. holiflag = model.getValue("/root/hidden/calendarinfo/calendarinfolist[" + i +"]/holiflag");
  257. holinm = model.getValue("/root/hidden/calendarinfo/calendarinfolist[" + i +"]/holinm");
  258. if( holinm == '-' ){
  259. holinm = "";
  260. }
  261. return holinm.substring(0,5);
  262. }
  263. function fGetCalendarMemo2( i )
  264. {
  265. var holiflag = "";
  266. var dutflag = "";
  267. var holinm = "";
  268. var ordendresn = "";
  269. var fstexamcnt = 0;
  270. var reexamcnt = 0;
  271. holiflag = model.getValue("/root/hidden/calendarinfo/calendarinfolist[" + i +"]/holiflag");
  272. dutflag = model.getValue("/root/hidden/calendarinfo/calendarinfolist[" + i +"]/dutflag");
  273. holinm = model.getValue("/root/hidden/calendarinfo/calendarinfolist[" + i +"]/holinm");
  274. ordendresn = model.getValue("/root/hidden/calendarinfo/calendarinfolist[" + i +"]/ordendresn");
  275. fstexamcnt = model.getValue("/root/hidden/calendarinfo/calendarinfolist[" + i +"]/fstexamcnt");
  276. reexamcnt = model.getValue("/root/hidden/calendarinfo/calendarinfolist[" + i +"]/reexamcnt");
  277. if( holinm == '-' ){
  278. holinm = "";
  279. }
  280. return holinm + "/" + ordendresn + "\n" + fstexamcnt + "/" + reexamcnt;
  281. }
  282. /*
  283. //달력을 클릭(선택) 했을 때
  284. function fClickOnCalendar(){
  285. var calRow = grd_calendar.row;
  286. var calCol = grd_calendar.col;
  287. calCol = calCol % 7;
  288. var isDay = grd_calendar.valueMatrix(calRow, calCol);
  289. if( isDay != "" ){
  290. if( isDay.length == 1 ) isDay = "0" + isDay;
  291. var dd = ( (model.getValue("/root/hidden/calendar/year")).concat(model.getValue("/root/hidden/calendar/month")) ).concat(isDay);
  292. model.makeNode("/root/main/selecteddd");
  293. model.setValue("/root/main/selecteddd", dd);
  294. }
  295. }
  296. */
  297. function fSetMonth( newMonth ){
  298. model.setValue("/root/hidden/calendar/month", newMonth);
  299. var isMonth = model.getValue("/root/hidden/calendar/month");
  300. var isYear = model.getValue("/root/hidden/calendar/year");
  301. var isDate = (isYear+isMonth+1).toDate();
  302. //setCalendar(isDate);
  303. fGetCalendarData();
  304. }
  305. ]]>
  306. </script>
  307. </xhtml:head>
  308. <xhtml:body pagewidth="492" pageheight="373" style="margin-left:8; margin-top:8; margin-right:8; margin-bottom:8; ">
  309. <group id="grp_calendar" style="left:0px; top:0px; width:492px; height:40px; ">
  310. <shape id="rectangle1" class="calendar_header" appearance="rectangle" style="left:0px; top:0px; width:492px; height:40px; "/>
  311. <button id="button31" class="icon_pre_year" style="left:151px; top:12px; width:16px; height:16px; ">
  312. <caption/>
  313. <script type="javascript" ev:event="DOMActivate">
  314. <![CDATA[
  315. var isMonth = model.getValue("/root/hidden/calendar/month");
  316. var isYear = model.getValue("/root/hidden/calendar/year");
  317. var isDate = (isYear+isMonth+1).toDate().getAddDate(-1,'Y');
  318. model.setValue("/root/hidden/calendar/year", isDate.getDateFormat('YYYY'));
  319. model.setValue("/root/hidden/calendar/month", isDate.getDateFormat('MM'));
  320. model.refresh();
  321. model.resetInstanceNode("/root/hidden/calendarinfo")
  322. //setCalendar(isDate);
  323. fGetCalendarData();
  324. ]]>
  325. </script>
  326. </button>
  327. <button id="button32" class="icon_next_year" style="left:326px; top:12px; width:16px; height:16px; ">
  328. <caption/>
  329. <script type="javascript" ev:event="DOMActivate">
  330. <![CDATA[
  331. var isMonth = model.getValue("/root/hidden/calendar/month");
  332. var isYear = model.getValue("/root/hidden/calendar/year");
  333. var isDate = (isYear+isMonth+1).toDate().getAddDate(1,'Y');
  334. model.setValue("/root/hidden/calendar/year", isDate.getDateFormat('YYYY'));
  335. model.setValue("/root/hidden/calendar/month", isDate.getDateFormat('MM'));
  336. model.refresh();
  337. model.resetInstanceNode("/root/hidden/calendarinfo")
  338. //setCalendar(isDate);
  339. fGetCalendarData();
  340. ]]>
  341. </script>
  342. </button>
  343. <button id="btn_premonth" class="icon_pre_month" style="left:170px; top:12px; width:16px; height:16px; ">
  344. <caption/>
  345. <script type="javascript" ev:event="DOMActivate">
  346. <![CDATA[
  347. var isMonth = model.getValue("/root/hidden/calendar/month");
  348. var isYear = model.getValue("/root/hidden/calendar/year");
  349. var isDate = (isYear+isMonth+1).toDate().getAddDate(-1,'M');
  350. model.setValue("/root/hidden/calendar/year", isDate.getDateFormat('YYYY'));
  351. model.setValue("/root/hidden/calendar/month", isDate.getDateFormat('MM'));
  352. model.refresh();
  353. model.resetInstanceNode("/root/hidden/calendarinfo")
  354. //setCalendar(isDate);
  355. fGetCalendarData();
  356. ]]>
  357. </script>
  358. </button>
  359. <button id="button34" class="icon_next_month" style="left:307px; top:12px; width:16px; height:16px; ">
  360. <caption/>
  361. <script type="javascript" ev:event="DOMActivate">
  362. <![CDATA[
  363. var isMonth = model.getValue("/root/hidden/calendar/month");
  364. var isYear = model.getValue("/root/hidden/calendar/year");
  365. var isDate = (isYear+isMonth+1).toDate().getAddDate(1,'M');
  366. model.setValue("/root/hidden/calendar/year", isDate.getDateFormat('YYYY'));
  367. model.setValue("/root/hidden/calendar/month", isDate.getDateFormat('MM'));
  368. model.refresh();
  369. model.resetInstanceNode("/root/hidden/calendarinfo")
  370. //setCalendar(isDate);
  371. fGetCalendarData();
  372. ]]>
  373. </script>
  374. </button>
  375. <output id="opt_year" ref="/root/hidden/calendar/year" class="calendar_output" style="left:196px; top:9px; width:30px; height:19px; "/>
  376. <output id="opt_month" ref="/root/hidden/calendar/month" class="calendar_output" style="left:246px; top:9px; width:30px; height:19px; "/>
  377. <caption id="caption1" class="calendar_output" style="left:226px; top:9px; width:20px; height:19px; ">년</caption>
  378. <caption id="caption2" class="calendar_output" style="left:276px; top:9px; width:20px; height:19px; ">월</caption>
  379. </group>
  380. <multilinegrid id="grd_calendar" nodeset="/root/hidden/calendar/weeklist/list" class="gridcalendar" autoresize="true" backcoloralternate="transparent" caption="일^월^화^수^목^금^토" colsep="^" colwidth="70, 70, 70, 70, 70, 70, 70" focuscolor="transparent" rowsep="|" tooltip="true" selectionmode="free" mergecellsfixedrows="bycolrec" style="left:0px; top:85px; width:492px; height:265px; ">
  381. <row>
  382. <col class="color_sun" ref="sun"/>
  383. <col ref="mon"/>
  384. <col ref="tue"/>
  385. <col ref="wed"/>
  386. <col ref="thu"/>
  387. <col ref="fri"/>
  388. <col class="color_sat" ref="sat"/>
  389. </row>
  390. <row>
  391. <col ref="sun_memo"/>
  392. <col ref="mon_memo"/>
  393. <col ref="tue_memo"/>
  394. <col ref="wed_memo"/>
  395. <col ref="thu_memo"/>
  396. <col ref="fri_memo" style="height:46; "/>
  397. <col ref="sat_memo"/>
  398. </row>
  399. <script type="javascript" ev:event="onclick">
  400. <![CDATA[
  401. //setCellColor(grd_calendar);
  402. fClickOnCalendar();
  403. ]]>
  404. </script>
  405. </multilinegrid>
  406. <caption id="caption3" style="left:0px; top:353px; width:35px; height:20px; text-align:center; background-color:#ffff99; ">오전</caption>
  407. <caption id="caption4" style="left:38px; top:353px; width:35px; height:20px; text-align:center; background-color:#ccffff; ">오후</caption>
  408. <caption id="caption5" style="left:75px; top:353px; width:35px; height:20px; text-align:center; background-color:#ff99cc; ">야간</caption>
  409. <caption id="caption6" style="left:112px; top:353px; width:35px; height:20px; text-align:center; background-color:#ffcc99; ">전일</caption>
  410. <caption id="caption7" style="left:152px; top:353px; width:35px; height:20px; text-align:center; ">없음</caption>
  411. <group id="group1" style="left:67px; top:48px; width:360px; height:30px; ">
  412. <button id="btn_jan" class="icon_month" style="left:0px; top:3px; width:27px; height:27px; ">
  413. <caption>1</caption>
  414. </button>
  415. <button id="btn_feb" class="icon_month" style="left:30px; top:3px; width:27px; height:27px; ">
  416. <caption>2</caption>
  417. </button>
  418. <button id="btn_mar" class="icon_month" style="left:60px; top:3px; width:27px; height:27px; ">
  419. <caption>3</caption>
  420. </button>
  421. <button id="btn_apr" class="icon_month" style="left:90px; top:3px; width:27px; height:27px; ">
  422. <caption>4</caption>
  423. </button>
  424. <button id="btn_may" class="icon_month" style="left:120px; top:3px; width:27px; height:27px; ">
  425. <caption>5</caption>
  426. </button>
  427. <button id="btn_jun" class="icon_month" style="left:150px; top:3px; width:27px; height:27px; ">
  428. <caption>6</caption>
  429. </button>
  430. <button id="btn_jul" class="icon_month" style="left:180px; top:3px; width:27px; height:27px; ">
  431. <caption>7</caption>
  432. </button>
  433. <button id="btn_aug" class="icon_month" style="left:210px; top:3px; width:27px; height:27px; ">
  434. <caption>8</caption>
  435. </button>
  436. <button id="btn_sep" class="icon_month" style="left:240px; top:3px; width:27px; height:27px; ">
  437. <caption>9</caption>
  438. </button>
  439. <button id="btn_oct" class="icon_month" style="left:270px; top:3px; width:27px; height:27px; ">
  440. <caption>10</caption>
  441. </button>
  442. <button id="btn_nov" class="icon_month" style="left:300px; top:3px; width:27px; height:27px; ">
  443. <caption>11</caption>
  444. </button>
  445. <button id="btn_dec" class="icon_month" style="left:330px; top:3px; width:27px; height:27px; ">
  446. <caption>12</caption>
  447. </button>
  448. <script type="javascript" ev:event="onclick">
  449. <![CDATA[
  450. var trgObj = document.controls.item(event.target);
  451. if( trgObj.elementName == "xforms:button" ) {
  452. var btnMark = trgObj.label;
  453. if(beforeId != ""){
  454. beforeObj = document.controls(beforeId);
  455. if(beforeObj != null) beforeObj.disabled = "false";
  456. }
  457. trgObj.disabled = "true";
  458. beforeId = trgObj.attribute("id");
  459. //달력 변경
  460. if( btnMark.length == 1 ){
  461. btnMark = '0' + btnMark;
  462. }
  463. fSetMonth(btnMark);
  464. }
  465. ]]>
  466. </script>
  467. </group>
  468. </xhtml:body>
  469. </xhtml:html>