".__("You must select a patient.")."

".__("Select a Patient")."

"; template_display(); } // end checking for patient //------HIPAA Logging $user_to_log=$_SESSION['authdata']['user']; if((LOGLEVEL<1)||LOG_HIPAA){syslog(LOG_INFO,"manageappointment.php|user $user_to_log accesses patient $patient");} switch ($action) { case "del": $page_title = __("Deleting Appointment"); $display_buffer .= "\n".__("Deleting")." ... \n"; $query = "DELETE FROM scheduler WHERE id='".addslashes($id)."'"; $result = $sql->query ($query); if ($result) { $display_buffer .= __("done")."."; } else { $display_buffer .= __("ERROR"); } $display_buffer .= "

\n".template::link_bar(array( __("Manage Appointments") => "$page_name?action=view&patient=$patient", __("Manage Patient") => "manage.php?id=$patient" )). "

\n"; // By default, we return to patient emr view $refresh = "manage.php?id=".urlencode($patient); break; // end delete appointment section default: // default action is to view appointments // grab patient information $this_patient = CreateObject('FreeMED.Patient', $patient); // display top of the box $page_title = __("Manage Appointments"); $display_buffer .= freemed::patient_box($this_patient). "

\n".template::link_bar(array( __("Book Appointment") => "book_appointment.php?patient=$patient&type=pat", __("Manage Patient") => "manage.php?id=$patient" ))."

\n"; // form the query $query = "SELECT * FROM scheduler WHERE ( (caldateof >= '".addslashes($cur_date)."' ) AND (calpatient = '".addslashes($patient)."' ) AND (caltype = 'pat' ) ) ORDER BY caldateof, calhour, calminute"; // submit the query $result = $sql->query ($query); // check for results if (!$sql->results($result)) { $display_buffer .= "

".__("This patient has no appointments.")."
". "

\n".template::link_bar(array( __("Book Appointment") => "book_appointment.php?patient=$patient&type=pat", __("Manage Patient") => "manage.php?id=$patient" ))."

\n"; } else { // if there are results... // first display the top of the table $bar_start_color = "cell"; $bar_alt_color = "cell_alt"; $display_buffer .= " "; // loop for all occurances in calendar db while ($r = $sql->fetch_array ($result)) { extract ($r); $calprenote = htmlentities (stripslashes ( substr ($r["calprenote"],0,50) ) ). ( (strlen($r["calprenote"])>50) ? "... " : "" ); // calculate durational hours & minutes $hours = (int) ($calduration / 60); $minutes = (int) ($calduration % 60); if ($calminute==0) $calminute="0"; // put together location name if (($calroom != 0) and ($calfacility != 0)) { $location = freemed::get_link_field ($calroom, "room", "roomname")." (". freemed::get_link_field ($calfacility, "facility", "psrname").")"; } elseif (($calroom != 0) and ($calfacility == 0)) { $location = freemed::get_link_field ($calroom, "room", "roomname"); } else { $location = __("NONE SELECTED"); } // end of location putting together if (($minutes+0)==0) $minutes="00"; // fix for 0 not 00 if (($calminute+0)==0) $calminute="00"; // same as above if (($calcptcode+0)==0) $calcptcode="".__("NONE SELECTED").""; // actual display $display_buffer .= " "; } // end loop for all occurances (while) // bottom of the table $display_buffer .= "
".__("Date")." ".__("Time/Duration")." ".__("Location")." ".__("Note")." ".__("CPT Code")." ".__("Action")."
$caldateof ".$scheduler->display_time( $calhour,$calminute)."
(".$hours."h ".$minutes."m)
".( !empty($location) ? $location : " " )." ".( !empty($calprenote) ? $calprenote : " " )." $calcptcode ".__("Move")." ".__("Delete")."
". "

\n".template::link_bar(array( __("Book Appointment") => "book_appointment.php?patient=$patient&type=pat", __("Manage Patient") => "manage.php?id=$patient" ))."

\n"; } // end checking for results (if) break; } // end master switch //----- Display template template_display(); ?>