calendar updates: support for preferred category in IN event, visual improvements...
[openemr.git] / interface / main / calendar / add_edit_event.php
blob8745b71ecab15b7bb3f252ccaf41bf4ebf03a6dd
1 <?
2 // Copyright (C) 2005-2006 Rod Roark <rod@sunsetsystems.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 // The event editor looks something like this:
11 //------------------------------------------------------------//
12 // Category __________________V O All day event //
13 // Date _____________ [?] O Time ___:___ __V //
14 // Title ___________________ duration ____ minutes //
15 // Patient _(Click_to_select)_ //
16 // Provider __________________V X Repeats ______V ______V //
17 // Status __________________V until __________ [?] //
18 // Comments ________________________________________________ //
19 // //
20 // [Save] [Find Available] [Delete] [Cancel] //
21 //------------------------------------------------------------//
23 include_once("../../globals.php");
24 include_once("$srcdir/patient.inc");
26 // Things that might be passed by our opener.
28 $eid = $_GET['eid']; // only for existing events
29 $date = $_GET['date']; // this and below only for new events
30 $userid = $_GET['userid'];
31 $default_catid = $_GET['catid'] ? $_GET['catid'] : '5';
33 if ($date)
34 $date = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6);
35 else
36 $date = date("Y-m-d");
38 $starttimem = '00';
39 if (isset($_GET['starttimem']))
40 $starttimem = substr('00' . $_GET['starttimem'], -2);
42 if (isset($_GET['starttimeh'])) {
43 $starttimeh = $_GET['starttimeh'];
44 if (isset($_GET['startampm'])) {
45 if ($_GET['startampm'] == '2' && $starttimeh < 12)
46 $starttimeh += 12;
48 } else {
49 $starttimeh = date("G");
51 $startampm = '';
53 $info_msg = "";
55 // If we are saving, then save and close the window.
57 if ($_POST['form_save']) {
59 // Compute start and end time strings to be saved.
60 if ($_POST['form_allday']) {
61 $tmph = 0;
62 $tmpm = 0;
63 $duration = 24 * 60;
64 } else {
65 $tmph = $_POST['form_hour'] + 0;
66 $tmpm = $_POST['form_minute'] + 0;
67 if ($_POST['form_ampm'] == '2' && $tmph < 12) $tmph += 12;
68 $duration = $_POST['form_duration'];
70 $starttime = "$tmph:$tmpm:00";
72 $tmpm += $duration;
73 while ($tmpm >= 60) {
74 $tmpm -= 60;
75 ++$tmph;
77 $endtime = "$tmph:$tmpm:00";
79 // Useless garbage that we must save.
80 $locationspec = 'a:6:{s:14:"event_location";N;s:13:"event_street1";N;' .
81 's:13:"event_street2";N;s:10:"event_city";N;s:11:"event_state";N;s:12:"event_postal";N;}';
83 // More garbage, but this time 1 character of it is used to save the
84 // repeat type.
85 if ($_POST['form_repeat']) {
86 $recurrspec = 'a:5:{' .
87 's:17:"event_repeat_freq";s:1:"' . $_POST['form_repeat_freq'] . '";' .
88 's:22:"event_repeat_freq_type";s:1:"' . $_POST['form_repeat_type'] . '";' .
89 's:19:"event_repeat_on_num";s:1:"1";' .
90 's:19:"event_repeat_on_day";s:1:"0";' .
91 's:20:"event_repeat_on_freq";s:1:"0";}';
92 } else {
93 $recurrspec = 'a:5:{' .
94 's:17:"event_repeat_freq";N;' .
95 's:22:"event_repeat_freq_type";s:1:"0";' .
96 's:19:"event_repeat_on_num";s:1:"1";' .
97 's:19:"event_repeat_on_day";s:1:"0";' .
98 's:20:"event_repeat_on_freq";s:1:"1";}';
101 if ($eid) {
102 sqlStatement("UPDATE openemr_postcalendar_events SET " .
103 "pc_catid = '" . $_POST['form_category'] . "', " .
104 "pc_aid = '" . $_POST['form_provider'] . "', " .
105 "pc_pid = '" . $_POST['form_pid'] . "', " .
106 "pc_title = '" . $_POST['form_title'] . "', " .
107 "pc_time = NOW(), " .
108 "pc_hometext = '" . $_POST['form_comments'] . "', " .
109 "pc_informant = '" . $_SESSION['authUserID'] . "', " .
110 "pc_eventDate = '" . fixDate($_POST['form_date']) . "', " .
111 "pc_endDate = '" . fixDate($_POST['form_enddate']) . "', " .
112 "pc_duration = '" . ($duration * 60) . "', " .
113 "pc_recurrtype = '" . ($_POST['form_repeat'] ? '1' : '0') . "', " .
114 "pc_recurrspec = '$recurrspec', " .
115 "pc_startTime = '$starttime', " .
116 "pc_endTime = '$endtime', " .
117 "pc_alldayevent = '" . $_POST['form_allday'] . "', " .
118 "pc_apptstatus = '" . $_POST['form_apptstatus'] . "', " .
119 "pc_prefcatid = '" . $_POST['form_prefcat'] . "' " .
120 "WHERE pc_eid = '$eid'");
121 } else {
122 sqlInsert("INSERT INTO openemr_postcalendar_events ( " .
123 "pc_catid, pc_aid, pc_pid, pc_title, pc_time, pc_hometext, " .
124 "pc_informant, pc_eventDate, pc_endDate, pc_duration, pc_recurrtype, " .
125 "pc_recurrspec, pc_startTime, pc_endTime, pc_alldayevent, " .
126 "pc_apptstatus, pc_prefcatid, pc_location, pc_eventstatus, pc_sharing " .
127 ") VALUES ( " .
128 "'" . $_POST['form_category'] . "', " .
129 "'" . $_POST['form_provider'] . "', " .
130 "'" . $_POST['form_pid'] . "', " .
131 "'" . $_POST['form_title'] . "', " .
132 "NOW(), " .
133 "'" . $_POST['form_comments'] . "', " .
134 "'" . $_SESSION['authUserID'] . "', " .
135 "'" . fixDate($_POST['form_date']) . "', " .
136 "'" . fixDate($_POST['form_enddate']) . "', " .
137 "'" . ($duration * 60) . "', " .
138 "'" . ($_POST['form_repeat'] ? '1' : '0') . "', " .
139 "'$recurrspec', " .
140 "'$starttime', " .
141 "'$endtime', " .
142 "'" . $_POST['form_allday'] . "', " .
143 "'" . $_POST['form_apptstatus'] . "', " .
144 "'" . $_POST['form_prefcat'] . "', " .
145 "'$locationspec', " .
146 "1, " .
147 "1 )");
150 // Save new DOB if it's there.
151 $patient_dob = trim($_POST['form_dob']);
152 if ($patient_dob && $_POST['form_pid']) {
153 sqlStatement("UPDATE patient_data SET DOB = '$patient_dob' WHERE " .
154 "pid = '" . $_POST['form_pid'] . "'");
158 else if ($_POST['form_delete']) {
159 sqlStatement("DELETE FROM openemr_postcalendar_events WHERE " .
160 "pc_eid = '$eid'");
163 if ($_POST['form_save'] || $_POST['form_delete']) {
164 // Close this window and refresh the calendar display.
165 echo "<html>\n<body>\n<script language='JavaScript'>\n";
166 if ($info_msg) echo " alert('$info_msg');\n";
167 echo " if (!opener.closed && opener.refreshme) opener.refreshme();\n";
168 echo " window.close();\n";
169 echo "</script>\n</body>\n</html>\n";
170 exit();
173 // If we get this far then we are displaying the form.
175 $statuses = array(
176 '-' => '',
177 '*' => '* Reminder done',
178 '+' => '+ Chart pulled',
179 '?' => '? No show',
180 '@' => '@ Arrived',
181 '~' => '~ Arrived late',
182 '!' => '! Left w/o visit',
183 '#' => '# Ins/fin issue',
184 '<' => '< In exam room',
185 '>' => '> Checked out',
186 '$' => '$ Coding done',
189 $repeats = 0; // if the event repeats
190 $repeattype = '0';
191 $repeatfreq = '0';
192 $patientid = '';
193 if ($_REQUEST['patientid']) $patientid = $_REQUEST['patientid'];
194 $patientname = " (Click to select)";
195 $patienttitle = "";
196 $hometext = "";
197 $row = array();
199 // If we are editing an existing event, then get its data.
200 if ($eid) {
201 $row = sqlQuery("SELECT * FROM openemr_postcalendar_events WHERE pc_eid = $eid");
202 $date = $row['pc_eventDate'];
203 $userid = $row['pc_aid'];
204 $patientid = $row['pc_pid'];
205 $starttimeh = substr($row['pc_startTime'], 0, 2) + 0;
206 $starttimem = substr($row['pc_startTime'], 3, 2);
207 $repeats = $row['pc_recurrtype'];
208 if (preg_match('/"event_repeat_freq_type";s:1:"(\d)"/', $row['pc_recurrspec'], $matches)) {
209 $repeattype = $matches[1];
211 if (preg_match('/"event_repeat_freq";s:1:"(\d)"/', $row['pc_recurrspec'], $matches)) {
212 $repeatfreq = $matches[1];
214 $hometext = $row['pc_hometext'];
215 if (substr($hometext, 0, 6) == ':text:') $hometext = substr($hometext, 6);
218 // If we have a patient ID, get the name and phone numbers to display.
219 if ($patientid) {
220 $prow = sqlQuery("SELECT lname, fname, phone_home, phone_biz, DOB " .
221 "FROM patient_data WHERE pid = '" . $patientid . "'");
222 $patientname = $prow['lname'] . ", " . $prow['fname'];
223 if ($prow['phone_home']) $patienttitle .= " H=" . $prow['phone_home'];
224 if ($prow['phone_biz']) $patienttitle .= " W=" . $prow['phone_biz'];
227 // Get the providers list.
228 $ures = sqlStatement("SELECT id, username, fname, lname FROM users WHERE " .
229 "authorized != 0 ORDER BY lname, fname");
231 // Get event categories.
232 $cres = sqlStatement("SELECT pc_catid, pc_catname, pc_recurrtype, pc_duration, pc_end_all_day " .
233 "FROM openemr_postcalendar_categories ORDER BY pc_catname");
235 // Fix up the time format for AM/PM.
236 $startampm = '1';
237 if ($starttimeh >= 12) { // p.m. starts at noon and not 12:01
238 $startampm = '2';
239 if ($starttimeh > 12) $starttimeh -= 12;
242 <html>
243 <head>
244 <title><? echo $eid ? "Edit" : "Add New" ?> Event</title>
245 <link rel=stylesheet href='<? echo $css_header ?>' type='text/css'>
247 <style>
248 td { font-size:10pt; }
249 </style>
251 <script type="text/javascript" src="../../../library/topdialog.js"></script>
252 <script type="text/javascript" src="../../../library/dialog.js"></script>
253 <script type="text/javascript" src="../../../library/overlib_mini.js"></script>
254 <script type="text/javascript" src="../../../library/calendar.js"></script>
255 <script type="text/javascript" src="../../../library/textformat.js"></script>
257 <script language="JavaScript">
259 var mypcc = '<? echo $GLOBALS['phone_country_code'] ?>';
261 var durations = new Array();
262 // var rectypes = new Array();
264 // Read the event categories, generate their options list, and get
265 // the default event duration from them if this is a new event.
266 $catoptions = "";
267 $prefcat_options = " <option value='0'>-- None --</option>\n";
268 $thisduration = 0;
269 if ($eid) {
270 $thisduration = $row['pc_alldayevent'] ? 1440 : round($row['pc_duration'] / 60);
272 while ($crow = sqlFetchArray($cres)) {
273 $duration = round($crow['pc_duration'] / 60);
274 if ($crow['pc_end_all_day']) $duration = 1440;
275 echo " durations[" . $crow['pc_catid'] . "] = $duration\n";
276 // echo " rectypes[" . $crow['pc_catid'] . "] = " . $crow['pc_recurrtype'] . "\n";
277 $catoptions .= " <option value='" . $crow['pc_catid'] . "'";
278 if ($eid) {
279 if ($crow['pc_catid'] == $row['pc_catid']) $catoptions .= " selected";
280 } else {
281 if ($crow['pc_catid'] == $default_catid) {
282 $catoptions .= " selected";
283 $thisduration = $duration;
286 $catoptions .= ">" . $crow['pc_catname'] . "</option>\n";
288 // This section is to build the list of preferred categories:
289 if ($duration) {
290 $prefcat_options .= " <option value='" . $crow['pc_catid'] . "'";
291 if ($eid) {
292 if ($crow['pc_catid'] == $row['pc_prefcatid']) $prefcat_options .= " selected";
294 $prefcat_options .= ">" . $crow['pc_catname'] . "</option>\n";
300 // This is for callback by the find-patient popup.
301 function setpatient(pid, lname, fname, dob) {
302 var f = document.forms[0];
303 f.form_patient.value = lname + ', ' + fname;
304 f.form_pid.value = pid;
305 dobstyle = (dob == '' || dob.substr(5, 10) == '00-00') ? '' : 'none';
306 document.getElementById('dob_row').style.display = dobstyle;
309 // This invokes the find-patient popup.
310 function sel_patient() {
311 dlgopen('find_patient_popup.php', '_blank', 500, 400);
314 // Do whatever is needed when a new event category is selected.
315 // For now this means changing the event title and duration.
316 function set_display() {
317 var f = document.forms[0];
318 var s = f.form_category;
319 if (s.selectedIndex >= 0) {
320 var catid = s.options[s.selectedIndex].value;
321 var style_apptstatus = document.getElementById('title_apptstatus').style;
322 var style_prefcat = document.getElementById('title_prefcat').style;
323 if (catid == '2') { // In Office
324 style_apptstatus.display = 'none';
325 style_prefcat.display = '';
326 f.form_apptstatus.style.display = 'none';
327 f.form_prefcat.style.display = '';
328 } else {
329 style_prefcat.display = 'none';
330 style_apptstatus.display = '';
331 f.form_prefcat.style.display = 'none';
332 f.form_apptstatus.style.display = '';
337 // Do whatever is needed when a new event category is selected.
338 // For now this means changing the event title and duration.
339 function set_category() {
340 var f = document.forms[0];
341 var s = f.form_category;
342 if (s.selectedIndex >= 0) {
343 var catid = s.options[s.selectedIndex].value;
344 f.form_title.value = s.options[s.selectedIndex].text;
345 f.form_duration.value = durations[catid];
346 set_display();
350 // Modify some visual attributes when the all-day or timed-event
351 // radio buttons are clicked.
352 function set_allday() {
353 var f = document.forms[0];
354 var color1 = '#777777';
355 var color2 = '#777777';
356 var disabled2 = true;
357 if (document.getElementById('rballday1').checked) {
358 color1 = '#000000';
360 if (document.getElementById('rballday2').checked) {
361 color2 = '#000000';
362 disabled2 = false;
364 document.getElementById('tdallday1').style.color = color1;
365 document.getElementById('tdallday2').style.color = color2;
366 document.getElementById('tdallday3').style.color = color2;
367 document.getElementById('tdallday4').style.color = color2;
368 document.getElementById('tdallday5').style.color = color2;
369 f.form_hour.disabled = disabled2;
370 f.form_minute.disabled = disabled2;
371 f.form_ampm.disabled = disabled2;
372 f.form_duration.disabled = disabled2;
375 // Modify some visual attributes when the Repeat checkbox is clicked.
376 function set_repeat() {
377 var f = document.forms[0];
378 var isdisabled = true;
379 var mycolor = '#777777';
380 var myvisibility = 'hidden';
381 if (f.form_repeat.checked) {
382 isdisabled = false;
383 mycolor = '#000000';
384 myvisibility = 'visible';
386 f.form_repeat_type.disabled = isdisabled;
387 f.form_repeat_freq.disabled = isdisabled;
388 f.form_enddate.disabled = isdisabled;
389 document.getElementById('tdrepeat1').style.color = mycolor;
390 document.getElementById('tdrepeat2').style.color = mycolor;
391 document.getElementById('imgrepeat').style.visibility = myvisibility;
394 // This is for callback by the find-available popup.
395 function setappt(year,mon,mday,hours,minutes) {
396 var f = document.forms[0];
397 f.form_date.value = '' + year + '-' +
398 ('' + (mon + 100)).substring(1) + '-' +
399 ('' + (mday + 100)).substring(1);
400 f.form_ampm.selectedIndex = (hours >= 12) ? 1 : 0;
401 f.form_hour.value = (hours > 12) ? hours - 12 : hours;
402 f.form_minute.value = ('' + (minutes + 100)).substring(1);
405 // Invoke the find-available popup.
406 function find_available() {
407 var s = document.forms[0].form_provider;
408 var c = document.forms[0].form_category;
409 dlgopen('find_appt_popup.php?providerid=' + s.options[s.selectedIndex].value +
410 '&catid=' + c.options[c.selectedIndex].value, '_blank', 500, 400);
413 // Check for errors when the form is submitted.
414 function validate() {
415 var f = document.forms[0];
416 if (f.form_repeat.checked &&
417 (! f.form_enddate.value || f.form_enddate.value < f.form_date.value)) {
418 alert('An end date later than the start date is required for repeated events!');
419 return false;
421 return true;
424 </script>
426 </head>
428 <body <?echo $top_bg_line;?> onunload='imclosing()'>
430 <!-- Required for the popup date selectors -->
431 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
433 <form method='post' name='theform' action='add_edit_event.php?eid=<? echo $eid ?>'
434 onsubmit='return validate()'>
435 <center>
437 <table border='0' width='100%'>
439 <tr>
440 <td width='1%' nowrap>
441 <b><? xl('Category','e'); ?>:</b>
442 </td>
443 <td nowrap>
444 <select name='form_category' onchange='set_category()' style='width:100%'>
445 <? echo $catoptions ?>
446 </select>
447 </td>
448 <td width='1%' nowrap>
449 &nbsp;&nbsp;
450 <input type='radio' name='form_allday' onclick='set_allday()' value='1' id='rballday1'
451 <? if ($thisduration == 1440) echo "checked " ?>/>
452 </td>
453 <td colspan='2' nowrap id='tdallday1'>
454 <? xl('All day event','e'); ?>
455 </td>
456 </tr>
458 <tr>
459 <td nowrap>
460 <b><? xl('Date','e'); ?>:</b>
461 </td>
462 <td nowrap>
463 <input type='text' size='10' name='form_date'
464 value='<? echo $eid ? $row['pc_eventDate'] : $date ?>'
465 title='yyyy-mm-dd event date or starting date'
466 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />
467 <a href="javascript:show_calendar('theform.form_date')"
468 title="Click here to choose a date"
469 ><img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' border='0' alt='[?]'></a>
470 </td>
471 <td nowrap>
472 &nbsp;&nbsp;
473 <input type='radio' name='form_allday' onclick='set_allday()' value='0' id='rballday2'
474 <? if ($thisduration != 1440) echo "checked " ?>/>
475 </td>
476 <td width='1%' nowrap id='tdallday2'>
477 <? xl('Time','e'); ?>
478 </td>
479 <td width='1%' nowrap id='tdallday3'>
480 <input type='text' size='2' name='form_hour'
481 value='<? echo $starttimeh ?>'
482 title='Event start time' /> :
483 <input type='text' size='2' name='form_minute'
484 value='<? echo $starttimem ?>'
485 title='Event start time' />&nbsp;
486 <select name='form_ampm' title='Note: 12:00 noon is PM, not AM'>
487 <option value='1'>AM</option>
488 <option value='2'<? if ($startampm == '2') echo " selected" ?>>PM</option>
489 </select>
490 </td>
491 </tr>
493 <tr>
494 <td nowrap>
495 <b><? xl('Title','e'); ?>:</b>
496 </td>
497 <td nowrap>
498 <input type='text' size='10' name='form_title'
499 value='<? echo addslashes($row['pc_title']) ?>'
500 style='width:100%'
501 title='Event title' />
502 </td>
503 <td nowrap>
504 &nbsp;
505 </td>
506 <td nowrap id='tdallday4'><? xl('duration','e'); ?>
507 </td>
508 <td nowrap id='tdallday5'>
509 <input type='text' size='4' name='form_duration' value='<? echo $thisduration ?>'
510 title='Event duration in minutes' /> <? xl('minutes','e'); ?>
511 </td>
512 </tr>
514 <tr>
515 <td nowrap>
516 <b><? xl('Patient','e'); ?>:</b>
517 </td>
518 <td nowrap>
519 <input type='text' size='10' name='form_patient' style='width:100%'
520 value='<? echo $patientname ?>' onclick='sel_patient()'
521 title='Click to select patient' readonly />
522 <input type='hidden' name='form_pid' value='<? echo $patientid ?>' />
523 </td>
524 <td colspan='3' nowrap style='font-size:8pt'>
525 &nbsp;<? echo $patienttitle ?>
526 </td>
527 </tr>
529 <tr>
530 <td nowrap>
531 <b><? xl('Provider','e'); ?>:</b>
532 </td>
533 <td nowrap>
534 <select name='form_provider' style='width:100%'>
536 while ($urow = sqlFetchArray($ures)) {
537 echo " <option value='" . $urow['id'] . "'";
538 if ($userid) {
539 if ($urow['id'] == $userid) echo " selected";
540 } else {
541 if ($urow['id'] == $_SESSION['authUserID']) echo " selected";
543 echo ">" . $urow['lname'];
544 if ($urow['fname']) echo ", " . $urow['fname'];
545 echo "</option>\n";
548 </select>
549 </td>
550 <td nowrap>
551 &nbsp;&nbsp;
552 <input type='checkbox' name='form_repeat' onclick='set_repeat(this)'
553 value='1'<? if ($repeats) echo " checked" ?>/>
554 </td>
555 <td nowrap id='tdrepeat1'><? xl('Repeats','e'); ?>
556 </td>
557 <td nowrap>
559 <select name='form_repeat_freq' title='Every, every other, every 3rd, etc.'>
561 foreach (array(1 => 'every', 2 => '2nd', 3 => '3rd', 4 => '4th', 5 => '5th', 6 => '6th')
562 as $key => $value)
564 echo " <option value='$key'";
565 if ($key == $repeatfreq) echo " selected";
566 echo ">$value</option>\n";
569 </select>
571 <select name='form_repeat_type'>
573 // See common.api.php for these:
574 foreach (array(0 => 'day' , 4 => 'workday', 1 => 'week', 2 => 'month', 3 => 'year')
575 as $key => $value)
577 echo " <option value='$key'";
578 if ($key == $repeattype) echo " selected";
579 echo ">$value</option>\n";
582 </select>
584 </td>
585 </tr>
587 <tr>
588 <td nowrap>
589 <span id='title_apptstatus'><b><? xl('Status','e'); ?>:</b></span>
590 <span id='title_prefcat' style='display:none'><b><? xl('Pref Cat','e'); ?>:</b></span>
591 </td>
592 <td nowrap>
594 <select name='form_apptstatus' style='width:100%' title='Appointment status'>
596 foreach ($statuses as $key => $value) {
597 echo " <option value='$key'";
598 if ($key == $row['pc_apptstatus']) echo " selected";
599 echo ">" . htmlspecialchars($value) . "</option>\n";
602 </select>
603 <!--
604 The following list will be invisible unless this is an In Office
605 event, in which case form_apptstatus (above) is to be invisible.
607 <select name='form_prefcat' style='width:100%;display:none' title='Preferred Event Category'>
608 <? echo $prefcat_options ?>
609 </select>
611 </td>
612 <td nowrap>
613 &nbsp;
614 </td>
615 <td nowrap id='tdrepeat2'><? xl('until','e'); ?>
616 </td>
617 <td nowrap>
618 <input type='text' size='10' name='form_enddate' value='<? echo $row['pc_endDate'] ?>'
619 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
620 title='yyyy-mm-dd last date of this event' />
621 <a href="javascript:show_calendar('theform.form_enddate')"
622 title="Click here to choose a date"
623 ><img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
624 border='0' alt='[?]' id='imgrepeat' /></a>
625 </td>
626 </tr>
628 <tr>
629 <td nowrap>
630 <b><? xl('Comments','e'); ?>:</b>
631 </td>
632 <td colspan='4' nowrap>
633 <input type='text' size='40' name='form_comments' style='width:100%'
634 value='<? echo $hometext ?>'
635 title='Optional information about this event' />
636 </td>
637 </tr>
639 <?php
640 // DOB is important for the clinic, so if it's missing give them a chance
641 // to enter it right here. We must display or hide this row dynamically
642 // in case the patient-select popup is used.
643 $patient_dob = trim($prow['DOB']);
644 $dobstyle = ($prow && (!$patient_dob || substr($patient_dob, 5) == '00-00')) ?
645 '' : 'none';
647 <tr id='dob_row' style='display:<?php echo $dobstyle ?>'>
648 <td colspan='4' nowrap>
649 <b><font color='red'><? xl('DOB is missing, please enter if possible','e'); ?>:</font></b>
650 </td>
651 <td nowrap>
652 <input type='text' size='10' name='form_dob'
653 title='yyyy-mm-dd date of birth'
654 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />
655 <a href="javascript:show_calendar('theform.form_dob')"
656 title="Click here to choose a date"
657 ><img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' border='0' alt='[?]'></a>
658 </td>
659 </tr>
661 </table>
664 <input type='submit' name='form_save' value='Save' />
665 &nbsp;
666 <input type='button' value='Find Available' onclick='find_available()' />
667 &nbsp;
668 <input type='submit' name='form_delete' value='Delete'<? if (!$eid) echo " disabled" ?> />
669 &nbsp;
670 <input type='button' value='Cancel' onclick='window.close()' />
671 </p>
672 </center>
673 </form>
674 <script language='JavaScript'>
675 <? if ($eid) { ?>
676 set_display();
677 <? } else { ?>
678 set_category();
679 <? } ?>
680 set_allday();
681 set_repeat();
682 </script>
683 </body>
684 </html>