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 use OpenEMR\Core\Header
;
34 if ($_GET['set_pid']) {
35 require_once($GLOBALS['srcdir'].'/pid.inc');
36 setpid($_GET['set_pid']);
39 // form parameter docid can be passed to restrict the display to a document.
40 $docid = empty($_REQUEST['docid']) ?
0 : 0 +
$_REQUEST['docid'];
42 // form parameter orderid can be passed to restrict the display to a procedure order.
43 $orderid = empty($_REQUEST['orderid']) ?
0 : intval($_REQUEST['orderid']);
47 $row = sqlQuery("SELECT foreign_id FROM documents WHERE id = ?", array($docid));
48 $patient_id = intval($row['foreign_id']);
49 } else if ($orderid) {
50 $row = sqlQuery("SELECT patient_id FROM procedure_order WHERE procedure_order_id = ?", array($orderid));
51 $patient_id = intval($row['patient_id']);
54 // Check authorization.
55 if (!acl_check('patients', 'notes', '', array('write','addonly'))) {
56 die(htmlspecialchars(xl('Not authorized'), ENT_NOQUOTES
));
59 $tmp = getPatientData($patient_id, "squad");
60 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad'])) {
61 die(htmlspecialchars(xl('Not authorized for this squad.'), ENT_NOQUOTES
));
64 //the number of records to display per screen
68 $mode = $_REQUEST['mode'];
69 $offset = $_REQUEST['offset'];
70 $offset_sent = $_REQUEST['offset_sent'];
71 $form_active = $_REQUEST['form_active'];
72 $form_inactive = $_REQUEST['form_inactive'];
73 $noteid = $_REQUEST['noteid'];
74 $form_doc_only = isset($_POST['mode']) ?
(empty($_POST['form_doc_only']) ?
0 : 1) : 1;
75 if ($_REQUEST['s'] == '1') {
78 $inbox_style = "style='display:none;border:5px solid #FFFFFF;'";
79 $outbox_style = "style='border:5px solid #FFFFFF;'";
83 $inbox_style = "style='border:5px solid #FFFFFF;'";
85 $outbox_style = "style='display:none;border:5px solid #FFFFFF;'";
88 if (!isset($offset)) {
92 if (!isset($offset_sent)) {
96 // Collect active variable and applicable html code for links
99 $activity_string_html = 'form_active=1';
100 } else if ($form_inactive) {
102 $activity_string_html = 'form_inactive=1';
105 $activity_string_html = '';
106 $form_active = $form_inactive = '0';
109 // this code handles changing the state of activity tags when the user updates
110 // them through the interface
112 if ($mode == "update") {
113 foreach ($_POST as $var => $val) {
114 if (strncmp($var, 'act', 3) == 0) {
115 $id = str_replace("act", "", $var);
116 if ($_POST["chk$id"]) {
123 setGpRelation(1, $docid, 6, $id, !empty($_POST["lnk$id"]));
127 setGpRelation(2, $orderid, 6, $id, !empty($_POST["lnk$id"]));
131 } elseif ($mode == "new") {
132 $note = $_POST['note'];
134 updatePnote($noteid, $note, $_POST['form_note_type'], $_POST['assigned_to'], '', !empty($_POST['form_datetime']) ?
DateTimeToYYYYMMDDHHMMSS($_POST['form_datetime']) : '');
141 $_POST['form_note_type'],
142 $_POST['assigned_to'],
143 !empty($_POST['form_datetime']) ?
DateTimeToYYYYMMDDHHMMSS($_POST['form_datetime']) : ''
148 setGpRelation(1, $docid, 6, $noteid);
152 setGpRelation(2, $orderid, 6, $noteid);
156 } elseif ($mode == "delete") {
158 deletePnote($noteid);
159 newEvent("delete", $_SESSION['authUser'], $_SESSION['authProvider'], 1, "pnotes: id ".$noteid);
164 if ($mode != "delete" && $mode != "update") {
165 exit(); // add exit for ajax save from pnotes_full_add.php sjp 12/20/2017
170 $assigned_to = $_SESSION['authUser'];
172 $prow = getPnoteById($noteid, 'title,assigned_to,body');
173 $title = $prow['title'];
174 $assigned_to = $prow['assigned_to'];
177 // Get the users list. The "Inactive" test is a kludge, we should create
178 // a separate column for this.
179 $ures = sqlStatement("SELECT username, fname, lname FROM users " .
180 "WHERE username != '' AND active = 1 AND " .
181 "( info IS NULL OR info NOT LIKE '%Inactive%' ) " .
182 "ORDER BY lname, fname");
184 $pres = getPatientData($patient_id, "lname, fname");
185 $patientname = $pres['lname'] . ", " . $pres['fname'];
188 $result = getPnotesByDate(
191 'id,date,body,user,activity,title,assigned_to,message_status',
200 $result_sent = getSentPnotesByDate(
203 'id,date,body,user,activity,title,assigned_to,message_status',
217 <?php Header
::setupHeader(['common', 'jquery-ui']); ?
>
219 <script type
="text/javascript">
220 /// todo, move this to a common library
222 $
(document
).ready(function(){
224 $
("#dem_view").click( function() {
225 toggle( $
(this
), "#DEM" );
229 $
("#stats_div").load("stats.php");
230 $
("#notes_div").load("pnotes_fragment.php");
234 $
(".note_modal").on('click', function(e
) {
237 dlgopen('', '', 650, 400, '', '', {
239 {text
: '<?php echo xla('Close
'); ?>', close
: true, style
: 'default btn-sm'}
245 url
: $
(this
).attr('href')
251 function show_div(name
){
253 document
.getElementById('inbox_div').style
.display
= '';
254 document
.getElementById('outbox_div').style
.display
= 'none';
256 document
.getElementById('inbox_div').style
.display
= 'none';
257 document
.getElementById('outbox_div').style
.display
= '';
261 function refreshme() {
262 top
.restoreSession();
263 document
.location
.reload();
267 <body
class="body_top">
269 <div id
="pnotes"> <!-- large outer DIV
-->
271 <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()'>
276 $title_docname .= " " . xl("linked to document") . " ";
277 $d = new Document($docid);
278 $title_docname .= $d->get_url_file();
282 $title_docname .= " " . xl("linked to procedure order") . " $orderid";
284 $docid_esc=attr($docid);
285 $orderid_esc=attr($orderid);
287 $urlparms = "docid=$docid_esc&orderid=$orderid_esc";
291 <span
class="title"><?php
echo xlt('Patient Messages') . $title_docname; ?
></span
>
293 <div id
='namecontainer_pnotes' class='namecontainer_pnotes'>
294 <?php
echo htmlspecialchars(xl('for'), ENT_NOQUOTES
);?
> 
;<span
class="title">
295 <a href
="../summary/demographics.php" onclick
="return top.restoreSession()"><?php
echo htmlspecialchars(getPatientName($patient_id), ENT_NOQUOTES
); ?
></a
></span
>
298 <a href
="pnotes_full_add.php?<?php echo $urlparms; ?>" class="css_button note_modal" onclick
='return top.restoreSession()'><span
><?php
echo xlt('Add'); ?
></span
></a
>
299 <a href
="demographics.php" class="css_button" onclick
="top.restoreSession()">
300 <span
><?php
echo htmlspecialchars(xl('View Patient'), ENT_NOQUOTES
);?
></span
>
306 <?php
if ($active == "all") { ?
>
307 <span
><?php
echo xlt('Show All'); ?
></span
>
309 <a href
="pnotes_full.php?<?php echo $urlparms; ?>" class="link" onclick
="return top.restoreSession()"><span
><?php
echo xlt('Show All'); ?
></span
></a
>
312 <?php
if ($active == '1') { ?
>
313 <span
><?php
echo xlt('Show Active'); ?
></span
>
315 <a href
="pnotes_full.php?form_active=1&<?php echo $urlparms; ?>" class="link" onclick
="return top.restoreSession()"><span
><?php
echo xlt('Show Active'); ?
></span
></a
>
318 <?php
if ($active == '0') { ?
>
319 <span
><?php
echo xlt('Show Inactive'); ?
></span
>
321 <a href
="pnotes_full.php?form_inactive=1&<?php echo $urlparms; ?>" class="link" onclick
="return top.restoreSession()"><span
><?php
echo xlt('Show Inactive'); ?
></span
></a
>
325 <input type
='hidden' name
='mode' id
="mode" value
="new">
326 <input type
='hidden' name
='offset' id
="offset" value
="<?php echo attr($offset); ?>">
327 <input type
='hidden' name
='offset_sent' id
="offset_sent" value
="<?php echo attr($offset_sent); ?>">
328 <input type
='hidden' name
='form_active' id
="form_active" value
="<?php echo htmlspecialchars($form_active, ENT_QUOTES); ?>">
329 <input type
='hidden' name
='form_inactive' id
="form_inactive" value
="<?php echo htmlspecialchars($form_inactive, ENT_QUOTES); ?>">
330 <input type
='hidden' name
='noteid' id
="noteid" value
="<?php echo htmlspecialchars($noteid, ENT_QUOTES); ?>">
331 <input type
='hidden' name
='form_doc_only' id
="form_doc_only" value
="<?php echo htmlspecialchars($form_doc_only, ENT_QUOTES); ?>">
336 // Get the billing note if there is one.
340 $resnote = getPatientData($patient_id, "billing_note");
341 if (!empty($resnote['billing_note'])) {
342 $billing_note = $resnote['billing_note'];
343 $colorbeg = "<span style='color:red'>";
344 $colorend = "</span>";
347 //Display what the patient owes
348 $balance = get_patient_balance($patient_id);
351 <?php
if ($billing_note ||
$balance) { ?
>
353 <div style
='margin-top:3px'>
356 if ($balance != "0") {
357 // $formatted = sprintf((xl('$').'%01.2f'), $balance);
358 $formatted = oeFormatMoney($balance);
359 echo " <tr class='text billing'>\n";
360 echo " <td>".$colorbeg . htmlspecialchars(xl('Balance Due'), ENT_NOQUOTES
) .
361 $colorend." ".$colorbeg. htmlspecialchars($formatted, ENT_NOQUOTES
) .
367 echo " <tr class='text billing'>\n";
368 echo " <td>".$colorbeg . htmlspecialchars(xl('Billing Note'), ENT_NOQUOTES
) .
369 $colorend." ".$colorbeg . htmlspecialchars($billing_note, ENT_NOQUOTES
) .
379 <li
class="<?php echo $inbox; ?>" ><a onclick
="show_div('inbox')" href
="#"><?php
echo htmlspecialchars(xl('Inbox'), ENT_NOQUOTES
); ?
></a
></li
>
380 <li
class="<?php echo $outbox; ?>" ><a onclick
="show_div('outbox')" href
="#"><?php
echo htmlspecialchars(xl('Sent Items'), ENT_NOQUOTES
); ?
></a
></li
>
382 <div
class='tabContainer' >
383 <div id
='inbox_div' <?php
echo $inbox_style; ?
> >
384 <form border
='0' method
='post' name
='update_activity' id
='update_activity'
385 action
="pnotes_full.php?<?php echo $urlparms; ?>&<?php echo attr($activity_string_html);?>" onsubmit
='return top.restoreSession()'>
386 <!-- start of previous notes DIV
-->
387 <div
class=pat_notes
>
388 <input type
='hidden' name
='mode' value
="update">
389 <input type
='hidden' name
='offset' id
='offset' value
="<?php echo attr($offset); ?>">
390 <input type
='hidden' name
='offset_sent' id
='offset_sent' value
="<?php echo attr($offset_sent); ?>">
391 <input type
='hidden' name
='noteid' id
='noteid' value
="0">
392 <table border
='0' cellpadding
="1" class="text">
393 <?php
if ($result != "") : ?
>
395 <td colspan
='5' style
="padding: 5px;" >
396 <a href
="#" class="change_activity" ><span
><?php
echo htmlspecialchars(xl('Update Active'), ENT_NOQUOTES
); ?
></span
></a
>
398 <a href
="pnotes_full.php?<?php echo $urlparms; ?>&<?php echo attr($activity_string_html);?>" class="" id
='Submit' onclick
='return top.restoreSession()'><span
><?php
echo htmlspecialchars(xl('Refresh'), ENT_NOQUOTES
); ?
></span
></a
>
403 <table border
='0' cellpadding
="1" class="text" width
= "80%">
405 // display all of the notes for the day, as well as others that are active
406 // from previous dates, up to a certain number, $N
409 echo " <tr class=showborder_head align='left'>\n";
410 echo " <th style='width:100px';> </th>\n";
411 echo " <th>" . xlt('Active') . " </th>\n";
412 echo " <th>" . (($docid ||
$orderid) ?
xlt('Linked') : '') . "</th>\n";
413 echo " <th>" . xlt('Type') . "</th>\n";
414 echo " <th>" . xlt('Content') . "</th>\n";
415 echo " <th>" . xlt('Status') . "</th>\n";
419 foreach ($result as $iter) {
421 $row_note_id = $iter['id'];
425 if (isGpRelation(1, $docid, 6, $row_note_id)) {
428 // Skip unlinked notes if that is requested.
429 if ($form_doc_only) {
433 } else if ($orderid) {
434 if (isGpRelation(2, $orderid, 6, $row_note_id)) {
437 // Skip unlinked notes if that is requested.
438 if ($form_doc_only) {
444 $body = $iter['body'];
445 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
446 $body = nl2br(htmlspecialchars(oeFormatPatientNote($body), ENT_NOQUOTES
));
448 $body = htmlspecialchars(oeFormatSDFT(strtotime($iter['date'])).date(' H:i', strtotime($iter['date'])), ENT_NOQUOTES
) .
449 ' (' . htmlspecialchars($iter['user'], ENT_NOQUOTES
) . ') ' . nl2br(htmlspecialchars(oeFormatPatientNote($body), ENT_NOQUOTES
));
452 $body = preg_replace('/(\sto\s)-patient-(\))/', '${1}'.$patientname.'${2}', $body);
453 if (($iter{"activity"}) && ($iter['message_status'] != "Done")) {
454 $checked = "checked";
459 // highlight the row if it's been selected for updating
460 if ($_REQUEST['noteid'] == $row_note_id) {
461 echo " <tr height=20 class='noterow highlightcolor' id='".htmlspecialchars($row_note_id, ENT_QUOTES
)."'>\n";
463 echo " <tr class='noterow' id='".htmlspecialchars($row_note_id, ENT_QUOTES
)."'>\n";
467 echo " <td><a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=".htmlspecialchars($row_note_id, ENT_QUOTES
).
468 "' class='css_button_small note_modal' onclick='return top.restoreSession()'><span>". htmlspecialchars(xl('Edit'), ENT_NOQUOTES
) ."</span></a>\n";
470 // display, or not, a button to delete the note
471 // if the user is an admin or if they are the author of the note, they can delete it
472 if (($iter['user'] == $_SESSION['authUser']) ||
(acl_check('admin', 'super', '', 'write'))) {
473 echo " <a href='#' class='deletenote css_button_small' id='del" . htmlspecialchars($row_note_id, ENT_QUOTES
) .
474 "' title='" . htmlspecialchars(xl('Delete this note'), ENT_QUOTES
) . "' onclick='return top.restoreSession()'><span>" .
475 htmlspecialchars(xl('Delete'), ENT_NOQUOTES
) . "</span>\n";
481 echo " <td class='text bold'>\n";
482 echo " <input type='hidden' name='act".htmlspecialchars($row_note_id, ENT_QUOTES
)."' value='1' />\n";
483 echo " <input type='checkbox' name='chk".htmlspecialchars($row_note_id, ENT_QUOTES
)."' $checked />\n";
486 echo " <td class='text bold'>\n";
487 if ($docid ||
$orderid) {
488 echo " <input type='checkbox' name='lnk" . htmlspecialchars($row_note_id, ENT_QUOTES
) . "' $linked />\n";
493 echo " <td class='bold notecell' id='".htmlspecialchars($row_note_id, ENT_QUOTES
)."'>" .
494 "<a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=".htmlspecialchars($row_note_id, ENT_QUOTES
)."' class='note_modal' onclick='return top.restoreSession()'>\n";
495 // Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
496 echo generate_display_field(array('data_type'=>'1','list_id'=>'note_type'), $iter['title']);
499 echo " <td class='notecell' id='".htmlspecialchars($row_note_id, ENT_QUOTES
)."'>\n";
502 echo " <td class='notecell' id='".htmlspecialchars($row_note_id, ENT_QUOTES
)."'>\n";
503 echo getListItemTitle("message_status", $iter['message_status']);
511 print "<tr><td colspan='3' class='text'>" . htmlspecialchars(xl('None'), ENT_NOQUOTES
) . ".</td></tr>\n";
520 <table width
='400' border
='0' cellpadding
='0' cellspacing
='0'>
524 if ($offset > ($N-1)) {
525 $offsetN = $offset-$N;
526 echo " <a class='link' href='pnotes_full.php" .
528 "&form_active=" . htmlspecialchars($form_active, ENT_QUOTES
) .
529 "&form_inactive=" . htmlspecialchars($form_inactive, ENT_QUOTES
) .
530 "&form_doc_only=" . htmlspecialchars($form_doc_only, ENT_QUOTES
) .
531 "&offset=" .attr($offsetN) . "&" . attr($activity_string_html) . "' onclick='return top.restoreSession()'>[" .
532 htmlspecialchars(xl('Previous'), ENT_NOQUOTES
) . "]</a>\n";
538 if ($result_count == $N) {
539 $offsetN = $offset+
$N;
540 echo " <a class='link' href='pnotes_full.php" .
542 "&form_active=" . htmlspecialchars($form_active, ENT_QUOTES
) .
543 "&form_inactive=" . htmlspecialchars($form_inactive, ENT_QUOTES
) .
544 "&form_doc_only=" . htmlspecialchars($form_doc_only, ENT_QUOTES
) .
545 "&offset=" .attr($offsetN) . "&" . attr($activity_string_html) . "' onclick='return top.restoreSession()'>[" .
546 htmlspecialchars(xl('Next'), ENT_NOQUOTES
) . "]</a>\n";
554 <div id
='outbox_div' <?php
echo $outbox_style; ?
> >
555 <table border
='0' cellpadding
="1" class="text">
556 <?php
if ($result_sent != "") : ?
>
558 <td colspan
='5' style
="padding: 5px;" >
559 <a href
="pnotes_full.php?<?php echo $urlparms; ?>&s=1&<?php echo attr($activity_string_html);?>"
560 class="" id
='Submit' onclick
='return top.restoreSession()'><span
><?php
echo xlt('Refresh'); ?
></span
></a
>
565 <table border
='0' cellpadding
="1" class="text" width
= "80%">
567 // display all of the notes for the day, as well as others that are active
568 // from previous dates, up to a certain number, $N
570 if ($result_sent != "") {
571 echo " <tr class=showborder_head align='left'>\n";
572 echo " <th style='width:100px';> </th>\n";
573 echo " <th>" . htmlspecialchars(xl('Active'), ENT_NOQUOTES
) . " </th>\n";
574 echo " <th>" . (($docid ||
$orderid) ?
htmlspecialchars(xl('Linked'), ENT_NOQUOTES
) : '') . "</th>\n";
575 echo " <th>" . htmlspecialchars(xl('Type'), ENT_NOQUOTES
) . "</th>\n";
576 echo " <th>" . htmlspecialchars(xl('Content'), ENT_NOQUOTES
) . "</th>\n";
579 $result_sent_count = 0;
580 foreach ($result_sent as $iter) {
581 $result_sent_count++
;
582 $row_note_id = $iter['id'];
586 if (isGpRelation(1, $docid, 6, $row_note_id)) {
589 // Skip unlinked notes if that is requested.
590 if ($form_doc_only) {
594 } else if ($orderid) {
595 if (isGpRelation(2, $orderid, 6, $row_note_id)) {
598 // Skip unlinked notes if that is requested.
599 if ($form_doc_only) {
605 $body = $iter['body'];
606 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
607 $body = nl2br(htmlspecialchars(oeFormatPatientNote($body), ENT_NOQUOTES
));
609 $body = htmlspecialchars(oeFormatSDFT(strtotime($iter['date'])).date(' H:i', strtotime($iter['date'])), ENT_NOQUOTES
) .
610 ' (' . htmlspecialchars($iter['user'], ENT_NOQUOTES
) . ') ' . nl2br(htmlspecialchars(oeFormatPatientNote($body), ENT_NOQUOTES
));
613 $body = preg_replace('/(:\d{2}\s\()' . $patient_id . '(\sto\s)/', '${1}' . $patientname . '${2}', $body);
614 if (($iter{"activity"}) && ($iter['message_status'] != "Done")) {
615 $checked = "checked";
620 // highlight the row if it's been selected for updating
621 if ($_REQUEST['noteid'] == $row_note_id) {
622 echo " <tr height=20 class='noterow highlightcolor' id='".htmlspecialchars($row_note_id, ENT_QUOTES
)."'>\n";
624 echo " <tr class='noterow' id='".htmlspecialchars($row_note_id, ENT_QUOTES
)."'>\n";
628 echo " <td><a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=".htmlspecialchars($row_note_id, ENT_QUOTES
).
629 "' class='css_button_small note_modal' onclick='return top.restoreSession()'><span>". htmlspecialchars(xl('Edit'), ENT_NOQUOTES
) ."</span></a>\n";
631 // display, or not, a button to delete the note
632 // if the user is an admin or if they are the author of the note, they can delete it
633 if (($iter['user'] == $_SESSION['authUser']) ||
(acl_check('admin', 'super', '', 'write'))) {
634 echo " <a href='#' class='deletenote css_button_small' id='del" . htmlspecialchars($row_note_id, ENT_QUOTES
) .
635 "' title='" . htmlspecialchars(xl('Delete this note'), ENT_QUOTES
) . "' onclick='return restoreSession()'><span>" .
636 htmlspecialchars(xl('Delete'), ENT_NOQUOTES
) . "</span>\n";
642 echo " <td class='text bold'>\n";
643 echo " <input type='hidden' name='act".htmlspecialchars($row_note_id, ENT_QUOTES
)."' value='1' />\n";
644 echo " <input type='checkbox' name='chk".htmlspecialchars($row_note_id, ENT_QUOTES
)."' $checked />\n";
647 echo " <td class='text bold'>\n";
648 if ($docid ||
$orderid) {
649 echo " <input type='checkbox' name='lnk" . htmlspecialchars($row_note_id, ENT_QUOTES
) . "' $linked />\n";
654 echo " <td class='bold notecell' id='".htmlspecialchars($row_note_id, ENT_QUOTES
)."'>" .
655 "<a href='pnotes_full_add.php?$urlparms&trigger=edit¬eid=".htmlspecialchars($row_note_id, ENT_QUOTES
)."' class='note_modal' onclick='return top.restoreSession()'>\n";
656 // Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
657 echo generate_display_field(array('data_type'=>'1','list_id'=>'note_type'), $iter['title']);
660 echo " <td class='notecell' id='".htmlspecialchars($row_note_id, ENT_QUOTES
)."'>\n";
669 print "<tr><td colspan='3' class='text'>" . htmlspecialchars(xl('None'), ENT_NOQUOTES
) . ".</td></tr>\n";
676 <table width
='400' border
='0' cellpadding
='0' cellspacing
='0'>
680 if ($offset_sent > ($M-1)) {
681 $offsetSentM = $offset_sent-$M;
682 echo " <a class='link' href='pnotes_full.php" .
685 "&form_active=" . htmlspecialchars($form_active, ENT_QUOTES
) .
686 "&form_inactive=" . htmlspecialchars($form_inactive, ENT_QUOTES
) .
687 "&form_doc_only=" . htmlspecialchars($form_doc_only, ENT_QUOTES
) .
688 "&offset_sent=" . attr($offsetSentM) . "&" . attr($activity_string_html) . "' onclick='return top.restoreSession()'>[" .
689 htmlspecialchars(xl('Previous'), ENT_NOQUOTES
) . "]</a>\n";
695 if ($result_sent_count == $M) {
696 $offsetSentM = $offset_sent+
$M;
697 echo " <a class='link' href='pnotes_full.php" .
700 "&form_active=" . htmlspecialchars($form_active, ENT_QUOTES
) .
701 "&form_inactive=" . htmlspecialchars($form_inactive, ENT_QUOTES
) .
702 "&form_doc_only=" . htmlspecialchars($form_doc_only, ENT_QUOTES
) .
703 "&offset_sent=" . attr($offsetSentM) . "&" . attr($activity_string_html) . "' onclick='return top.restoreSession()'>[" .
704 htmlspecialchars(xl('Next'), ENT_NOQUOTES
) . "]</a>\n";
713 <script language
='JavaScript'>
716 if ($_GET['set_pid']) {
717 $ndata = getPatientData($patient_id, "fname, lname, pubpid");
719 parent
.left_nav
.setPatient(<?php
echo "'" . addslashes($ndata['fname']." ".$ndata['lname']) . "'," .
720 addslashes($patient_id) . ",'" . addslashes($ndata['pubpid']) . "',window.name"; ?
>);
724 // If this note references a new patient document, pop up a display
727 if ($noteid /* && $title == 'New Document' */) {
728 $prow = getPnoteById($noteid, 'body');
729 if (preg_match('/New scanned document (\d+): [^\n]+\/([^\n]+)/', $prow['body'], $matches)) {
730 $docid = $matches[1];
731 $docname = $matches[2];
733 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',
734 '_blank', 'resizable=1,scrollbars=1,width=600,height=500');
742 </div
> <!-- end outer
'pnotes' -->
746 <script language
="javascript">
748 // jQuery stuff to make the page a little easier to use
750 $
(document
).ready(function(){
751 $
("#appendnote").click(function() { AppendNote(); });
752 $
("#newnote").click(function() { NewNote(); });
753 $
("#printnote").click(function() { PrintNote(); });
755 $
(".change_activity").click(function() { top
.restoreSession(); $
("#update_activity").submit(); });
757 $
(".deletenote").click(function() { DeleteNote(this
); });
759 $
(".noterow").mouseover(function() { $
(this
).toggleClass("highlight"); });
760 $
(".noterow").mouseout(function() { $
(this
).toggleClass("highlight"); });
761 $
(".notecell").click(function() { EditNote(this
); });
765 var EditNote
= function(note
) {
766 top
.restoreSession();
767 $
("#noteid").val(note
.id
);
769 $
("#new_note").submit();
772 var NewNote
= function () {
773 top
.restoreSession();
774 $
("#noteid").val('');
775 $
("#new_note").submit();
778 var AppendNote
= function () {
779 top
.restoreSession();
780 $
("#new_note").submit();
783 var PrintNote
= function () {
784 top
.restoreSession();
785 window
.open('pnotes_print.php?noteid=<?php echo htmlspecialchars($noteid, ENT_QUOTES); ?>', '_blank', 'resizable=1,scrollbars=1,width=600,height=500');
788 var DeleteNote
= function(note
) {
789 if (confirm("<?php echo htmlspecialchars(xl('Are you sure you want to delete this note?', '', '', '\n '), ENT_QUOTES) .
790 htmlspecialchars(xl('This action CANNOT be undone.'), ENT_QUOTES); ?>")) {
791 top
.restoreSession();
792 // strip the 'del' part of the object's ID
793 $
("#noteid").val(note
.id
.replace(/del
/, ""));
794 $
("#mode").val("delete");
795 $
("#new_note").submit();