- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / modules / registration_admission / gui_bridge / default / gui_show_notes.php
blob4434f645946aa776fd6ee35b2d9a97a371a32a54
1 <?php
3 # Resolve href for return button
5 if(isset($HTTP_SESSION_VARS['sess_file_return'])&&!empty($HTTP_SESSION_VARS['sess_file_return']))
6 $returnfile=$HTTP_SESSION_VARS['sess_file_return'];
7 else $returnfile=$top_dir.'show_appointment.php';
9 # Patch 2003-11-20
10 if($parent_admit){
11 $retbuf='&encounter_nr='.$HTTP_SESSION_VARS['sess_full_en'];
12 $sTitleNr =($HTTP_SESSION_VARS['sess_full_en']);
13 }else{
14 $retbuf='&pid='.$HTTP_SESSION_VARS['sess_pid'];
15 $sTitleNr =($HTTP_SESSION_VARS['sess_full_pid']);
18 # Resolve href for close button
20 if($HTTP_COOKIE_VARS["ck_login_logged".$sid]) $breakfilen = $root_path."main/startframe.php".URL_APPEND;
21 else $breakfile = $breakfile.URL_APPEND."&target=entry";
23 # Start Smarty templating here
24 /**
25 * LOAD Smarty
27 # Note: it is advisable to load this after the inc_front_chain_lang.php so
28 # that the smarty script can use the user configured template theme
30 require_once($root_path.'gui/smarty_template/smarty_care.class.php');
31 $smarty = new smarty_care('common');
33 # Title in the toolbar
34 $smarty->assign('sToolbarTitle',"$page_title ($sTitleNr)");
36 $smarty->assign('breakfile',$breakfile);
38 # Window bar title
39 $smarty->assign('title',"$page_title ($sTitleNr)");
41 # href for help button
42 $smarty->assign('pbHelp',"javascript:gethelp('notes_router.php','$notestype','".strtr($subtitle,' ','+')."','$mode','$rows')");
44 # Onload Javascript code
45 $smarty->assign('sOnLoadJs','onLoad="if (window.focus) window.focus();"');
47 # href for the return button
48 $smarty->assign('pbBack',$returnfile.URL_APPEND.$retbuf.'&target='.$target.'&mode=show&type_nr='.$type_nr);
50 /**
51 * Helper function to generate rows
53 function createTR($ld_text, $input_val, $colspan = 1)
55 global $toggle, $root_path;
58 <tr>
59 <td bgColor="#eeeeee" ><FONT SIZE=-1 FACE="Arial,verdana,sans serif"><?php echo $ld_text ?>:
60 </td>
61 <td colspan=<?php echo $colspan; ?> bgcolor="#ffffee"><FONT SIZE=-1 FACE="Arial,verdana,sans serif"><?php echo $input_val; ?>
62 </td>
63 </tr>
65 <?php
66 $toggle=!$toggle;
70 # Collect extra javascript code
72 ob_start();
76 <script language="javascript">
77 <!--
79 function popRecordHistory(table,pid) {
80 urlholder="./record_history.php<?php echo URL_REDIRECT_APPEND; ?>&table="+table+"&pid="+pid;
81 HISTWIN<?php echo $sid ?>=window.open(urlholder,"histwin<?php echo $sid ?>","menubar=no,width=400,height=550,resizable=yes,scrollbars=yes");
83 function popNotesDetails(n,t) {
84 urlholder="./show_notes_details.php<?php echo URL_REDIRECT_APPEND; ?>&nr="+n+"&title="+t+"&ln=<?php echo $name_last ?>&fn=<?php echo $name_first ?>&bd=<?php echo $date_birth ?>";
85 HISTWIN<?php echo $sid ?>=window.open(urlholder,"histwin<?php echo $sid ?>","menubar=no,width=400,height=550,resizable=yes,scrollbars=yes");
88 <?php require($root_path.'include/inc_checkdate_lang.php'); ?>
90 -->
91 </script>
92 <?php
93 //gjergji : new calendar
94 require_once ('../../js/jscalendar/calendar.php');
95 $calendar = new DHTML_Calendar('../../js/jscalendar/', $lang, 'calendar-system', true);
96 $calendar->load_files();
97 //end : gjergji
100 if($parent_admit) include($root_path.'include/inc_js_barcode_wristband_popwin.php');
102 $sTemp = ob_get_contents();
104 ob_end_clean();
106 $smarty->append('JavaScript',$sTemp);
108 /* Load the tabs */
109 if($parent_admit) {
110 $tab_bot_line='#66ee66';
111 include('./gui_bridge/default/gui_tabs_patadmit.php');
112 $smarty->assign('sTabsFile','registration_admission/admit_tabs.tpl');
113 $smarty->assign('sClassItem','class="adm_item"');
114 $smarty->assign('sClassInput','class="adm_input"');
115 }else{
116 $tab_bot_line='#66ee66';
117 include('./gui_bridge/default/gui_tabs_patreg.php');
118 $smarty->assign('sTabsFile','registration_admission/reg_tabs.tpl');
119 $smarty->assign('sClassItem','class="reg_item"');
120 $smarty->assign('sClassInput','class="reg_input"');
123 # If encounter is already discharged, show warning
125 if($parent_admit&&$is_discharged){
127 $smarty->assign('is_discharged',TRUE);
128 $smarty->assign('sWarnIcon',"<img ".createComIcon($root_path,'warn.gif','0','absmiddle').">");
129 if($current_encounter) $smarty->assign('sDischarged',$LDEncounterClosed);
130 else $smarty->assign('sDischarged',$LDPatientIsDischarged);
133 if($parent_admit) $smarty->assign('LDCaseNr',$LDAdmitNr);
134 else $smarty->assign('LDCaseNr',$LDRegistrationNr);
136 if($parent_admit) $smarty->assign('sEncNrPID',$HTTP_SESSION_VARS['sess_full_en']);
137 else $smarty->assign('sEncNrPID',$HTTP_SESSION_VARS['sess_full_pid']);
139 $smarty->assign('img_source',"<img $img_source>");
141 $smarty->assign('LDTitle',$LDTitle);
142 $smarty->assign('title',$title);
143 $smarty->assign('LDLastName',$LDLastName);
144 $smarty->assign('name_last',$name_last);
145 $smarty->assign('LDFirstName',$LDFirstName);
146 $smarty->assign('name_first',$name_first);
148 # If person is dead show a black cross and assign death date
150 if($death_date && $death_date != DBF_NODATE){
151 $smarty->assign('sCrossImg','<img '.createComIcon($root_path,'blackcross_sm.gif','0').'>');
152 $smarty->assign('sDeathDate',@formatDate2Local($death_date,$date_format));
155 # Set a row span counter, initialize with 7
156 $iRowSpan = 7;
158 if($GLOBAL_CONFIG['patient_name_2_show']&&$name_2){
159 $smarty->assign('LDName2',$LDName2);
160 $smarty->assign('name_2',$name_2);
161 $iRowSpan++;
164 if($GLOBAL_CONFIG['patient_name_3_show']&&$name_3){
165 $smarty->assign('LDName3',$LDName3);
166 $smarty->assign('name_3',$name_3);
167 $iRowSpan++;
170 if($GLOBAL_CONFIG['patient_name_middle_show']&&$name_middle){
171 $smarty->assign('LDNameMid',$LDNameMid);
172 $smarty->assign('name_middle',$name_middle);
173 $iRowSpan++;
176 $smarty->assign('sRowSpan',"rowspan=\"$iRowSpan\"");
178 $smarty->assign('LDBday',$LDBday);
179 $smarty->assign('sBdayDate',@formatDate2Local($date_birth,$date_format));
181 $smarty->assign('LDSex',$LDSex);
182 if($sex=='m') $smarty->assign('sSexType',$LDMale);
183 elseif($sex=='f') $smarty->assign('sSexType',$LDFemale);
185 $smarty->assign('LDBloodGroup',$LDBloodGroup);
186 if($blood_group){
187 $buf='LD'.$blood_group;
188 $smarty->assign('blood_group',$$buf);
191 # Assign common element names
193 $smarty->assign('LDDate',$LDDate);
194 $smarty->assign('LDBy',$LDBy);
197 # If mode is to show the data
199 if($mode=='show'){
200 if($rows){
201 if($parent_admit) $bgimg='tableHeaderbg3.gif';
202 else $bgimg='tableHeader_gr.gif';
203 $tbg= 'background="'.$root_path.'gui/img/common/'.$theme_com_icon.'/'.$bgimg.'"';
205 $smarty->assign('subtitle',$subtitle);
206 $smarty->assign('LDDetails',$LDDetails);
208 if(!$parent_admit){
209 $smarty->assign('parent_admit',TRUE);
210 $smarty->assign('LDEncounterNr',$LDEncounterNr);
213 # Start displaying the data in a list using the "report_row.tpl" template
215 $toggle=0;
216 $sRows = '';
218 while($row=$result->FetchRow()){
219 if($toggle){
220 $sRowClass = 'class="wardlistrow2"';
221 }else{
222 $sRowClass = 'class="wardlistrow1"';
224 $toggle=!$toggle;
226 $smarty->assign('sRowClass',$sRowClass);
228 if(!empty($row['date'])) $smarty->assign('sDate',@formatDate2Local($row['date'],$date_format));
230 $sTemp = '';
232 if(!empty($row['notes'])) $sTemp = hilite(substr($row['notes'],0,$GLOBAL_CONFIG['notes_preview_maxlen']));
233 if (strlen($row['notes']) > $GLOBAL_CONFIG['notes_preview_maxlen']) $sTemp = $sTemp.' [...]';
234 $sTemp = $sTemp.'<br>';
235 if(!empty($row['short_notes'])) $sTemp = $sTemp.'[ '.hilite($row['short_notes']).' ]';
236 $smarty->assign('sPreview',$sTemp);
238 # Link to pdf generator
239 $topdf= '<a href="'.$root_path.'modules/pdfmaker/emr_generic/report.php'.URL_APPEND.'&enc='.$row['encounter_nr'].'&recnr='.$row['nr'].'&type_nr='.$this_type['nr'].'&LD_var='.$this_type['LD_var'].'" target=_blank><img '.createComIcon($root_path,'pdf_icon.gif','0','',TRUE).'></a>';
241 if (strlen($row['notes']) > $GLOBAL_CONFIG['notes_preview_maxlen']){
242 $smarty->assign('sDetails','<a href="javascript:popNotesDetails(\''.$row['nr'].'\',\''.strtr($subtitle,"' ","´+").'\',\''.$this_type['LD_var'].'\')"><img '.createComIcon($root_path,'info3.gif','0','',TRUE).'></a>');
244 $smarty->assign('sMakePdf',$topdf);
245 }elseif(!empty($row['notes'])){
246 $smarty->assign('sMakePdf',$topdf);
249 if($row['personell_name']) $smarty->assign('sAuthor',$row['personell_name']);
251 if(!$parent_admit){
252 $smarty->assign('sEncNr','<a href="aufnahme_daten_zeigen.php'.URL_APPEND.'&encounter_nr='.$row['encounter_nr'].'&origin=patreg_reg">'.$row['encounter_nr'].'</a>');
254 # buffer the row and assign to array
255 ob_start();
256 $smarty->display('registration_admission/report_row.tpl');
257 $sRows = $sRows.ob_get_contents();
258 ob_end_clean();
260 $smarty->assign('sReportRows',$sRows);
261 }else{
263 # Else prompt no data available yet.
265 $smarty->assign('bShowNoRecord',TRUE);
266 $smarty->assign('sMascotImg','<img '.createMascot($root_path,'mascot1_r.gif','0','absmiddle').'>');
267 $smarty->assign('norecordyet',$norecordyet);
268 } // end of if $rows
270 }else{
272 # Else, mode is new data entry. Show the entry form
274 $smarty->assign('bShowEntryForm',TRUE);
275 $smarty->assign('bSetAsForm',TRUE);
277 # collect Javascript for the form
279 ob_start();
283 <script language="JavaScript">
284 <!-- Script Begin
285 function chkform(d) {
286 if(d.date.value==""){
287 alert("<?php echo $LDPlsEnterDate; ?>");
288 d.date.focus();
289 return false;
290 }else if(d.notes.value==""){
291 alert("<?php echo $LDPlsEnterReport; ?>");
292 d.notes.focus();
293 return false;
294 }else if(d.personell_name.value==""){
295 alert("<?php echo $LDPlsEnterFullName; ?>");
296 d.personell_name.focus();
297 return false;
298 }else{
299 return true;
302 // Script End -->
303 </script>
307 $sTemp = ob_get_contents();
308 ob_end_clean();
310 $smarty->assign('sFormJavaScript',$sTemp);
312 //gjergji : new calendar
313 $smarty->assign('sDateMiniCalendar',$calendar->show_calendar($calendar,$date_format,'date'));
314 //end : gjergji
316 $smarty->assign('LDNotes',$LDApplication.' '.$LDNotes);
317 $smarty->assign('sNotesInput','<textarea name="notes" cols=40 rows=8 wrap="virtual"></textarea>');
318 $smarty->assign('LDShortNotes',$LDShortNotes);
319 $smarty->assign('sShortNotesInput','<input type="text" name="short_notes" size=50 maxlength=25>');
320 $smarty->assign('LDSendCopyTo',$LDSendCopyTo);
321 $smarty->assign('sSendCopyInput','<input type="text" name="send_to_name" size=50 maxlength=60>');
323 $smarty->assign('sAuthorInput','<input type="text" name="personell_name" size=50 maxlength=60 value="'.$HTTP_SESSION_VARS['sess_user_name'].'" readonly>');
326 $sTemp = '<input type="hidden" name="encounter_nr" value="'.$HTTP_SESSION_VARS['sess_en'].'">
327 <input type="hidden" name="pid" value="'.$HTTP_SESSION_VARS['sess_pid'].'">
328 <input type="hidden" name="modify_id" value="'.$HTTP_SESSION_VARS['sess_user_name'].'">
329 <input type="hidden" name="create_id" value="'.$HTTP_SESSION_VARS['sess_user_name'].'">
330 <input type="hidden" name="create_time" value="null">
331 <input type="hidden" name="mode" value="create">
332 <input type="hidden" name="personell_nr">
333 <input type="hidden" name="send_to_pid">
334 <input type="hidden" name="type_nr" value="'.$type_nr.'">
335 <input type="hidden" name="target" value="'.$target.'">
336 <input type="hidden" name="history" value="Created: '.date('Y-m-d H:i:s').' : '.$HTTP_SESSION_VARS['sess_user_name']."\n".'">';
338 $smarty->assign('sHiddenInputs',$sTemp);
340 $smarty->assign('pbSubmit','<input type="image" '.createLDImgSrc($root_path,'savedisc.gif','0').'>');
342 } // End of if mode
344 $smarty->assign('sBackIcon','<img '.createComIcon($root_path,'l-arrowgrnlrg.gif','0','absmiddle').'>');
346 if($parent_admit) $buf='&encounter_nr='.$HTTP_SESSION_VARS['sess_full_en'];
347 else $buf='&pid='.$HTTP_SESSION_VARS['sess_full_pid'];
349 $smarty->assign('sBackLink','<a href="'.$returnfile.URL_APPEND.$buf.'&target='.$target.'&mode=show&type_nr='.$type_nr.'">'.$LDBackToOptions.'</a>');
351 # Type nr 3 = discharge summary/notes
352 # Type nr 99 = auxilliary notes
354 if($parent_admit&&(!$is_discharged||$type_nr==3||$type_nr==99)) {
356 $smarty->assign('sNewRecIcon','<img '.createComIcon($root_path,'bul_arrowgrnlrg.gif','0','absmiddle').'>');
357 $smarty->assign('sNewRecLink','<a href="'.$thisfile.URL_APPEND.'&pid='.$HTTP_SESSION_VARS['sess_pid'].'&target='.$target.'&mode=new&type_nr='.$type_nr.'">'.$LDEnterNewRecord.'</a>');
360 // Buffer the options table
362 ob_start();
365 <!- Column for the options table -->
366 <!-- Load the options table -->
368 <div class="vi_data">
369 <img <?php echo createComIcon($root_path,'angle_left_s.gif',0); ?>>
370 <br>
371 <?php echo "$LDNotes $LDAndSym $LDReports $LDTypes" ?>
372 </div>
374 <!-- Reports/Notes types table -->
376 <TABLE cellSpacing=0 cellPadding=0 class="frame" border=0>
377 <TBODY>
378 <TR>
379 <TD>
380 <TABLE cellSpacing=1 cellPadding=2 border=0>
381 <TBODY class="submenu" >
382 <?php
383 while(list($x,$v)=each($types)){
385 <TR>
386 <td align=center>
387 <img
388 <?php
389 # Type nr 3 = discharge summary/notes
390 # Type nr 99 = auxilliary notes
392 if($parent_admit&&(!$is_discharged||$v['nr']==3||$v['nr']==99)) echo createComIcon($root_path,'comments.gif','0');
393 else echo createComIcon($root_path,'docu_unrd.gif','0');
395 </td>
396 <TD vAlign=top >
397 <a href="show_notes.php<?php echo URL_APPEND ?>&pid=<?php echo $pid ?>&target=<?php echo $target ?>&type_nr=<?php echo $v['nr'] ?>">
398 <?php
399 if(isset($$v['LD_var'])&&!empty($$v['LD_var'])) echo $$v['LD_var']; else echo $v['name']
401 </a>
402 </TD>
403 </TR>
404 <?php
406 if($parent_admit){
408 <TR>
409 <td align=center>
410 <img <?php echo createComIcon($root_path,'icon_acro.gif','0');?>>
411 </TD>
412 <TD vAlign=top >
413 <a href="<?php echo $root_path."modules/pdfmaker/emr_generic/report_all.php".URL_APPEND."&enc=".$HTTP_SESSION_VARS['sess_en']; ?>" target=_blank>
414 <?php
415 echo $LDPrintPDFDocAllReport;
417 </a>
418 </TD>
419 </TR>
420 <?php
423 </TBODY>
424 </TABLE>
425 </TD>
426 </TR>
427 </TBODY>
428 </TABLE>
429 </td>
430 </tr>
431 </table>
433 <!-- End of main data block table -->
437 <?php
439 $sTemp = ob_get_contents();
440 ob_end_clean();
442 $smarty->assign('sOptionsMenu',$sTemp);
444 # Now buffer the bottom controls
446 ob_start();
448 if($parent_admit) {
449 include('./include/bottom_controls_admission_options.inc.php');
450 }else{
451 include('./include/bottom_controls_registration_options.inc.php');
454 $sTemp = ob_get_contents();
455 ob_end_clean();
457 $smarty->assign('sBottomControls',$sTemp);
459 $smarty->assign('pbCancel','<a href="'.$returnfile.URL_APPEND.$buf.'&target='.$target.'&mode=show&type_nr='.$type_nr.'"><img '.createLDImgSrc($root_path,'cancel.gif','0').' alt="'.$LDCancelClose.'"></a>');
461 $smarty->assign('sMainBlockIncludeFile','registration_admission/common_report.tpl');
463 $smarty->display('common/mainframe.tpl');