added support for patient billing note
[openemr.git] / interface / patient_file / summary / pnotes.php
bloba4017027109a792b5f972b6a451c97e459191c9f
1 <?
2 include_once("../../globals.php");
3 include_once("$srcdir/pnotes.inc");
4 ?>
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 bottommargin=0 marginwidth=2 marginheight=0>
14 <table border=0 cellspacing=0 cellpadding=0 height=100%>
15 <tr>
16 <td background="<?echo $linepic;?>" width=7 height=100%>
17 &nbsp;
18 </td>
19 <td valign=top>
21 <a href="pnotes_full.php" target="Main"><font class="title">Patient Notes</font><font class=more><?echo $tmore;?></font></a>
23 <br>
25 <table border=0>
28 //display all of the notes for the day, as well as others that are active from previous dates, up to a certain number, $N
29 $N = 4;
31 $conn = $GLOBALS['adodb']['db'];
33 // Get the billing note if there is one.
34 $billing_note = "";
35 $colorbeg = "";
36 $colorend = "";
37 $sql = "select genericname2, genericval2 " .
38 "from patient_data where pid = '$pid' limit 1";
39 $resnote = $conn->Execute($sql);
40 if($resnote && !$resnote->EOF && $resnote->fields['genericname2'] == 'Billing') {
41 $billing_note = $resnote->fields['genericval2'];
42 $colorbeg = "<font color='red'>";
43 $colorend = "<font>";
46 //Display what the patient owes
47 require_once($GLOBALS['fileroot'] ."/library/classes/WSWrapper.class.php");
48 $customer_info['id'] = 0;
49 $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'";
50 $result = $conn->Execute($sql);
51 if($result && !$result->EOF)
53 $customer_info['id'] = $result->fields['foreign_id'];
56 $function['ezybiz.customer_balance'] = array(new xmlrpcval($customer_info,"struct"));
57 $ws = new WSWrapper($function);
58 if(is_numeric($ws->value)) {
59 $formatted = sprintf('$%01.2f', $ws->value);
60 print "<tr><td>$colorbeg" . "Balance Due$colorend</td><td>$colorbeg$formatted$colorend</td></tr>\n";
63 if($billing_note) {
64 print "<tr><td>$colorbeg" . "Billing Note$colorend</td><td>$colorbeg$billing_note$colorend</td></tr>\n";
67 //retrieve all active notes
68 if ($result = getPnotesByDate("", 1, "date,body,user",$pid,"all",0)){
70 $notes_count = 0;//number of notes so far displayed
71 foreach ($result as $iter) {
72 if ($notes_count >= $N) {
73 //we have more active notes to print, but we've reached our display maximum
74 print "<tr><td colspan=3 align=center><a target=Main href='pnotes_full.php?active=1' class=alert>Some notes were not displayed. Click here to view all.</a></td></tr>\n";
75 break;
79 if (getdate() == strtotime($iter{"date"})) {
80 $date_string = "Today, " . date( "D F jS" ,strtotime($iter{"date"}));
81 } else {
82 $date_string = date( "D F jS" ,strtotime($iter{"date"}));
85 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";
88 $notes_count++;
94 </table>
96 </td>
97 </tr>
98 </table>
100 </body>
101 </html>