2 include_once ('../../globals.php');
3 include_once ('../../../library/sql.inc');
4 include_once ('../../../library/classes/Prescription.class.php');
5 include_once("../../../library/formdata.inc.php");
11 $practice_address = '';
17 $practice_license = '';
21 $patient_address = '';
29 "<div class='signature'>"
30 . " ______________________________________________<br/>"
32 $sigline['embossed'] =
33 "<div class='signature'>"
34 . " _____________________________________________________<br/>"
35 # . "Signature - Valid for three days and in Broward County only."
40 . "<img src='./sig.jpg'>"
42 $query = sqlStatement("select fname,lname,street,city,state,postal_code,phone_home,DATE_FORMAT(DOB,'%m/%d/%y') as DOB from patient_data where pid =" . $_SESSION['pid']);
43 if ($result = mysql_fetch_array($query, MYSQL_ASSOC
)) {
44 $patient_name = $result['fname'] . ' ' . $result['lname'];
45 $patient_address = $result['street'];
46 $patient_city = $result['city'];
47 $patient_state = $result['state'];
48 $patient_zip = $result['postal_code'];
49 $patient_phone = $result['phone_home'];
50 $patient_dob = $result['DOB'];
52 //update user information if selected from form
53 if ($_POST['update']) { // OPTION update practice inf
54 $query = "update users set " .
55 "fname = '" . formData('practice_fname') . "', " .
56 "lname = '" . formData('practice_lname') . "', " .
57 "title = '" . formData('practice_title') . "', " .
58 "street = '" . formData('practice_address') . "', " .
59 "city = '" . formData('practice_city') . "', " .
60 "state = '" . formData('practice_state') . "', " .
61 "zip = '" . formData('practice_zip') . "', " .
62 "phone = '" . formData('practice_phone') . "', " .
63 "fax = '" . formData('practice_fax') . "', " .
64 "federaldrugid = '" . formData('practice_dea') . "' " .
65 "where id =" . $_SESSION['authUserID'];
68 //get user information
69 $query = sqlStatement("select * from users where id =" . $_SESSION['authUserID']);
70 if ($result = mysql_fetch_array($query, MYSQL_ASSOC
)) {
71 $physician_name = $result['fname'] . ' ' . $result['lname'] . ', ' . $result['title'];
72 $practice_fname = $result['fname'];
73 $practice_lname = $result['lname'];
74 $practice_title = $result['title'];
75 $practice_address = $result['street'];
76 $practice_city = $result['city'];
77 $practice_state = $result['state'];
78 $practice_zip = $result['zip'];
79 $practice_phone = $result['phone'];
80 $practice_fax = $result['fax'];
81 $practice_dea = $result['federaldrugid'];
83 if ($_POST['print_pdf'] ||
$_POST['print_html']) {
84 $camos_content = array();
85 foreach ($_POST as $key => $val) {
86 if (substr($key,0,3) == 'ch_') {
87 $query = sqlStatement("select content from form_CAMOS where id =" .
89 if ($result = mysql_fetch_array($query, MYSQL_ASSOC
)) {
90 if ($_POST['print_html']) { //do this change to formatting only for html output
91 $content = preg_replace('|\n|','<br/>', $result['content']);
92 $content = preg_replace('|<br/><br/>|','<br/>', $content);
94 $content = $result['content'];
96 array_push($camos_content,$content);
99 if (substr($key,0,5) == 'chrx_') {
100 $rx = new Prescription(substr($key,5));
101 //$content = $rx->drug.' '.$rx->form.' '.$rx->dosage;
105 . $rx->unit_array
[$rx->unit
] . '<br/>'
107 . $rx->form_array
[$rx->form
]. '<br/>'
109 . $rx->form_array
[$rx->form
]. ' '
110 . $rx->route_array
[$rx->route
] . ' '
111 . $rx->interval_array
[$rx->interval
] . '<br/>'
112 . 'refills:' . $rx->refills
. '';
113 // . $rx->substitute_array[$rx->substitute]. ''
114 // . $rx->per_refill . '';
115 array_push($camos_content,$content);
118 if (!$_GET['letterhead']) { //OPTION print a prescription with css formatting
122 <?php
html_header_show();?
>
124 <?php
xl('CAMOS','e'); ?
>
126 <link rel
="stylesheet" type
="text/css" href
="./rx.css" />
128 <body onload
='init()'>
129 <img src
='./hline.jpg' id
='hline'>
130 <img src
='./vline.jpg' id
='vline'>
132 if ($camos_content[0]) { //decide if we are printing this rx
135 function topHeaderRx() {
136 global $physician_name,$practice_address,$practice_city,$practice_state,$practice_zip,$practice_phone,$practice_fax,$practice_dea;
137 print $physician_name . "<br/>\n";
138 print $practice_address . "<br/>\n";
139 print $practice_city . ", ";
140 print $practice_state . " ";
141 print $practice_zip . "<br/>\n";
142 print xl('Voice') . ': ' . $practice_phone . ' / ' . xl('Fax') . ': ' . $practice_fax . "<br/>\n";
143 print xl('DEA') . ': ' . $practice_dea;
145 function bottomHeaderRx() {
146 global $patient_name,$patient_address,$patient_city,$patient_state,$patient_zip,$patient_phone,$patient_dob;
147 print "<span class='mytagname'> " . xl('Name') . ":</span>\n";
148 print "<span class='mydata'> $patient_name </span>\n";
149 print "<span class='mytagname'> " . xl('Address') . ": </span>\n";
150 print "<span class='mydata'> $patient_address, $patient_city, " .
151 "$patient_state $patient_zip </span><br/>\n";
152 print "<span class='mytagname'>" . xl('Phone') . ":</span>\n";
153 print "<span class='mydata'>$patient_phone</span>\n";
154 print "<span class='mytagname'>" . xl('DOB') . ":</span>\n";
155 print "<span class='mydata'> $patient_dob </span>\n";
156 print "<span class='mytagname'>" . xl('Date') . ":</span>\n";
157 print "<span class='mydata'>" . date("F d, Y") . "</span><br/><br/>\n";
158 print "<div class='symbol'>" . xl('Rx') . "</div><br/>\n";
161 <div id
='rx1' class='rx' >
162 <div
class='topheader'>
168 <div
class='bottomheader'>
173 <div
class='content'>
175 print $camos_content[0];
178 <?
print $sigline[$_GET[sigline
]] ?
>
179 </div
> <!-- end of rx block
-->
181 } // end of deciding if we are printing the above rx block
183 print "<img src='./xout.jpg' id='rx1'>\n";
187 if ($camos_content[1]) { //decide if we are printing this rx
189 <div id
='rx2' class='rx' >
190 <div
class='topheader'>
196 <div
class='bottomheader'>
201 <div
class='content'>
203 print $camos_content[1];
206 <?
print $sigline[$_GET[sigline
]] ?
>
207 </div
> <!-- end of rx block
-->
209 } // end of deciding if we are printing the above rx block
211 print "<img src='./xout.jpg' id='rx2'>\n";
215 if ($camos_content[2]) { //decide if we are printing this rx
217 <div id
='rx3' class='rx' >
218 <div
class='topheader'>
224 <div
class='bottomheader'>
229 <div
class='content'>
231 print $camos_content[2];
234 <?
print $sigline[$_GET[sigline
]] ?
>
235 </div
> <!-- end of rx block
-->
237 } // end of deciding if we are printing the above rx block
239 print "<img src='./xout.jpg' id='rx3'>\n";
243 if ($camos_content[3]) { //decide if we are printing this rx
245 <div id
='rx4' class='rx' >
246 <div
class='topheader'>
252 <div
class='bottomheader'>
257 <div
class='content'>
259 print $camos_content[3];
262 <?
print $sigline[$_GET[sigline
]] ?
>
263 </div
> <!-- end of rx block
-->
265 } // end of deciding if we are printing the above rx block
267 print "<img src='./xout.jpg' id='rx4'>\n";
273 }//end of printing to rx not letterhead
274 elseif ($_GET['letterhead']) { //OPTION print to letterhead
275 $content = preg_replace('/PATIENTNAME/i',$patient_name,$camos_content[0]);
276 if($_POST['print_html']) { //print letterhead to html
282 font
-family
: sans
-serif
;
302 <title
><?php
xl('Letter','e'); ?
></title
>
305 <div
class='paddingdiv'>
308 print "<div style='font-weight:bold;'>";
309 print $physician_name . "<br/>\n";
310 print $practice_address . "<br/>\n";
311 print $practice_city.', '.$practice_state.' '.$practice_zip . "<br/>\n";
312 print $practice_phone . ' (' . xl('Voice') . ')' . "<br/>\n";
313 print $practice_phone . ' ('. xl('Fax') . ')' . "<br/>\n";
315 print date("l, F jS, Y") . "<br/>\n";
319 print "<div style='font-size:90%;'>";
323 print "<div style='font-weight:bold;'>";
326 if ($_GET['signer'] == 'patient') {
327 print "__________________________________________________________________________________" . "<br/>\n";
328 print xl("Print name, sign and date.") . "<br/>\n";
330 elseif ($_GET['signer'] == 'doctor') {
331 print xl('Sincerely,') . "<br/>\n";
334 print $physician_name . "<br/>\n";
338 <script language
='JavaScript'>
347 else { //print letterhead to pdf
348 include_once('../../../library/classes/class.ezpdf.php');
349 $pdf =& new Cezpdf();
350 $pdf->selectFont('../../../library/fonts/Times-Bold');
351 $pdf->ezSetCmMargins(3,1,1,1);
352 $pdf->ezText($physician_name,12);
353 $pdf->ezText($practice_address,12);
354 $pdf->ezText($practice_city.', '.$practice_state.' '.$practice_zip,12);
355 $pdf->ezText($practice_phone . ' (' . xl('Voice') . ')',12);
356 $pdf->ezText($practice_phone . ' ('. xl('Fax') . ')',12);
358 $pdf->ezText(date("l, F jS, Y"),12);
360 $pdf->selectFont('../../../library/fonts/Helvetica');
361 $pdf->ezText($content,10);
362 $pdf->selectFont('../../../library/fonts/Times-Bold');
365 if ($_GET['signer'] == 'patient') {
366 $pdf->ezText("__________________________________________________________________________________",12);
367 $pdf->ezText(xl("Print name, sign and date."),12);
369 elseif ($_GET['signer'] == 'doctor') {
370 $pdf->ezText(xl('Sincerely,'),12);
373 $pdf->ezText($physician_name,12);
376 } //end of html vs pdf print
379 else { //OPTION selection of what to print
383 <?php
html_header_show();?
>
385 <?php
xl('CAMOS','e'); ?
>
387 <script type
="text/javascript">
388 //below init function just to demonstrate how to do it.
389 //now need to create 'cycle' function triggered by button to go by fours
390 //through selected types of subcategories.
391 //this is to be very very cool.
394 var f
= document
.forms
[0];
395 var x
= f
.elements
.length
;
398 if (f
.elements
[i
].type
== 'checkbox') {
399 f
.elements
[i
].checked
= true;
403 function uncheckall(){
404 var f
= document
.forms
[0];
405 var x
= f
.elements
.length
;
408 if (f
.elements
[i
].type
== 'checkbox') {
409 f
.elements
[i
].checked
= false;
414 var log
= document
.getElementById('log');
415 var cboxes
= document
.getElementById('checkboxes');
416 var cb
= cboxes
.getElementsByTagName('div');
417 if (cycle_engine(cb
,0) == 0) {cycle_engine(cb
,1);}
419 function cycle_engine(cb
,seed
) {
420 //seed determines if we should turn on up to first 4
421 var count_turnon
= 0;
422 var count_turnoff
= 0;
423 for (var i
=0;i
<cb
.length
;i++
) {
424 cbc
= cb
[i
].childNodes
;
425 if (cbc
[2].innerHTML
== 'prescriptions') {
426 if (cbc
[1].checked
== true) {
427 cbc
[1].checked
= false;
430 if ((count_turnoff
> 0 || seed
== 1) && count_turnon
< 4) {
431 cbc
[1].checked
= true;
437 return count_turnoff
;
441 <link rel
="stylesheet" type
="text/css" href
="./rx.css" />
443 <h1
><?php
xl('Select CAMOS Entries for Printing','e'); ?
></h1
>
444 <form method
=POST name
='pick_items' target
=_new
>
445 <input type
=button name
=cyclerx value
='<?php xl('Cycle
','e
'); ?>' onClick
='cycle()'><br
/>
446 <input type
='button' value
='<?php xl('Select All
','e
'); ?>' onClick
='checkall()'>
447 <input type
='button' value
='<?php xl('Unselect All
','e
'); ?>' onClick
='uncheckall()'>
449 <?php
if ($_GET['letterhead']) { ?
>
450 <input type
=submit name
='print_pdf' value
='<?php xl('Print (PDF
)','e
'); ?>'>
453 <input type
=submit name
='print_html' value
='<?php xl('Print (HTML
)','e
'); ?>'>
455 $query = sqlStatement("select x.id as id, x.category, x.subcategory, x.item from " .
456 "form_CAMOS as x join forms as y on (x.id = y.form_id) " .
457 "where y.encounter = " . $_SESSION['encounter'] .
458 " and y.pid = " . $_SESSION['pid'] .
459 " and y.form_name like 'CAMOS%'" .
460 " and x.activity = 1");
462 echo "<div id='checkboxes'>\n";
464 while ($result = mysql_fetch_array($query, MYSQL_ASSOC
)) {
466 if ($result['category'] == 'prescriptions' && $count < 4) {
468 $checked = 'checked';
471 echo "<input type=checkbox name='ch_" . $result['id'] . "' $checked><span>" .
472 $result['category'] . '</span>:' . $result['subcategory'] . ':' . $result['item'] . "<br/>\n";
476 echo "<div id='log'>\n";//temp for debugging
478 //create Prescription object for the purpose of drawing data from the Prescription
479 //table for those who wish to do so
480 $rxarray = Prescription
::prescriptions_factory($_SESSION['pid']);
481 //now give a choice of drugs from the Prescription table
482 foreach($rxarray as $val) {
483 echo "<input type=checkbox name='chrx_" . $val->id
. "'>" .
484 $val->drug
. ':' . $val->start_date
. "<br/>\n";
488 <?php
if ($_GET['letterhead']) { ?
>
489 <input type
=submit name
='print_pdf' value
='<?php xl('Print (PDF
)','e
'); ?>'>
492 <input type
=submit name
='print_html' value
='<?php xl('Print (HTML
)','e
'); ?>'>
494 <h1
><?php
xl('Update User Information','e'); ?
></h1
>
495 <form method
=POST name
='pick_items'>
498 <td
> <?php
xl('First Name','e'); ?
>: </td
>
499 <td
> <input type
=text name
=practice_fname value
='<? echo htmlspecialchars($practice_fname,ENT_QUOTES); ?>'> </td
>
502 <td
> <?php
xl('Last Name','e'); ?
>: </td
>
503 <td
> <input type
=text name
=practice_lname value
='<? echo htmlspecialchars($practice_lname,ENT_QUOTES); ?>'> </td
>
506 <td
> <?php
xl('Title','e'); ?
>: </td
>
507 <td
> <input type
=text name
=practice_title value
='<? echo htmlspecialchars($practice_title,ENT_QUOTES); ?>'> </td
>
510 <td
> <?php
xl('Street Address','e'); ?
>: </td
>
511 <td
> <input type
=text name
=practice_address value
='<? echo htmlspecialchars($practice_address,ENT_QUOTES); ?>'> </td
>
514 <td
> <?php
xl('City','e'); ?
>: </td
>
515 <td
> <input type
=text name
=practice_city value
='<? echo htmlspecialchars($practice_city,ENT_QUOTES); ?>'> </td
>
518 <td
> <?php
xl('State','e'); ?
>: </td
>
519 <td
> <input type
=text name
=practice_state value
='<? echo htmlspecialchars($practice_state,ENT_QUOTES); ?>'> </td
>
522 <td
> <?php
xl('Zip','e'); ?
>: </td
>
523 <td
> <input type
=text name
=practice_zip value
='<? echo htmlspecialchars($practice_zip,ENT_QUOTES); ?>'> </td
>
526 <td
> <?php
xl('Phone','e'); ?
>: </td
>
527 <td
> <input type
=text name
=practice_phone value
='<? echo htmlspecialchars($practice_phone,ENT_QUOTES); ?>'> </td
>
530 <td
> <?php
xl('Fax','e'); ?
>: </td
>
531 <td
> <input type
=text name
=practice_fax value
='<? echo htmlspecialchars($practice_fax,ENT_QUOTES); ?>'> </td
>
534 <td
> <?php
xl('DEA','e'); ?
>: </td
>
535 <td
> <input type
=text name
=practice_dea value
='<? echo htmlspecialchars($practice_dea,ENT_QUOTES); ?>'> </td
>
538 <input type
=submit name
=update value
='<?php xl('Update
','e
'); ?>'>
541 } //end of else statement