2 //error_reporting(E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR);
3 require('./roots.php');
4 require($root_path.'include/inc_environment_global.php');
6 * CARE2X Integrated Hospital Information System beta 2.0.1 - 2004-07-04
7 * GNU General Public License
8 * Copyright 2002,2003,2004,2005,2006 Elpidio Latorilla
11 * See the file "copy_notice.txt" for the licence notice
13 $thisfile=basename(__FILE__
);
14 require_once($root_path.'include/care_api_classes/class_appointment.php');
15 $obj=new Appointment();
18 $bPastDateError = FALSE;
21 # Save PID to session. Patch as result of bug report from Francesco and Marco.
23 if((!isset($pid)||
!$pid)&&$HTTP_SESSION_VARS['sess_pid']) $pid=$HTTP_SESSION_VARS['sess_pid'];
24 elseif(isset($pid)&&$pid) $HTTP_SESSION_VARS['sess_pid']=$pid;
31 # Validate date against past date
33 if($mode=='create'||
$mode=='update') {
34 include_once($root_path.'include/inc_date_format_functions.php');
35 $HTTP_POST_VARS['date']=@formatDate2STD
($HTTP_POST_VARS['date'],$date_format);
36 $sBufDate = (int) str_replace('-','',$HTTP_POST_VARS['date']);
37 $sBufToday = (int) date('Ymd');
38 $sBufDate = ($sBufDate - $sBufToday);
40 # If date in the past, force mode to "select" and erase date data
43 $bPastDateError = TRUE;
49 if($mode=='create'||
$mode=='update') {
51 $HTTP_POST_VARS['time']=@convertTimeToStandard
($HTTP_POST_VARS['time']);
53 if(!isset($HTTP_POST_VARS['remind_mail'])) $HTTP_POST_VARS['remind_mail']='0';
54 if(!isset($HTTP_POST_VARS['remind_email'])) $HTTP_POST_VARS['remind_email']='0';
55 if(!isset($HTTP_POST_VARS['remind_phone'])) $HTTP_POST_VARS['remind_phone']='0';
56 $HTTP_POST_VARS['modify_id']=$HTTP_SESSION_VARS['sess_user_name'];
57 $HTTP_POST_VARS['modify_time'] = date('YmdHis');
58 $HTTP_POST_VARS['history']= $obj->ConcatHistory("Update: ".date('Y-m-d H:i:s')." : ".$HTTP_SESSION_VARS['sess_user_name']."\n");
60 $HTTP_POST_VARS['appt_status']='pending';
61 $HTTP_POST_VARS['create_id']=$HTTP_SESSION_VARS['sess_user_name'];
62 $HTTP_POST_VARS['create_time'] = date('YmdHis');
63 $HTTP_POST_VARS['history'] = "Created: ".date('Y-m-d H:i:s')." ".$HTTP_SESSION_VARS['sess_user_name']."\n";
65 include('./include/save_admission_data.inc.php');
66 }elseif(($mode=='select')&&!empty($nr)){
67 $appt_row=$obj->getAppointment($nr);
68 if(is_array($appt_row)){
70 //while(list($x,$v)=each($appt_row)) $$x=$v;
72 }elseif($mode=='appt_cancel'&&!empty($nr)){
73 $HTTP_POST_VARS['history']=$obj->ConcatHistory("Cancel: ".date('Y-m-d H:i:s')." : ".$HTTP_SESSION_VARS['sess_user_name']."\n");
74 $HTTP_POST_VARS['appt_status']='cancelled';
75 $HTTP_POST_VARS['cancel_reason']=$reason;
76 $HTTP_POST_VARS['modify_id']=$HTTP_SESSION_VARS['sess_user_name'];
77 $HTTP_POST_VARS['modify_time'] = date('YmdHis');
79 include('./include/save_admission_data.inc.php');
83 $lang_tables=array('prompt.php','departments.php');
84 require('./include/init_show.php');
86 if($result=&$obj->getPersonsAppointmentsObj($pid)){
87 $rows=$result->RecordCount();
90 # Load the encounter classes
91 require_once($root_path.'include/care_api_classes/class_encounter.php');
92 $enc_obj=new Encounter
;
94 /* Get all encounter classes */
95 $encounter_classes=&$enc_obj->AllEncounterClassesObject();
97 $subtitle=$LDAppointments;
98 $HTTP_SESSION_VARS['sess_file_return']=$thisfile;
100 /* Load departments */
101 require_once($root_path.'include/care_api_classes/class_department.php');
102 $dept_obj=new Department
;
103 $deptarray=$dept_obj->getAllMedical('name_formal');
105 $buffer=str_replace('~tag~',$title.' '.$name_last,$LDNoRecordYet);
106 $norecordyet=str_replace('~obj~',strtolower($subtitle),$buffer);
109 require('./gui_bridge/default/gui_show.php');