2 include_once ('../../globals.php');
3 include_once ('../../../library/sql.inc');
4 include_once ('../../../library/classes/Prescription.class.php');
10 $practice_address = '';
16 $practice_license = '';
20 $patient_address = '';
28 "<div class='signature'>"
29 . " ______________________________________________<br/>"
31 $sigline['embossed'] =
32 "<div class='signature'>"
33 . " _____________________________________________________<br/>"
34 # . "Signature - Valid for three days and in Broward County only."
39 . "<img src='./sig.jpg'>"
41 $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']);
42 if ($result = mysql_fetch_array($query, MYSQL_ASSOC
)) {
43 $patient_name = $result['fname'] . ' ' . $result['lname'];
44 $patient_address = $result['street'];
45 $patient_city = $result['city'];
46 $patient_state = $result['state'];
47 $patient_zip = $result['postal_code'];
48 $patient_phone = $result['phone_home'];
49 $patient_dob = $result['DOB'];
51 //update user information if selected from form
52 if ($_POST['update']) { // OPTION update practice inf
53 $query = "update users set " .
54 "fname = '" . $_POST['practice_fname'] . "', " .
55 "lname = '" . $_POST['practice_lname'] . "', " .
56 "title = '" . $_POST['practice_title'] . "', " .
57 "street = '" . $_POST['practice_address'] . "', " .
58 "city = '" . $_POST['practice_city'] . "', " .
59 "state = '" . $_POST['practice_state'] . "', " .
60 "zip = '" . $_POST['practice_zip'] . "', " .
61 "phone = '" . $_POST['practice_phone'] . "', " .
62 "fax = '" . $_POST['practice_fax'] . "', " .
63 "federaldrugid = '" . $_POST['practice_dea'] . "' " .
64 "where id =" . $_SESSION['authUserID'];
67 //get user information
68 $query = sqlStatement("select * from users where id =" . $_SESSION['authUserID']);
69 if ($result = mysql_fetch_array($query, MYSQL_ASSOC
)) {
70 $physician_name = $result['fname'] . ' ' . $result['lname'] . ', ' . $result['title'];
71 $practice_fname = $result['fname'];
72 $practice_lname = $result['lname'];
73 $practice_title = $result['title'];
74 $practice_address = $result['street'];
75 $practice_city = $result['city'];
76 $practice_state = $result['state'];
77 $practice_zip = $result['zip'];
78 $practice_phone = $result['phone'];
79 $practice_fax = $result['fax'];
80 $practice_dea = $result['federaldrugid'];
82 if ($_POST['print']) {
83 $camos_content = array();
84 foreach ($_POST as $key => $val) {
85 if (substr($key,0,3) == 'ch_') {
86 $query = sqlStatement("select content from form_CAMOS where id =" .
88 if ($result = mysql_fetch_array($query, MYSQL_ASSOC
)) {
89 if (!$_GET['letterhead']) { //do this change to formatting only for web output (rx output)
90 $content = preg_replace('|\n|','<br/>', $result['content']);
91 $content = preg_replace('|<br/><br/>|','<br/>', $content);
93 $content = $result['content'];
95 array_push($camos_content,$content);
98 if (substr($key,0,5) == 'chrx_') {
99 $rx = new Prescription(substr($key,5));
100 //$content = $rx->drug.' '.$rx->form.' '.$rx->dosage;
104 . $rx->unit_array
[$rx->unit
] . '<br/>'
106 . $rx->form_array
[$rx->form
]. '<br/>'
108 . $rx->form_array
[$rx->form
]. ' '
109 . $rx->route_array
[$rx->route
] . ' '
110 . $rx->interval_array
[$rx->interval
] . '<br/>'
111 . 'refills:' . $rx->refills
. '';
112 // . $rx->substitute_array[$rx->substitute]. ''
113 // . $rx->per_refill . '';
114 array_push($camos_content,$content);
117 if (!$_GET['letterhead']) { //OPTION print a prescription with css formatting
121 <?
html_header_show();?
>
123 Four Pane Prescription Printer
125 <link rel
="stylesheet" type
="text/css" href
="./rx.css" />
127 <body onload
='init()'>
128 <img src
='./hline.jpg' id
='hline'>
129 <img src
='./vline.jpg' id
='vline'>
131 if ($camos_content[0]) { //decide if we are printing this rx
133 <div id
='rx1' class='rx' >
134 <div
class='topheader'>
136 print $physician_name . "<br/>\n";
137 print $practice_address . "<br/>\n";
138 print $practice_city . ", ";
139 print $practice_state . " ";
140 print $practice_zip . "<br/>\n";
141 print 'voice: ' . $practice_phone . ' / fax: ' . $practice_fax . "<br/>\n";
142 print 'DEA: ' . $practice_dea;
146 <div
class='bottomheader'>
148 print "<span class='mytagname'> Name:</span>\n";
149 print "<span class='mydata'> $patient_name </span>\n";
150 print "<span class='mytagname'> Address: </span>\n";
151 print "<span class='mydata'> $patient_address, $patient_city, " .
152 "$patient_state $patient_zip </span><br/>\n";
153 print "<span class='mytagname'>Phone:</span>\n";
154 print "<span class='mydata'>$patient_phone</span>\n";
155 print "<span class='mytagname'>DOB:</span>\n";
156 print "<span class='mydata'> $patient_dob </span>\n";
157 print "<span class='mytagname'>Date:</span>\n";
158 print "<span class='mydata'>" . date("F d, Y") . "</span><br/><br/>\n";
159 print "<div class='symbol'>Rx</div><br/>\n";
162 <div
class='content'>
164 print $camos_content[0];
167 <?
print $sigline[$_GET[sigline
]] ?
>
168 </div
> <!-- end of rx block
-->
170 } // end of deciding if we are printing the above rx block
172 print "<img src='./xout.jpg' id='rx1'>\n";
176 if ($camos_content[1]) { //decide if we are printing this rx
178 <div id
='rx2' class='rx' >
179 <div
class='topheader'>
181 print $physician_name . "<br/>\n";
182 print $practice_address . "<br/>\n";
183 print $practice_city . ", ";
184 print $practice_state . " ";
185 print $practice_zip . "<br/>\n";
186 //print $practice_phone . "<br/>\n";
187 print 'voice: ' . $practice_phone . ' / fax: ' . $practice_fax . "<br/>\n";
188 print 'DEA: ' . $practice_dea;
192 <div
class='bottomheader'>
194 print "<span class='mytagname'> Name:</span>\n";
195 print "<span class='mydata'> $patient_name </span>\n";
196 print "<span class='mytagname'> Address: </span>\n";
197 print "<span class='mydata'> $patient_address, $patient_city, " .
198 "$patient_state $patient_zip </span><br/>\n";
199 print "<span class='mytagname'>Phone:</span>\n";
200 print "<span class='mydata'>$patient_phone</span>\n";
201 print "<span class='mytagname'>DOB:</span>\n";
202 print "<span class='mydata'> $patient_dob </span>\n";
203 print "<span class='mytagname'>Date:</span>\n";
204 print "<span class='mydata'>" . date("F d, Y") . "</span><br/><br/>\n";
205 print "<div class='symbol'>Rx</div><br/>\n";
208 <div
class='content'>
210 print $camos_content[1];
213 <?
print $sigline[$_GET[sigline
]] ?
>
214 </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";
222 if ($camos_content[2]) { //decide if we are printing this rx
224 <div id
='rx3' class='rx' >
225 <div
class='topheader'>
227 print $physician_name . "<br/>\n";
228 print $practice_address . "<br/>\n";
229 print $practice_city . ", ";
230 print $practice_state . " ";
231 print $practice_zip . "<br/>\n";
232 //print $practice_phone . "<br/>\n";
233 print 'voice: ' . $practice_phone . ' / fax: ' . $practice_fax . "<br/>\n";
234 print 'DEA: ' . $practice_dea;
238 <div
class='bottomheader'>
240 print "<span class='mytagname'> Name:</span>\n";
241 print "<span class='mydata'> $patient_name </span>\n";
242 print "<span class='mytagname'> Address: </span>\n";
243 print "<span class='mydata'> $patient_address, $patient_city, " .
244 "$patient_state $patient_zip </span><br/>\n";
245 print "<span class='mytagname'>Phone:</span>\n";
246 print "<span class='mydata'>$patient_phone</span>\n";
247 print "<span class='mytagname'>DOB:</span>\n";
248 print "<span class='mydata'> $patient_dob </span>\n";
249 print "<span class='mytagname'>Date:</span>\n";
250 print "<span class='mydata'>" . date("F d, Y") . "</span><br/><br/>\n";
251 print "<div class='symbol'>Rx</div><br/>\n";
254 <div
class='content'>
256 print $camos_content[2];
259 <?
print $sigline[$_GET[sigline
]] ?
>
260 </div
> <!-- end of rx block
-->
262 } // end of deciding if we are printing the above rx block
264 print "<img src='./xout.jpg' id='rx3'>\n";
268 if ($camos_content[3]) { //decide if we are printing this rx
270 <div id
='rx4' class='rx' >
271 <div
class='topheader'>
273 print $physician_name . "<br/>\n";
274 print $practice_address . "<br/>\n";
275 print $practice_city . ", ";
276 print $practice_state . " ";
277 print $practice_zip . "<br/>\n";
278 //print $practice_phone . "<br/>\n";
279 print 'voice: ' . $practice_phone . ' / fax: ' . $practice_fax . "<br/>\n";
280 print 'DEA: ' . $practice_dea;
284 <div
class='bottomheader'>
286 print "<span class='mytagname'> Name:</span>\n";
287 print "<span class='mydata'> $patient_name </span>\n";
288 print "<span class='mytagname'> Address: </span>\n";
289 print "<span class='mydata'> $patient_address, $patient_city, " .
290 "$patient_state $patient_zip </span><br/>\n";
291 print "<span class='mytagname'>Phone:</span>\n";
292 print "<span class='mydata'>$patient_phone</span>\n";
293 print "<span class='mytagname'>DOB:</span>\n";
294 print "<span class='mydata'> $patient_dob </span>\n";
295 print "<span class='mytagname'>Date:</span>\n";
296 print "<span class='mydata'>" . date("F d, Y") . "</span><br/><br/>\n";
297 print "<div class='symbol'>Rx</div><br/>\n";
300 <div
class='content'>
302 print $camos_content[3];
305 <?
print $sigline[$_GET[sigline
]] ?
>
306 </div
> <!-- end of rx block
-->
308 } // end of deciding if we are printing the above rx block
310 print "<img src='./xout.jpg' id='rx4'>\n";
316 }//end of printing to rx not letterhead
317 elseif ($_GET['letterhead']) { //OPTION print to pdf letterhead
318 $content = preg_replace('/PATIENTNAME/i',$patient_name,$camos_content[0]);
319 include_once('../../../library/classes/class.ezpdf.php');
320 $pdf =& new Cezpdf();
321 $pdf->selectFont('../../../library/fonts/Times-Bold');
322 $pdf->ezSetCmMargins(3,1,1,1);
323 $pdf->ezText($physician_name,12);
324 $pdf->ezText($practice_address,12);
325 $pdf->ezText($practice_city.', '.$practice_state.' '.$practice_zip,12);
326 $pdf->ezText($practice_phone . ' (voice)',12);
327 $pdf->ezText($practice_phone . ' (fax)',12);
329 $pdf->ezText(date("l, F jS, Y"),12);
331 $pdf->selectFont('../../../library/fonts/Helvetica');
332 $pdf->ezText($content,10);
333 $pdf->selectFont('../../../library/fonts/Times-Bold');
336 if ($_GET['signer'] == 'patient') {
337 $pdf->ezText("__________________________________________________________________________________",12);
338 $pdf->ezText("Print name, sign and date.",12);
340 elseif ($_GET['signer'] == 'doctor') {
341 $pdf->ezText('Sincerely,',12);
344 $pdf->ezText($physician_name,12);
349 else { //OPTION selection of what to print
353 <?
html_header_show();?
>
355 Four Pane Prescription Printer
357 <script type
="text/javascript">
358 //below init function just to demonstrate how to do it.
359 //now need to create 'cycle' function triggered by button to go by fours
360 //through selected types of subcategories.
361 //this is to be very very cool.
364 var f
= document
.forms
[0];
365 var x
= f
.elements
.length
;
368 if (f
.elements
[i
].type
== 'checkbox') {
369 f
.elements
[i
].checked
= true;
373 function uncheckall(){
374 var f
= document
.forms
[0];
375 var x
= f
.elements
.length
;
378 if (f
.elements
[i
].type
== 'checkbox') {
379 f
.elements
[i
].checked
= false;
384 var log
= document
.getElementById('log');
385 var cboxes
= document
.getElementById('checkboxes');
386 var cb
= cboxes
.getElementsByTagName('div');
387 if (cycle_engine(cb
,0) == 0) {cycle_engine(cb
,1);}
389 function cycle_engine(cb
,seed
) {
390 //seed determines if we should turn on up to first 4
391 var count_turnon
= 0;
392 var count_turnoff
= 0;
393 for (var i
=0;i
<cb
.length
;i++
) {
394 cbc
= cb
[i
].childNodes
;
395 if (cbc
[2].innerHTML
== 'prescriptions') {
396 if (cbc
[1].checked
== true) {
397 cbc
[1].checked
= false;
400 if ((count_turnoff
> 0 || seed
== 1) && count_turnon
< 4) {
401 cbc
[1].checked
= true;
407 return count_turnoff
;
411 <link rel
="stylesheet" type
="text/css" href
="./rx.css" />
413 <h1
>Select CAMOS Entries
for printing
</h1
>
414 <form method
=POST name
='pick_items' target
=_new
>
415 <input type
=button name
=cyclerx value
='cycle' onClick
='cycle()'><br
/>
416 <input type
='button' value
='check all' onClick
='checkall()'>
417 <input type
='button' value
='uncheck all' onClick
='uncheckall()'>
418 <input type
=submit name
=print value
=print>
420 $query = sqlStatement("select x.id as id, x.category, x.subcategory, x.item from " .
421 "form_CAMOS as x join forms as y on (x.id = y.form_id) " .
422 "where y.encounter = " . $_SESSION['encounter'] .
423 " and y.pid = " . $_SESSION['pid'] .
424 " and y.form_name like 'CAMOS%'" .
425 " and x.activity = 1");
427 echo "<div id='checkboxes'>\n";
429 while ($result = mysql_fetch_array($query, MYSQL_ASSOC
)) {
431 if ($result['category'] == 'prescriptions' && $count < 4) {
433 $checked = 'checked';
436 echo "<input type=checkbox name='ch_" . $result['id'] . "' $checked><span>" .
437 $result['category'] . '</span>:' . $result['subcategory'] . ':' . $result['item'] . "<br/>\n";
441 echo "<div id='log'>\n";//temp for debugging
443 //create Prescription object for the purpose of drawing data from the Prescription
444 //table for those who wish to do so
445 $rxarray = Prescription
::prescriptions_factory($_SESSION['pid']);
446 //now give a choice of drugs from the Prescription table
447 foreach($rxarray as $val) {
448 echo "<input type=checkbox name='chrx_" . $val->id
. "'>" .
449 $val->drug
. ':' . $val->start_date
. "<br/>\n";
452 <input type
=submit name
=print value
=print>
454 <h1
>Update User Information
</h1
>
455 <form method
=POST name
='pick_items'>
458 <td
> First Name
: </td
>
459 <td
> <input type
=text name
=practice_fname value
='<? echo $practice_fname; ?>'> </td
>
462 <td
> Last Name
: </td
>
463 <td
> <input type
=text name
=practice_lname value
='<? echo $practice_lname; ?>'> </td
>
467 <td
> <input type
=text name
=practice_title value
='<? echo $practice_title; ?>'> </td
>
470 <td
> Street Address
: </td
>
471 <td
> <input type
=text name
=practice_address value
='<? echo $practice_address; ?>'> </td
>
475 <td
> <input type
=text name
=practice_city value
='<? echo $practice_city; ?>'> </td
>
479 <td
> <input type
=text name
=practice_state value
='<? echo $practice_state; ?>'> </td
>
483 <td
> <input type
=text name
=practice_zip value
='<? echo $practice_zip; ?>'> </td
>
487 <td
> <input type
=text name
=practice_phone value
='<? echo $practice_phone; ?>'> </td
>
491 <td
> <input type
=text name
=practice_fax value
='<? echo $practice_fax; ?>'> </td
>
495 <td
> <input type
=text name
=practice_dea value
='<? echo $practice_dea; ?>'> </td
>
498 <input type
=submit name
=update value
=update
>
501 } //end of else statement