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 ".mitigateSqlTableUpperCase("form_CAMOS")." where id =" .
89 if ($result = mysql_fetch_array($query, MYSQL_ASSOC
)) {
91 if ($_POST['print_html']) { //do this change to formatting only for html output
92 $content = preg_replace('|\n|','<br/>', text($result['content']));
93 $content = preg_replace('|<br/><br/>|','<br/>', $content);
95 $content = $result['content'];
97 array_push($camos_content,$content);
100 if (substr($key,0,5) == 'chrx_') {
101 $rx = new Prescription(substr($key,5));
102 //$content = $rx->drug.' '.$rx->form.' '.$rx->dosage;
104 . text($rx->drug
) . ' '
105 . text($rx->size
) . ''
106 . text($rx->unit_array
[$rx->unit
]) . '<br/>'
107 . text($rx->quantity
). ' '
108 . text($rx->form_array
[$rx->form
]). '<br/>'
109 . text($rx->dosage
) . ' '
110 . text($rx->form_array
[$rx->form
]). ' '
111 . text($rx->route_array
[$rx->route
]) . ' '
112 . text($rx->interval_array
[$rx->interval
]) . '<br/>'
113 . text($rx->note
) . '<br/>'
114 . 'refills:' . $rx->refills
. '';
115 // . $rx->substitute_array[$rx->substitute]. ''
116 // . $rx->per_refill . '';
117 array_push($camos_content,$content);
120 if (!$_GET['letterhead']) { //OPTION print a prescription with css formatting
124 <?php
html_header_show();?
>
126 <?php
xl('CAMOS','e'); ?
>
128 <link rel
="stylesheet" type
="text/css" href
="./rx.css" />
130 <body onload
='init()'>
131 <img src
='./hline.jpg' id
='hline'>
132 <img src
='./vline.jpg' id
='vline'>
134 if ($camos_content[0]) { //decide if we are printing this rx
137 function topHeaderRx() {
138 global $physician_name,$practice_address,$practice_city,$practice_state,$practice_zip,$practice_phone,$practice_fax,$practice_dea;
139 print $physician_name . "<br/>\n";
140 print $practice_address . "<br/>\n";
141 print $practice_city . ", ";
142 print $practice_state . " ";
143 print $practice_zip . "<br/>\n";
144 print xl('Voice') . ': ' . $practice_phone . ' / ' . xl('Fax') . ': ' . $practice_fax . "<br/>\n";
145 print xl('DEA') . ': ' . $practice_dea;
147 function bottomHeaderRx() {
148 global $patient_name,$patient_address,$patient_city,$patient_state,$patient_zip,$patient_phone,$patient_dob;
149 print "<span class='mytagname'> " . xl('Name') . ":</span>\n";
150 print "<span class='mydata'> $patient_name </span>\n";
151 print "<span class='mytagname'> " . xl('Address') . ": </span>\n";
152 print "<span class='mydata'> $patient_address, $patient_city, " .
153 "$patient_state $patient_zip </span><br/>\n";
154 print "<span class='mytagname'>" . xl('Phone') . ":</span>\n";
155 print "<span class='mydata'>$patient_phone</span>\n";
156 print "<span class='mytagname'>" . xl('DOB') . ":</span>\n";
157 print "<span class='mydata'> $patient_dob </span>\n";
158 print "<span class='mytagname'>" . xl('Date') . ":</span>\n";
159 print "<span class='mydata'>" . date("F d, Y") . "</span><br/><br/>\n";
160 print "<div class='symbol'>" . xl('Rx') . "</div><br/>\n";
163 <div id
='rx1' class='rx' >
164 <div
class='topheader'>
170 <div
class='bottomheader'>
175 <div
class='content'>
177 print $camos_content[0];
180 <?php
print $sigline[$_GET[sigline
]] ?
>
181 </div
> <!-- end of rx block
-->
183 } // end of deciding if we are printing the above rx block
185 print "<img src='./xout.jpg' id='rx1'>\n";
190 if ($camos_content[1]) { //decide if we are printing this rx
192 <div id
='rx2' class='rx' >
193 <div
class='topheader'>
200 <div
class='bottomheader'>
206 <div
class='content'>
209 print $camos_content[1];
212 <?php
print $sigline[$_GET[sigline
]] ?
>
213 </div
> <!-- end of rx block
-->
216 } // end of deciding if we are printing the above rx block
218 print "<img src='./xout.jpg' id='rx2'>\n";
223 if ($camos_content[2]) { //decide if we are printing this rx
225 <div id
='rx3' class='rx' >
226 <div
class='topheader'>
233 <div
class='bottomheader'>
239 <div
class='content'>
242 print $camos_content[2];
245 <?php
print $sigline[$_GET[sigline
]] ?
>
246 </div
> <!-- end of rx block
-->
249 } // end of deciding if we are printing the above rx block
251 print "<img src='./xout.jpg' id='rx3'>\n";
256 if ($camos_content[3]) { //decide if we are printing this rx
258 <div id
='rx4' class='rx' >
259 <div
class='topheader'>
266 <div
class='bottomheader'>
272 <div
class='content'>
275 print $camos_content[3];
278 <?php
print $sigline[$_GET[sigline
]] ?
>
279 </div
> <!-- end of rx block
-->
282 } // end of deciding if we are printing the above rx block
284 print "<img src='./xout.jpg' id='rx4'>\n";
290 }//end of printing to rx not letterhead
291 elseif ($_GET['letterhead']) { //OPTION print to letterhead
292 $content = preg_replace('/PATIENTNAME/i',$patient_name,$camos_content[0]);
293 if($_POST['print_html']) { //print letterhead to html
299 font
-family
: sans
-serif
;
319 <title
><?php
xl('Letter','e'); ?
></title
>
322 <div
class='paddingdiv'>
325 print "<div style='font-weight:bold;'>";
326 print $physician_name . "<br/>\n";
327 print $practice_address . "<br/>\n";
328 print $practice_city.', '.$practice_state.' '.$practice_zip . "<br/>\n";
329 print $practice_phone . ' (' . xl('Voice') . ')' . "<br/>\n";
330 print $practice_phone . ' ('. xl('Fax') . ')' . "<br/>\n";
332 print date("l, F jS, Y") . "<br/>\n";
336 print "<div style='font-size:90%;'>";
340 print "<div style='font-weight:bold;'>";
343 if ($_GET['signer'] == 'patient') {
344 print "__________________________________________________________________________________" . "<br/>\n";
345 print xl("Print name, sign and date.") . "<br/>\n";
347 elseif ($_GET['signer'] == 'doctor') {
348 print xl('Sincerely,') . "<br/>\n";
351 print $physician_name . "<br/>\n";
355 <script language
='JavaScript'>
356 var win
= top
.printLogPrint ? top
: opener
.top
;
357 win
.printLogPrint(window
);
365 else { //print letterhead to pdf
366 include_once('../../../library/classes/class.ezpdf.php');
367 $pdf =& new Cezpdf();
368 $pdf->selectFont('../../../library/fonts/Times-Bold');
369 $pdf->ezSetCmMargins(3,1,1,1);
370 $pdf->ezText($physician_name,12);
371 $pdf->ezText($practice_address,12);
372 $pdf->ezText($practice_city.', '.$practice_state.' '.$practice_zip,12);
373 $pdf->ezText($practice_phone . ' (' . xl('Voice') . ')',12);
374 $pdf->ezText($practice_phone . ' ('. xl('Fax') . ')',12);
376 $pdf->ezText(date("l, F jS, Y"),12);
378 $pdf->selectFont('../../../library/fonts/Helvetica');
379 $pdf->ezText($content,10);
380 $pdf->selectFont('../../../library/fonts/Times-Bold');
383 if ($_GET['signer'] == 'patient') {
384 $pdf->ezText("__________________________________________________________________________________",12);
385 $pdf->ezText(xl("Print name, sign and date."),12);
387 elseif ($_GET['signer'] == 'doctor') {
388 $pdf->ezText(xl('Sincerely,'),12);
391 $pdf->ezText($physician_name,12);
394 } //end of html vs pdf print
397 else { //OPTION selection of what to print
401 <?php
html_header_show();?
>
403 <?php
xl('CAMOS','e'); ?
>
405 <script type
="text/javascript">
406 //below init function just to demonstrate how to do it.
407 //now need to create 'cycle' function triggered by button to go by fours
408 //through selected types of subcategories.
409 //this is to be very very cool.
412 var f
= document
.forms
[0];
413 var x
= f
.elements
.length
;
416 if (f
.elements
[i
].type
== 'checkbox') {
417 f
.elements
[i
].checked
= true;
421 function uncheckall(){
422 var f
= document
.forms
[0];
423 var x
= f
.elements
.length
;
426 if (f
.elements
[i
].type
== 'checkbox') {
427 f
.elements
[i
].checked
= false;
432 var log
= document
.getElementById('log');
433 var cboxes
= document
.getElementById('checkboxes');
434 var cb
= cboxes
.getElementsByTagName('div');
435 if (cycle_engine(cb
,0) == 0) {cycle_engine(cb
,1);}
437 function cycle_engine(cb
,seed
) {
438 //seed determines if we should turn on up to first 4
439 var count_turnon
= 0;
440 var count_turnoff
= 0;
441 for (var i
=0;i
<cb
.length
;i++
) {
442 cbc
= cb
[i
].childNodes
;
443 if (cbc
[2].innerHTML
== 'prescriptions') {
444 if (cbc
[1].checked
== true) {
445 cbc
[1].checked
= false;
448 if ((count_turnoff
> 0 || seed
== 1) && count_turnon
< 4) {
449 cbc
[1].checked
= true;
455 return count_turnoff
;
459 <link rel
="stylesheet" type
="text/css" href
="./rx.css" />
461 <h1
><?php
xl('Select CAMOS Entries for Printing','e'); ?
></h1
>
462 <form method
=POST name
='pick_items' target
=_new
>
463 <input type
=button name
=cyclerx value
='<?php xl('Cycle
','e
'); ?>' onClick
='cycle()'><br
/>
464 <input type
='button' value
='<?php xl('Select All
','e
'); ?>' onClick
='checkall()'>
465 <input type
='button' value
='<?php xl('Unselect All
','e
'); ?>' onClick
='uncheckall()'>
467 <?php
if ($_GET['letterhead']) { ?
>
468 <input type
=submit name
='print_pdf' value
='<?php xl('Print (PDF
)','e
'); ?>'>
471 <input type
=submit name
='print_html' value
='<?php xl('Print (HTML
)','e
'); ?>'>
474 //check if an encounter is set
475 if ($_SESSION['encounter'] == NULL) {
476 $query = sqlStatement("select x.id as id, x.category, x.subcategory, x.item from " .
477 mitigateSqlTableUpperCase("form_CAMOS")." as x join forms as y on (x.id = y.form_id) " .
478 "where y.pid = " . $_SESSION['pid'] .
479 " and y.form_name like 'CAMOS%'" .
480 " and x.activity = 1");
483 $query = sqlStatement("select x.id as id, x.category, x.subcategory, x.item from " .
484 mitigateSqlTableUpperCase("form_CAMOS")." as x join forms as y on (x.id = y.form_id) " .
485 "where y.encounter = " . $_SESSION['encounter'] .
486 " and y.pid = " . $_SESSION['pid'] .
487 " and y.form_name like 'CAMOS%'" .
488 " and x.activity = 1");
491 echo "<div id='checkboxes'>\n";
493 while ($result = mysql_fetch_array($query, MYSQL_ASSOC
)) {
495 if ($result['category'] == 'prescriptions' && $count < 4) {
497 $checked = 'checked';
500 echo "<input type=checkbox name='ch_" . $result['id'] . "' $checked><span>" .
501 $result['category'] . '</span>:' . $result['subcategory'] . ':' . $result['item'] . "<br/>\n";
505 echo "<div id='log'>\n";//temp for debugging
507 //create Prescription object for the purpose of drawing data from the Prescription
508 //table for those who wish to do so
509 $rxarray = Prescription
::prescriptions_factory($_SESSION['pid']);
510 //now give a choice of drugs from the Prescription table
511 foreach($rxarray as $val) {
512 echo "<input type=checkbox name='chrx_" . $val->id
. "'>" .
513 $val->drug
. ':' . $val->start_date
. "<br/>\n";
517 <?php
if ($_GET['letterhead']) { ?
>
518 <input type
=submit name
='print_pdf' value
='<?php xl('Print (PDF
)','e
'); ?>'>
521 <input type
=submit name
='print_html' value
='<?php xl('Print (HTML
)','e
'); ?>'>
523 <h1
><?php
xl('Update User Information','e'); ?
></h1
>
524 <form method
=POST name
='pick_items'>
527 <td
> <?php
xl('First Name','e'); ?
>: </td
>
528 <td
> <input type
=text name
=practice_fname value
='<?php echo htmlspecialchars($practice_fname,ENT_QUOTES); ?>'> </td
>
531 <td
> <?php
xl('Last Name','e'); ?
>: </td
>
532 <td
> <input type
=text name
=practice_lname value
='<?php echo htmlspecialchars($practice_lname,ENT_QUOTES); ?>'> </td
>
535 <td
> <?php
xl('Title','e'); ?
>: </td
>
536 <td
> <input type
=text name
=practice_title value
='<?php echo htmlspecialchars($practice_title,ENT_QUOTES); ?>'> </td
>
539 <td
> <?php
xl('Street Address','e'); ?
>: </td
>
540 <td
> <input type
=text name
=practice_address value
='<?php echo htmlspecialchars($practice_address,ENT_QUOTES); ?>'> </td
>
543 <td
> <?php
xl('City','e'); ?
>: </td
>
544 <td
> <input type
=text name
=practice_city value
='<?php echo htmlspecialchars($practice_city,ENT_QUOTES); ?>'> </td
>
547 <td
> <?php
xl('State','e'); ?
>: </td
>
548 <td
> <input type
=text name
=practice_state value
='<?php echo htmlspecialchars($practice_state,ENT_QUOTES); ?>'> </td
>
551 <td
> <?php
xl('Zip','e'); ?
>: </td
>
552 <td
> <input type
=text name
=practice_zip value
='<?php echo htmlspecialchars($practice_zip,ENT_QUOTES); ?>'> </td
>
555 <td
> <?php
xl('Phone','e'); ?
>: </td
>
556 <td
> <input type
=text name
=practice_phone value
='<?php echo htmlspecialchars($practice_phone,ENT_QUOTES); ?>'> </td
>
559 <td
> <?php
xl('Fax','e'); ?
>: </td
>
560 <td
> <input type
=text name
=practice_fax value
='<?php echo htmlspecialchars($practice_fax,ENT_QUOTES); ?>'> </td
>
563 <td
> <?php
xl('DEA','e'); ?
>: </td
>
564 <td
> <input type
=text name
=practice_dea value
='<?php echo htmlspecialchars($practice_dea,ENT_QUOTES); ?>'> </td
>
567 <input type
=submit name
=update value
='<?php xl('Update
','e
'); ?>'>
570 } //end of else statement