4 * Display, enter, modify and manage patient notes.
7 * @link http://www.open-emr.org
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2018-2020 Brady Miller <brady.g.miller@gmail.com>
10 * @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.php');
15 require_once($GLOBALS['srcdir'] . '/patient.inc.php');
16 require_once($GLOBALS['srcdir'] . '/options.inc.php');
17 require_once($GLOBALS['srcdir'] . '/gprelations.inc.php');
19 use OpenEMR\Common\Acl\AclMain
;
20 use OpenEMR\Common\Csrf\CsrfUtils
;
21 use OpenEMR\Common\Logging\EventAuditLogger
;
22 use OpenEMR\Core\Header
;
23 use OpenEMR\Services\UserService
;
25 if (!empty($_GET['set_pid'])) {
26 require_once($GLOBALS['srcdir'] . '/pid.inc.php');
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']);
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 (!AclMain
::aclCheckCore('patients', 'notes', '', array('write','addonly'))) {
50 die(xlt('Not authorized'));
53 $tmp = getPatientData($patient_id, "squad");
54 if ($tmp['squad'] && ! AclMain
::aclCheckCore('squads', $tmp['squad'])) {
55 die(xlt('Not authorized for this squad.'));
58 //the number of records to display per screen
62 $mode = $_REQUEST['mode'] ??
null;
63 $offset = $_REQUEST['offset'] ??
null;
64 $offset_sent = $_REQUEST['offset_sent'] ??
null;
65 $form_active = $_REQUEST['form_active'] ??
null;
66 $form_inactive = $_REQUEST['form_inactive'] ??
null;
67 $noteid = $_REQUEST['noteid'] ??
null;
68 $form_doc_only = isset($_POST['mode']) ?
(empty($_POST['form_doc_only']) ?
0 : 1) : 1;
69 if (!empty($_REQUEST['s']) && ($_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 } elseif ($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', 'opener']); ?
>
217 /// todo, move this to a common library
221 $
("#dem_view").click( function() {
222 toggle( $
(this
), "#DEM" );
227 // I can't find a reason to load this!
228 /*$("#stats_div").load("stats.php",
230 csrf_token_form: <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>
234 $
("#notes_div").load("pnotes_fragment.php",
236 csrf_token_form
: <?php
echo js_escape(CsrfUtils
::collectCsrfToken()); ?
>
242 $
(".note_modal").on('click', function(e
) {
245 dlgopen('', '', 700, 400, '', '', {
247 {text
: <?php
echo xlj('Close'); ?
>, close
: true, style
: 'default btn-sm'}
253 url
: $
(this
).attr('href')
259 function show_div(name
){
261 document
.getElementById('inbox_div').style
.display
= '';
262 document
.getElementById('outbox_div').style
.display
= 'none';
264 document
.getElementById('inbox_div').style
.display
= 'none';
265 document
.getElementById('outbox_div').style
.display
= '';
269 function refreshme() {
270 top
.restoreSession();
271 document
.location
.reload();
274 function restoreSession() {
275 return opener
.top
.restoreSession();
281 <div
class="container mt-3" id
="pnotes"> <!-- large outer DIV
-->
283 <form 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()'>
284 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
289 $title_docname .= " " . xl("linked to document") . " ";
290 $d = new Document($docid);
291 $title_docname .= $d->get_url_file();
295 $title_docname .= " " . xl("linked to procedure order") . " $orderid";
298 $urlparms = "docid=" . attr_url($docid) . "&orderid=" . attr_url($orderid);
299 $title = text(getPatientName($patient_id));
301 <title
><?php
echo $title; ?
></title
>
304 <h3
><?php
echo xlt('Patient Messages') . text($title_docname) . " " . xlt('for');
307 <a href
="../summary/demographics.php" onclick
="return top.restoreSession()"><?php
echo $title; ?
></a
>
310 <span
><?php
echo $title; ?
></span
><?php
} ?
>
313 <div
class="row oe-margin-b-10">
315 <div
class="btn-group">
316 <a href
="pnotes_full_add.php?<?php echo $urlparms; ?>" class="btn btn-primary btn-add note_modal" onclick
='return top.restoreSession()'><?php
echo xlt('Add'); ?
></a
>
317 <?php
if (!$orderid) { ?
>
318 <a href
="demographics.php" class="btn btn-secondary btn-back" onclick
="top.restoreSession()"><?php
echo xlt('Back to Patient'); ?
></a
>
320 <a href
="pnotes_full.php?<?php echo $urlparms; ?>&<?php echo $activity_string_html;?>" class="btn btn-secondary btn-update" id
='Submit' onclick
='return top.restoreSession()'><?php
echo xlt('Refresh'); ?
></a
>
321 <a href
="#" class="change_activity btn btn-secondary btn"><?php
echo xlt('Update Active'); ?
></a
>
326 <div
class="row oe-margin-b-10">
329 // Get the billing note if there is one.
333 $resnote = getPatientData($patient_id, "billing_note");
334 if (!empty($resnote['billing_note'])) {
335 $billing_note = $resnote['billing_note'];
336 $colorbeg = "<span class='text-danger'>";
337 $colorend = "</span>";
340 //Display what the patient owes
341 $balance = get_patient_balance($patient_id);
344 <?php
if ($billing_note ||
$balance) { ?
>
345 <div
class="table-responsive mt-1">
346 <table
class="table">
348 if ($balance != "0") {
349 // $formatted = sprintf((xl('$').'%01.2f'), $balance);
350 $formatted = oeFormatMoney($balance);
351 echo " <tr class='text billing'>\n";
352 echo " <td>" . $colorbeg . xlt('Balance Due') .
353 $colorend . " " . $colorbeg . text($formatted) .
354 $colorend . "</td>\n";
359 echo " <tr class='text billing'>\n";
360 echo " <td>" . $colorbeg . xlt('Billing Note') .
361 $colorend . " " . $colorbeg . text($billing_note) .
362 $colorend . "</td>\n";
372 <input type
='hidden' name
='mode' id
="mode" value
="new" />
373 <input type
='hidden' name
='offset' id
="offset" value
="<?php echo attr($offset); ?>" />
374 <input type
='hidden' name
='offset_sent' id
="offset_sent" value
="<?php echo attr($offset_sent); ?>" />
375 <input type
='hidden' name
='form_active' id
="form_active" value
="<?php echo attr($form_active); ?>" />
376 <input type
='hidden' name
='form_inactive' id
="form_inactive" value
="<?php echo attr($form_inactive); ?>" />
377 <input type
='hidden' name
='noteid' id
="noteid" value
="<?php echo attr($noteid); ?>" />
378 <input type
='hidden' name
='form_doc_only' id
="form_doc_only" value
="<?php echo attr($form_doc_only); ?>" />
381 <div
class='tabContainer jumbotron p-4'>
382 <?php
if ($active == "all") { ?
>
383 <span
><?php
echo xlt('Show All'); ?
></span
>
385 <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
>
388 <?php
if ($active == '1') { ?
>
389 <span
><?php
echo xlt('Show Active'); ?
></span
>
391 <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
>
394 <?php
if ($active == '0') { ?
>
395 <span
><?php
echo xlt('Show Inactive'); ?
></span
>
397 <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
>
399 <div id
='inbox_div' class="table-responsive">
400 <form method
='post' name
='update_activity' id
='update_activity'
401 action
="pnotes_full.php?<?php echo $urlparms; ?>&<?php echo $activity_string_html;?>" onsubmit
='return top.restoreSession()'>
402 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
404 <!-- start of previous notes DIV
-->
405 <div
class="pat_notes">
406 <input type
='hidden' name
='mode' value
="update" />
407 <input type
='hidden' name
='offset' id
='offset' value
="<?php echo attr($offset); ?>" />
408 <input type
='hidden' name
='offset_sent' id
='offset_sent' value
="<?php echo attr($offset_sent); ?>" />
409 <input type
='hidden' name
='noteid' id
='noteid' value
="0" />
411 <table
class="table table-borderless text">
412 <?php
if ($result != "") : ?
>
416 <table
class="table table-borderless text">
418 // display all of the notes for the day, as well as others that are active
419 // from previous dates, up to a certain number, $N
422 echo " <tr class='showborder_head'>\n";
423 echo " <th>" . xlt('Actions') . "</th>\n";
424 echo " <th>" . xlt('Active{{Note}}') . " </th>\n";
425 echo " <th>" . (($docid ||
$orderid) ?
xlt('Linked') : '') . "</th>\n";
426 echo " <th>" . xlt('Type') . "</th>\n";
427 echo " <th>" . xlt('Content') . "</th>\n";
428 echo " <th>" . xlt('Status') . "</th>\n";
429 echo " <th>" . xlt('Last update') . "</th>\n";
430 echo " <th>" . xlt('Update by') . "</th>\n";
434 foreach ($result as $iter) {
436 $row_note_id = $iter['id'];
440 if (isGpRelation(1, $docid, 6, $row_note_id)) {
443 // Skip unlinked notes if that is requested.
444 if ($form_doc_only) {
448 } elseif ($orderid) {
449 if (isGpRelation(2, $orderid, 6, $row_note_id)) {
452 // Skip unlinked notes if that is requested.
453 if ($form_doc_only) {
459 $body = $iter['body'];
460 $body = preg_replace('/(\sto\s)-patient-(\))/', '${1}' . $patientname . '${2}', $body);
461 $body = preg_replace('/(\d{4}-\d{2}-\d{2} \d{2}:\d{2}\s\([^)(]+\s)(to)(\s[^)(]+\))/', '${1}' . xl('to{{Destination}}') . '${3}', $body);
462 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
463 $body = pnoteConvertLinks(nl2br(text(oeFormatPatientNote($body))));
465 $body = text(oeFormatSDFT(strtotime($iter['date'])) . date(' H:i', strtotime($iter['date']))) .
466 ' (' . text($iter['user']) . ') ' . pnoteConvertLinks(nl2br(text(oeFormatPatientNote($body))));
469 if (($iter["activity"]) && ($iter['message_status'] != "Done")) {
470 $checked = "checked";
475 // highlight the row if it's been selected for updating
476 if (!empty($_REQUEST['noteid']) && ($_REQUEST['noteid'] == $row_note_id)) {
477 echo " <tr class='noterow highlightcolor' id='" . attr($row_note_id) . "'>\n";
479 echo " <tr class='noterow' id='" . attr($row_note_id) . "'>\n";
483 echo " <td class='text-nowrap'><a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=" . attr_url($row_note_id) .
484 "' class='btn btn-primary btn-sm btn-edit note_modal' onclick='return top.restoreSession()'>" . xlt('Edit') . "</a>\n";
486 // display, or not, a button to delete the note
487 // if the user is an admin or if they are the author of the note, they can delete it
488 if (($iter['user'] == $_SESSION['authUser']) ||
(AclMain
::aclCheckCore('admin', 'super', '', 'write'))) {
489 echo " <a href='#' class='deletenote btn btn-danger btn-sm btn-delete' id='del" . attr($row_note_id) .
490 "' title='" . xla('Delete this note') . "' onclick='return top.restoreSession()'>" .
491 xlt('Delete') . "</a>\n";
497 echo " <td class='text font-weight-bold'>\n";
498 echo " <input type='hidden' name='act" . attr($row_note_id) . "' value='1' />\n";
499 echo " <input type='checkbox' name='chk" . attr($row_note_id) . "' $checked />\n";
502 echo " <td class='text font-weight-bold'>\n";
503 if ($docid ||
$orderid) {
504 echo " <input type='checkbox' name='lnk" . attr($row_note_id) . "' $linked />\n";
509 echo " <td class='font-weight-bold notecell' id='" . attr($row_note_id) . "'>" .
510 "<a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=" . attr_url($row_note_id) . "' class='note_modal' onclick='return top.restoreSession()'>\n";
511 // Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
512 echo generate_display_field(array('data_type' => '1','list_id' => 'note_type'), $iter['title']);
515 echo " <td class='notecell' id='" . attr($row_note_id) . "'>\n";
518 echo " <td class='notecell' id='" . attr($row_note_id) . "'>\n";
519 echo getListItemTitle("message_status", $iter['message_status']);
521 echo " <td class='notecell'>";
522 echo text(oeFormatDateTime($iter['update_date']));
524 echo " <td class='notecell'>";
525 $updateBy = $userService->getUser($iter['update_by']);
526 echo !is_null($updateBy) ?
text($updateBy['fname']) . ' ' . text($updateBy['lname']) : '';
532 print "<tr><td colspan='3' class='text'>" . xlt('None{{Note}}') . ".</td></tr>\n";
539 <table
class="table table-borderless">
543 if ($offset > ($N - 1)) {
544 $offsetN = $offset - $N;
545 echo " <a class='link' href='pnotes_full.php" .
547 "&form_active=" . attr_url($form_active) .
548 "&form_inactive=" . attr_url($form_inactive) .
549 "&form_doc_only=" . attr_url($form_doc_only) .
550 "&offset=" . attr_url($offsetN) . "&" . $activity_string_html . "' onclick='return top.restoreSession()'>[" .
551 xlt('Previous') . "]</a>\n";
555 <td
class="text-right">
557 if ($result_count == $N) {
558 $offsetN = $offset +
$N;
559 echo " <a class='link' href='pnotes_full.php" .
561 "&form_active=" . attr_url($form_active) .
562 "&form_inactive=" . attr_url($form_inactive) .
563 "&form_doc_only=" . attr_url($form_doc_only) .
564 "&offset=" . attr_url($offsetN) . "&" . $activity_string_html . "' onclick='return top.restoreSession()'>[" .
565 xlt('Next') . "]</a>\n";
573 <div id
='outbox_div table-resonsive' <?php
echo $outbox_style; ?
> >
574 <table
class="table table-borderless text">
575 <?php
if ($result_sent != "") : ?
>
577 <td colspan
="5" class="p-1">
578 <a href
="pnotes_full.php?<?php echo $urlparms; ?>&s=1&<?php echo $activity_string_html; ?>"
579 id
='Submit' onclick
='return top.restoreSession()'><?php
echo xlt('Refresh'); ?
></a
>
585 <table
class="table table-borderless text w-75">
587 // display all of the notes for the day, as well as others that are active
588 // from previous dates, up to a certain number, $N
590 if ($result_sent != "") {
591 echo " <tr class='showborder_head'>\n";
592 echo " <th> </th>\n";
593 echo " <th>" . xlt('Active{{Note}}') . " </th>\n";
594 echo " <th>" . (($docid ||
$orderid) ?
xlt('Linked') : '') . "</th>\n";
595 echo " <th>" . xlt('Type') . "</th>\n";
596 echo " <th>" . xlt('Content') . "</th>\n";
599 $result_sent_count = 0;
600 foreach ($result_sent as $iter) {
601 $result_sent_count++
;
602 $row_note_id = $iter['id'];
606 if (isGpRelation(1, $docid, 6, $row_note_id)) {
609 // Skip unlinked notes if that is requested.
610 if ($form_doc_only) {
614 } elseif ($orderid) {
615 if (isGpRelation(2, $orderid, 6, $row_note_id)) {
618 // Skip unlinked notes if that is requested.
619 if ($form_doc_only) {
625 $body = $iter['body'];
626 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
627 $body = pnoteConvertLinks(nl2br(text(oeFormatPatientNote($body))));
629 $body = text(oeFormatSDFT(strtotime($iter['date'])) . date(' H:i', strtotime($iter['date']))) .
630 ' (' . text($iter['user']) . ') ' . pnoteConvertLinks(nl2br(text(oeFormatPatientNote($body))));
633 $body = preg_replace('/(:\d{2}\s\()' . $patient_id . '(\sto\s)/', '${1}' . $patientname . '${2}', $body);
634 if (($iter["activity"]) && ($iter['message_status'] != "Done")) {
635 $checked = "checked";
640 // highlight the row if it's been selected for updating
641 if ($_REQUEST['noteid'] == $row_note_id) {
642 echo " <tr class='noterow highlightcolor' id='" . attr($row_note_id) . "'>\n";
644 echo " <tr class='noterow' id='" . attr($row_note_id) . "'>\n";
647 echo " <td><a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=" . attr_url($row_note_id) .
648 "' class='btn btn-primary btn-sm btn-edit note_modal' onclick='return top.restoreSession()'>" . xlt('Edit') . "</a>\n";
650 // display, or not, a button to delete the note
651 // if the user is an admin or if they are the author of the note, they can delete it
652 if (($iter['user'] == $_SESSION['authUser']) ||
(AclMain
::aclCheckCore('admin', 'super', '', 'write'))) {
653 echo " <a href='#' class='deletenote btn btn-danger btn-sm btn-delete' id='del" . attr($row_note_id) .
654 "' title='" . xla('Delete this note') . "' onclick='return restoreSession()'><span>" .
655 xlt('Delete') . "</span>\n";
661 echo " <td class='text font-weight-bold'>\n";
662 echo " <input type='hidden' name='act" . attr($row_note_id) . "' value='1' />\n";
663 echo " <input type='checkbox' name='chk" . attr($row_note_id) . "' $checked />\n";
666 echo " <td class='text font-weight-bold'>\n";
667 if ($docid ||
$orderid) {
668 echo " <input type='checkbox' name='lnk" . attr($row_note_id) . "' $linked />\n";
673 echo " <td class='font-weight-bold notecell' id='" . attr($row_note_id) . "'>" .
674 "<a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=" . attr_url($row_note_id) . "' class='note_modal' onclick='return top.restoreSession()'>\n";
675 // Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
676 echo generate_display_field(array('data_type' => '1','list_id' => 'note_type'), $iter['title']);
679 echo " <td class='notecell' id='" . attr($row_note_id) . "'>\n";
688 print "<tr><td colspan='3' class='text'>" . xlt('None{{Result}}') . ".</td></tr>\n";
693 <table
class="table table-borderless">
697 if ($offset_sent > ($M - 1)) {
698 $offsetSentM = $offset_sent - $M;
699 echo " <a class='link' href='pnotes_full.php" .
702 "&form_active=" . attr_url($form_active) .
703 "&form_inactive=" . attr_url($form_inactive) .
704 "&form_doc_only=" . attr_url($form_doc_only) .
705 "&offset_sent=" . attr_url($offsetSentM) . "&" . $activity_string_html . "' onclick='return top.restoreSession()'>[" .
706 xlt('Previous') . "]</a>\n";
712 if ($result_sent_count == $M) {
713 $offsetSentM = $offset_sent +
$M;
714 echo " <a class='link' href='pnotes_full.php" .
717 "&form_active=" . attr_url($form_active) .
718 "&form_inactive=" . attr_url($form_inactive) .
719 "&form_doc_only=" . attr_url($form_doc_only) .
720 "&offset_sent=" . attr_url($offsetSentM) . "&" . $activity_string_html . "' onclick='return top.restoreSession()'>[" .
721 xlt('Next') . "]</a>\n";
729 </div
> <!-- end outer
'pnotes' -->
733 if (!empty($_GET['set_pid'])) {
734 $ndata = getPatientData($patient_id, "fname, lname, pubpid");
736 parent
.left_nav
.setPatient(<?php
echo js_escape($ndata['fname'] . " " . $ndata['lname']) . "," .
737 js_escape($patient_id) . "," . js_escape($ndata['pubpid']) . ",window.name"; ?
>);
741 // If this note references a new patient document, pop up a display
744 if ($noteid /* && $title == 'New Document' */) {
745 $prow = getPnoteById($noteid, 'body');
746 if (preg_match('/New scanned document (\d+): [^\n]+\/([^\n]+)/', $prow['body'], $matches)) {
747 $docid = $matches[1];
748 $docname = $matches[2];
750 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',
751 '_blank', 'resizable=1,scrollbars=1,width=600,height=500');
759 // jQuery stuff to make the page a little easier to use
762 $
("#appendnote").click(function() { AppendNote(); });
763 $
("#newnote").click(function() { NewNote(); });
764 $
("#printnote").click(function() { PrintNote(); });
766 $
(".change_activity").click(function() { top
.restoreSession(); $
("#update_activity").submit(); });
768 $
(".deletenote").click(function() { DeleteNote(this
); });
770 $
(".noterow").mouseover(function() { $
(this
).toggleClass("highlight"); });
771 $
(".noterow").mouseout(function() { $
(this
).toggleClass("highlight"); });
775 var NewNote
= function () {
776 top
.restoreSession();
777 $
("#noteid").val('');
778 $
("#new_note").submit();
781 var AppendNote
= function () {
782 top
.restoreSession();
783 $
("#new_note").submit();
786 var PrintNote
= function () {
787 top
.restoreSession();
788 window
.open('pnotes_print.php?noteid=<?php echo attr_url($noteid); ?>', '_blank', 'resizable=1,scrollbars=1,width=600,height=500');
791 var DeleteNote
= function(note
) {
792 if (confirm(<?php
echo xlj('Are you sure you want to delete this note?'); ?
> +
'\n ' +
<?php
echo xlj('This action CANNOT be undone.'); ?
>)) {
793 top
.restoreSession();
794 // strip the 'del' part of the object's ID
795 $
("#noteid").val(note
.id
.replace(/del
/, ""));
796 $
("#mode").val("delete");
797 $
("#new_note").submit();