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.g.miller@gmail.com>
18 * @link http://www.open-emr.org
23 /* Include required globals */
24 require_once('../../globals.php');
25 require_once($GLOBALS['srcdir'].'/pnotes.inc');
26 require_once($GLOBALS['srcdir'].'/patient.inc');
27 require_once($GLOBALS['srcdir'].'/acl.inc');
28 require_once($GLOBALS['srcdir'].'/log.inc');
29 require_once($GLOBALS['srcdir'].'/options.inc.php');
30 require_once($GLOBALS['srcdir'].'/gprelations.inc.php');
32 if ($_GET['set_pid']) {
33 require_once($GLOBALS['srcdir'].'/pid.inc');
34 setpid($_GET['set_pid']);
37 // form parameter docid can be passed to restrict the display to a document.
38 $docid = empty($_REQUEST['docid']) ?
0 : 0 +
$_REQUEST['docid'];
40 // form parameter orderid can be passed to restrict the display to a procedure order.
41 $orderid = empty($_REQUEST['orderid']) ?
0 : intval($_REQUEST['orderid']);
45 $row = sqlQuery("SELECT foreign_id FROM documents WHERE id = ?", array($docid));
46 $patient_id = intval($row['foreign_id']);
47 } else if ($orderid) {
48 $row = sqlQuery("SELECT patient_id FROM procedure_order WHERE procedure_order_id = ?", array($orderid));
49 $patient_id = intval($row['patient_id']);
52 // Check authorization.
53 if (!acl_check('patients', 'notes', '', array('write','addonly'))) {
54 die(htmlspecialchars(xl('Not authorized'), ENT_NOQUOTES
));
57 $tmp = getPatientData($patient_id, "squad");
58 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad'])) {
59 die(htmlspecialchars(xl('Not authorized for this squad.'), ENT_NOQUOTES
));
62 //the number of records to display per screen
66 $mode = $_REQUEST['mode'];
67 $offset = $_REQUEST['offset'];
68 $offset_sent = $_REQUEST['offset_sent'];
69 $form_active = $_REQUEST['form_active'];
70 $form_inactive = $_REQUEST['form_inactive'];
71 $noteid = $_REQUEST['noteid'];
72 $form_doc_only = isset($_POST['mode']) ?
(empty($_POST['form_doc_only']) ?
0 : 1) : 1;
73 if ($_REQUEST['s'] == '1') {
76 $inbox_style = "style='display:none;border:5px solid #FFFFFF;'";
77 $outbox_style = "style='border:5px solid #FFFFFF;'";
81 $inbox_style = "style='border:5px solid #FFFFFF;'";
83 $outbox_style = "style='display:none;border:5px solid #FFFFFF;'";
86 if (!isset($offset)) {
90 if (!isset($offset_sent)) {
94 // Collect active variable and applicable html code for links
97 $activity_string_html = 'form_active=1';
98 } else if ($form_inactive) {
100 $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"]) {
121 setGpRelation(1, $docid, 6, $id, !empty($_POST["lnk$id"]));
125 setGpRelation(2, $orderid, 6, $id, !empty($_POST["lnk$id"]));
129 } elseif ($mode == "new") {
130 $note = $_POST['note'];
132 updatePnote($noteid, $note, $_POST['form_note_type'], $_POST['assigned_to']);
139 $_POST['form_note_type'],
140 $_POST['assigned_to']
145 setGpRelation(1, $docid, 6, $noteid);
149 setGpRelation(2, $orderid, 6, $noteid);
153 } elseif ($mode == "delete") {
155 deletePnote($noteid);
156 newEvent("delete", $_SESSION['authUser'], $_SESSION['authProvider'], 1, "pnotes: id ".$noteid);
164 $assigned_to = $_SESSION['authUser'];
166 $prow = getPnoteById($noteid, 'title,assigned_to,body');
167 $title = $prow['title'];
168 $assigned_to = $prow['assigned_to'];
171 // Get the users list. The "Inactive" test is a kludge, we should create
172 // a separate column for this.
173 $ures = sqlStatement("SELECT username, fname, lname FROM users " .
174 "WHERE username != '' AND active = 1 AND " .
175 "( info IS NULL OR info NOT LIKE '%Inactive%' ) " .
176 "ORDER BY lname, fname");
178 $pres = getPatientData($patient_id, "lname, fname");
179 $patientname = $pres['lname'] . ", " . $pres['fname'];
182 $result = getPnotesByDate(
185 'id,date,body,user,activity,title,assigned_to,message_status',
194 $result_sent = getSentPnotesByDate(
197 'id,date,body,user,activity,title,assigned_to,message_status',
210 <?php
html_header_show();?
>
212 <link rel
='stylesheet' href
="<?php echo $css_header;?>" type
="text/css">
214 <!-- supporting javascript code
-->
215 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-2/index.js"></script
>
216 <link rel
="stylesheet" type
="text/css" href
="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media
="screen" />
217 <script type
="text/javascript" src
="../../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
218 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-3-2/index.js"></script
>
219 <script type
="text/javascript" src
="../../../library/js/common.js"></script
>
220 <script type
="text/javascript" src
="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script
>
221 <script type
="text/javascript">
222 /// todo, move this to a common library
224 $
(document
).ready(function(){
226 $
("#dem_view").click( function() {
227 toggle( $
(this
), "#DEM" );
231 $
("#stats_div").load("stats.php");
232 $
("#notes_div").load("pnotes_fragment.php");
238 function show_div(name
){
240 document
.getElementById('inbox_div').style
.display
= '';
241 document
.getElementById('outbox_div').style
.display
= 'none';
243 document
.getElementById('inbox_div').style
.display
= 'none';
244 document
.getElementById('outbox_div').style
.display
= '';
249 <body
class="body_top">
251 <div id
="pnotes"> <!-- large outer DIV
-->
253 <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()'>
258 $title_docname .= " " . xl("linked to document") . " ";
259 $d = new Document($docid);
260 $title_docname .= $d->get_url_file();
264 $title_docname .= " " . xl("linked to procedure order") . " $orderid";
267 $urlparms = "docid=$docid&orderid=$orderid";
271 <span
class="title"><?php
echo xlt('Patient Notes') . $title_docname; ?
></span
>
273 <div id
='namecontainer_pnotes' class='namecontainer_pnotes' style
='float:left;margin-right:10px'>
274 <?php
echo htmlspecialchars(xl('for'), ENT_NOQUOTES
);?
> 
;<span
class="title">
275 <a href
="../summary/demographics.php" onclick
="top.restoreSession()"><?php
echo htmlspecialchars(getPatientName($patient_id), ENT_NOQUOTES
); ?
></a
></span
>
278 <a href
="pnotes_full_add.php?<?php echo $urlparms; ?>" class="css_button iframe" onclick
='top.restoreSession()'><span
><?php
echo xlt('Add'); ?
></span
></a
>
279 <a href
="demographics.php" class="css_button" onclick
="top.restoreSession()">
280 <span
><?php
echo htmlspecialchars(xl('View Patient'), ENT_NOQUOTES
);?
></span
>
286 <?php
if ($active == "all") { ?
>
287 <span
><?php
echo xlt('Show All'); ?
></span
>
289 <a href
="pnotes_full.php?<?php echo $urlparms; ?>" class="link" onclick
="top.restoreSession()"><span
><?php
echo xlt('Show All'); ?
></span
></a
>
292 <?php
if ($active == '1') { ?
>
293 <span
><?php
echo xlt('Show Active'); ?
></span
>
295 <a href
="pnotes_full.php?form_active=1&<?php echo $urlparms; ?>" class="link" onclick
="top.restoreSession()"><span
><?php
echo xlt('Show Active'); ?
></span
></a
>
298 <?php
if ($active == '0') { ?
>
299 <span
><?php
echo xlt('Show Inactive'); ?
></span
>
301 <a href
="pnotes_full.php?form_inactive=1&<?php echo $urlparms; ?>" class="link" onclick
="top.restoreSession()"><span
><?php
echo xlt('Show Inactive'); ?
></span
></a
>
305 <input type
='hidden' name
='mode' id
="mode" value
="new">
306 <input type
='hidden' name
='offset' id
="offset" value
="<?php echo $offset; ?>">
307 <input type
='hidden' name
='offset_sent' id
="offset_sent" value
="<?php echo $offset_sent; ?>">
308 <input type
='hidden' name
='form_active' id
="form_active" value
="<?php echo htmlspecialchars($form_active, ENT_QUOTES); ?>">
309 <input type
='hidden' name
='form_inactive' id
="form_inactive" value
="<?php echo htmlspecialchars($form_inactive, ENT_QUOTES); ?>">
310 <input type
='hidden' name
='noteid' id
="noteid" value
="<?php echo htmlspecialchars($noteid, ENT_QUOTES); ?>">
311 <input type
='hidden' name
='form_doc_only' id
="form_doc_only" value
="<?php echo htmlspecialchars($form_doc_only, ENT_QUOTES); ?>">
316 // Get the billing note if there is one.
320 $resnote = getPatientData($patient_id, "billing_note");
321 if (!empty($resnote['billing_note'])) {
322 $billing_note = $resnote['billing_note'];
323 $colorbeg = "<span style='color:red'>";
324 $colorend = "</span>";
327 //Display what the patient owes
328 $balance = get_patient_balance($patient_id);
331 <?php
if ($billing_note ||
$balance) { ?
>
333 <div style
='margin-top:3px'>
336 if ($balance != "0") {
337 // $formatted = sprintf((xl('$').'%01.2f'), $balance);
338 $formatted = oeFormatMoney($balance);
339 echo " <tr class='text billing'>\n";
340 echo " <td>".$colorbeg . htmlspecialchars(xl('Balance Due'), ENT_NOQUOTES
) .
341 $colorend." ".$colorbeg. htmlspecialchars($formatted, ENT_NOQUOTES
) .
347 echo " <tr class='text billing'>\n";
348 echo " <td>".$colorbeg . htmlspecialchars(xl('Billing Note'), ENT_NOQUOTES
) .
349 $colorend." ".$colorbeg . htmlspecialchars($billing_note, ENT_NOQUOTES
) .
359 <li
class="<?php echo $inbox; ?>" ><a onclick
="show_div('inbox')" href
="#"><?php
echo htmlspecialchars(xl('Inbox'), ENT_NOQUOTES
); ?
></a
></li
>
360 <li
class="<?php echo $outbox; ?>" ><a onclick
="show_div('outbox')" href
="#"><?php
echo htmlspecialchars(xl('Sent Items'), ENT_NOQUOTES
); ?
></a
></li
>
362 <div
class='tabContainer' >
363 <div id
='inbox_div' <?php
echo $inbox_style; ?
> >
364 <form border
='0' method
='post' name
='update_activity' id
='update_activity'
365 action
="pnotes_full.php?<?php echo $urlparms; ?>&<?php echo attr($activity_string_html);?>" onsubmit
='return top.restoreSession()'>
366 <!-- start of previous notes DIV
-->
367 <div
class=pat_notes
>
368 <input type
='hidden' name
='mode' value
="update">
369 <input type
='hidden' name
='offset' id
='offset' value
="<?php echo $offset; ?>">
370 <input type
='hidden' name
='offset_sent' id
='offset_sent' value
="<?php echo $offset_sent; ?>">
371 <input type
='hidden' name
='noteid' id
='noteid' value
="0">
372 <table border
='0' cellpadding
="1" class="text">
373 <?php
if ($result != "") : ?
>
375 <td colspan
='5' style
="padding: 5px;" >
376 <a href
="#" class="change_activity" ><span
><?php
echo htmlspecialchars(xl('Update Active'), ENT_NOQUOTES
); ?
></span
></a
>
378 <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
>
383 <table border
='0' cellpadding
="1" class="text" width
= "80%">
385 // display all of the notes for the day, as well as others that are active
386 // from previous dates, up to a certain number, $N
389 echo " <tr class=showborder_head align='left'>\n";
390 echo " <th style='width:100px';> </th>\n";
391 echo " <th>" . xlt('Active') . " </th>\n";
392 echo " <th>" . (($docid ||
$orderid) ?
xlt('Linked') : '') . "</th>\n";
393 echo " <th>" . xlt('Type') . "</th>\n";
394 echo " <th>" . xlt('Content') . "</th>\n";
398 foreach ($result as $iter) {
400 $row_note_id = $iter['id'];
404 if (isGpRelation(1, $docid, 6, $row_note_id)) {
407 // Skip unlinked notes if that is requested.
408 if ($form_doc_only) {
412 } else if ($orderid) {
413 if (isGpRelation(2, $orderid, 6, $row_note_id)) {
416 // Skip unlinked notes if that is requested.
417 if ($form_doc_only) {
423 $body = $iter['body'];
424 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
425 $body = nl2br(htmlspecialchars(oeFormatPatientNote($body), ENT_NOQUOTES
));
427 $body = htmlspecialchars(oeFormatSDFT(strtotime($iter['date'])).date(' H:i', strtotime($iter['date'])), ENT_NOQUOTES
) .
428 ' (' . htmlspecialchars($iter['user'], ENT_NOQUOTES
) . ') ' . nl2br(htmlspecialchars(oeFormatPatientNote($body), ENT_NOQUOTES
));
431 $body = preg_replace('/(\sto\s)-patient-(\))/', '${1}'.$patientname.'${2}', $body);
432 if (($iter{"activity"}) && ($iter['message_status'] != "Done")) {
433 $checked = "checked";
438 // highlight the row if it's been selected for updating
439 if ($_REQUEST['noteid'] == $row_note_id) {
440 echo " <tr height=20 class='noterow highlightcolor' id='".htmlspecialchars($row_note_id, ENT_QUOTES
)."'>\n";
442 echo " <tr class='noterow' id='".htmlspecialchars($row_note_id, ENT_QUOTES
)."'>\n";
446 echo " <td><a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=".htmlspecialchars($row_note_id, ENT_QUOTES
).
447 "' class='css_button_small iframe' onclick='top.restoreSession()'><span>". htmlspecialchars(xl('Edit'), ENT_NOQUOTES
) ."</span></a>\n";
449 // display, or not, a button to delete the note
450 // if the user is an admin or if they are the author of the note, they can delete it
451 if (($iter['user'] == $_SESSION['authUser']) ||
(acl_check('admin', 'super', '', 'write'))) {
452 echo " <a href='#' class='deletenote css_button_small' id='del" . htmlspecialchars($row_note_id, ENT_QUOTES
) .
453 "' title='" . htmlspecialchars(xl('Delete this note'), ENT_QUOTES
) . "' onclick='top.restoreSession()'><span>" .
454 htmlspecialchars(xl('Delete'), ENT_NOQUOTES
) . "</span>\n";
460 echo " <td class='text bold'>\n";
461 echo " <input type='hidden' name='act".htmlspecialchars($row_note_id, ENT_QUOTES
)."' value='1' />\n";
462 echo " <input type='checkbox' name='chk".htmlspecialchars($row_note_id, ENT_QUOTES
)."' $checked />\n";
465 echo " <td class='text bold'>\n";
466 if ($docid ||
$orderid) {
467 echo " <input type='checkbox' name='lnk" . htmlspecialchars($row_note_id, ENT_QUOTES
) . "' $linked />\n";
472 echo " <td class='bold notecell' id='".htmlspecialchars($row_note_id, ENT_QUOTES
)."'>" .
473 "<a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=".htmlspecialchars($row_note_id, ENT_QUOTES
)."' class='iframe' onclick='top.restoreSession()'>\n";
474 // Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
475 echo generate_display_field(array('data_type'=>'1','list_id'=>'note_type'), $iter['title']);
478 echo " <td class='notecell' id='".htmlspecialchars($row_note_id, ENT_QUOTES
)."'>\n";
487 print "<tr><td colspan='3' class='text'>" . htmlspecialchars(xl('None'), ENT_NOQUOTES
) . ".</td></tr>\n";
496 <table width
='400' border
='0' cellpadding
='0' cellspacing
='0'>
500 if ($offset > ($N-1)) {
501 echo " <a class='link' href='pnotes_full.php" .
503 "&form_active=" . htmlspecialchars($form_active, ENT_QUOTES
) .
504 "&form_inactive=" . htmlspecialchars($form_inactive, ENT_QUOTES
) .
505 "&form_doc_only=" . htmlspecialchars($form_doc_only, ENT_QUOTES
) .
506 "&offset=" . ($offset-$N) . "&" . attr($activity_string_html) . "' onclick='top.restoreSession()'>[" .
507 htmlspecialchars(xl('Previous'), ENT_NOQUOTES
) . "]</a>\n";
513 if ($result_count == $N) {
514 echo " <a class='link' href='pnotes_full.php" .
516 "&form_active=" . htmlspecialchars($form_active, ENT_QUOTES
) .
517 "&form_inactive=" . htmlspecialchars($form_inactive, ENT_QUOTES
) .
518 "&form_doc_only=" . htmlspecialchars($form_doc_only, ENT_QUOTES
) .
519 "&offset=" . ($offset+
$N) . "&" . attr($activity_string_html) . "' onclick='top.restoreSession()'>[" .
520 htmlspecialchars(xl('Next'), ENT_NOQUOTES
) . "]</a>\n";
528 <div id
='outbox_div' <?php
echo $outbox_style; ?
> >
529 <table border
='0' cellpadding
="1" class="text">
530 <?php
if ($result_sent != "") : ?
>
532 <td colspan
='5' style
="padding: 5px;" >
533 <a href
="pnotes_full.php?<?php echo $urlparms; ?>&s=1&<?php echo attr($activity_string_html);?>"
534 class="" id
='Submit' onclick
='top.restoreSession()'><span
><?php
echo xlt('Refresh'); ?
></span
></a
>
539 <table border
='0' cellpadding
="1" class="text" width
= "80%">
541 // display all of the notes for the day, as well as others that are active
542 // from previous dates, up to a certain number, $N
544 if ($result_sent != "") {
545 echo " <tr class=showborder_head align='left'>\n";
546 echo " <th style='width:100px';> </th>\n";
547 echo " <th>" . htmlspecialchars(xl('Active'), ENT_NOQUOTES
) . " </th>\n";
548 echo " <th>" . (($docid ||
$orderid) ?
htmlspecialchars(xl('Linked'), ENT_NOQUOTES
) : '') . "</th>\n";
549 echo " <th>" . htmlspecialchars(xl('Type'), ENT_NOQUOTES
) . "</th>\n";
550 echo " <th>" . htmlspecialchars(xl('Content'), ENT_NOQUOTES
) . "</th>\n";
553 $result_sent_count = 0;
554 foreach ($result_sent as $iter) {
555 $result_sent_count++
;
556 $row_note_id = $iter['id'];
560 if (isGpRelation(1, $docid, 6, $row_note_id)) {
563 // Skip unlinked notes if that is requested.
564 if ($form_doc_only) {
568 } else if ($orderid) {
569 if (isGpRelation(2, $orderid, 6, $row_note_id)) {
572 // Skip unlinked notes if that is requested.
573 if ($form_doc_only) {
579 $body = $iter['body'];
580 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
581 $body = nl2br(htmlspecialchars(oeFormatPatientNote($body), ENT_NOQUOTES
));
583 $body = htmlspecialchars(oeFormatSDFT(strtotime($iter['date'])).date(' H:i', strtotime($iter['date'])), ENT_NOQUOTES
) .
584 ' (' . htmlspecialchars($iter['user'], ENT_NOQUOTES
) . ') ' . nl2br(htmlspecialchars(oeFormatPatientNote($body), ENT_NOQUOTES
));
587 $body = preg_replace('/(:\d{2}\s\()' . $patient_id . '(\sto\s)/', '${1}' . $patientname . '${2}', $body);
588 if (($iter{"activity"}) && ($iter['message_status'] != "Done")) {
589 $checked = "checked";
594 // highlight the row if it's been selected for updating
595 if ($_REQUEST['noteid'] == $row_note_id) {
596 echo " <tr height=20 class='noterow highlightcolor' id='".htmlspecialchars($row_note_id, ENT_QUOTES
)."'>\n";
598 echo " <tr class='noterow' id='".htmlspecialchars($row_note_id, ENT_QUOTES
)."'>\n";
602 echo " <td><a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=".htmlspecialchars($row_note_id, ENT_QUOTES
).
603 "' class='css_button_small iframe' onclick='top.restoreSession()'><span>". htmlspecialchars(xl('Edit'), ENT_NOQUOTES
) ."</span></a>\n";
605 // display, or not, a button to delete the note
606 // if the user is an admin or if they are the author of the note, they can delete it
607 if (($iter['user'] == $_SESSION['authUser']) ||
(acl_check('admin', 'super', '', 'write'))) {
608 echo " <a href='#' class='deletenote css_button_small' id='del" . htmlspecialchars($row_note_id, ENT_QUOTES
) .
609 "' title='" . htmlspecialchars(xl('Delete this note'), ENT_QUOTES
) . "' onclick='top.restoreSession()'><span>" .
610 htmlspecialchars(xl('Delete'), ENT_NOQUOTES
) . "</span>\n";
616 echo " <td class='text bold'>\n";
617 echo " <input type='hidden' name='act".htmlspecialchars($row_note_id, ENT_QUOTES
)."' value='1' />\n";
618 echo " <input type='checkbox' name='chk".htmlspecialchars($row_note_id, ENT_QUOTES
)."' $checked />\n";
621 echo " <td class='text bold'>\n";
622 if ($docid ||
$orderid) {
623 echo " <input type='checkbox' name='lnk" . htmlspecialchars($row_note_id, ENT_QUOTES
) . "' $linked />\n";
628 echo " <td class='bold notecell' id='".htmlspecialchars($row_note_id, ENT_QUOTES
)."'>" .
629 "<a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=".htmlspecialchars($row_note_id, ENT_QUOTES
)."' class='iframe' onclick='top.restoreSession()'>\n";
630 // Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
631 echo generate_display_field(array('data_type'=>'1','list_id'=>'note_type'), $iter['title']);
634 echo " <td class='notecell' id='".htmlspecialchars($row_note_id, ENT_QUOTES
)."'>\n";
643 print "<tr><td colspan='3' class='text'>" . htmlspecialchars(xl('None'), ENT_NOQUOTES
) . ".</td></tr>\n";
650 <table width
='400' border
='0' cellpadding
='0' cellspacing
='0'>
654 if ($offset_sent > ($M-1)) {
655 echo " <a class='link' href='pnotes_full.php" .
658 "&form_active=" . htmlspecialchars($form_active, ENT_QUOTES
) .
659 "&form_inactive=" . htmlspecialchars($form_inactive, ENT_QUOTES
) .
660 "&form_doc_only=" . htmlspecialchars($form_doc_only, ENT_QUOTES
) .
661 "&offset_sent=" . ($offset_sent-$M) . "&" . attr($activity_string_html) . "' onclick='top.restoreSession()'>[" .
662 htmlspecialchars(xl('Previous'), ENT_NOQUOTES
) . "]</a>\n";
668 if ($result_sent_count == $M) {
669 echo " <a class='link' href='pnotes_full.php" .
672 "&form_active=" . htmlspecialchars($form_active, ENT_QUOTES
) .
673 "&form_inactive=" . htmlspecialchars($form_inactive, ENT_QUOTES
) .
674 "&form_doc_only=" . htmlspecialchars($form_doc_only, ENT_QUOTES
) .
675 "&offset_sent=" . ($offset_sent+
$M) . "&" . attr($activity_string_html) . "' onclick='top.restoreSession()'>[" .
676 htmlspecialchars(xl('Next'), ENT_NOQUOTES
) . "]</a>\n";
685 <script language
='JavaScript'>
688 if ($_GET['set_pid']) {
689 $ndata = getPatientData($patient_id, "fname, lname, pubpid");
691 parent
.left_nav
.setPatient(<?php
echo "'" . addslashes($ndata['fname']." ".$ndata['lname']) . "'," .
692 addslashes($patient_id) . ",'" . addslashes($ndata['pubpid']) . "',window.name"; ?
>);
696 // If this note references a new patient document, pop up a display
699 if ($noteid /* && $title == 'New Document' */) {
700 $prow = getPnoteById($noteid, 'body');
701 if (preg_match('/New scanned document (\d+): [^\n]+\/([^\n]+)/', $prow['body'], $matches)) {
702 $docid = $matches[1];
703 $docname = $matches[2];
705 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',
706 '_blank', 'resizable=1,scrollbars=1,width=600,height=500');
714 </div
> <!-- end outer
'pnotes' -->
718 <script language
="javascript">
720 // jQuery stuff to make the page a little easier to use
722 $
(document
).ready(function(){
723 $
("#appendnote").click(function() { AppendNote(); });
724 $
("#newnote").click(function() { NewNote(); });
725 $
("#printnote").click(function() { PrintNote(); });
727 $
(".change_activity").click(function() { top
.restoreSession(); $
("#update_activity").submit(); });
729 $
(".deletenote").click(function() { DeleteNote(this
); });
731 $
(".noterow").mouseover(function() { $
(this
).toggleClass("highlight"); });
732 $
(".noterow").mouseout(function() { $
(this
).toggleClass("highlight"); });
733 $
(".notecell").click(function() { EditNote(this
); });
737 var EditNote
= function(note
) {
738 top
.restoreSession();
739 $
("#noteid").val(note
.id
);
741 $
("#new_note").submit();
744 var NewNote
= function () {
745 top
.restoreSession();
746 $
("#noteid").val('');
747 $
("#new_note").submit();
750 var AppendNote
= function () {
751 top
.restoreSession();
752 $
("#new_note").submit();
755 var PrintNote
= function () {
756 top
.restoreSession();
757 window
.open('pnotes_print.php?noteid=<?php echo htmlspecialchars($noteid, ENT_QUOTES); ?>', '_blank', 'resizable=1,scrollbars=1,width=600,height=500');
760 var DeleteNote
= function(note
) {
761 if (confirm("<?php echo htmlspecialchars(xl('Are you sure you want to delete this note?', '', '', '\n '), ENT_QUOTES) .
762 htmlspecialchars(xl('This action CANNOT be undone.'), ENT_QUOTES); ?>")) {
763 top
.restoreSession();
764 // strip the 'del' part of the object's ID
765 $
("#noteid").val(note
.id
.replace(/del
/, ""));
766 $
("#mode").val("delete");
767 $
("#new_note").submit();