c461f3312c2ec08f5653706b0ff4f3e608b7bd13
4 $sanitize_all_escapes=true;
7 //STOP FAKE REGISTER GLOBALS
8 $fake_register_globals=false;
11 require_once("../../globals.php");
12 require_once("$srcdir/pnotes.inc");
13 require_once("$srcdir/acl.inc");
14 require_once("$srcdir/patient.inc");
15 require_once("$srcdir/options.inc.php");
16 require_once("$srcdir/classes/Document.class.php");
18 // form parameter docid can be passed to restrict the display to a document.
19 $docid = empty($_REQUEST['docid']) ?
0 : intval($_REQUEST['docid']);
21 // form parameter orderid can be passed to restrict the display to a procedure order.
22 $orderid = empty($_REQUEST['orderid']) ?
0 : intval($_REQUEST['orderid']);
26 $row = sqlQuery("SELECT foreign_id FROM documents WHERE id = ?", array($docid));
27 $patient_id = intval($row['foreign_id']);
30 $row = sqlQuery("SELECT patient_id FROM procedure_order WHERE procedure_order_id = ?", array($orderid));
31 $patient_id = intval($row['patient_id']);
33 $urlparms = "docid=$docid&orderid=$orderid";
37 <?php
html_header_show();?
>
39 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.js"></script
>
40 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
43 <body
class="body_bottom">
46 $thisauth = acl_check('patients', 'notes');
48 $tmp = getPatientData($patient_id, "squad");
49 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
53 echo "<p>(" . htmlspecialchars( xl('Notes not authorized'), ENT_NOQUOTES
) . ")</p>\n";
54 echo "</body>\n</html>\n";
61 <?php
if ( acl_check('patients', 'notes','',array('write','addonly') )): ?
>
63 <?php
if ($GLOBALS['concurrent_layout']) { ?
>
64 <a href
="pnotes_full.php?<?php echo $urlparms; ?>" onclick
="top.restoreSession()">
66 <a href
="pnotes_full.php?<?php echo $urlparms; ?>" target
="Main" onclick
="top.restoreSession()">
69 <span
class="title"><?php
echo htmlspecialchars( xl('Notes'), ENT_NOQUOTES
); ?
>
72 echo " " . xlt("linked to document") . " ";
73 $d = new Document($docid);
74 echo $d->get_url_file();
77 echo " " . xlt("linked to procedure order") . " $orderid";
81 <span
class=more
><?php
echo htmlspecialchars( $tmore, ENT_NOQUOTES
);?
></span
>
90 //display all of the notes for the day, as well as others that are active from previous dates, up to a certain number, $N
93 // Get the billing note if there is one.
97 $sql = "select genericname2, genericval2 " .
98 "from patient_data where pid = ? limit 1";
99 $resnote = sqlQuery($sql, array($patient_id) );
100 if($resnote && $resnote['genericname2'] == 'Billing') {
101 $billing_note = $resnote['genericval2'];
102 $colorbeg = "<span style='color:red'>";
103 $colorend = "</span>";
106 //Display what the patient owes
107 $balance = get_patient_balance($patient_id);
108 if ($balance != "0") {
109 $formatted = sprintf((xl('$').'%01.2f'), $balance);
110 echo " <tr class='text billing'>\n";
111 echo " <td>" . $colorbeg . htmlspecialchars( xl('Balance Due'), ENT_NOQUOTES
) .
112 $colorend . "</td><td>" . $colorbeg .
113 htmlspecialchars( $formatted, ENT_NOQUOTES
) . $colorend."</td>\n";
118 echo " <tr class='text billing'>\n";
119 echo " <td>" . $colorbeg . htmlspecialchars( xl('Billing Note'), ENT_NOQUOTES
) .
120 $colorend . "</td><td>" . $colorbeg .
121 htmlspecialchars( $billing_note, ENT_NOQUOTES
) . $colorend . "</td>\n";
125 //retrieve all active notes
126 $result = getPnotesByDate("", 1, "id,date,body,user,title,assigned_to",
127 $patient_id, "all", 0, '', $docid, '', $orderid);
129 if ($result != null) {
130 $notes_count = 0;//number of notes so far displayed
131 foreach ($result as $iter) {
133 if ($notes_count >= $N) {
134 //we have more active notes to print, but we've reached our display maximum
136 echo " <td colspan='3' align='center'>\n";
138 if (!$GLOBALS['concurrent_layout']) echo "target='Main' ";
139 echo "href='pnotes_full.php?active=1&$urlparms" .
140 "' class='alert' onclick='top.restoreSession()'>";
141 echo htmlspecialchars( xl('Some notes were not displayed.','','',' '), ENT_NOQUOTES
) .
142 htmlspecialchars( xl('Click here to view all.'), ENT_NOQUOTES
) . "</a>\n";
148 $body = $iter['body'];
149 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
150 $body = nl2br(htmlspecialchars( $body, ENT_NOQUOTES
));
152 $body = htmlspecialchars( date('Y-m-d H:i', strtotime($iter['date'])), ENT_NOQUOTES
) .
153 ' (' . htmlspecialchars( $iter['user'], ENT_NOQUOTES
) . ') ' . nl2br(htmlspecialchars( $body, ENT_NOQUOTES
));
156 echo " <tr class='text noterow' id='".htmlspecialchars( $iter['id'], ENT_QUOTES
)."'>\n";
158 // Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
159 echo " <td valign='top' class='bold'>";
160 echo generate_display_field(array('data_type'=>'1','list_id'=>'note_type'), $iter['title']);
163 echo " <td valign='top'>$body</td>\n";
173 </div
> <!-- end pnotes
-->
177 <script language
="javascript">
178 // jQuery stuff to make the page a little easier to use
180 $
(document
).ready(function(){
181 $
(".noterow").mouseover(function() { $
(this
).toggleClass("highlight"); });
182 $
(".noterow").mouseout(function() { $
(this
).toggleClass("highlight"); });
183 $
(".noterow").click(function() { EditNote(this
); });
186 var EditNote
= function(note
) {
187 <?php
if ( acl_check('patients', 'notes','',array('write','addonly') )): ?
>
188 top
.restoreSession();
189 <?php
if (!$GLOBALS['concurrent_layout']): ?
>
190 top
.Main
.location
.href
= "pnotes_full.php?<?php echo $urlparms; ?>¬eid=" + note
.id +
"&active=1";
192 location
.href
= "pnotes_full.php?<?php echo $urlparms; ?>¬eid=" + note
.id +
"&active=1";
196 alert("<?php echo htmlspecialchars( xl('You do not have access to view/edit this note'), ENT_QUOTES); ?>");