translation patches from Dr. Bosman and his crew
[openemr.git] / interface / patient_file / summary / pnotes.php
blobb4d46738c5206438867ebc8093bc09218b23173e
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') { ?>
36 <?php if ($GLOBALS['concurrent_layout']) { ?>
37 <a href="pnotes_full.php">
38 <?php } else { ?>
39 <a href="pnotes_full.php" target="Main">
40 <?php } ?>
42 <font class="title"><?php xl('Notes','e'); ?></font><font class=more><?echo $tmore;?></font>
43 </a>
44 <? } ?>
46 <br>
48 <table border='0'>
51 //display all of the notes for the day, as well as others that are active from previous dates, up to a certain number, $N
52 $N = 15;
54 $conn = $GLOBALS['adodb']['db'];
56 // Get the billing note if there is one.
57 $billing_note = "";
58 $colorbeg = "";
59 $colorend = "";
60 $sql = "select genericname2, genericval2 " .
61 "from patient_data where pid = '$pid' limit 1";
62 $resnote = $conn->Execute($sql);
63 if($resnote && !$resnote->EOF && $resnote->fields['genericname2'] == 'Billing') {
64 $billing_note = $resnote->fields['genericval2'];
65 $colorbeg = "<font color='red'>";
66 $colorend = "<font>";
69 //Display what the patient owes
70 require_once($GLOBALS['fileroot'] ."/library/classes/WSWrapper.class.php");
71 $customer_info['id'] = 0;
72 $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'";
73 $result = $conn->Execute($sql);
74 if($result && !$result->EOF)
76 $customer_info['id'] = $result->fields['foreign_id'];
79 $function['ezybiz.customer_balance'] = array(new xmlrpcval($customer_info,"struct"));
80 $ws = new WSWrapper($function);
81 if(is_numeric($ws->value)) {
82 $formatted = sprintf('$%01.2f', $ws->value);
83 echo " <tr>\n";
84 echo " <td>$colorbeg" . "Balance Due$colorend</td><td>$colorbeg$formatted$colorend</td>\n";
85 echo " </tr>\n";
88 if($billing_note) {
89 echo " <tr>\n";
90 echo " <td>$colorbeg" . "Billing Note$colorend</td><td>$colorbeg$billing_note$colorend</td>\n";
91 echo " </tr>\n";
94 //retrieve all active notes
95 if ($result = getPnotesByDate("", 1, "id,date,body,user,title,assigned_to",
96 $pid, "all", 0))
98 $notes_count = 0;//number of notes so far displayed
99 foreach ($result as $iter) {
101 if ($notes_count >= $N) {
102 //we have more active notes to print, but we've reached our display maximum
103 echo " <tr>\n";
104 echo " <td colspan='3' align='center'>\n";
105 echo " <a ";
106 if (!$GLOBALS['concurrent_layout']) echo "target='Main' ";
107 echo "href='pnotes_full.php?active=1' class='alert'>";
108 echo "Some notes were not displayed. Click here to view all.</a>\n";
109 echo " </td>\n";
110 echo " </tr>\n";
111 break;
114 $body = $iter['body'];
115 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
116 $body = nl2br($body);
117 } else {
118 $body = date('Y-m-d H:i', strtotime($iter['date'])) .
119 ' (' . $iter['user'] . ') ' . nl2br($body);
122 echo " <tr>\n";
123 echo " <td valign='top'>\n";
124 echo " <a href='pnotes_full.php?noteid=" . $iter['id'] . "&active=1'";
125 if (!$GLOBALS['concurrent_layout']) echo " target='Main'";
126 echo " 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>