translation patches from Dr. Bosman and his crew
[openemr.git] / interface / main / calendar / add_edit_event.php
blob32406ed9128a6d374ccbbf046394794be9629f3f
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");
25 include_once("$srcdir/forms.inc");
27 // Things that might be passed by our opener.
29 $eid = $_GET['eid']; // only for existing events
30 $date = $_GET['date']; // this and below only for new events
31 $userid = $_GET['userid'];
32 $default_catid = $_GET['catid'] ? $_GET['catid'] : '5';
34 if ($date)
35 $date = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6);
36 else
37 $date = date("Y-m-d");
39 $starttimem = '00';
40 if (isset($_GET['starttimem']))
41 $starttimem = substr('00' . $_GET['starttimem'], -2);
43 if (isset($_GET['starttimeh'])) {
44 $starttimeh = $_GET['starttimeh'];
45 if (isset($_GET['startampm'])) {
46 if ($_GET['startampm'] == '2' && $starttimeh < 12)
47 $starttimeh += 12;
49 } else {
50 $starttimeh = date("G");
52 $startampm = '';
54 $info_msg = "";
56 // If we are saving, then save and close the window.
58 if ($_POST['form_save']) {
60 $event_date = fixDate($_POST['form_date']);
62 // Compute start and end time strings to be saved.
63 if ($_POST['form_allday']) {
64 $tmph = 0;
65 $tmpm = 0;
66 $duration = 24 * 60;
67 } else {
68 $tmph = $_POST['form_hour'] + 0;
69 $tmpm = $_POST['form_minute'] + 0;
70 if ($_POST['form_ampm'] == '2' && $tmph < 12) $tmph += 12;
71 $duration = $_POST['form_duration'];
73 $starttime = "$tmph:$tmpm:00";
75 $tmpm += $duration;
76 while ($tmpm >= 60) {
77 $tmpm -= 60;
78 ++$tmph;
80 $endtime = "$tmph:$tmpm:00";
82 // Useless garbage that we must save.
83 $locationspec = 'a:6:{s:14:"event_location";N;s:13:"event_street1";N;' .
84 's:13:"event_street2";N;s:10:"event_city";N;s:11:"event_state";N;s:12:"event_postal";N;}';
86 // More garbage, but this time 1 character of it is used to save the
87 // repeat type.
88 if ($_POST['form_repeat']) {
89 $recurrspec = 'a:5:{' .
90 's:17:"event_repeat_freq";s:1:"' . $_POST['form_repeat_freq'] . '";' .
91 's:22:"event_repeat_freq_type";s:1:"' . $_POST['form_repeat_type'] . '";' .
92 's:19:"event_repeat_on_num";s:1:"1";' .
93 's:19:"event_repeat_on_day";s:1:"0";' .
94 's:20:"event_repeat_on_freq";s:1:"0";}';
95 } else {
96 $recurrspec = 'a:5:{' .
97 's:17:"event_repeat_freq";N;' .
98 's:22:"event_repeat_freq_type";s:1:"0";' .
99 's:19:"event_repeat_on_num";s:1:"1";' .
100 's:19:"event_repeat_on_day";s:1:"0";' .
101 's:20:"event_repeat_on_freq";s:1:"1";}';
104 if ($eid) {
105 sqlStatement("UPDATE openemr_postcalendar_events SET " .
106 "pc_catid = '" . $_POST['form_category'] . "', " .
107 "pc_aid = '" . $_POST['form_provider'] . "', " .
108 "pc_pid = '" . $_POST['form_pid'] . "', " .
109 "pc_title = '" . $_POST['form_title'] . "', " .
110 "pc_time = NOW(), " .
111 "pc_hometext = '" . $_POST['form_comments'] . "', " .
112 "pc_informant = '" . $_SESSION['authUserID'] . "', " .
113 "pc_eventDate = '" . $event_date . "', " .
114 "pc_endDate = '" . fixDate($_POST['form_enddate']) . "', " .
115 "pc_duration = '" . ($duration * 60) . "', " .
116 "pc_recurrtype = '" . ($_POST['form_repeat'] ? '1' : '0') . "', " .
117 "pc_recurrspec = '$recurrspec', " .
118 "pc_startTime = '$starttime', " .
119 "pc_endTime = '$endtime', " .
120 "pc_alldayevent = '" . $_POST['form_allday'] . "', " .
121 "pc_apptstatus = '" . $_POST['form_apptstatus'] . "', " .
122 "pc_prefcatid = '" . $_POST['form_prefcat'] . "' " .
123 "WHERE pc_eid = '$eid'");
124 } else {
125 sqlInsert("INSERT INTO openemr_postcalendar_events ( " .
126 "pc_catid, pc_aid, pc_pid, pc_title, pc_time, pc_hometext, " .
127 "pc_informant, pc_eventDate, pc_endDate, pc_duration, pc_recurrtype, " .
128 "pc_recurrspec, pc_startTime, pc_endTime, pc_alldayevent, " .
129 "pc_apptstatus, pc_prefcatid, pc_location, pc_eventstatus, pc_sharing " .
130 ") VALUES ( " .
131 "'" . $_POST['form_category'] . "', " .
132 "'" . $_POST['form_provider'] . "', " .
133 "'" . $_POST['form_pid'] . "', " .
134 "'" . $_POST['form_title'] . "', " .
135 "NOW(), " .
136 "'" . $_POST['form_comments'] . "', " .
137 "'" . $_SESSION['authUserID'] . "', " .
138 "'" . $event_date . "', " .
139 "'" . fixDate($_POST['form_enddate']) . "', " .
140 "'" . ($duration * 60) . "', " .
141 "'" . ($_POST['form_repeat'] ? '1' : '0') . "', " .
142 "'$recurrspec', " .
143 "'$starttime', " .
144 "'$endtime', " .
145 "'" . $_POST['form_allday'] . "', " .
146 "'" . $_POST['form_apptstatus'] . "', " .
147 "'" . $_POST['form_prefcat'] . "', " .
148 "'$locationspec', " .
149 "1, " .
150 "1 )");
153 // Save new DOB if it's there.
154 $patient_dob = trim($_POST['form_dob']);
155 if ($patient_dob && $_POST['form_pid']) {
156 sqlStatement("UPDATE patient_data SET DOB = '$patient_dob' WHERE " .
157 "pid = '" . $_POST['form_pid'] . "'");
160 // Auto-create a new encounter if appropriate.
162 if ($GLOBALS['auto_create_new_encounters'] &&
163 $_POST['form_apptstatus'] == '@' && $event_date == date('Y-m-d'))
165 $tmprow = sqlQuery("SELECT count(*) AS count FROM form_encounter WHERE " .
166 "pid = '" . $_POST['form_pid'] . "' AND date = '$event_date 00:00:00'");
167 if ($tmprow['count'] == 0) {
168 $tmprow = sqlQuery("SELECT username, facility FROM users WHERE id = '" .
169 $_POST['form_provider'] . "'");
170 $username = $tmprow['username'];
171 $facility = $tmprow['facility'];
172 $conn = $GLOBALS['adodb']['db'];
173 $encounter = $conn->GenID("sequences");
174 addForm($encounter, "New Patient Encounter",
175 sqlInsert("INSERT INTO form_encounter SET " .
176 "date = '$event_date', " .
177 "onset_date = '$event_date', " .
178 "reason = '" . $_POST['form_comments'] . "', " .
179 "facility = '$facility', " .
180 "pid = '" . $_POST['form_pid'] . "', " .
181 "encounter = '$encounter'"
183 "newpatient", $_POST['form_pid'], "1", "NOW()", $username
185 $info_msg .= "New encounter $encounter was created. ";
190 else if ($_POST['form_delete']) {
191 sqlStatement("DELETE FROM openemr_postcalendar_events WHERE " .
192 "pc_eid = '$eid'");
195 if ($_POST['form_save'] || $_POST['form_delete']) {
196 // Close this window and refresh the calendar display.
197 echo "<html>\n<body>\n<script language='JavaScript'>\n";
198 if ($info_msg) echo " alert('$info_msg');\n";
199 echo " if (!opener.closed && opener.refreshme) opener.refreshme();\n";
200 echo " window.close();\n";
201 echo "</script>\n</body>\n</html>\n";
202 exit();
205 // If we get this far then we are displaying the form.
207 $statuses = array(
208 '-' => '',
209 '*' => xl('* Reminder done'),
210 '+' => xl('+ Chart pulled'),
211 '?' => xl('? No show'),
212 '@' => xl('@ Arrived'),
213 '~' => xl('~ Arrived late'),
214 '!' => xl('! Left w/o visit'),
215 '#' => xl('# Ins/fin issue'),
216 '<' => xl('< In exam room'),
217 '>' => xl('> Checked out'),
218 '$' => xl('$ Coding done'),
221 $repeats = 0; // if the event repeats
222 $repeattype = '0';
223 $repeatfreq = '0';
224 $patientid = '';
225 if ($_REQUEST['patientid']) $patientid = $_REQUEST['patientid'];
226 $patientname = xl('Click to select');
227 $patienttitle = "";
228 $hometext = "";
229 $row = array();
231 // If we are editing an existing event, then get its data.
232 if ($eid) {
233 $row = sqlQuery("SELECT * FROM openemr_postcalendar_events WHERE pc_eid = $eid");
234 $date = $row['pc_eventDate'];
235 $userid = $row['pc_aid'];
236 $patientid = $row['pc_pid'];
237 $starttimeh = substr($row['pc_startTime'], 0, 2) + 0;
238 $starttimem = substr($row['pc_startTime'], 3, 2);
239 $repeats = $row['pc_recurrtype'];
240 if (preg_match('/"event_repeat_freq_type";s:1:"(\d)"/', $row['pc_recurrspec'], $matches)) {
241 $repeattype = $matches[1];
243 if (preg_match('/"event_repeat_freq";s:1:"(\d)"/', $row['pc_recurrspec'], $matches)) {
244 $repeatfreq = $matches[1];
246 $hometext = $row['pc_hometext'];
247 if (substr($hometext, 0, 6) == ':text:') $hometext = substr($hometext, 6);
250 // If we have a patient ID, get the name and phone numbers to display.
251 if ($patientid) {
252 $prow = sqlQuery("SELECT lname, fname, phone_home, phone_biz, DOB " .
253 "FROM patient_data WHERE pid = '" . $patientid . "'");
254 $patientname = $prow['lname'] . ", " . $prow['fname'];
255 if ($prow['phone_home']) $patienttitle .= " H=" . $prow['phone_home'];
256 if ($prow['phone_biz']) $patienttitle .= " W=" . $prow['phone_biz'];
259 // Get the providers list.
260 $ures = sqlStatement("SELECT id, username, fname, lname FROM users WHERE " .
261 "authorized != 0 AND active = 1 ORDER BY lname, fname");
263 // Get event categories.
264 $cres = sqlStatement("SELECT pc_catid, pc_catname, pc_recurrtype, pc_duration, pc_end_all_day " .
265 "FROM openemr_postcalendar_categories ORDER BY pc_catname");
267 // Fix up the time format for AM/PM.
268 $startampm = '1';
269 if ($starttimeh >= 12) { // p.m. starts at noon and not 12:01
270 $startampm = '2';
271 if ($starttimeh > 12) $starttimeh -= 12;
274 <html>
275 <head>
276 <title><? echo $eid ? "Edit" : "Add New" ?> <?php xl('Event','e');?></title>
277 <link rel=stylesheet href='<? echo $css_header ?>' type='text/css'>
279 <style>
280 td { font-size:10pt; }
281 </style>
283 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
284 <script type="text/javascript" src="../../../library/topdialog.js"></script>
285 <script type="text/javascript" src="../../../library/dialog.js"></script>
286 <script type="text/javascript" src="../../../library/textformat.js"></script>
287 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
288 <script type="text/javascript" src="../../../library/dynarch_calendar_en.js"></script>
289 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
291 <script language="JavaScript">
293 var mypcc = '<? echo $GLOBALS['phone_country_code'] ?>';
295 var durations = new Array();
296 // var rectypes = new Array();
298 // Read the event categories, generate their options list, and get
299 // the default event duration from them if this is a new event.
300 $catoptions = "";
301 $prefcat_options = " <option value='0'>-- None --</option>\n";
302 $thisduration = 0;
303 if ($eid) {
304 $thisduration = $row['pc_alldayevent'] ? 1440 : round($row['pc_duration'] / 60);
306 while ($crow = sqlFetchArray($cres)) {
307 $duration = round($crow['pc_duration'] / 60);
308 if ($crow['pc_end_all_day']) $duration = 1440;
309 echo " durations[" . $crow['pc_catid'] . "] = $duration\n";
310 // echo " rectypes[" . $crow['pc_catid'] . "] = " . $crow['pc_recurrtype'] . "\n";
311 $catoptions .= " <option value='" . $crow['pc_catid'] . "'";
312 if ($eid) {
313 if ($crow['pc_catid'] == $row['pc_catid']) $catoptions .= " selected";
314 } else {
315 if ($crow['pc_catid'] == $default_catid) {
316 $catoptions .= " selected";
317 $thisduration = $duration;
320 $catoptions .= ">" . $crow['pc_catname'] . "</option>\n";
322 // This section is to build the list of preferred categories:
323 if ($duration) {
324 $prefcat_options .= " <option value='" . $crow['pc_catid'] . "'";
325 if ($eid) {
326 if ($crow['pc_catid'] == $row['pc_prefcatid']) $prefcat_options .= " selected";
328 $prefcat_options .= ">" . $crow['pc_catname'] . "</option>\n";
334 // This is for callback by the find-patient popup.
335 function setpatient(pid, lname, fname, dob) {
336 var f = document.forms[0];
337 f.form_patient.value = lname + ', ' + fname;
338 f.form_pid.value = pid;
339 dobstyle = (dob == '' || dob.substr(5, 10) == '00-00') ? '' : 'none';
340 document.getElementById('dob_row').style.display = dobstyle;
343 // This invokes the find-patient popup.
344 function sel_patient() {
345 dlgopen('find_patient_popup.php', '_blank', 500, 400);
348 // Do whatever is needed when a new event category is selected.
349 // For now this means changing the event title and duration.
350 function set_display() {
351 var f = document.forms[0];
352 var s = f.form_category;
353 if (s.selectedIndex >= 0) {
354 var catid = s.options[s.selectedIndex].value;
355 var style_apptstatus = document.getElementById('title_apptstatus').style;
356 var style_prefcat = document.getElementById('title_prefcat').style;
357 if (catid == '2') { // In Office
358 style_apptstatus.display = 'none';
359 style_prefcat.display = '';
360 f.form_apptstatus.style.display = 'none';
361 f.form_prefcat.style.display = '';
362 } else {
363 style_prefcat.display = 'none';
364 style_apptstatus.display = '';
365 f.form_prefcat.style.display = 'none';
366 f.form_apptstatus.style.display = '';
371 // Do whatever is needed when a new event category is selected.
372 // For now this means changing the event title and duration.
373 function set_category() {
374 var f = document.forms[0];
375 var s = f.form_category;
376 if (s.selectedIndex >= 0) {
377 var catid = s.options[s.selectedIndex].value;
378 f.form_title.value = s.options[s.selectedIndex].text;
379 f.form_duration.value = durations[catid];
380 set_display();
384 // Modify some visual attributes when the all-day or timed-event
385 // radio buttons are clicked.
386 function set_allday() {
387 var f = document.forms[0];
388 var color1 = '#777777';
389 var color2 = '#777777';
390 var disabled2 = true;
391 if (document.getElementById('rballday1').checked) {
392 color1 = '#000000';
394 if (document.getElementById('rballday2').checked) {
395 color2 = '#000000';
396 disabled2 = false;
398 document.getElementById('tdallday1').style.color = color1;
399 document.getElementById('tdallday2').style.color = color2;
400 document.getElementById('tdallday3').style.color = color2;
401 document.getElementById('tdallday4').style.color = color2;
402 document.getElementById('tdallday5').style.color = color2;
403 f.form_hour.disabled = disabled2;
404 f.form_minute.disabled = disabled2;
405 f.form_ampm.disabled = disabled2;
406 f.form_duration.disabled = disabled2;
409 // Modify some visual attributes when the Repeat checkbox is clicked.
410 function set_repeat() {
411 var f = document.forms[0];
412 var isdisabled = true;
413 var mycolor = '#777777';
414 var myvisibility = 'hidden';
415 if (f.form_repeat.checked) {
416 isdisabled = false;
417 mycolor = '#000000';
418 myvisibility = 'visible';
420 f.form_repeat_type.disabled = isdisabled;
421 f.form_repeat_freq.disabled = isdisabled;
422 f.form_enddate.disabled = isdisabled;
423 document.getElementById('tdrepeat1').style.color = mycolor;
424 document.getElementById('tdrepeat2').style.color = mycolor;
425 document.getElementById('img_enddate').style.visibility = myvisibility;
428 // This is for callback by the find-available popup.
429 function setappt(year,mon,mday,hours,minutes) {
430 var f = document.forms[0];
431 f.form_date.value = '' + year + '-' +
432 ('' + (mon + 100)).substring(1) + '-' +
433 ('' + (mday + 100)).substring(1);
434 f.form_ampm.selectedIndex = (hours >= 12) ? 1 : 0;
435 f.form_hour.value = (hours > 12) ? hours - 12 : hours;
436 f.form_minute.value = ('' + (minutes + 100)).substring(1);
439 // Invoke the find-available popup.
440 function find_available() {
441 var s = document.forms[0].form_provider;
442 var c = document.forms[0].form_category;
443 dlgopen('find_appt_popup.php?providerid=' + s.options[s.selectedIndex].value +
444 '&catid=' + c.options[c.selectedIndex].value, '_blank', 500, 400);
447 // Check for errors when the form is submitted.
448 function validate() {
449 var f = document.forms[0];
450 if (f.form_repeat.checked &&
451 (! f.form_enddate.value || f.form_enddate.value < f.form_date.value)) {
452 alert('An end date later than the start date is required for repeated events!');
453 return false;
455 return true;
458 </script>
460 </head>
462 <body <?echo $top_bg_line;?> onunload='imclosing()'>
464 <form method='post' name='theform' action='add_edit_event.php?eid=<? echo $eid ?>'
465 onsubmit='return validate()'>
466 <center>
468 <table border='0' width='100%'>
470 <tr>
471 <td width='1%' nowrap>
472 <b><? xl('Category','e'); ?>:</b>
473 </td>
474 <td nowrap>
475 <select name='form_category' onchange='set_category()' style='width:100%'>
476 <? echo $catoptions ?>
477 </select>
478 </td>
479 <td width='1%' nowrap>
480 &nbsp;&nbsp;
481 <input type='radio' name='form_allday' onclick='set_allday()' value='1' id='rballday1'
482 <? if ($thisduration == 1440) echo "checked " ?>/>
483 </td>
484 <td colspan='2' nowrap id='tdallday1'>
485 <? xl('All day event','e'); ?>
486 </td>
487 </tr>
489 <tr>
490 <td nowrap>
491 <b><? xl('Date','e'); ?>:</b>
492 </td>
493 <td nowrap>
494 <input type='text' size='10' name='form_date' id='form_date'
495 value='<? echo $eid ? $row['pc_eventDate'] : $date ?>'
496 title='<?php xl('yyyy-mm-dd event date or starting date','e'); ?>'
497 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />
498 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
499 id='img_date' border='0' alt='[?]' style='cursor:pointer'
500 title='<?php xl('Click here to choose a date','e'); ?>'>
501 </td>
502 <td nowrap>
503 &nbsp;&nbsp;
504 <input type='radio' name='form_allday' onclick='set_allday()' value='0' id='rballday2'
505 <? if ($thisduration != 1440) echo "checked " ?>/>
506 </td>
507 <td width='1%' nowrap id='tdallday2'>
508 <? xl('Time','e'); ?>
509 </td>
510 <td width='1%' nowrap id='tdallday3'>
511 <input type='text' size='2' name='form_hour'
512 value='<? echo $starttimeh ?>'
513 title='<?php xl('Event start time','e'); ?>' /> :
514 <input type='text' size='2' name='form_minute'
515 value='<? echo $starttimem ?>'
516 title='<?php xl('Event start time','e'); ?>' />&nbsp;
517 <select name='form_ampm' title='Note: 12:00 noon is PM, not AM'>
518 <option value='1'><?php xl('AM','e'); ?></option>
519 <option value='2'<? if ($startampm == '2') echo " selected" ?>><?php xl('PM','e'); ?></option>
520 </select>
521 </td>
522 </tr>
524 <tr>
525 <td nowrap>
526 <b><? xl('Title','e'); ?>:</b>
527 </td>
528 <td nowrap>
529 <input type='text' size='10' name='form_title'
530 value='<? echo addslashes($row['pc_title']) ?>'
531 style='width:100%'
532 title='<?php xl('Event title','e'); ?>' />
533 </td>
534 <td nowrap>
535 &nbsp;
536 </td>
537 <td nowrap id='tdallday4'><? xl('duration','e'); ?>
538 </td>
539 <td nowrap id='tdallday5'>
540 <input type='text' size='4' name='form_duration' value='<? echo $thisduration ?>'
541 title='<?php xl('Event duration in minutes','e'); ?>' /> <? xl('minutes','e'); ?>
542 </td>
543 </tr>
545 <tr>
546 <td nowrap>
547 <b><? xl('Patient','e'); ?>:</b>
548 </td>
549 <td nowrap>
550 <input type='text' size='10' name='form_patient' style='width:100%'
551 value='<? echo $patientname ?>' onclick='sel_patient()'
552 title='<?php xl('Click to select patient','e'); ?>' readonly />
553 <input type='hidden' name='form_pid' value='<? echo $patientid ?>' />
554 </td>
555 <td colspan='3' nowrap style='font-size:8pt'>
556 &nbsp;<? echo $patienttitle ?>
557 </td>
558 </tr>
560 <tr>
561 <td nowrap>
562 <b><? xl('Provider','e'); ?>:</b>
563 </td>
564 <td nowrap>
565 <select name='form_provider' style='width:100%'>
567 while ($urow = sqlFetchArray($ures)) {
568 echo " <option value='" . $urow['id'] . "'";
569 if ($userid) {
570 if ($urow['id'] == $userid) echo " selected";
571 } else {
572 if ($urow['id'] == $_SESSION['authUserID']) echo " selected";
574 echo ">" . $urow['lname'];
575 if ($urow['fname']) echo ", " . $urow['fname'];
576 echo "</option>\n";
579 </select>
580 </td>
581 <td nowrap>
582 &nbsp;&nbsp;
583 <input type='checkbox' name='form_repeat' onclick='set_repeat(this)'
584 value='1'<? if ($repeats) echo " checked" ?>/>
585 </td>
586 <td nowrap id='tdrepeat1'><? xl('Repeats','e'); ?>
587 </td>
588 <td nowrap>
590 <select name='form_repeat_freq' title='Every, every other, every 3rd, etc.'>
592 foreach (array(1 => 'every', 2 => '2nd', 3 => '3rd', 4 => '4th', 5 => '5th', 6 => '6th')
593 as $key => $value)
595 echo " <option value='$key'";
596 if ($key == $repeatfreq) echo " selected";
597 echo ">$value</option>\n";
600 </select>
602 <select name='form_repeat_type'>
604 // See common.api.php for these:
605 foreach (array(0 => 'day' , 4 => 'workday', 1 => 'week', 2 => 'month', 3 => 'year')
606 as $key => $value)
608 echo " <option value='$key'";
609 if ($key == $repeattype) echo " selected";
610 echo ">$value</option>\n";
613 </select>
615 </td>
616 </tr>
618 <tr>
619 <td nowrap>
620 <span id='title_apptstatus'><b><? xl('Status','e'); ?>:</b></span>
621 <span id='title_prefcat' style='display:none'><b><? xl('Pref Cat','e'); ?>:</b></span>
622 </td>
623 <td nowrap>
625 <select name='form_apptstatus' style='width:100%' title='<?php xl('Appointment status','e'); ?>'>
627 foreach ($statuses as $key => $value) {
628 echo " <option value='$key'";
629 if ($key == $row['pc_apptstatus']) echo " selected";
630 echo ">" . htmlspecialchars($value) . "</option>\n";
633 </select>
634 <!--
635 The following list will be invisible unless this is an In Office
636 event, in which case form_apptstatus (above) is to be invisible.
638 <select name='form_prefcat' style='width:100%;display:none' title='<?php xl('Preferred Event Category','e');?>'>
639 <? echo $prefcat_options ?>
640 </select>
642 </td>
643 <td nowrap>
644 &nbsp;
645 </td>
646 <td nowrap id='tdrepeat2'><? xl('until','e'); ?>
647 </td>
648 <td nowrap>
649 <input type='text' size='10' name='form_enddate' id='form_enddate'
650 value='<? echo $row['pc_endDate'] ?>'
651 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
652 title='<?php xl('yyyy-mm-dd last date of this event','e');?>' />
653 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
654 id='img_enddate' border='0' alt='[?]' style='cursor:pointer'
655 title='<?php xl('Click here to choose a date','e');?>'>
656 </td>
657 </tr>
659 <tr>
660 <td nowrap>
661 <b><? xl('Comments','e'); ?>:</b>
662 </td>
663 <td colspan='4' nowrap>
664 <input type='text' size='40' name='form_comments' style='width:100%'
665 value='<? echo $hometext ?>'
666 title='<?php xl('Optional information about this event','e');?>' />
667 </td>
668 </tr>
670 <?php
671 // DOB is important for the clinic, so if it's missing give them a chance
672 // to enter it right here. We must display or hide this row dynamically
673 // in case the patient-select popup is used.
674 $patient_dob = trim($prow['DOB']);
675 $dobstyle = ($prow && (!$patient_dob || substr($patient_dob, 5) == '00-00')) ?
676 '' : 'none';
678 <tr id='dob_row' style='display:<?php echo $dobstyle ?>'>
679 <td colspan='4' nowrap>
680 <b><font color='red'><? xl('DOB is missing, please enter if possible','e'); ?>:</font></b>
681 </td>
682 <td nowrap>
683 <input type='text' size='10' name='form_dob' id='form_dob'
684 title='<?php xl('yyyy-mm-dd date of birth','e');?>'
685 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />
686 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
687 id='img_dob' border='0' alt='[?]' style='cursor:pointer'
688 title='<?php xl('Click here to choose a date','e');?>'>
689 </td>
690 </tr>
692 </table>
695 <input type='submit' name='form_save' value='<?php xl('Save','e');?>' />
696 &nbsp;
697 <input type='button' value='<?php xl('Find Available','e');?>' onclick='find_available()' />
698 &nbsp;
699 <input type='submit' name='form_delete' value='<?php xl('Delete','e');?>'<? if (!$eid) echo " disabled" ?> />
700 &nbsp;
701 <input type='button' value='<?php xl('Cancel','e');?>' onclick='window.close()' />
702 </p>
703 </center>
704 </form>
706 <script language='JavaScript'>
707 <? if ($eid) { ?>
708 set_display();
709 <? } else { ?>
710 set_category();
711 <? } ?>
712 set_allday();
713 set_repeat();
715 Calendar.setup({inputField:"form_date", ifFormat:"%Y-%m-%d", button:"img_date"});
716 Calendar.setup({inputField:"form_enddate", ifFormat:"%Y-%m-%d", button:"img_enddate"});
717 Calendar.setup({inputField:"form_dob", ifFormat:"%Y-%m-%d", button:"img_dob"});
718 </script>
720 </body>
721 </html>