Added a new billing widget and following related changes:
[openemr.git] / interface / patient_file / summary / pnotes_fragment.php
blob308c937a99ad23436d6e31f514fbcd5ea11d7d57
1 <?php
2 // This program is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU General Public License
4 // as published by the Free Software Foundation; either version 2
5 // of the License, or (at your option) any later version.
7 //SANITIZE ALL ESCAPES
8 $sanitize_all_escapes=true;
9 //
11 //STOP FAKE REGISTER GLOBALS
12 $fake_register_globals=false;
15 require_once("../../globals.php");
16 require_once("$srcdir/pnotes.inc");
17 require_once("$srcdir/acl.inc");
18 require_once("$srcdir/patient.inc");
19 require_once("$srcdir/options.inc.php");
20 require_once("$srcdir/classes/Document.class.php");
21 require_once("$srcdir/formatting.inc.php");
23 // form parameter docid can be passed to restrict the display to a document.
24 $docid = empty($_REQUEST['docid']) ? 0 : 0 + $_REQUEST['docid'];
27 <div id='pnotes' style='margin-top:3px; margin-left:10px; margin-right:10px'>
30 <?php
31 //display all of the notes for the day, as well as others that are active from previous dates, up to a certain number, $N
32 $N = 3; ?>
34 <br/>
36 <?php
38 $has_notes = 0;
39 $thisauth = acl_check('patients', 'notes');
40 if ($thisauth) {
41 $tmp = getPatientData($pid, "squad");
42 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
43 $thisauth = 0;
45 if (!$thisauth) {
46 echo "<p>(" . htmlspecialchars(xl('Notes not authorized'),ENT_NOQUOTES) . ")</p>\n";
47 } else { ?>
49 <table width='100%'>
51 <?php
53 //retrieve all active notes
54 $result = getPnotesByDate("", 1, "id,date,body,user,title,assigned_to",
55 $pid, "$N", 0, '', $docid);
57 if ($result != null) {
58 $notes_count = 0;//number of notes so far displayed
59 foreach ($result as $iter) {
60 $has_note = 1;
62 $body = $iter['body'];
63 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
64 $body = nl2br(htmlspecialchars(oeFormatPatientNote($body),ENT_NOQUOTES));
65 } else {
66 $body = htmlspecialchars(oeFormatSDFT(strtotime($iter['date'])) . date(' H:i', strtotime($iter['date'])) .
67 ' (' . $iter['user'] . ') ',ENT_NOQUOTES) .
68 nl2br(htmlspecialchars(oeFormatPatientNote($body),ENT_NOQUOTES));
71 echo " <tr class='text' id='".htmlspecialchars($iter['id'],ENT_QUOTES)."' style='border-bottom:1px dashed' >\n";
73 // Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
74 echo " <td valign='top' class='text'><b>";
75 echo generate_display_field(array('data_type'=>'1','list_id'=>'note_type'), $iter['title']);
76 echo "</b></td>\n";
78 echo " <td valign='top' class='text'>$body</td>\n";
79 echo " </tr>\n";
81 $notes_count++;
83 } ?>
85 </table>
87 <?php
88 if ( $has_note < 1 ) { ?>
89 <span class='text'>
90 <?php echo htmlspecialchars(xl( "There are no notes on file for this patient."),ENT_NOQUOTES);
91 echo " ";
92 echo htmlspecialchars(xl("To add notes, please click "),ENT_NOQUOTES);
93 echo "<a href='pnotes_full.php'>";
94 echo htmlspecialchars(xl("here"),ENT_NOQUOTES);
95 echo "</a>."; ?>
96 </span>
97 <?php } else {
99 <br/>
100 <span class='text'>
101 <?php echo htmlspecialchars(xl('Displaying the following number of most recent notes:'),ENT_NOQUOTES); ?>
102 <b><?php echo $N;?></b><br>
103 <a href='pnotes_full.php'><?php echo htmlspecialchars(xl('Click here to view them all.'),ENT_NOQUOTES); ?></a>
104 </span>
105 <?php
106 } ?>
108 <br/>
109 <br/>
111 <?php } ?>
113 </div> <!-- end pnotes -->
115 <script language="javascript">
116 // jQuery stuff to make the page a little easier to use
118 $(document).ready(function(){
119 $(".noterow").mouseover(function() { $(this).toggleClass("highlight"); });
120 $(".noterow").mouseout(function() { $(this).toggleClass("highlight"); });
123 </script>