Change form select interface so picking form from select menu automatically jumps...
[openemr.git] / interface / patient_file / summary / pnotes.php
blobd3f50e13092a7fbbec6a2e33499bb0409834cc0e
1 <?
2 include_once("../../globals.php");
3 include_once("$srcdir/pnotes.inc");
4 include_once("$srcdir/acl.inc");
5 ?>
6 <html>
7 <head>
9 <link rel=stylesheet href="<?echo $css_header;?>" type="text/css">
11 </head>
12 <body <?echo $bottom_bg_line;?> topmargin='0' rightmargin='0' leftmargin='2'
13 bottommargin='0' marginwidth='2' marginheight='0'>
16 $thisauth = acl_check('patients', 'notes');
17 if ($thisauth) {
18 $tmp = getPatientData($pid, "squad");
19 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
20 $thisauth = 0;
22 if (!$thisauth) {
23 echo "<p>(Notes not authorized)</p>\n";
24 echo "</body>\n</html>\n";
25 exit();
29 <table border='0' cellspacing='0' cellpadding='0' height='100%'>
30 <tr>
32 <td valign='top'>
34 <? if ($thisauth == 'write' || $thisauth == 'addonly') { ?>
35 <a href="pnotes_full.php" target="Main">
36 <font class="title">Notes</font><font class=more><?echo $tmore;?></font>
37 </a>
38 <? } ?>
40 <br>
42 <table border='0'>
45 //display all of the notes for the day, as well as others that are active from previous dates, up to a certain number, $N
46 $N = 15;
48 $conn = $GLOBALS['adodb']['db'];
50 // Get the billing note if there is one.
51 $billing_note = "";
52 $colorbeg = "";
53 $colorend = "";
54 $sql = "select genericname2, genericval2 " .
55 "from patient_data where pid = '$pid' limit 1";
56 $resnote = $conn->Execute($sql);
57 if($resnote && !$resnote->EOF && $resnote->fields['genericname2'] == 'Billing') {
58 $billing_note = $resnote->fields['genericval2'];
59 $colorbeg = "<font color='red'>";
60 $colorend = "<font>";
63 //Display what the patient owes
64 require_once($GLOBALS['fileroot'] ."/library/classes/WSWrapper.class.php");
65 $customer_info['id'] = 0;
66 $sql = "SELECT foreign_id from integration_mapping as im LEFT JOIN patient_data as pd on im.local_id=pd.id where pd.pid = '" . $pid . "' and im.local_table='patient_data' and im.foreign_table='customer'";
67 $result = $conn->Execute($sql);
68 if($result && !$result->EOF)
70 $customer_info['id'] = $result->fields['foreign_id'];
73 $function['ezybiz.customer_balance'] = array(new xmlrpcval($customer_info,"struct"));
74 $ws = new WSWrapper($function);
75 if(is_numeric($ws->value)) {
76 $formatted = sprintf('$%01.2f', $ws->value);
77 echo " <tr>\n";
78 echo " <td>$colorbeg" . "Balance Due$colorend</td><td>$colorbeg$formatted$colorend</td>\n";
79 echo " </tr>\n";
82 if($billing_note) {
83 echo " <tr>\n";
84 echo " <td>$colorbeg" . "Billing Note$colorend</td><td>$colorbeg$billing_note$colorend</td>\n";
85 echo " </tr>\n";
88 //retrieve all active notes
89 if ($result = getPnotesByDate("", 1, "id,date,body,user,title,assigned_to",
90 $pid, "all", 0))
92 $notes_count = 0;//number of notes so far displayed
93 foreach ($result as $iter) {
95 if ($notes_count >= $N) {
96 //we have more active notes to print, but we've reached our display maximum
97 echo " <tr>\n";
98 echo " <td colspan='3' align='center'>\n";
99 echo " <a target='Main' href='pnotes_full.php?active=1' class='alert'>";
100 echo "Some notes were not displayed. Click here to view all.</a>\n";
101 echo " </td>\n";
102 echo " </tr>\n";
103 break;
106 /****
107 if (getdate() == strtotime($iter{"date"})) {
108 $date_string = "Today, " . date( "D F jS" ,strtotime($iter{"date"}));
109 } else {
110 $date_string = date( "D F jS" ,strtotime($iter{"date"}));
112 print "<tr><td><a href='pnotes_full.php?active=1' target=Main class=bold>".$date_string . " (". $iter{"user"}.")</a></td><td>" . "<a href='pnotes_full.php?active=1' target=Main class=text>" . stripslashes($iter{"body"}) . "</a></td></tr>\n";
113 ****/
115 $body = $iter['body'];
116 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
117 $body = nl2br($body);
118 } else {
119 $body = date('Y-m-d H:i', strtotime($iter['date'])) .
120 ' (' . $iter['user'] . ') ' . nl2br($body);
123 echo " <tr>\n";
124 echo " <td valign='top'>\n";
125 echo " <a href='pnotes_full.php?noteid=" . $iter['id'] .
126 "&active=1' target='Main' class='bold'>" . $iter['title'] . "</a>\n";
127 echo " </td>\n";
128 echo " <td valign='top'>\n";
129 echo " <font class='text'>$body</font>\n";
130 echo " </td>\n";
131 echo " </tr>\n";
133 $notes_count++;
138 </table>
140 </td>
141 </tr>
142 </table>
144 </body>
145 </html>