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'].'/gprelations.inc.php');
35 require_once($GLOBALS['srcdir'].'/formatting.inc.php');
37 if ($_GET['set_pid']) {
38 require_once($GLOBALS['srcdir'].'/pid.inc');
39 setpid($_GET['set_pid']);
42 // form parameter docid can be passed to restrict the display to a document.
43 $docid = empty($_REQUEST['docid']) ?
0 : 0 +
$_REQUEST['docid'];
45 // form parameter orderid can be passed to restrict the display to a procedure order.
46 $orderid = empty($_REQUEST['orderid']) ?
0 : intval($_REQUEST['orderid']);
50 $row = sqlQuery("SELECT foreign_id FROM documents WHERE id = ?", array($docid));
51 $patient_id = intval($row['foreign_id']);
54 $row = sqlQuery("SELECT patient_id FROM procedure_order WHERE procedure_order_id = ?", array($orderid));
55 $patient_id = intval($row['patient_id']);
58 // Check authorization.
59 if (!acl_check('patients','notes','',array('write','addonly') ))
60 die(htmlspecialchars( xl('Not authorized'), ENT_NOQUOTES
));
61 $tmp = getPatientData($patient_id, "squad");
62 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
63 die(htmlspecialchars( xl('Not authorized for this squad.'), ENT_NOQUOTES
));
65 //the number of records to display per screen
69 $mode = $_REQUEST['mode'];
70 $offset = $_REQUEST['offset'];
71 $offset_sent = $_REQUEST['offset_sent'];
72 $form_active = $_REQUEST['form_active'];
73 $form_inactive = $_REQUEST['form_inactive'];
74 $noteid = $_REQUEST['noteid'];
75 $form_doc_only = isset($_POST['mode']) ?
(empty($_POST['form_doc_only']) ?
0 : 1) : 1;
76 if($_REQUEST['s'] == '1'){
79 $inbox_style = "style='display:none;border:5px solid #FFFFFF;'";
80 $outbox_style = "style='border:5px solid #FFFFFF;'";
84 $inbox_style = "style='border:5px solid #FFFFFF;'";;
85 $outbox_style = "style='display:none;border:5px solid #FFFFFF;'";
88 if (!isset($offset)) $offset = 0;
89 if (!isset($offset_sent)) $offset_sent = 0;
91 // Collect active variable and applicable html code for links
94 $activity_string_html = 'form_active=1';
96 else if ($form_inactive) {
98 $activity_string_html = 'form_inactive=1';
102 $activity_string_html = '';
103 $form_active = $form_inactive = '0';
106 // this code handles changing the state of activity tags when the user updates
107 // them through the interface
109 if ($mode == "update") {
110 foreach ($_POST as $var => $val) {
111 if (strncmp($var, 'act', 3) == 0) {
112 $id = str_replace("act", "", $var);
113 if ($_POST["chk$id"]) {
119 setGpRelation(1, $docid, 6, $id, !empty($_POST["lnk$id"]));
122 setGpRelation(2, $orderid, 6, $id, !empty($_POST["lnk$id"]));
127 elseif ($mode == "new") {
128 $note = $_POST['note'];
130 updatePnote($noteid, $note, $_POST['form_note_type'], $_POST['assigned_to']);
133 $noteid = addPnote($patient_id, $note, $userauthorized, '1',
134 $_POST['form_note_type'], $_POST['assigned_to']);
137 setGpRelation(1, $docid, 6, $noteid);
140 setGpRelation(2, $orderid, 6, $noteid);
144 elseif ($mode == "delete") {
146 deletePnote($noteid);
147 newEvent("delete", $_SESSION['authUser'], $_SESSION['authProvider'], 1, "pnotes: id ".$noteid);
154 $assigned_to = $_SESSION['authUser'];
156 $prow = getPnoteById($noteid, 'title,assigned_to,body');
157 $title = $prow['title'];
158 $assigned_to = $prow['assigned_to'];
161 // Get the users list. The "Inactive" test is a kludge, we should create
162 // a separate column for this.
163 $ures = sqlStatement("SELECT username, fname, lname FROM users " .
164 "WHERE username != '' AND active = 1 AND " .
165 "( info IS NULL OR info NOT LIKE '%Inactive%' ) " .
166 "ORDER BY lname, fname");
168 $pres = getPatientData($patient_id, "lname, fname");
169 $patientname = $pres['lname'] . ", " . $pres['fname'];
172 $result = getPnotesByDate("", $active, 'id,date,body,user,activity,title,assigned_to,message_status',
173 $patient_id, $N, $offset, '', $docid, '', $orderid);
174 $result_sent = getSentPnotesByDate("", $active, 'id,date,body,user,activity,title,assigned_to,message_status',
175 $patient_id, $M, $offset_sent, '', $docid, '', $orderid);
180 <?php
html_header_show();?
>
182 <link rel
='stylesheet' href
="<?php echo $css_header;?>" type
="text/css">
184 <!-- supporting javascript code
-->
185 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-1/index.js"></script
>
186 <link rel
="stylesheet" type
="text/css" href
="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media
="screen" />
187 <script type
="text/javascript" src
="../../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
188 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-3-2/index.js"></script
>
189 <script type
="text/javascript" src
="../../../library/js/common.js"></script
>
190 <script type
="text/javascript" src
="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script
>
191 <script type
="text/javascript">
192 /// todo, move this to a common library
194 $
(document
).ready(function(){
196 $
("#dem_view").click( function() {
197 toggle( $
(this
), "#DEM" );
201 $
("#stats_div").load("stats.php");
202 $
("#notes_div").load("pnotes_fragment.php");
208 function show_div(name
){
210 document
.getElementById('inbox_div').style
.display
= '';
211 document
.getElementById('outbox_div').style
.display
= 'none';
213 document
.getElementById('inbox_div').style
.display
= 'none';
214 document
.getElementById('outbox_div').style
.display
= '';
219 <body
class="body_top">
221 <div id
="pnotes"> <!-- large outer DIV
-->
223 <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()'>
228 $title_docname .= " " . xl("linked to document") . " ";
229 $d = new Document($docid);
230 $title_docname .= $d->get_url_file();
233 $title_docname .= " " . xl("linked to procedure order") . " $orderid";
236 $urlparms = "docid=$docid&orderid=$orderid";
240 <span
class="title"><?php
echo xlt('Patient Notes') . $title_docname; ?
></span
>
242 <div id
='namecontainer_pnotes' class='namecontainer_pnotes' style
='float:left;margin-right:10px'>
243 <?php
echo htmlspecialchars( xl('for'), ENT_NOQUOTES
);?
> 
;<span
class="title">
244 <a href
="../summary/demographics.php" onclick
="top.restoreSession()"><?php
echo htmlspecialchars( getPatientName($patient_id), ENT_NOQUOTES
); ?
></a
></span
>
247 <a href
="pnotes_full_add.php?<?php echo $urlparms; ?>" class="css_button iframe" onclick
='top.restoreSession()'><span
><?php
echo xlt('Add'); ?
></span
></a
>
248 <a href
="demographics.php" class="css_button" onclick
="top.restoreSession()">
249 <span
><?php
echo htmlspecialchars( xl('View Patient'), ENT_NOQUOTES
);?
></span
>
255 <?php
if ($active == "all") { ?
>
256 <span
><?php
echo xlt('Show All'); ?
></span
>
258 <a href
="pnotes_full.php?<?php echo $urlparms; ?>" class="link" onclick
="top.restoreSession()"><span
><?php
echo xlt('Show All'); ?
></span
></a
>
261 <?php
if ($active == '1') { ?
>
262 <span
><?php
echo xlt('Show Active'); ?
></span
>
264 <a href
="pnotes_full.php?form_active=1&<?php echo $urlparms; ?>" class="link" onclick
="top.restoreSession()"><span
><?php
echo xlt('Show Active'); ?
></span
></a
>
267 <?php
if ($active == '0') { ?
>
268 <span
><?php
echo xlt('Show Inactive'); ?
></span
>
270 <a href
="pnotes_full.php?form_inactive=1&<?php echo $urlparms; ?>" class="link" onclick
="top.restoreSession()"><span
><?php
echo xlt('Show Inactive'); ?
></span
></a
>
274 <input type
='hidden' name
='mode' id
="mode" value
="new">
275 <input type
='hidden' name
='offset' id
="offset" value
="<?php echo $offset; ?>">
276 <input type
='hidden' name
='offset_sent' id
="offset_sent" value
="<?php echo $offset_sent; ?>">
277 <input type
='hidden' name
='form_active' id
="form_active" value
="<?php echo htmlspecialchars( $form_active, ENT_QUOTES); ?>">
278 <input type
='hidden' name
='form_inactive' id
="form_inactive" value
="<?php echo htmlspecialchars( $form_inactive, ENT_QUOTES); ?>">
279 <input type
='hidden' name
='noteid' id
="noteid" value
="<?php echo htmlspecialchars( $noteid, ENT_QUOTES); ?>">
280 <input type
='hidden' name
='form_doc_only' id
="form_doc_only" value
="<?php echo htmlspecialchars( $form_doc_only, ENT_QUOTES); ?>">
285 // Get the billing note if there is one.
289 $resnote = getPatientData($patient_id, "billing_note");
290 if(!empty($resnote['billing_note'])) {
291 $billing_note = $resnote['billing_note'];
292 $colorbeg = "<span style='color:red'>";
293 $colorend = "</span>";
296 //Display what the patient owes
297 $balance = get_patient_balance($patient_id);
300 <?php
if ($billing_note ||
$balance ) { ?
>
302 <div style
='margin-top:3px'>
305 if ($balance != "0") {
306 // $formatted = sprintf((xl('$').'%01.2f'), $balance);
307 $formatted = oeFormatMoney($balance);
308 echo " <tr class='text billing'>\n";
309 echo " <td>".$colorbeg . htmlspecialchars( xl('Balance Due'), ENT_NOQUOTES
) .
310 $colorend." ".$colorbeg. htmlspecialchars( $formatted, ENT_NOQUOTES
) .
316 echo " <tr class='text billing'>\n";
317 echo " <td>".$colorbeg . htmlspecialchars( xl('Billing Note'), ENT_NOQUOTES
) .
318 $colorend." ".$colorbeg . htmlspecialchars( $billing_note, ENT_NOQUOTES
) .
328 <li
class="<?php echo $inbox; ?>" ><a onclick
="show_div('inbox')" href
="#"><?php
echo htmlspecialchars(xl('Inbox'),ENT_NOQUOTES
); ?
></a
></li
>
329 <li
class="<?php echo $outbox; ?>" ><a onclick
="show_div('outbox')" href
="#"><?php
echo htmlspecialchars(xl('Sent Items'),ENT_NOQUOTES
); ?
></a
></li
>
331 <div
class='tabContainer' >
332 <div id
='inbox_div' <?php
echo $inbox_style; ?
> >
333 <form border
='0' method
='post' name
='update_activity' id
='update_activity'
334 action
="pnotes_full.php?<?php echo $urlparms; ?>&<?php echo attr($activity_string_html);?>" onsubmit
='return top.restoreSession()'>
335 <!-- start of previous notes DIV
-->
336 <div
class=pat_notes
>
337 <input type
='hidden' name
='mode' value
="update">
338 <input type
='hidden' name
='offset' id
='offset' value
="<?php echo $offset; ?>">
339 <input type
='hidden' name
='offset_sent' id
='offset_sent' value
="<?php echo $offset_sent; ?>">
340 <input type
='hidden' name
='noteid' id
='noteid' value
="0">
341 <table border
='0' cellpadding
="1" class="text">
342 <?php
if ($result != ""): ?
>
344 <td colspan
='5' style
="padding: 5px;" >
345 <a href
="#" class="change_activity" ><span
><?php
echo htmlspecialchars( xl('Update Active'), ENT_NOQUOTES
); ?
></span
></a
>
347 <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
>
352 <table border
='0' cellpadding
="1" class="text" width
= "80%">
354 // display all of the notes for the day, as well as others that are active
355 // from previous dates, up to a certain number, $N
358 echo " <tr class=showborder_head align='left'>\n";
359 echo " <th style='width:100px';> </th>\n";
360 echo " <th>" . xlt('Active') . " </th>\n";
361 echo " <th>" . (($docid ||
$orderid) ?
xlt('Linked') : '') . "</th>\n";
362 echo " <th>" . xlt('Type') . "</th>\n";
363 echo " <th>" . xlt('Content') . "</th>\n";
367 foreach ($result as $iter) {
369 $row_note_id = $iter['id'];
373 if (isGpRelation(1, $docid, 6, $row_note_id)) {
377 // Skip unlinked notes if that is requested.
378 if ($form_doc_only) continue;
382 if (isGpRelation(2, $orderid, 6, $row_note_id)) {
386 // Skip unlinked notes if that is requested.
387 if ($form_doc_only) continue;
391 $body = $iter['body'];
392 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
393 $body = nl2br(htmlspecialchars( oeFormatPatientNote($body), ENT_NOQUOTES
));
395 $body = htmlspecialchars( oeFormatSDFT(strtotime($iter['date'])).date(' H:i', strtotime($iter['date'])), ENT_NOQUOTES
) .
396 ' (' . htmlspecialchars( $iter['user'], ENT_NOQUOTES
) . ') ' . nl2br(htmlspecialchars( oeFormatPatientNote($body), ENT_NOQUOTES
));
398 $body = preg_replace('/(\sto\s)-patient-(\))/','${1}'.$patientname.'${2}',$body);
399 if ( ($iter{"activity"}) && ($iter['message_status'] != "Done") ) {
400 $checked = "checked";
405 // highlight the row if it's been selected for updating
406 if ($_REQUEST['noteid'] == $row_note_id) {
407 echo " <tr height=20 class='noterow highlightcolor' id='".htmlspecialchars( $row_note_id, ENT_QUOTES
)."'>\n";
410 echo " <tr class='noterow' id='".htmlspecialchars( $row_note_id, ENT_QUOTES
)."'>\n";
414 echo " <td><a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=".htmlspecialchars( $row_note_id, ENT_QUOTES
).
415 "' class='css_button_small iframe' onclick='top.restoreSession()'><span>". htmlspecialchars( xl('Edit'), ENT_NOQUOTES
) ."</span></a>\n";
417 // display, or not, a button to delete the note
418 // if the user is an admin or if they are the author of the note, they can delete it
419 if (($iter['user'] == $_SESSION['authUser']) ||
(acl_check('admin','super','','write'))) {
420 echo " <a href='#' class='deletenote css_button_small' id='del" . htmlspecialchars( $row_note_id, ENT_QUOTES
) .
421 "' title='" . htmlspecialchars( xl('Delete this note'), ENT_QUOTES
) . "' onclick='top.restoreSession()'><span>" .
422 htmlspecialchars( xl('Delete'), ENT_NOQUOTES
) . "</span>\n";
427 echo " <td class='text bold'>\n";
428 echo " <input type='hidden' name='act".htmlspecialchars( $row_note_id, ENT_QUOTES
)."' value='1' />\n";
429 echo " <input type='checkbox' name='chk".htmlspecialchars( $row_note_id, ENT_QUOTES
)."' $checked />\n";
432 echo " <td class='text bold'>\n";
433 if ($docid ||
$orderid) {
434 echo " <input type='checkbox' name='lnk" . htmlspecialchars($row_note_id, ENT_QUOTES
) . "' $linked />\n";
438 echo " <td class='bold notecell' id='".htmlspecialchars( $row_note_id, ENT_QUOTES
)."'>" .
439 "<a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=".htmlspecialchars( $row_note_id, ENT_QUOTES
)."' class='iframe' onclick='top.restoreSession()'>\n";
440 // Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
441 echo generate_display_field(array('data_type'=>'1','list_id'=>'note_type'), $iter['title']);
444 echo " <td class='notecell' id='".htmlspecialchars( $row_note_id, ENT_QUOTES
)."'>\n";
453 print "<tr><td colspan='3' class='text'>" . htmlspecialchars( xl('None'), ENT_NOQUOTES
) . ".</td></tr>\n";
462 <table width
='400' border
='0' cellpadding
='0' cellspacing
='0'>
466 if ($offset > ($N-1)) {
467 echo " <a class='link' href='pnotes_full.php" .
469 "&form_active=" . htmlspecialchars( $form_active, ENT_QUOTES
) .
470 "&form_inactive=" . htmlspecialchars( $form_inactive, ENT_QUOTES
) .
471 "&form_doc_only=" . htmlspecialchars( $form_doc_only, ENT_QUOTES
) .
472 "&offset=" . ($offset-$N) . "&" . attr($activity_string_html) . "' onclick='top.restoreSession()'>[" .
473 htmlspecialchars( xl('Previous'), ENT_NOQUOTES
) . "]</a>\n";
479 if ($result_count == $N) {
480 echo " <a class='link' href='pnotes_full.php" .
482 "&form_active=" . htmlspecialchars( $form_active, ENT_QUOTES
) .
483 "&form_inactive=" . htmlspecialchars( $form_inactive, ENT_QUOTES
) .
484 "&form_doc_only=" . htmlspecialchars( $form_doc_only, ENT_QUOTES
) .
485 "&offset=" . ($offset+
$N) . "&" . attr($activity_string_html) . "' onclick='top.restoreSession()'>[" .
486 htmlspecialchars( xl('Next'), ENT_NOQUOTES
) . "]</a>\n";
494 <div id
='outbox_div' <?php
echo $outbox_style; ?
> >
495 <table border
='0' cellpadding
="1" class="text">
496 <?php
if ($result_sent != ""): ?
>
498 <td colspan
='5' style
="padding: 5px;" >
499 <a href
="pnotes_full.php?<?php echo $urlparms; ?>&s=1&<?php echo attr($activity_string_html);?>"
500 class="" id
='Submit' onclick
='top.restoreSession()'><span
><?php
echo xlt('Refresh'); ?
></span
></a
>
505 <table border
='0' cellpadding
="1" class="text" width
= "80%">
507 // display all of the notes for the day, as well as others that are active
508 // from previous dates, up to a certain number, $N
510 if ($result_sent != "") {
511 echo " <tr class=showborder_head align='left'>\n";
512 echo " <th style='width:100px';> </th>\n";
513 echo " <th>" . htmlspecialchars( xl('Active'), ENT_NOQUOTES
) . " </th>\n";
514 echo " <th>" . (($docid ||
$orderid) ?
htmlspecialchars( xl('Linked'), ENT_NOQUOTES
) : '') . "</th>\n";
515 echo " <th>" . htmlspecialchars( xl('Type'), ENT_NOQUOTES
) . "</th>\n";
516 echo " <th>" . htmlspecialchars( xl('Content'), ENT_NOQUOTES
) . "</th>\n";
519 $result_sent_count = 0;
520 foreach ($result_sent as $iter) {
521 $result_sent_count++
;
522 $row_note_id = $iter['id'];
526 if (isGpRelation(1, $docid, 6, $row_note_id)) {
530 // Skip unlinked notes if that is requested.
531 if ($form_doc_only) continue;
535 if (isGpRelation(2, $orderid, 6, $row_note_id)) {
539 // Skip unlinked notes if that is requested.
540 if ($form_doc_only) continue;
544 $body = $iter['body'];
545 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
546 $body = nl2br(htmlspecialchars( oeFormatPatientNote($body), ENT_NOQUOTES
));
548 $body = htmlspecialchars( oeFormatSDFT(strtotime($iter['date'])).date(' H:i', strtotime($iter['date'])), ENT_NOQUOTES
) .
549 ' (' . htmlspecialchars( $iter['user'], ENT_NOQUOTES
) . ') ' . nl2br(htmlspecialchars( oeFormatPatientNote($body), ENT_NOQUOTES
));
551 $body = preg_replace('/(:\d{2}\s\()' . $patient_id . '(\sto\s)/','${1}' . $patientname . '${2}', $body);
552 if (($iter{"activity"}) && ($iter['message_status'] != "Done") ) {
553 $checked = "checked";
558 // highlight the row if it's been selected for updating
559 if ($_REQUEST['noteid'] == $row_note_id) {
560 echo " <tr height=20 class='noterow highlightcolor' id='".htmlspecialchars( $row_note_id, ENT_QUOTES
)."'>\n";
563 echo " <tr class='noterow' id='".htmlspecialchars( $row_note_id, ENT_QUOTES
)."'>\n";
567 echo " <td><a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=".htmlspecialchars( $row_note_id, ENT_QUOTES
).
568 "' class='css_button_small iframe' onclick='top.restoreSession()'><span>". htmlspecialchars( xl('Edit'), ENT_NOQUOTES
) ."</span></a>\n";
570 // display, or not, a button to delete the note
571 // if the user is an admin or if they are the author of the note, they can delete it
572 if (($iter['user'] == $_SESSION['authUser']) ||
(acl_check('admin','super','','write'))) {
573 echo " <a href='#' class='deletenote css_button_small' id='del" . htmlspecialchars( $row_note_id, ENT_QUOTES
) .
574 "' title='" . htmlspecialchars( xl('Delete this note'), ENT_QUOTES
) . "' onclick='top.restoreSession()'><span>" .
575 htmlspecialchars( xl('Delete'), ENT_NOQUOTES
) . "</span>\n";
580 echo " <td class='text bold'>\n";
581 echo " <input type='hidden' name='act".htmlspecialchars( $row_note_id, ENT_QUOTES
)."' value='1' />\n";
582 echo " <input type='checkbox' name='chk".htmlspecialchars( $row_note_id, ENT_QUOTES
)."' $checked />\n";
585 echo " <td class='text bold'>\n";
586 if ($docid ||
$orderid) {
587 echo " <input type='checkbox' name='lnk" . htmlspecialchars($row_note_id, ENT_QUOTES
) . "' $linked />\n";
591 echo " <td class='bold notecell' id='".htmlspecialchars( $row_note_id, ENT_QUOTES
)."'>" .
592 "<a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=".htmlspecialchars( $row_note_id, ENT_QUOTES
)."' class='iframe' onclick='top.restoreSession()'>\n";
593 // Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
594 echo generate_display_field(array('data_type'=>'1','list_id'=>'note_type'), $iter['title']);
597 echo " <td class='notecell' id='".htmlspecialchars( $row_note_id, ENT_QUOTES
)."'>\n";
606 print "<tr><td colspan='3' class='text'>" . htmlspecialchars( xl('None'), ENT_NOQUOTES
) . ".</td></tr>\n";
613 <table width
='400' border
='0' cellpadding
='0' cellspacing
='0'>
617 if ($offset_sent > ($M-1)) {
618 echo " <a class='link' href='pnotes_full.php" .
621 "&form_active=" . htmlspecialchars( $form_active, ENT_QUOTES
) .
622 "&form_inactive=" . htmlspecialchars( $form_inactive, ENT_QUOTES
) .
623 "&form_doc_only=" . htmlspecialchars( $form_doc_only, ENT_QUOTES
) .
624 "&offset_sent=" . ($offset_sent-$M) . "&" . attr($activity_string_html) . "' onclick='top.restoreSession()'>[" .
625 htmlspecialchars( xl('Previous'), ENT_NOQUOTES
) . "]</a>\n";
631 if ($result_sent_count == $M) {
632 echo " <a class='link' href='pnotes_full.php" .
635 "&form_active=" . htmlspecialchars( $form_active, ENT_QUOTES
) .
636 "&form_inactive=" . htmlspecialchars( $form_inactive, ENT_QUOTES
) .
637 "&form_doc_only=" . htmlspecialchars( $form_doc_only, ENT_QUOTES
) .
638 "&offset_sent=" . ($offset_sent+
$M) . "&" . attr($activity_string_html) . "' onclick='top.restoreSession()'>[" .
639 htmlspecialchars( xl('Next'), ENT_NOQUOTES
) . "]</a>\n";
648 <script language
='JavaScript'>
651 if ($_GET['set_pid']) {
652 $ndata = getPatientData($patient_id, "fname, lname, pubpid");
654 parent
.left_nav
.setPatient(<?php
echo "'" . addslashes($ndata['fname']." ".$ndata['lname']) . "'," .
655 addslashes($patient_id) . ",'" . addslashes($ndata['pubpid']) . "',window.name"; ?
>);
659 // If this note references a new patient document, pop up a display
662 if ($noteid /* && $title == 'New Document' */ ) {
663 $prow = getPnoteById($noteid, 'body');
664 if (preg_match('/New scanned document (\d+): [^\n]+\/([^\n]+)/', $prow['body'], $matches)) {
665 $docid = $matches[1];
666 $docname = $matches[2];
668 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',
669 '_blank', 'resizable=1,scrollbars=1,width=600,height=500');
677 </div
> <!-- end outer
'pnotes' -->
681 <script language
="javascript">
683 // jQuery stuff to make the page a little easier to use
685 $
(document
).ready(function(){
686 $
("#appendnote").click(function() { AppendNote(); });
687 $
("#newnote").click(function() { NewNote(); });
688 $
("#printnote").click(function() { PrintNote(); });
690 $
(".change_activity").click(function() { top
.restoreSession(); $
("#update_activity").submit(); });
692 $
(".deletenote").click(function() { DeleteNote(this
); });
694 $
(".noterow").mouseover(function() { $
(this
).toggleClass("highlight"); });
695 $
(".noterow").mouseout(function() { $
(this
).toggleClass("highlight"); });
696 $
(".notecell").click(function() { EditNote(this
); });
700 var EditNote
= function(note
) {
701 top
.restoreSession();
702 $
("#noteid").val(note
.id
);
704 $
("#new_note").submit();
707 var NewNote
= function () {
708 top
.restoreSession();
709 $
("#noteid").val('');
710 $
("#new_note").submit();
713 var AppendNote
= function () {
714 top
.restoreSession();
715 $
("#new_note").submit();
718 var PrintNote
= function () {
719 top
.restoreSession();
720 window
.open('pnotes_print.php?noteid=<?php echo htmlspecialchars( $noteid, ENT_QUOTES); ?>', '_blank', 'resizable=1,scrollbars=1,width=600,height=500');
723 var DeleteNote
= function(note
) {
724 if (confirm("<?php echo htmlspecialchars( xl('Are you sure you want to delete this note?','','','\n '), ENT_QUOTES) .
725 htmlspecialchars( xl('This action CANNOT be undone.'), ENT_QUOTES); ?>")) {
726 top
.restoreSession();
727 // strip the 'del' part of the object's ID
728 $
("#noteid").val(note
.id
.replace(/del
/, ""));
729 $
("#mode").val("delete");
730 $
("#new_note").submit();