- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / modules / laboratory / labor_test_request_aftersave.php
blobf810d39e907b697792748a25f4108f34d2d39418
1 <?php
2 error_reporting(E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR);
3 require('./roots.php');
4 require($root_path.'include/inc_environment_global.php');
5 /**
6 * CARE2X Integrated Hospital Information System Deployment 2.2 - 2006-07-10
7 * GNU General Public License
8 * Copyright 2002,2003,2004,2005,2006 Elpidio Latorilla
9 * elpidio@care2x.org,
11 * See the file "copy_notice.txt" for the licence notice
13 $lang_tables[] = 'departments.php';
14 $lang_tables[] = 'konsil.php';
15 define('LANG_FILE','lab.php');
16 /* We need to differentiate from where the user is coming:
17 * $user_origin != lab ; from patient charts folder
18 * $user_origin == lab ; from the laboratory
19 * and set the user cookie name and break or return filename
21 if($user_origin=='lab')
23 $local_user='ck_lab_user';
24 if($target=='radio') $breakfile=$root_path.'modules/radiology/radiolog.php'.URL_APPEND;
25 else $breakfile=$root_path.'modules/laboratory/labor.php'.URL_APPEND;
27 else
29 $local_user='ck_pflege_user';
30 $breakfile=$root_path.'modules/nursing/nursing-station-patientdaten.php'.URL_APPEND.'&pn='.$pn.'&station='.$station.'&edit='.$edit.'&user_origin='.$user_origin;
33 require_once($root_path.'include/inc_front_chain_lang.php');
35 /**
36 * LOAD Smarty
39 # Note: it is advisable to load this after the inc_front_chain_lang.php so
40 # that the smarty script can use the user configured template theme
41 require_once($root_path.'gui/smarty_template/smarty_care.class.php');
42 $smarty = new smarty_care('nursing');
44 $thisfile=basename(__FILE__);
46 $db_request_table=$target;
48 //$db->debug=1;
50 /* Check for the patietn number = $pn. If available get the patients data, */
51 if(isset($pn)&&$pn) {
52 include_once($root_path.'include/care_api_classes/class_encounter.php');
53 $enc_obj=new Encounter;
55 if($enc_obj->loadEncounterData($pn)){
56 $edit=true;
57 include_once($root_path.'include/care_api_classes/class_globalconfig.php');
58 $GLOBAL_CONFIG=array();
59 $glob_obj=new GlobalConfig($GLOBAL_CONFIG);
60 $glob_obj->getConfig('patient_%');
61 switch ($enc_obj->EncounterClass())
63 case '1': $full_en = ($pn + $GLOBAL_CONFIG['patient_inpatient_nr_adder']);
64 break;
65 case '2': $full_en = ($pn + $GLOBAL_CONFIG['patient_outpatient_nr_adder']);
66 break;
67 default: $full_en = ($pn + $GLOBAL_CONFIG['patient_inpatient_nr_adder']);
69 $HTTP_SESSION_VARS['sess_en']=$pn;
70 $HTTP_SESSION_VARS['sess_full_en']=$full_en;
74 /* Here begins the real work */
75 require_once($root_path.'include/inc_date_format_functions.php');
78 if(!isset($mode)) $mode='';
80 if($enc_obj->is_loaded)
83 $sql="SELECT * FROM care_test_request_".$db_request_table." WHERE batch_nr='".$batch_nr."'";
84 if($ergebnis=$db->Execute($sql))
86 if($editable_rows=$ergebnis->RecordCount())
89 $stored_request=$ergebnis->FetchRow();
90 if($target=='baclabor')
92 parse_str($stored_request['material'],$stored_material);
93 parse_str($stored_request['test_type'],$stored_test_type);
95 elseif($target=='chemlabor')
97 if($stored_request['parameters']!='') parse_str($stored_request['parameters'],$stored_param);
99 $read_form=1;
100 $printmode=1;
103 else
105 echo "<p>$sql<p>$LDDbNoRead";
109 # Detect the type of form
110 # $bgc1 = The main background color of the form
112 switch($target){
113 case 'radio':
114 $formtitle = $LDRadiology;
115 $bgc1='#ffffff';
116 break;
117 case 'generic':
118 include_once($root_path.'include/care_api_classes/class_department.php');
119 $dept_obj=new Department;
120 if($dept_obj->preloadDept($stored_request['testing_dept'])){
121 $buffer=$dept_obj->LDvar();
122 if(isset($$buffer)&&!empty($$buffer)) $formtitle=$$buffer;
123 else $formtitle=$dept_obj->FormalName();
125 $bgc1='#bbdbc4';
126 break;
127 case 'chemlabor':
128 $formtitle = $LDChemicallaboratory;
129 $bgc1='#fff3f3';
130 if(file_exists($root_path.'language/'.$lang.'/lang_'.$lang.'_konsil_chemlabor.php')){
131 include_once($root_path.'language/'.$lang.'/lang_'.$lang.'_konsil_chemlabor.php');
132 }else{
133 include_once($root_path.'language/en/lang_en_konsil_chemlabor.php');
135 break;
136 case 'baclabor':
137 $formtitle = $LDBacteriologicalLaboratory;
138 $bgc1='#fff3f3';
139 break;
140 case 'blood':
141 $formtitle = $LDBloodBank;
142 $bgc1='#99ffcc';
143 break;
144 case 'patho':
145 $formtitle = $LDPathology;
146 $bgc1='#cde1ec';
147 break;
148 default: $bgc1='#ffffff';
152 # Start the smarty templating
155 * HEAD META definition
157 $smarty->assign('setCharSet',setCharSet());
160 * Toolbar
163 if(!isset($edit) || empty($edit)) $smarty->assign('edit',FALSE);
165 # Set it to be purely printout
166 $smarty->assign('printmode',TRUE);
168 # Added for the html tag direction
169 $smarty->assign('HTMLtag',html_ret_rtl($lang));
171 # Set colors
172 $smarty->assign('top_txtcolor',$cfg['top_txtcolor']);
173 $smarty->assign('top_bgcolor',$cfg['top_bgcolor']);
174 $smarty->assign('body_bgcolor',$cfg['body_bgcolor']);
175 $smarty->assign('body_txtcolor',$cfg['body_txtcolor']);
176 $smarty->assign('bgc1',$bgc1);
178 $smarty->assign('gifHilfeR',createLDImgSrc($root_path,'hilfe-r.gif','0') );
179 $smarty->assign('LDCloseAlt',$LDCloseAlt );
180 $smarty->assign('gifClose2',createLDImgSrc($root_path,'close2.gif','0') );
182 # Added for the common header top block
184 $smarty->assign('sToolbarTitle',"$LDTestRequest :: $formtitle");
186 $smarty->assign('pbBack','javascript:window.history.back()');
187 $smarty->assign('gifBack2',createLDImgSrc($root_path,'back2.gif','0') );
189 # Added for the common header top block
190 $smarty->assign('pbHelp','javascript:gethelp(\'request_aftersave.php\')');
192 $smarty->assign('breakfile',$breakfile);
194 if($cfg['dhtml']) {
195 $smarty->assign('dhtml','style="filter:alpha(opacity=70)" onMouseover="hilite(this,1)" onMouseOut="hilite(this,0)"');
196 } else {
197 $smarty->assign('dhtml','');
201 # Window bar title
202 $smarty->assign('title',$LDTestRequest);
203 $smarty->assign('Name',$station);
207 if($target=='baclabor'){
209 $smarty->assign('css_lab','.lab {font-family: arial; font-size: 9; color:#ee6666;}');
211 }else{
213 $smarty->assign('css_lab','.lab {font-family: arial; font-size: 9; color:purple;}');
218 * collect JavaScript for Smarty
221 ob_start();
225 <script language="javascript">
226 <!--
227 function printOut()
229 urlholder="labor_test_request_printpop.php?sid=<?php echo $sid ?>&lang=<?php echo $lang ?>&user_origin=<?php echo $user_origin ?>&subtarget=<?php echo $target ?>&batch_nr=<?php echo $batch_nr ?>&pn=<?php echo $pn ?>";
230 testprintout<?php echo $sid ?>=window.open(urlholder,"testprintout<?php echo $sid ?>","width=800,height=600,menubar=no,resizable=yes,scrollbars=yes");
231 //testprintout<?php echo $sid ?>.print();
233 // -->
234 </script>
235 <?php
236 require($root_path.'include/inc_js_gethelp.php');
237 require($root_path.'include/inc_css_a_hilitebu.php');
239 $sTemp = ob_get_contents();
240 ob_end_clean();
241 $smarty->assign('JavaScript',$sTemp);
243 $smarty->assign('gifMascot','<img '.createMascot($root_path,'mascot1_r.gif','0','absmiddle').'>');
245 if($status=="draft") $smarty->assign('sAfterSavePrompt',$LDFormSaved[$saved]);
246 else $smarty->assign('sAfterSavePrompt',$LDRequestSent[$saved]);
248 $smarty->assign('LDWhatToDo',$LDWhatToDo);
249 $smarty->assign('pbPrintOut','javascript:printOut()');
250 $smarty->assign('gifGrnArrow','<img '.createComIcon($root_path,'bul_arrowgrnsm.gif','0','absmiddle',TRUE).'>');
251 $smarty->assign('LDPrintForm',$LDPrintForm);
252 $smarty->assign('pbEditForm',$root_path."modules/nursing/nursing-station-patientdaten-doconsil-".$target.".php".URL_APPEND."&pn=$pn&edit=$edit&station=$station&target=$target&dept_nr=$dept_nr&user_origin=$user_origin&noresize=$noresize&mode=edit&batch_nr=$batch_nr");
253 $smarty->assign('LDEditForm',$LDEditForm);
254 $smarty->assign('pbNewSamePatient',$root_path."modules/nursing/nursing-station-patientdaten-doconsil-".$target.".php".URL_APPEND."&pn=$pn&edit=$edit&station=$station&target=$target&dept_nr=$dept_nr&user_origin=$user_origin&noresize=$noresize&mode=");
255 $smarty->assign('LDNewFormSamePatient',$LDNewFormSamePatient);
257 if($user_origin=='lab'){
258 $smarty->assign('user_origin_lab',TRUE);
259 $smarty->assign('pbNewForm',$root_path."modules/nursing/nursing-station-patientdaten-doconsil-".$target.".php".URL_APPEND."&edit=0&station=$station&target=$target&dept_nr=$dept_nr&user_origin=$user_origin&noresize=$noresize");
260 $smarty->assign('LDNewFormOtherPatient',$LDNewFormOtherPatient);
263 $smarty->assign('breakfile',$breakfile);
264 $smarty->assign('LDEndTestRequest',$LDEndTestRequest);
266 require_once($root_path.'include/inc_test_request_printout_fx.php');
268 /* Load the form for printing out
269 * This is a hybrid compromise as long as not all forms are converted to smarty
270 * templates. In this case, when the form is pathology, the smarty assignments are done
271 * otherwise the output is buffered
273 $edit=0;
274 if($target=='patho'){
276 $smarty->assign('patho',TRUE);
277 include($root_path.'include/inc_test_request_printout_patho.php');
279 }else{
281 # Collect output buffer
282 ob_start();
283 if($target=='baclabor'){
284 include($root_path.'include/inc_test_findings_form_baclabor.php');
285 }else{
286 include($root_path.'include/inc_test_request_printout_'.$target.'.php');
288 $sTemp = ob_get_contents();
289 ob_end_clean();
290 $smarty->assign('printout_form',$sTemp);
294 * show Copyright
295 * managed in smarty_care.class.php
298 $smarty->assign('sCopyright',$smarty->Copyright());
299 $smarty->assign('sPageTime',$smarty->Pagetime());
302 * show Template
305 $smarty->display('laboratory/request_aftersave.tpl');
306 // $smarty->display('debug.tpl');