3 * Display, enter, modify and manage patient notes.
5 * LICENSE: This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 3
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
17 * @author Brady Miller <brady@sparmy.com>
18 * @link http://www.open-emr.org
21 //SANITIZE ALL ESCAPES
22 $sanitize_all_escapes=true;
24 //STOP FAKE REGISTER GLOBALS
25 $fake_register_globals=false;
27 /* Include required globals */
28 require_once('../../globals.php');
29 require_once($GLOBALS['srcdir'].'/pnotes.inc');
30 require_once($GLOBALS['srcdir'].'/patient.inc');
31 require_once($GLOBALS['srcdir'].'/acl.inc');
32 require_once($GLOBALS['srcdir'].'/log.inc');
33 require_once($GLOBALS['srcdir'].'/options.inc.php');
34 require_once($GLOBALS['srcdir'].'/classes/Document.class.php');
35 require_once($GLOBALS['srcdir'].'/gprelations.inc.php');
36 require_once($GLOBALS['srcdir'].'/formatting.inc.php');
38 if ($_GET['set_pid']) {
39 require_once($GLOBALS['srcdir'].'/pid.inc');
40 setpid($_GET['set_pid']);
43 // form parameter docid can be passed to restrict the display to a document.
44 $docid = empty($_REQUEST['docid']) ?
0 : 0 +
$_REQUEST['docid'];
46 // form parameter orderid can be passed to restrict the display to a procedure order.
47 $orderid = empty($_REQUEST['orderid']) ?
0 : intval($_REQUEST['orderid']);
51 $row = sqlQuery("SELECT foreign_id FROM documents WHERE id = ?", array($docid));
52 $patient_id = intval($row['foreign_id']);
55 $row = sqlQuery("SELECT patient_id FROM procedure_order WHERE procedure_order_id = ?", array($orderid));
56 $patient_id = intval($row['patient_id']);
59 // Check authorization.
60 if (!acl_check('patients','notes','',array('write','addonly') ))
61 die(htmlspecialchars( xl('Not authorized'), ENT_NOQUOTES
));
62 $tmp = getPatientData($patient_id, "squad");
63 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
64 die(htmlspecialchars( xl('Not authorized for this squad.'), ENT_NOQUOTES
));
66 //the number of records to display per screen
70 $mode = $_REQUEST['mode'];
71 $offset = $_REQUEST['offset'];
72 $offset_sent = $_REQUEST['offset_sent'];
73 $form_active = $_REQUEST['form_active'];
74 $form_inactive = $_REQUEST['form_inactive'];
75 $noteid = $_REQUEST['noteid'];
76 $form_doc_only = isset($_POST['mode']) ?
(empty($_POST['form_doc_only']) ?
0 : 1) : 1;
77 if($_REQUEST['s'] == '1'){
80 $inbox_style = "style='display:none;border:5px solid #FFFFFF;'";
81 $outbox_style = "style='border:5px solid #FFFFFF;'";
85 $inbox_style = "style='border:5px solid #FFFFFF;'";;
86 $outbox_style = "style='display:none;border:5px solid #FFFFFF;'";
89 if (!isset($offset)) $offset = 0;
90 if (!isset($offset_sent)) $offset_sent = 0;
92 // Collect active variable and applicable html code for links
95 $activity_string_html = 'form_active=1';
97 else if ($form_inactive) {
99 $activity_string_html = 'form_inactive=1';
103 $activity_string_html = '';
104 $form_active = $form_inactive = '0';
107 // this code handles changing the state of activity tags when the user updates
108 // them through the interface
110 if ($mode == "update") {
111 foreach ($_POST as $var => $val) {
112 if (strncmp($var, 'act', 3) == 0) {
113 $id = str_replace("act", "", $var);
114 if ($_POST["chk$id"]) {
120 setGpRelation(1, $docid, 6, $id, !empty($_POST["lnk$id"]));
123 setGpRelation(2, $orderid, 6, $id, !empty($_POST["lnk$id"]));
128 elseif ($mode == "new") {
129 $note = $_POST['note'];
131 updatePnote($noteid, $note, $_POST['form_note_type'], $_POST['assigned_to']);
134 $noteid = addPnote($patient_id, $note, $userauthorized, '1',
135 $_POST['form_note_type'], $_POST['assigned_to']);
138 setGpRelation(1, $docid, 6, $noteid);
141 setGpRelation(2, $orderid, 6, $noteid);
145 elseif ($mode == "delete") {
147 deletePnote($noteid);
148 newEvent("delete", $_SESSION['authUser'], $_SESSION['authProvider'], 1, "pnotes: id ".$noteid);
155 $assigned_to = $_SESSION['authUser'];
157 $prow = getPnoteById($noteid, 'title,assigned_to,body');
158 $title = $prow['title'];
159 $assigned_to = $prow['assigned_to'];
162 // Get the users list. The "Inactive" test is a kludge, we should create
163 // a separate column for this.
164 $ures = sqlStatement("SELECT username, fname, lname FROM users " .
165 "WHERE username != '' AND active = 1 AND " .
166 "( info IS NULL OR info NOT LIKE '%Inactive%' ) " .
167 "ORDER BY lname, fname");
169 $pres = getPatientData($patient_id, "lname, fname");
170 $patientname = $pres['lname'] . ", " . $pres['fname'];
173 $result = getPnotesByDate("", $active, 'id,date,body,user,activity,title,assigned_to,message_status',
174 $patient_id, $N, $offset, '', $docid, '', $orderid);
175 $result_sent = getSentPnotesByDate("", $active, 'id,date,body,user,activity,title,assigned_to,message_status',
176 $patient_id, $M, $offset_sent, '', $docid, '', $orderid);
181 <?php
html_header_show();?
>
183 <link rel
='stylesheet' href
="<?php echo $css_header;?>" type
="text/css">
185 <!-- supporting javascript code
-->
186 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-1/index.js"></script
>
187 <link rel
="stylesheet" type
="text/css" href
="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media
="screen" />
188 <script type
="text/javascript" src
="../../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
189 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-3-2/index.js"></script
>
190 <script type
="text/javascript" src
="../../../library/js/common.js"></script
>
191 <script type
="text/javascript" src
="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script
>
192 <script type
="text/javascript">
193 /// todo, move this to a common library
195 $
(document
).ready(function(){
197 $
("#dem_view").click( function() {
198 toggle( $
(this
), "#DEM" );
202 $
("#stats_div").load("stats.php");
203 $
("#notes_div").load("pnotes_fragment.php");
209 function show_div(name
){
211 document
.getElementById('inbox_div').style
.display
= '';
212 document
.getElementById('outbox_div').style
.display
= 'none';
214 document
.getElementById('inbox_div').style
.display
= 'none';
215 document
.getElementById('outbox_div').style
.display
= '';
220 <body
class="body_top">
222 <div id
="pnotes"> <!-- large outer DIV
-->
224 <form border
='0' method
='post' name
='new_note' id
="new_note" action
='pnotes_full.php?docid=<?php echo htmlspecialchars($docid, ENT_QUOTES); ?>&orderid=<?php echo htmlspecialchars($orderid, ENT_QUOTES); ?>&<?php echo attr($activity_string_html);?>' onsubmit
='return top.restoreSession()'>
229 $title_docname .= " " . xl("linked to document") . " ";
230 $d = new Document($docid);
231 $title_docname .= $d->get_url_file();
234 $title_docname .= " " . xl("linked to procedure order") . " $orderid";
237 $urlparms = "docid=$docid&orderid=$orderid";
241 <span
class="title"><?php
echo xlt('Patient Notes') . $title_docname; ?
></span
>
243 <div id
='namecontainer_pnotes' class='namecontainer_pnotes' style
='float:left;margin-right:10px'>
244 <?php
echo htmlspecialchars( xl('for'), ENT_NOQUOTES
);?
> 
;<span
class="title">
245 <a href
="../summary/demographics.php" onclick
="top.restoreSession()"><?php
echo htmlspecialchars( getPatientName($patient_id), ENT_NOQUOTES
); ?
></a
></span
>
248 <a href
="pnotes_full_add.php?<?php echo $urlparms; ?>" class="css_button iframe" onclick
='top.restoreSession()'><span
><?php
echo xlt('Add'); ?
></span
></a
>
249 <a href
="demographics.php" class="css_button" onclick
="top.restoreSession()">
250 <span
><?php
echo htmlspecialchars( xl('View Patient'), ENT_NOQUOTES
);?
></span
>
256 <?php
if ($active == "all") { ?
>
257 <span
><?php
echo xlt('Show All'); ?
></span
>
259 <a href
="pnotes_full.php?<?php echo $urlparms; ?>" class="link" onclick
="top.restoreSession()"><span
><?php
echo xlt('Show All'); ?
></span
></a
>
262 <?php
if ($active == '1') { ?
>
263 <span
><?php
echo xlt('Show Active'); ?
></span
>
265 <a href
="pnotes_full.php?form_active=1&<?php echo $urlparms; ?>" class="link" onclick
="top.restoreSession()"><span
><?php
echo xlt('Show Active'); ?
></span
></a
>
268 <?php
if ($active == '0') { ?
>
269 <span
><?php
echo xlt('Show Inactive'); ?
></span
>
271 <a href
="pnotes_full.php?form_inactive=1&<?php echo $urlparms; ?>" class="link" onclick
="top.restoreSession()"><span
><?php
echo xlt('Show Inactive'); ?
></span
></a
>
275 <input type
='hidden' name
='mode' id
="mode" value
="new">
276 <input type
='hidden' name
='offset' id
="offset" value
="<?php echo $offset; ?>">
277 <input type
='hidden' name
='offset_sent' id
="offset_sent" value
="<?php echo $offset_sent; ?>">
278 <input type
='hidden' name
='form_active' id
="form_active" value
="<?php echo htmlspecialchars( $form_active, ENT_QUOTES); ?>">
279 <input type
='hidden' name
='form_inactive' id
="form_inactive" value
="<?php echo htmlspecialchars( $form_inactive, ENT_QUOTES); ?>">
280 <input type
='hidden' name
='noteid' id
="noteid" value
="<?php echo htmlspecialchars( $noteid, ENT_QUOTES); ?>">
281 <input type
='hidden' name
='form_doc_only' id
="form_doc_only" value
="<?php echo htmlspecialchars( $form_doc_only, ENT_QUOTES); ?>">
286 // Get the billing note if there is one.
290 $resnote = getPatientData($patient_id, "billing_note");
291 if(!empty($resnote['billing_note'])) {
292 $billing_note = $resnote['billing_note'];
293 $colorbeg = "<span style='color:red'>";
294 $colorend = "</span>";
297 //Display what the patient owes
298 $balance = get_patient_balance($patient_id);
301 <?php
if ($billing_note ||
$balance ) { ?
>
303 <div style
='margin-top:3px'>
306 if ($balance != "0") {
307 // $formatted = sprintf((xl('$').'%01.2f'), $balance);
308 $formatted = oeFormatMoney($balance);
309 echo " <tr class='text billing'>\n";
310 echo " <td>".$colorbeg . htmlspecialchars( xl('Balance Due'), ENT_NOQUOTES
) .
311 $colorend." ".$colorbeg. htmlspecialchars( $formatted, ENT_NOQUOTES
) .
317 echo " <tr class='text billing'>\n";
318 echo " <td>".$colorbeg . htmlspecialchars( xl('Billing Note'), ENT_NOQUOTES
) .
319 $colorend." ".$colorbeg . htmlspecialchars( $billing_note, ENT_NOQUOTES
) .
329 <li
class="<?php echo $inbox; ?>" ><a onclick
="show_div('inbox')" href
="#"><?php
echo htmlspecialchars(xl('Inbox'),ENT_NOQUOTES
); ?
></a
></li
>
330 <li
class="<?php echo $outbox; ?>" ><a onclick
="show_div('outbox')" href
="#"><?php
echo htmlspecialchars(xl('Sent Items'),ENT_NOQUOTES
); ?
></a
></li
>
332 <div
class='tabContainer' >
333 <div id
='inbox_div' <?php
echo $inbox_style; ?
> >
334 <form border
='0' method
='post' name
='update_activity' id
='update_activity'
335 action
="pnotes_full.php?<?php echo $urlparms; ?>&<?php echo attr($activity_string_html);?>" onsubmit
='return top.restoreSession()'>
336 <!-- start of previous notes DIV
-->
337 <div
class=pat_notes
>
338 <input type
='hidden' name
='mode' value
="update">
339 <input type
='hidden' name
='offset' id
='offset' value
="<?php echo $offset; ?>">
340 <input type
='hidden' name
='offset_sent' id
='offset_sent' value
="<?php echo $offset_sent; ?>">
341 <input type
='hidden' name
='noteid' id
='noteid' value
="0">
342 <table border
='0' cellpadding
="1" class="text">
343 <?php
if ($result != ""): ?
>
345 <td colspan
='5' style
="padding: 5px;" >
346 <a href
="#" class="change_activity" ><span
><?php
echo htmlspecialchars( xl('Update Active'), ENT_NOQUOTES
); ?
></span
></a
>
348 <a href
="pnotes_full.php?<?php echo $urlparms; ?>&<?php echo attr($activity_string_html);?>" class="" id
='Submit' onclick
='top.restoreSession()'><span
><?php
echo htmlspecialchars( xl('Refresh'), ENT_NOQUOTES
); ?
></span
></a
>
353 <table border
='0' cellpadding
="1" class="text" width
= "80%">
355 // display all of the notes for the day, as well as others that are active
356 // from previous dates, up to a certain number, $N
359 echo " <tr class=showborder_head align='left'>\n";
360 echo " <th style='width:100px';> </th>\n";
361 echo " <th>" . xlt('Active') . " </th>\n";
362 echo " <th>" . (($docid ||
$orderid) ?
xlt('Linked') : '') . "</th>\n";
363 echo " <th>" . xlt('Type') . "</th>\n";
364 echo " <th>" . xlt('Content') . "</th>\n";
368 foreach ($result as $iter) {
370 $row_note_id = $iter['id'];
374 if (isGpRelation(1, $docid, 6, $row_note_id)) {
378 // Skip unlinked notes if that is requested.
379 if ($form_doc_only) continue;
383 if (isGpRelation(2, $orderid, 6, $row_note_id)) {
387 // Skip unlinked notes if that is requested.
388 if ($form_doc_only) continue;
392 $body = $iter['body'];
393 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
394 $body = nl2br(htmlspecialchars( oeFormatPatientNote($body), ENT_NOQUOTES
));
396 $body = htmlspecialchars( oeFormatSDFT(strtotime($iter['date'])).date(' H:i', strtotime($iter['date'])), ENT_NOQUOTES
) .
397 ' (' . htmlspecialchars( $iter['user'], ENT_NOQUOTES
) . ') ' . nl2br(htmlspecialchars( oeFormatPatientNote($body), ENT_NOQUOTES
));
399 $body = preg_replace('/(\sto\s)-patient-(\))/','${1}'.$patientname.'${2}',$body);
400 if ( ($iter{"activity"}) && ($iter['message_status'] != "Done") ) {
401 $checked = "checked";
406 // highlight the row if it's been selected for updating
407 if ($_REQUEST['noteid'] == $row_note_id) {
408 echo " <tr height=20 class='noterow highlightcolor' id='".htmlspecialchars( $row_note_id, ENT_QUOTES
)."'>\n";
411 echo " <tr class='noterow' id='".htmlspecialchars( $row_note_id, ENT_QUOTES
)."'>\n";
415 echo " <td><a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=".htmlspecialchars( $row_note_id, ENT_QUOTES
).
416 "' class='css_button_small iframe' onclick='top.restoreSession()'><span>". htmlspecialchars( xl('Edit'), ENT_NOQUOTES
) ."</span></a>\n";
418 // display, or not, a button to delete the note
419 // if the user is an admin or if they are the author of the note, they can delete it
420 if (($iter['user'] == $_SESSION['authUser']) ||
(acl_check('admin','super','','write'))) {
421 echo " <a href='#' class='deletenote css_button_small' id='del" . htmlspecialchars( $row_note_id, ENT_QUOTES
) .
422 "' title='" . htmlspecialchars( xl('Delete this note'), ENT_QUOTES
) . "' onclick='top.restoreSession()'><span>" .
423 htmlspecialchars( xl('Delete'), ENT_NOQUOTES
) . "</span>\n";
428 echo " <td class='text bold'>\n";
429 echo " <input type='hidden' name='act".htmlspecialchars( $row_note_id, ENT_QUOTES
)."' value='1' />\n";
430 echo " <input type='checkbox' name='chk".htmlspecialchars( $row_note_id, ENT_QUOTES
)."' $checked />\n";
433 echo " <td class='text bold'>\n";
434 if ($docid ||
$orderid) {
435 echo " <input type='checkbox' name='lnk" . htmlspecialchars($row_note_id, ENT_QUOTES
) . "' $linked />\n";
439 echo " <td class='bold notecell' id='".htmlspecialchars( $row_note_id, ENT_QUOTES
)."'>" .
440 "<a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=".htmlspecialchars( $row_note_id, ENT_QUOTES
)."' class='iframe' onclick='top.restoreSession()'>\n";
441 // Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
442 echo generate_display_field(array('data_type'=>'1','list_id'=>'note_type'), $iter['title']);
445 echo " <td class='notecell' id='".htmlspecialchars( $row_note_id, ENT_QUOTES
)."'>\n";
454 print "<tr><td colspan='3' class='text'>" . htmlspecialchars( xl('None'), ENT_NOQUOTES
) . ".</td></tr>\n";
463 <table width
='400' border
='0' cellpadding
='0' cellspacing
='0'>
467 if ($offset > ($N-1)) {
468 echo " <a class='link' href='pnotes_full.php" .
470 "&form_active=" . htmlspecialchars( $form_active, ENT_QUOTES
) .
471 "&form_inactive=" . htmlspecialchars( $form_inactive, ENT_QUOTES
) .
472 "&form_doc_only=" . htmlspecialchars( $form_doc_only, ENT_QUOTES
) .
473 "&offset=" . ($offset-$N) . "&" . attr($activity_string_html) . "' onclick='top.restoreSession()'>[" .
474 htmlspecialchars( xl('Previous'), ENT_NOQUOTES
) . "]</a>\n";
480 if ($result_count == $N) {
481 echo " <a class='link' href='pnotes_full.php" .
483 "&form_active=" . htmlspecialchars( $form_active, ENT_QUOTES
) .
484 "&form_inactive=" . htmlspecialchars( $form_inactive, ENT_QUOTES
) .
485 "&form_doc_only=" . htmlspecialchars( $form_doc_only, ENT_QUOTES
) .
486 "&offset=" . ($offset+
$N) . "&" . attr($activity_string_html) . "' onclick='top.restoreSession()'>[" .
487 htmlspecialchars( xl('Next'), ENT_NOQUOTES
) . "]</a>\n";
495 <div id
='outbox_div' <?php
echo $outbox_style; ?
> >
496 <table border
='0' cellpadding
="1" class="text">
497 <?php
if ($result_sent != ""): ?
>
499 <td colspan
='5' style
="padding: 5px;" >
500 <a href
="pnotes_full.php?<?php echo $urlparms; ?>&s=1&<?php echo attr($activity_string_html);?>"
501 class="" id
='Submit' onclick
='top.restoreSession()'><span
><?php
echo xlt('Refresh'); ?
></span
></a
>
506 <table border
='0' cellpadding
="1" class="text" width
= "80%">
508 // display all of the notes for the day, as well as others that are active
509 // from previous dates, up to a certain number, $N
511 if ($result_sent != "") {
512 echo " <tr class=showborder_head align='left'>\n";
513 echo " <th style='width:100px';> </th>\n";
514 echo " <th>" . htmlspecialchars( xl('Active'), ENT_NOQUOTES
) . " </th>\n";
515 echo " <th>" . (($docid ||
$orderid) ?
htmlspecialchars( xl('Linked'), ENT_NOQUOTES
) : '') . "</th>\n";
516 echo " <th>" . htmlspecialchars( xl('Type'), ENT_NOQUOTES
) . "</th>\n";
517 echo " <th>" . htmlspecialchars( xl('Content'), ENT_NOQUOTES
) . "</th>\n";
520 $result_sent_count = 0;
521 foreach ($result_sent as $iter) {
522 $result_sent_count++
;
523 $row_note_id = $iter['id'];
527 if (isGpRelation(1, $docid, 6, $row_note_id)) {
531 // Skip unlinked notes if that is requested.
532 if ($form_doc_only) continue;
536 if (isGpRelation(2, $orderid, 6, $row_note_id)) {
540 // Skip unlinked notes if that is requested.
541 if ($form_doc_only) continue;
545 $body = $iter['body'];
546 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
547 $body = nl2br(htmlspecialchars( oeFormatPatientNote($body), ENT_NOQUOTES
));
549 $body = htmlspecialchars( oeFormatSDFT(strtotime($iter['date'])).date(' H:i', strtotime($iter['date'])), ENT_NOQUOTES
) .
550 ' (' . htmlspecialchars( $iter['user'], ENT_NOQUOTES
) . ') ' . nl2br(htmlspecialchars( oeFormatPatientNote($body), ENT_NOQUOTES
));
552 $body = preg_replace('/(:\d{2}\s\()' . $patient_id . '(\sto\s)/','${1}' . $patientname . '${2}', $body);
553 if (($iter{"activity"}) && ($iter['message_status'] != "Done") ) {
554 $checked = "checked";
559 // highlight the row if it's been selected for updating
560 if ($_REQUEST['noteid'] == $row_note_id) {
561 echo " <tr height=20 class='noterow highlightcolor' id='".htmlspecialchars( $row_note_id, ENT_QUOTES
)."'>\n";
564 echo " <tr class='noterow' id='".htmlspecialchars( $row_note_id, ENT_QUOTES
)."'>\n";
568 echo " <td><a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=".htmlspecialchars( $row_note_id, ENT_QUOTES
).
569 "' class='css_button_small iframe' onclick='top.restoreSession()'><span>". htmlspecialchars( xl('Edit'), ENT_NOQUOTES
) ."</span></a>\n";
571 // display, or not, a button to delete the note
572 // if the user is an admin or if they are the author of the note, they can delete it
573 if (($iter['user'] == $_SESSION['authUser']) ||
(acl_check('admin','super','','write'))) {
574 echo " <a href='#' class='deletenote css_button_small' id='del" . htmlspecialchars( $row_note_id, ENT_QUOTES
) .
575 "' title='" . htmlspecialchars( xl('Delete this note'), ENT_QUOTES
) . "' onclick='top.restoreSession()'><span>" .
576 htmlspecialchars( xl('Delete'), ENT_NOQUOTES
) . "</span>\n";
581 echo " <td class='text bold'>\n";
582 echo " <input type='hidden' name='act".htmlspecialchars( $row_note_id, ENT_QUOTES
)."' value='1' />\n";
583 echo " <input type='checkbox' name='chk".htmlspecialchars( $row_note_id, ENT_QUOTES
)."' $checked />\n";
586 echo " <td class='text bold'>\n";
587 if ($docid ||
$orderid) {
588 echo " <input type='checkbox' name='lnk" . htmlspecialchars($row_note_id, ENT_QUOTES
) . "' $linked />\n";
592 echo " <td class='bold notecell' id='".htmlspecialchars( $row_note_id, ENT_QUOTES
)."'>" .
593 "<a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=".htmlspecialchars( $row_note_id, ENT_QUOTES
)."' class='iframe' onclick='top.restoreSession()'>\n";
594 // Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
595 echo generate_display_field(array('data_type'=>'1','list_id'=>'note_type'), $iter['title']);
598 echo " <td class='notecell' id='".htmlspecialchars( $row_note_id, ENT_QUOTES
)."'>\n";
607 print "<tr><td colspan='3' class='text'>" . htmlspecialchars( xl('None'), ENT_NOQUOTES
) . ".</td></tr>\n";
614 <table width
='400' border
='0' cellpadding
='0' cellspacing
='0'>
618 if ($offset_sent > ($M-1)) {
619 echo " <a class='link' href='pnotes_full.php" .
622 "&form_active=" . htmlspecialchars( $form_active, ENT_QUOTES
) .
623 "&form_inactive=" . htmlspecialchars( $form_inactive, ENT_QUOTES
) .
624 "&form_doc_only=" . htmlspecialchars( $form_doc_only, ENT_QUOTES
) .
625 "&offset_sent=" . ($offset_sent-$M) . "&" . attr($activity_string_html) . "' onclick='top.restoreSession()'>[" .
626 htmlspecialchars( xl('Previous'), ENT_NOQUOTES
) . "]</a>\n";
632 if ($result_sent_count == $M) {
633 echo " <a class='link' href='pnotes_full.php" .
636 "&form_active=" . htmlspecialchars( $form_active, ENT_QUOTES
) .
637 "&form_inactive=" . htmlspecialchars( $form_inactive, ENT_QUOTES
) .
638 "&form_doc_only=" . htmlspecialchars( $form_doc_only, ENT_QUOTES
) .
639 "&offset_sent=" . ($offset_sent+
$M) . "&" . attr($activity_string_html) . "' onclick='top.restoreSession()'>[" .
640 htmlspecialchars( xl('Next'), ENT_NOQUOTES
) . "]</a>\n";
649 <script language
='JavaScript'>
652 if ($_GET['set_pid']) {
653 $ndata = getPatientData($patient_id, "fname, lname, pubpid");
655 parent
.left_nav
.setPatient(<?php
echo "'" . addslashes($ndata['fname']." ".$ndata['lname']) . "'," .
656 addslashes($patient_id) . ",'" . addslashes($ndata['pubpid']) . "',window.name"; ?
>);
660 // If this note references a new patient document, pop up a display
663 if ($noteid /* && $title == 'New Document' */ ) {
664 $prow = getPnoteById($noteid, 'body');
665 if (preg_match('/New scanned document (\d+): [^\n]+\/([^\n]+)/', $prow['body'], $matches)) {
666 $docid = $matches[1];
667 $docname = $matches[2];
669 window
.open('../../../controller.php?document&retrieve&patient_id=<?php echo htmlspecialchars($patient_id, ENT_QUOTES); ?>&document_id=<?php echo htmlspecialchars($docid, ENT_QUOTES); ?>&<?php echo htmlspecialchars($docname, ENT_QUOTES);?>&as_file=true',
670 '_blank', 'resizable=1,scrollbars=1,width=600,height=500');
678 </div
> <!-- end outer
'pnotes' -->
682 <script language
="javascript">
684 // jQuery stuff to make the page a little easier to use
686 $
(document
).ready(function(){
687 $
("#appendnote").click(function() { AppendNote(); });
688 $
("#newnote").click(function() { NewNote(); });
689 $
("#printnote").click(function() { PrintNote(); });
691 $
(".change_activity").click(function() { top
.restoreSession(); $
("#update_activity").submit(); });
693 $
(".deletenote").click(function() { DeleteNote(this
); });
695 $
(".noterow").mouseover(function() { $
(this
).toggleClass("highlight"); });
696 $
(".noterow").mouseout(function() { $
(this
).toggleClass("highlight"); });
697 $
(".notecell").click(function() { EditNote(this
); });
701 var EditNote
= function(note
) {
702 top
.restoreSession();
703 $
("#noteid").val(note
.id
);
705 $
("#new_note").submit();
708 var NewNote
= function () {
709 top
.restoreSession();
710 $
("#noteid").val('');
711 $
("#new_note").submit();
714 var AppendNote
= function () {
715 top
.restoreSession();
716 $
("#new_note").submit();
719 var PrintNote
= function () {
720 top
.restoreSession();
721 window
.open('pnotes_print.php?noteid=<?php echo htmlspecialchars( $noteid, ENT_QUOTES); ?>', '_blank', 'resizable=1,scrollbars=1,width=600,height=500');
724 var DeleteNote
= function(note
) {
725 if (confirm("<?php echo htmlspecialchars( xl('Are you sure you want to delete this note?','','','\n '), ENT_QUOTES) .
726 htmlspecialchars( xl('This action CANNOT be undone.'), ENT_QUOTES); ?>")) {
727 top
.restoreSession();
728 // strip the 'del' part of the object's ID
729 $
("#noteid").val(note
.id
.replace(/del
/, ""));
730 $
("#mode").val("delete");
731 $
("#new_note").submit();