3 * Display, enter, modify and manage patient notes.
6 * @link http://www.open-emr.org
7 * @author Brady Miller <brady.g.miller@gmail.com>
8 * @copyright Copyright (c) 2018-2020 Brady Miller <brady.g.miller@gmail.com>
9 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once('../../globals.php');
14 require_once($GLOBALS['srcdir'].'/pnotes.inc');
15 require_once($GLOBALS['srcdir'].'/patient.inc');
16 require_once($GLOBALS['srcdir'].'/acl.inc');
17 require_once($GLOBALS['srcdir'].'/options.inc.php');
18 require_once($GLOBALS['srcdir'].'/gprelations.inc.php');
20 use OpenEMR\Common\Csrf\CsrfUtils
;
21 use OpenEMR\Common\Logging\EventAuditLogger
;
22 use OpenEMR\Core\Header
;
23 use OpenEMR\Services\UserService
;
25 if ($_GET['set_pid']) {
26 require_once($GLOBALS['srcdir'].'/pid.inc');
27 setpid($_GET['set_pid']);
30 // form parameter docid can be passed to restrict the display to a document.
31 $docid = empty($_REQUEST['docid']) ?
0 : 0 +
$_REQUEST['docid'];
33 // form parameter orderid can be passed to restrict the display to a procedure order.
34 $orderid = empty($_REQUEST['orderid']) ?
0 : intval($_REQUEST['orderid']);
38 $userService = new UserService();
41 $row = sqlQuery("SELECT foreign_id FROM documents WHERE id = ?", array($docid));
42 $patient_id = intval($row['foreign_id']);
43 } else if ($orderid) {
44 $row = sqlQuery("SELECT patient_id FROM procedure_order WHERE procedure_order_id = ?", array($orderid));
45 $patient_id = intval($row['patient_id']);
48 // Check authorization.
49 if (!acl_check('patients', 'notes', '', array('write','addonly'))) {
50 die(xlt('Not authorized'));
53 $tmp = getPatientData($patient_id, "squad");
54 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad'])) {
55 die(xlt('Not authorized for this squad.'));
58 //the number of records to display per screen
62 $mode = $_REQUEST['mode'];
63 $offset = $_REQUEST['offset'];
64 $offset_sent = $_REQUEST['offset_sent'];
65 $form_active = $_REQUEST['form_active'];
66 $form_inactive = $_REQUEST['form_inactive'];
67 $noteid = $_REQUEST['noteid'];
68 $form_doc_only = isset($_POST['mode']) ?
(empty($_POST['form_doc_only']) ?
0 : 1) : 1;
69 if ($_REQUEST['s'] == '1') {
72 $inbox_style = "style='display:none;border:5px solid var(--white);'";
73 $outbox_style = "style='border:5px solid var(--white);'";
77 $inbox_style = "style='border:5px solid var(--white);'";
78 $outbox_style = "style='display:none;border:5px solid var(--white);'";
81 if (!isset($offset)) {
85 if (!isset($offset_sent)) {
89 // Collect active variable and applicable html code for links
92 $activity_string_html = 'form_active=1';
93 } else if ($form_inactive) {
95 $activity_string_html = 'form_inactive=1';
98 $activity_string_html = '';
99 $form_active = $form_inactive = '0';
102 // this code handles changing the state of activity tags when the user updates
103 // them through the interface
105 if (!CsrfUtils
::verifyCsrfToken($_POST["csrf_token_form"])) {
106 CsrfUtils
::csrfNotVerified();
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"]) {
120 setGpRelation(1, $docid, 6, $id, !empty($_POST["lnk$id"]));
124 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'], '', !empty($_POST['form_datetime']) ?
DateTimeToYYYYMMDDHHMMSS($_POST['form_datetime']) : '');
138 $_POST['form_note_type'],
139 $_POST['assigned_to'],
140 !empty($_POST['form_datetime']) ?
DateTimeToYYYYMMDDHHMMSS($_POST['form_datetime']) : ''
145 setGpRelation(1, $docid, 6, $noteid);
149 setGpRelation(2, $orderid, 6, $noteid);
153 } elseif ($mode == "delete") {
155 deletePnote($noteid);
156 EventAuditLogger
::instance()->newEvent("delete", $_SESSION['authUser'], $_SESSION['authProvider'], 1, "pnotes: id ".$noteid);
161 if ($mode != "delete" && $mode != "update") {
162 exit(); // add exit for ajax save from pnotes_full_add.php sjp 12/20/2017
167 $assigned_to = $_SESSION['authUser'];
169 $prow = getPnoteById($noteid, 'title,assigned_to,body');
170 $title = $prow['title'];
171 $assigned_to = $prow['assigned_to'];
174 // Get the users list. The "Inactive" test is a kludge, we should create
175 // a separate column for this.
176 $ures = sqlStatement("SELECT username, fname, lname FROM users " .
177 "WHERE username != '' AND active = 1 AND " .
178 "( info IS NULL OR info NOT LIKE '%Inactive%' ) " .
179 "ORDER BY lname, fname");
181 $pres = getPatientData($patient_id, "lname, fname");
182 $patientname = $pres['lname'] . ", " . $pres['fname'];
185 $result = getPnotesByDate(
188 'id,date,body,user,activity,title,assigned_to,message_status,update_date,update_by',
197 $result_sent = getSentPnotesByDate(
200 'id,date,body,user,activity,title,assigned_to,message_status,update_date,update_by',
214 <?php Header
::setupHeader(['common', 'jquery-ui', 'opener']); ?
>
216 <script type
="text/javascript">
217 /// todo, move this to a common library
221 $
("#dem_view").click( function() {
222 toggle( $
(this
), "#DEM" );
226 $
("#stats_div").load("stats.php",
228 csrf_token_form
: <?php
echo js_escape(CsrfUtils
::collectCsrfToken()); ?
>
231 $
("#notes_div").load("pnotes_fragment.php",
233 csrf_token_form
: <?php
echo js_escape(CsrfUtils
::collectCsrfToken()); ?
>
239 $
(".note_modal").on('click', function(e
) {
242 dlgopen('', '', 700, 400, '', '', {
244 {text
: <?php
echo xlj('Close'); ?
>, close
: true, style
: 'default btn-sm'}
250 url
: $
(this
).attr('href')
256 function show_div(name
){
258 document
.getElementById('inbox_div').style
.display
= '';
259 document
.getElementById('outbox_div').style
.display
= 'none';
261 document
.getElementById('inbox_div').style
.display
= 'none';
262 document
.getElementById('outbox_div').style
.display
= '';
266 function refreshme() {
267 top
.restoreSession();
268 document
.location
.reload();
271 function restoreSession() {
272 return opener
.top
.restoreSession();
276 <body
class="body_top">
278 <div
class="container-fluid" id
="pnotes"> <!-- large outer DIV
-->
280 <form border
='0' method
='post' name
='new_note' id
="new_note" action
='pnotes_full.php?docid=<?php echo attr_url($docid); ?>&orderid=<?php echo attr_url($orderid); ?>&<?php echo $activity_string_html; ?>' onsubmit
='return top.restoreSession()'>
281 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
286 $title_docname .= " " . xl("linked to document") . " ";
287 $d = new Document($docid);
288 $title_docname .= $d->get_url_file();
292 $title_docname .= " " . xl("linked to procedure order") . " $orderid";
295 $urlparms = "docid=" . attr_url($docid) . "&orderid=" . attr_url($orderid);
296 $title = text(getPatientName($patient_id));
298 <title
><?php
echo $title; ?
></title
>
300 <div
class="col-md-12">
301 <div
class="page-header">
302 <h3
><?php
echo xlt('Patient Messages') . text($title_docname) . " " . xlt('for');
305 <span
><a href
="../summary/demographics.php"
306 onclick
="return top.restoreSession()"><?php
echo $title; ?
></a
></span
>
308 <span
><?php
echo $title; ?
></span
><?php
} ?
>
313 <div
class="row oe-margin-b-10">
314 <div
class="col-md-12">
315 <a href
="pnotes_full_add.php?<?php echo $urlparms; ?>" class="btn btn-secondary note_modal" onclick
='return top.restoreSession()'><span
><?php
echo xlt('Add'); ?
></span
></a
>
316 <a href
="#" class="change_activity btn btn-secondary" ><span
><?php
echo xlt('Update Active'); ?
></span
></a
>
317 <a href
="pnotes_full.php?<?php echo $urlparms; ?>&<?php echo $activity_string_html;?>" class="btn btn-secondary" id
='Submit' onclick
='return top.restoreSession()'><span
><?php
echo xlt('Refresh'); ?
></span
></a
>
318 <?php
if (!$orderid) { ?
>
319 <a href
="demographics.php" class="btn btn-secondary" onclick
="top.restoreSession()"><span
><?php
echo xlt('Back to Patient'); ?
></span
></a
>
324 <div
class="row oe-margin-b-10">
325 <div
class="col-md-12">
327 // Get the billing note if there is one.
331 $resnote = getPatientData($patient_id, "billing_note");
332 if (!empty($resnote['billing_note'])) {
333 $billing_note = $resnote['billing_note'];
334 $colorbeg = "<span style='color:red'>";
335 $colorend = "</span>";
338 //Display what the patient owes
339 $balance = get_patient_balance($patient_id);
342 <?php
if ($billing_note ||
$balance) { ?
>
343 <div style
='margin-top:3px'>
346 if ($balance != "0") {
347 // $formatted = sprintf((xl('$').'%01.2f'), $balance);
348 $formatted = oeFormatMoney($balance);
349 echo " <tr class='text billing'>\n";
350 echo " <td>" . $colorbeg . xlt('Balance Due') .
351 $colorend . " " . $colorbeg . text($formatted) .
352 $colorend . "</td>\n";
357 echo " <tr class='text billing'>\n";
358 echo " <td>" . $colorbeg . xlt('Billing Note') .
359 $colorend . " " . $colorbeg . text($billing_note) .
360 $colorend . "</td>\n";
372 <div
class="col-md-12">
373 <?php
if ($active == "all") { ?
>
374 <span
><?php
echo xlt('Show All'); ?
></span
>
376 <a href
="pnotes_full.php?<?php echo $urlparms; ?>" class="link btn btn-secondary" onclick
="return top.restoreSession()"><span
><?php
echo xlt('Show All'); ?
></span
></a
>
379 <?php
if ($active == '1') { ?
>
380 <span
><?php
echo xlt('Show Active'); ?
></span
>
382 <a href
="pnotes_full.php?form_active=1&<?php echo $urlparms; ?>" class="link btn btn-secondary" onclick
="return top.restoreSession()"><span
><?php
echo xlt('Show Active'); ?
></span
></a
>
385 <?php
if ($active == '0') { ?
>
386 <span
><?php
echo xlt('Show Inactive'); ?
></span
>
388 <a href
="pnotes_full.php?form_inactive=1&<?php echo $urlparms; ?>" class="link btn btn-secondary" onclick
="return top.restoreSession()"><span
><?php
echo xlt('Show Inactive'); ?
></span
></a
>
393 <input type
='hidden' name
='mode' id
="mode" value
="new">
394 <input type
='hidden' name
='offset' id
="offset" value
="<?php echo attr($offset); ?>">
395 <input type
='hidden' name
='offset_sent' id
="offset_sent" value
="<?php echo attr($offset_sent); ?>">
396 <input type
='hidden' name
='form_active' id
="form_active" value
="<?php echo attr($form_active); ?>">
397 <input type
='hidden' name
='form_inactive' id
="form_inactive" value
="<?php echo attr($form_inactive); ?>">
398 <input type
='hidden' name
='noteid' id
="noteid" value
="<?php echo attr($noteid); ?>">
399 <input type
='hidden' name
='form_doc_only' id
="form_doc_only" value
="<?php echo attr($form_doc_only); ?>">
402 <?php
if ($GLOBALS['portal_offsite_enable']) { ?
>
404 <li
class="<?php echo $inbox; ?>" ><a onclick
="show_div('inbox')" href
="#"><?php
echo xlt('Inbox'); ?
></a
></li
>
405 <li
class="<?php echo $outbox; ?>" ><a onclick
="show_div('outbox')" href
="#"><?php
echo xlt('Sent Items'); ?
></a
></li
>
408 <div
class='tabContainer' >
409 <div id
='inbox_div' <?php
echo $inbox_style; ?
> >
410 <form border
='0' method
='post' name
='update_activity' id
='update_activity'
411 action
="pnotes_full.php?<?php echo $urlparms; ?>&<?php echo $activity_string_html;?>" onsubmit
='return top.restoreSession()'>
412 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
413 <!-- start of previous notes DIV
-->
414 <div
class=pat_notes
>
415 <input type
='hidden' name
='mode' value
="update">
416 <input type
='hidden' name
='offset' id
='offset' value
="<?php echo attr($offset); ?>">
417 <input type
='hidden' name
='offset_sent' id
='offset_sent' value
="<?php echo attr($offset_sent); ?>">
418 <input type
='hidden' name
='noteid' id
='noteid' value
="0">
419 <table border
='0' cellpadding
="1" class="text">
420 <?php
if ($result != "") : ?
>
424 <table border
='0' cellpadding
="1" class="text" width
= "100%">
426 // display all of the notes for the day, as well as others that are active
427 // from previous dates, up to a certain number, $N
430 echo " <tr class=showborder_head align='left'>\n";
431 echo " <th style='width:130px;'>" . xlt('Actions') . "</th>\n";
432 echo " <th>" . xlt('Active{{Note}}') . " </th>\n";
433 echo " <th>" . (($docid ||
$orderid) ?
xlt('Linked') : '') . "</th>\n";
434 echo " <th>" . xlt('Type') . "</th>\n";
435 echo " <th>" . xlt('Content') . "</th>\n";
436 echo " <th>" . xlt('Status') . "</th>\n";
437 echo " <th>" . xlt('Last update') . "</th>\n";
438 echo " <th>" . xlt('Update by') . "</th>\n";
442 foreach ($result as $iter) {
444 $row_note_id = $iter['id'];
448 if (isGpRelation(1, $docid, 6, $row_note_id)) {
451 // Skip unlinked notes if that is requested.
452 if ($form_doc_only) {
456 } else if ($orderid) {
457 if (isGpRelation(2, $orderid, 6, $row_note_id)) {
460 // Skip unlinked notes if that is requested.
461 if ($form_doc_only) {
467 $body = $iter['body'];
468 $body = preg_replace('/(\sto\s)-patient-(\))/', '${1}'.$patientname.'${2}', $body);
469 $body = preg_replace('/(\d{4}-\d{2}-\d{2} \d{2}:\d{2}\s\([^)(]+\s)(to)(\s[^)(]+\))/', '${1}' . xl('to{{Destination}}') . '${3}', $body);
470 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
471 $body = nl2br(text(oeFormatPatientNote($body)));
473 $body = text(oeFormatSDFT(strtotime($iter['date'])).date(' H:i', strtotime($iter['date']))) .
474 ' (' . text($iter['user']) . ') ' . nl2br(text(oeFormatPatientNote($body)));
477 if (($iter["activity"]) && ($iter['message_status'] != "Done")) {
478 $checked = "checked";
483 // highlight the row if it's been selected for updating
484 if ($_REQUEST['noteid'] == $row_note_id) {
485 echo " <tr height=20 class='noterow highlightcolor' id='" . attr($row_note_id) . "'>\n";
487 echo " <tr class='noterow' id='" . attr($row_note_id) . "'>\n";
491 echo " <td><a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=" . attr_url($row_note_id) .
492 "' class='css_button_small note_modal' onclick='return top.restoreSession()'><span>" . xlt('Edit') ."</span></a>\n";
494 // display, or not, a button to delete the note
495 // if the user is an admin or if they are the author of the note, they can delete it
496 if (($iter['user'] == $_SESSION['authUser']) ||
(acl_check('admin', 'super', '', 'write'))) {
497 echo " <a href='#' class='deletenote css_button_small' id='del" . attr($row_note_id) .
498 "' title='" . xla('Delete this note') . "' onclick='return top.restoreSession()'><span>" .
499 xlt('Delete') . "</span>\n";
505 echo " <td class='text bold'>\n";
506 echo " <input type='hidden' name='act" . attr($row_note_id) . "' value='1' />\n";
507 echo " <input type='checkbox' name='chk" . attr($row_note_id) . "' $checked />\n";
510 echo " <td class='text bold'>\n";
511 if ($docid ||
$orderid) {
512 echo " <input type='checkbox' name='lnk" . attr($row_note_id) . "' $linked />\n";
517 echo " <td class='bold notecell' id='" . attr($row_note_id) . "'>" .
518 "<a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=" . attr_url($row_note_id) . "' class='note_modal' onclick='return top.restoreSession()'>\n";
519 // Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
520 echo generate_display_field(array('data_type'=>'1','list_id'=>'note_type'), $iter['title']);
523 echo " <td class='notecell' id='" . attr($row_note_id) . "'>\n";
526 echo " <td class='notecell' id='" . attr($row_note_id) . "'>\n";
527 echo getListItemTitle("message_status", $iter['message_status']);
529 echo " <td class='notecell'>";
530 echo text(oeFormatDateTime($iter['update_date']));
532 echo " <td class='notecell'>";
533 $updateBy = $userService->getUser($iter['update_by']);
534 echo !is_null($updateBy) ?
text($updateBy->getFname()) . ' ' . text($updateBy->getLname()) : '';
542 print "<tr><td colspan='3' class='text'>" . xlt('None{{Note}}') . ".</td></tr>\n";
551 <table width
='400' border
='0' cellpadding
='0' cellspacing
='0'>
555 if ($offset > ($N-1)) {
556 $offsetN = $offset-$N;
557 echo " <a class='link' href='pnotes_full.php" .
559 "&form_active=" . attr_url($form_active) .
560 "&form_inactive=" . attr_url($form_inactive) .
561 "&form_doc_only=" . attr_url($form_doc_only) .
562 "&offset=" . attr_url($offsetN) . "&" . $activity_string_html . "' onclick='return top.restoreSession()'>[" .
563 xlt('Previous') . "]</a>\n";
569 if ($result_count == $N) {
570 $offsetN = $offset+
$N;
571 echo " <a class='link' href='pnotes_full.php" .
573 "&form_active=" . attr_url($form_active) .
574 "&form_inactive=" . attr_url($form_inactive) .
575 "&form_doc_only=" . attr_url($form_doc_only) .
576 "&offset=" . attr_url($offsetN) . "&" . $activity_string_html . "' onclick='return top.restoreSession()'>[" .
577 xlt('Next') . "]</a>\n";
585 <div id
='outbox_div' <?php
echo $outbox_style; ?
> >
586 <table border
='0' cellpadding
="1" class="text">
587 <?php
if ($result_sent != "") : ?
>
589 <td colspan
='5' style
="padding: 5px;" >
590 <a href
="pnotes_full.php?<?php echo $urlparms; ?>&s=1&<?php echo $activity_string_html; ?>"
591 class="" id
='Submit' onclick
='return top.restoreSession()'><span
><?php
echo xlt('Refresh'); ?
></span
></a
>
596 <table border
='0' cellpadding
="1" class="text" width
= "80%">
598 // display all of the notes for the day, as well as others that are active
599 // from previous dates, up to a certain number, $N
601 if ($result_sent != "") {
602 echo " <tr class=showborder_head align='left'>\n";
603 echo " <th style='width:100px';> </th>\n";
604 echo " <th>" . xlt('Active{{Note}}') . " </th>\n";
605 echo " <th>" . (($docid ||
$orderid) ?
xlt('Linked') : '') . "</th>\n";
606 echo " <th>" . xlt('Type') . "</th>\n";
607 echo " <th>" . xlt('Content') . "</th>\n";
610 $result_sent_count = 0;
611 foreach ($result_sent as $iter) {
612 $result_sent_count++
;
613 $row_note_id = $iter['id'];
617 if (isGpRelation(1, $docid, 6, $row_note_id)) {
620 // Skip unlinked notes if that is requested.
621 if ($form_doc_only) {
625 } else if ($orderid) {
626 if (isGpRelation(2, $orderid, 6, $row_note_id)) {
629 // Skip unlinked notes if that is requested.
630 if ($form_doc_only) {
636 $body = $iter['body'];
637 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
638 $body = nl2br(text(oeFormatPatientNote($body)));
640 $body = text(oeFormatSDFT(strtotime($iter['date'])).date(' H:i', strtotime($iter['date']))) .
641 ' (' . text($iter['user']) . ') ' . nl2br(text(oeFormatPatientNote($body)));
644 $body = preg_replace('/(:\d{2}\s\()' . $patient_id . '(\sto\s)/', '${1}' . $patientname . '${2}', $body);
645 if (($iter["activity"]) && ($iter['message_status'] != "Done")) {
646 $checked = "checked";
651 // highlight the row if it's been selected for updating
652 if ($_REQUEST['noteid'] == $row_note_id) {
653 echo " <tr height=20 class='noterow highlightcolor' id='" . attr($row_note_id) . "'>\n";
655 echo " <tr class='noterow' id='" . attr($row_note_id) . "'>\n";
658 echo " <td><a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=" . attr_url($row_note_id) .
659 "' class='css_button_small note_modal' onclick='return top.restoreSession()'><span>" . xlt('Edit') . "</span></a>\n";
661 // display, or not, a button to delete the note
662 // if the user is an admin or if they are the author of the note, they can delete it
663 if (($iter['user'] == $_SESSION['authUser']) ||
(acl_check('admin', 'super', '', 'write'))) {
664 echo " <a href='#' class='deletenote css_button_small' id='del" . attr($row_note_id) .
665 "' title='" . xla('Delete this note') . "' onclick='return restoreSession()'><span>" .
666 xlt('Delete') . "</span>\n";
672 echo " <td class='text bold'>\n";
673 echo " <input type='hidden' name='act" . attr($row_note_id) . "' value='1' />\n";
674 echo " <input type='checkbox' name='chk" . attr($row_note_id) . "' $checked />\n";
677 echo " <td class='text bold'>\n";
678 if ($docid ||
$orderid) {
679 echo " <input type='checkbox' name='lnk" . attr($row_note_id) . "' $linked />\n";
684 echo " <td class='bold notecell' id='" . attr($row_note_id) . "'>" .
685 "<a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=" . attr_url($row_note_id) . "' class='note_modal' onclick='return top.restoreSession()'>\n";
686 // Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
687 echo generate_display_field(array('data_type'=>'1','list_id'=>'note_type'), $iter['title']);
690 echo " <td class='notecell' id='" . attr($row_note_id) . "'>\n";
699 print "<tr><td colspan='3' class='text'>" . xlt('None{{Result}}') . ".</td></tr>\n";
706 <table width
='400' border
='0' cellpadding
='0' cellspacing
='0'>
710 if ($offset_sent > ($M-1)) {
711 $offsetSentM = $offset_sent-$M;
712 echo " <a class='link' href='pnotes_full.php" .
715 "&form_active=" . attr_url($form_active) .
716 "&form_inactive=" . attr_url($form_inactive) .
717 "&form_doc_only=" . attr_url($form_doc_only) .
718 "&offset_sent=" . attr_url($offsetSentM) . "&" . $activity_string_html . "' onclick='return top.restoreSession()'>[" .
719 xlt('Previous') . "]</a>\n";
725 if ($result_sent_count == $M) {
726 $offsetSentM = $offset_sent+
$M;
727 echo " <a class='link' href='pnotes_full.php" .
730 "&form_active=" . attr_url($form_active) .
731 "&form_inactive=" . attr_url($form_inactive) .
732 "&form_doc_only=" . attr_url($form_doc_only) .
733 "&offset_sent=" . attr_url($offsetSentM) . "&" . $activity_string_html . "' onclick='return top.restoreSession()'>[" .
734 xlt('Next') . "]</a>\n";
743 <script language
='JavaScript'>
746 if ($_GET['set_pid']) {
747 $ndata = getPatientData($patient_id, "fname, lname, pubpid");
749 parent
.left_nav
.setPatient(<?php
echo js_escape($ndata['fname']." ".$ndata['lname']) . "," .
750 js_escape($patient_id) . "," . js_escape($ndata['pubpid']) . ",window.name"; ?
>);
754 // If this note references a new patient document, pop up a display
757 if ($noteid /* && $title == 'New Document' */) {
758 $prow = getPnoteById($noteid, 'body');
759 if (preg_match('/New scanned document (\d+): [^\n]+\/([^\n]+)/', $prow['body'], $matches)) {
760 $docid = $matches[1];
761 $docname = $matches[2];
763 window
.open('../../../controller.php?document&retrieve&patient_id=<?php echo attr_url($patient_id); ?>&document_id=<?php echo attr_url($docid); ?>&<?php echo attr_url($docname);?>&as_file=true',
764 '_blank', 'resizable=1,scrollbars=1,width=600,height=500');
772 </div
> <!-- end outer
'pnotes' -->
776 <script language
="javascript">
778 // jQuery stuff to make the page a little easier to use
781 $
("#appendnote").click(function() { AppendNote(); });
782 $
("#newnote").click(function() { NewNote(); });
783 $
("#printnote").click(function() { PrintNote(); });
785 $
(".change_activity").click(function() { top
.restoreSession(); $
("#update_activity").submit(); });
787 $
(".deletenote").click(function() { DeleteNote(this
); });
789 $
(".noterow").mouseover(function() { $
(this
).toggleClass("highlight"); });
790 $
(".noterow").mouseout(function() { $
(this
).toggleClass("highlight"); });
794 var NewNote
= function () {
795 top
.restoreSession();
796 $
("#noteid").val('');
797 $
("#new_note").submit();
800 var AppendNote
= function () {
801 top
.restoreSession();
802 $
("#new_note").submit();
805 var PrintNote
= function () {
806 top
.restoreSession();
807 window
.open('pnotes_print.php?noteid=<?php echo attr_url($noteid); ?>', '_blank', 'resizable=1,scrollbars=1,width=600,height=500');
810 var DeleteNote
= function(note
) {
811 if (confirm(<?php
echo xlj('Are you sure you want to delete this note?'); ?
> +
'\n ' +
<?php
echo xlj('This action CANNOT be undone.'); ?
>)) {
812 top
.restoreSession();
813 // strip the 'del' part of the object's ID
814 $
("#noteid").val(note
.id
.replace(/del
/, ""));
815 $
("#mode").val("delete");
816 $
("#new_note").submit();