2 include_once('../../globals.php');
3 include_once('../../../library/classes/Prescription.class.php');
9 $practice_address = '';
15 $practice_license = '';
19 $patient_address = '';
27 "<div class='signature'>"
28 . " ______________________________________________<br/>"
30 $sigline['embossed'] =
31 "<div class='signature'>"
32 . " _____________________________________________________<br/>"
33 # . "Signature - Valid for three days and in Broward County only."
38 . "<img src='./sig.jpg'>"
40 $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']);
41 if ($result = sqlFetchArray($query)) {
42 $patient_name = $result['fname'] . ' ' . $result['lname'];
43 $patient_address = $result['street'];
44 $patient_city = $result['city'];
45 $patient_state = $result['state'];
46 $patient_zip = $result['postal_code'];
47 $patient_phone = $result['phone_home'];
48 $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 = '" . formData('practice_fname') . "', " .
55 "lname = '" . formData('practice_lname') . "', " .
56 "title = '" . formData('practice_title') . "', " .
57 "street = '" . formData('practice_address') . "', " .
58 "city = '" . formData('practice_city') . "', " .
59 "state = '" . formData('practice_state') . "', " .
60 "zip = '" . formData('practice_zip') . "', " .
61 "phone = '" . formData('practice_phone') . "', " .
62 "fax = '" . formData('practice_fax') . "', " .
63 "federaldrugid = '" . formData('practice_dea') . "' " .
64 "where id =" . $_SESSION['authUserID'];
68 //get user information
69 $query = sqlStatement("select * from users where id =" . $_SESSION['authUserID']);
70 if ($result = sqlFetchArray($query)) {
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'];
84 if ($_POST['print_pdf'] ||
$_POST['print_html']) {
85 $camos_content = array();
86 foreach ($_POST as $key => $val) {
87 if (substr($key, 0, 3) == 'ch_') {
88 $query = sqlStatement("select content from ".mitigateSqlTableUpperCase("form_CAMOS")." where id =" .
90 if ($result = sqlFetchArray($query)) {
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'];
98 array_push($camos_content, $content);
102 if (substr($key, 0, 5) == 'chrx_') {
103 $rx = new Prescription(substr($key, 5));
104 //$content = $rx->drug.' '.$rx->form.' '.$rx->dosage;
106 . text($rx->drug
) . ' '
107 . text($rx->size
) . ''
108 . text($rx->unit_array
[$rx->unit
]) . '<br/>'
109 . text($rx->quantity
). ' '
110 . text($rx->form_array
[$rx->form
]). '<br/>'
111 . text($rx->dosage
) . ' '
112 . text($rx->form_array
[$rx->form
]). ' '
113 . text($rx->route_array
[$rx->route
]) . ' '
114 . text($rx->interval_array
[$rx->interval
]) . '<br/>'
115 . text($rx->note
) . '<br/>'
116 . 'refills:' . $rx->refills
. '';
117 // . $rx->substitute_array[$rx->substitute]. ''
118 // . $rx->per_refill . '';
119 array_push($camos_content, $content);
123 if (!$_GET['letterhead']) { //OPTION print a prescription with css formatting
127 <?php
html_header_show();?
>
129 <?php
xl('CAMOS', 'e'); ?
>
131 <link rel
="stylesheet" type
="text/css" href
="./rx.css" />
133 <body onload
='init()'>
134 <img src
='./hline.jpg' id
='hline'>
135 <img src
='./vline.jpg' id
='vline'>
137 if ($camos_content[0]) { //decide if we are printing this rx
140 function topHeaderRx()
142 global $physician_name,$practice_address,$practice_city,$practice_state,$practice_zip,$practice_phone,$practice_fax,$practice_dea;
143 print $physician_name . "<br/>\n";
144 print $practice_address . "<br/>\n";
145 print $practice_city . ", ";
146 print $practice_state . " ";
147 print $practice_zip . "<br/>\n";
148 print xl('Voice') . ': ' . $practice_phone . ' / ' . xl('Fax') . ': ' . $practice_fax . "<br/>\n";
149 print xl('DEA') . ': ' . $practice_dea;
151 function bottomHeaderRx()
153 global $patient_name,$patient_address,$patient_city,$patient_state,$patient_zip,$patient_phone,$patient_dob;
154 print "<span class='mytagname'> " . xl('Name') . ":</span>\n";
155 print "<span class='mydata'> $patient_name </span>\n";
156 print "<span class='mytagname'> " . xl('Address') . ": </span>\n";
157 print "<span class='mydata'> $patient_address, $patient_city, " .
158 "$patient_state $patient_zip </span><br/>\n";
159 print "<span class='mytagname'>" . xl('Phone') . ":</span>\n";
160 print "<span class='mydata'>$patient_phone</span>\n";
161 print "<span class='mytagname'>" . xl('DOB') . ":</span>\n";
162 print "<span class='mydata'> $patient_dob </span>\n";
163 print "<span class='mytagname'>" . xl('Date') . ":</span>\n";
164 print "<span class='mydata'>" . date("F d, Y") . "</span><br/><br/>\n";
165 print "<div class='symbol'>" . xl('Rx') . "</div><br/>\n";
168 <div id
='rx1' class='rx' >
169 <div
class='topheader'>
175 <div
class='bottomheader'>
180 <div
class='content'>
182 print $camos_content[0];
185 <?php
print $sigline[$_GET[sigline
]] ?
>
186 </div
> <!-- end of rx block
-->
188 } // end of deciding if we are printing the above rx block
190 print "<img src='./xout.jpg' id='rx1'>\n";
195 if ($camos_content[1]) { //decide if we are printing this rx
197 <div id
='rx2' class='rx' >
198 <div
class='topheader'>
205 <div
class='bottomheader'>
211 <div
class='content'>
214 print $camos_content[1];
217 <?php
print $sigline[$_GET[sigline
]] ?
>
218 </div
> <!-- end of rx block
-->
220 } // end of deciding if we are printing the above rx block
222 print "<img src='./xout.jpg' id='rx2'>\n";
227 if ($camos_content[2]) { //decide if we are printing this rx
229 <div id
='rx3' class='rx' >
230 <div
class='topheader'>
237 <div
class='bottomheader'>
243 <div
class='content'>
246 print $camos_content[2];
249 <?php
print $sigline[$_GET[sigline
]] ?
>
250 </div
> <!-- end of rx block
-->
252 } // end of deciding if we are printing the above rx block
254 print "<img src='./xout.jpg' id='rx3'>\n";
259 if ($camos_content[3]) { //decide if we are printing this rx
261 <div id
='rx4' class='rx' >
262 <div
class='topheader'>
269 <div
class='bottomheader'>
275 <div
class='content'>
278 print $camos_content[3];
281 <?php
print $sigline[$_GET[sigline
]] ?
>
282 </div
> <!-- end of rx block
-->
284 } // end of deciding if we are printing the above rx block
286 print "<img src='./xout.jpg' id='rx4'>\n";
292 } //end of printing to rx not letterhead
293 elseif ($_GET['letterhead']) { //OPTION print to letterhead
294 $content = preg_replace('/PATIENTNAME/i', $patient_name, $camos_content[0]);
295 if ($_POST['print_html']) { //print letterhead to html
301 font
-family
: sans
-serif
;
321 <title
><?php
xl('Letter', 'e'); ?
></title
>
324 <div
class='paddingdiv'>
327 print "<div style='font-weight:bold;'>";
328 print $physician_name . "<br/>\n";
329 print $practice_address . "<br/>\n";
330 print $practice_city.', '.$practice_state.' '.$practice_zip . "<br/>\n";
331 print $practice_phone . ' (' . xl('Voice') . ')' . "<br/>\n";
332 print $practice_phone . ' ('. xl('Fax') . ')' . "<br/>\n";
334 print date("l, F jS, Y") . "<br/>\n";
338 print "<div style='font-size:90%;'>";
342 print "<div style='font-weight:bold;'>";
345 if ($_GET['signer'] == 'patient') {
346 print "__________________________________________________________________________________" . "<br/>\n";
347 print xl("Print name, sign and date.") . "<br/>\n";
348 } elseif ($_GET['signer'] == 'doctor') {
349 print xl('Sincerely,') . "<br/>\n";
352 print $physician_name . "<br/>\n";
357 <script language
='JavaScript'>
358 var win
= top
.printLogPrint ? top
: opener
.top
;
359 win
.printLogPrint(window
);
366 } else { //print letterhead to pdf
368 $pdf->selectFont('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);
375 $pdf->ezText('', 12);
376 $pdf->ezText(date("l, F jS, Y"), 12);
377 $pdf->ezText('', 12);
378 $pdf->selectFont('Helvetica');
379 $pdf->ezText($content, 10);
380 $pdf->selectFont('Times-Bold');
381 $pdf->ezText('', 12);
382 $pdf->ezText('', 12);
383 if ($_GET['signer'] == 'patient') {
384 $pdf->ezText("__________________________________________________________________________________", 12);
385 $pdf->ezText(xl("Print name, sign and date."), 12);
386 } elseif ($_GET['signer'] == 'doctor') {
387 $pdf->ezText(xl('Sincerely,'), 12);
388 $pdf->ezText('', 12);
389 $pdf->ezText('', 12);
390 $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");
482 $query = sqlStatement("select x.id as id, x.category, x.subcategory, x.item from " .
483 mitigateSqlTableUpperCase("form_CAMOS")." as x join forms as y on (x.id = y.form_id) " .
484 "where y.encounter = " . $_SESSION['encounter'] .
485 " and y.pid = " . $_SESSION['pid'] .
486 " and y.form_name like 'CAMOS%'" .
487 " and x.activity = 1");
491 echo "<div id='checkboxes'>\n";
493 while ($result = sqlFetchArray($query)) {
495 if ($result['category'] == 'prescriptions' && $count < 4) {
497 $checked = 'checked';
501 echo "<input type=checkbox name='ch_" . $result['id'] . "' $checked><span>" .
502 $result['category'] . '</span>:' . $result['subcategory'] . ':' . $result['item'] . "<br/>\n";
507 echo "<div id='log'>\n";//temp for debugging
509 //create Prescription object for the purpose of drawing data from the Prescription
510 //table for those who wish to do so
511 $rxarray = Prescription
::prescriptions_factory($_SESSION['pid']);
512 //now give a choice of drugs from the Prescription table
513 foreach ($rxarray as $val) {
514 echo "<input type=checkbox name='chrx_" . $val->id
. "'>" .
515 $val->drug
. ':' . $val->start_date
. "<br/>\n";
519 <?php
if ($_GET['letterhead']) { ?
>
520 <input type
=submit name
='print_pdf' value
='<?php xl('Print (PDF
)', 'e
'); ?>'>
523 <input type
=submit name
='print_html' value
='<?php xl('Print (HTML
)', 'e
'); ?>'>
525 <h1
><?php
xl('Update User Information', 'e'); ?
></h1
>
526 <form method
=POST name
='pick_items'>
529 <td
> <?php
xl('First Name', 'e'); ?
>: </td
>
530 <td
> <input type
=text name
=practice_fname value
='<?php echo htmlspecialchars($practice_fname, ENT_QUOTES); ?>'> </td
>
533 <td
> <?php
xl('Last Name', 'e'); ?
>: </td
>
534 <td
> <input type
=text name
=practice_lname value
='<?php echo htmlspecialchars($practice_lname, ENT_QUOTES); ?>'> </td
>
537 <td
> <?php
xl('Title', 'e'); ?
>: </td
>
538 <td
> <input type
=text name
=practice_title value
='<?php echo htmlspecialchars($practice_title, ENT_QUOTES); ?>'> </td
>
541 <td
> <?php
xl('Street Address', 'e'); ?
>: </td
>
542 <td
> <input type
=text name
=practice_address value
='<?php echo htmlspecialchars($practice_address, ENT_QUOTES); ?>'> </td
>
545 <td
> <?php
xl('City', 'e'); ?
>: </td
>
546 <td
> <input type
=text name
=practice_city value
='<?php echo htmlspecialchars($practice_city, ENT_QUOTES); ?>'> </td
>
549 <td
> <?php
xl('State', 'e'); ?
>: </td
>
550 <td
> <input type
=text name
=practice_state value
='<?php echo htmlspecialchars($practice_state, ENT_QUOTES); ?>'> </td
>
553 <td
> <?php
xl('Zip', 'e'); ?
>: </td
>
554 <td
> <input type
=text name
=practice_zip value
='<?php echo htmlspecialchars($practice_zip, ENT_QUOTES); ?>'> </td
>
557 <td
> <?php
xl('Phone', 'e'); ?
>: </td
>
558 <td
> <input type
=text name
=practice_phone value
='<?php echo htmlspecialchars($practice_phone, ENT_QUOTES); ?>'> </td
>
561 <td
> <?php
xl('Fax', 'e'); ?
>: </td
>
562 <td
> <input type
=text name
=practice_fax value
='<?php echo htmlspecialchars($practice_fax, ENT_QUOTES); ?>'> </td
>
565 <td
> <?php
xl('DEA', 'e'); ?
>: </td
>
566 <td
> <input type
=text name
=practice_dea value
='<?php echo htmlspecialchars($practice_dea, ENT_QUOTES); ?>'> </td
>
569 <input type
=submit name
=update value
='<?php xl('Update
', 'e
'); ?>'>
572 } //end of else statement