2 require_once('../../globals.php');
3 require_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 =?", array($_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 if (!verifyCsrfToken($_POST["csrf_token_form"])) {
57 $query = "update users set " .
58 "fname = '" . add_escape_custom($_POST['practice_fname']) . "', " .
59 "lname = '" . add_escape_custom($_POST['practice_lname']) . "', " .
60 "title = '" . add_escape_custom($_POST['practice_title']) . "', " .
61 "street = '" . add_escape_custom($_POST['practice_address']) . "', " .
62 "city = '" . add_escape_custom($_POST['practice_city']) . "', " .
63 "state = '" . add_escape_custom($_POST['practice_state']) . "', " .
64 "zip = '" . add_escape_custom($_POST['practice_zip']) . "', " .
65 "phone = '" . add_escape_custom($_POST['practice_phone']) . "', " .
66 "fax = '" . add_escape_custom($_POST['practice_fax']) . "', " .
67 "federaldrugid = '" . add_escape_custom($_POST['practice_dea']) . "' " .
68 "where id ='" . add_escape_custom($_SESSION['authUserID']) ."'";
72 //get user information
73 $query = sqlStatement("select * from users where id =?", array($_SESSION['authUserID']));
74 if ($result = sqlFetchArray($query)) {
75 $physician_name = $result['fname'] . ' ' . $result['lname'] . ', ' . $result['title'];
76 $practice_fname = $result['fname'];
77 $practice_lname = $result['lname'];
78 $practice_title = $result['title'];
79 $practice_address = $result['street'];
80 $practice_city = $result['city'];
81 $practice_state = $result['state'];
82 $practice_zip = $result['zip'];
83 $practice_phone = $result['phone'];
84 $practice_fax = $result['fax'];
85 $practice_dea = $result['federaldrugid'];
88 if ($_POST['print_pdf'] ||
$_POST['print_html']) {
89 if (!verifyCsrfToken($_POST["csrf_token_form"])) {
93 $camos_content = array();
94 foreach ($_POST as $key => $val) {
95 if (substr($key, 0, 3) == 'ch_') {
96 $query = sqlStatement("select content from ".mitigateSqlTableUpperCase("form_CAMOS")." where id =?", array(substr($key, 3)));
97 if ($result = sqlFetchArray($query)) {
98 if ($_POST['print_html']) { //do this change to formatting only for html output
99 $content = preg_replace('|\n|', '<br/>', text($result['content']));
100 $content = preg_replace('|<br/><br/>|', '<br/>', $content);
102 $content = $result['content'];
105 array_push($camos_content, $content);
109 if (substr($key, 0, 5) == 'chrx_') {
110 $rx = new Prescription(substr($key, 5));
111 //$content = $rx->drug.' '.$rx->form.' '.$rx->dosage;
113 . text($rx->drug
) . ' '
114 . text($rx->size
) . ''
115 . text($rx->unit_array
[$rx->unit
]) . '<br/>'
116 . text($rx->quantity
). ' '
117 . text($rx->form_array
[$rx->form
]). '<br/>'
118 . text($rx->dosage
) . ' '
119 . text($rx->form_array
[$rx->form
]). ' '
120 . text($rx->route_array
[$rx->route
]) . ' '
121 . text($rx->interval_array
[$rx->interval
]) . '<br/>'
122 . text($rx->note
) . '<br/>'
123 . 'refills:' . text($rx->refills
) . '';
124 // . $rx->substitute_array[$rx->substitute]. ''
125 // . $rx->per_refill . '';
126 array_push($camos_content, $content);
130 if (!$_GET['letterhead']) { //OPTION print a prescription with css formatting
134 <?php
html_header_show();?
>
136 <?php
echo xlt('CAMOS'); ?
>
138 <link rel
="stylesheet" type
="text/css" href
="./rx.css" />
140 <body onload
='init()'>
141 <img src
='./hline.jpg' id
='hline'>
142 <img src
='./vline.jpg' id
='vline'>
144 if ($camos_content[0]) { //decide if we are printing this rx
147 function topHeaderRx()
149 global $physician_name,$practice_address,$practice_city,$practice_state,$practice_zip,$practice_phone,$practice_fax,$practice_dea;
150 print text($physician_name) . "<br/>\n";
151 print text($practice_address) . "<br/>\n";
152 print text($practice_city) . ", ";
153 print text($practice_state) . " ";
154 print text($practice_zip) . "<br/>\n";
155 print xlt('Voice') . ': ' . text($practice_phone) . ' / ' . xlt('Fax') . ': ' . text($practice_fax) . "<br/>\n";
156 print xlt('DEA') . ': ' . text($practice_dea);
158 function bottomHeaderRx()
160 global $patient_name,$patient_address,$patient_city,$patient_state,$patient_zip,$patient_phone,$patient_dob;
161 print "<span class='mytagname'> " . xlt('Name') . ":</span>\n";
162 print "<span class='mydata'> " . text($patient_name) . " </span>\n";
163 print "<span class='mytagname'> " . xlt('Address') . ": </span>\n";
164 print "<span class='mydata'> " . text($patient_address) . ", " . text($patient_city) . ", " .
165 text($patient_state) . " " . text($patient_zip) . " </span><br/>\n";
166 print "<span class='mytagname'>" . xlt('Phone') . ":</span>\n";
167 print "<span class='mydata'>" . text($patient_phone) . "</span>\n";
168 print "<span class='mytagname'>" . xlt('DOB') . ":</span>\n";
169 print "<span class='mydata'> " . text($patient_dob) . " </span>\n";
170 print "<span class='mytagname'>" . xlt('Date') . ":</span>\n";
171 print "<span class='mydata'>" . date("F d, Y") . "</span><br/><br/>\n";
172 print "<div class='symbol'>" . xlt('Rx') . "</div><br/>\n";
175 <div id
='rx1' class='rx' >
176 <div
class='topheader'>
182 <div
class='bottomheader'>
187 <div
class='content'>
189 print $camos_content[0];
192 <?php
print $sigline[$_GET[sigline
]] ?
>
193 </div
> <!-- end of rx block
-->
195 } // end of deciding if we are printing the above rx block
197 print "<img src='./xout.jpg' id='rx1'>\n";
202 if ($camos_content[1]) { //decide if we are printing this rx
204 <div id
='rx2' class='rx' >
205 <div
class='topheader'>
212 <div
class='bottomheader'>
218 <div
class='content'>
221 print $camos_content[1];
224 <?php
print $sigline[$_GET[sigline
]] ?
>
225 </div
> <!-- end of rx block
-->
227 } // end of deciding if we are printing the above rx block
229 print "<img src='./xout.jpg' id='rx2'>\n";
234 if ($camos_content[2]) { //decide if we are printing this rx
236 <div id
='rx3' class='rx' >
237 <div
class='topheader'>
244 <div
class='bottomheader'>
250 <div
class='content'>
253 print $camos_content[2];
256 <?php
print $sigline[$_GET[sigline
]] ?
>
257 </div
> <!-- end of rx block
-->
259 } // end of deciding if we are printing the above rx block
261 print "<img src='./xout.jpg' id='rx3'>\n";
266 if ($camos_content[3]) { //decide if we are printing this rx
268 <div id
='rx4' class='rx' >
269 <div
class='topheader'>
276 <div
class='bottomheader'>
282 <div
class='content'>
285 print $camos_content[3];
288 <?php
print $sigline[$_GET[sigline
]] ?
>
289 </div
> <!-- end of rx block
-->
291 } // end of deciding if we are printing the above rx block
293 print "<img src='./xout.jpg' id='rx4'>\n";
299 } //end of printing to rx not letterhead
300 elseif ($_GET['letterhead']) { //OPTION print to letterhead
301 $content = preg_replace('/PATIENTNAME/i', $patient_name, $camos_content[0]);
302 if ($_POST['print_html']) { //print letterhead to html
308 font
-family
: sans
-serif
;
328 <title
><?php
echo xlt('Letter'); ?
></title
>
331 <div
class='paddingdiv'>
334 print "<div style='font-weight:bold;'>";
335 print text($physician_name) . "<br/>\n";
336 print text($practice_address) . "<br/>\n";
337 print text($practice_city).', '.text($practice_state).' '.text($practice_zip) . "<br/>\n";
338 print text($practice_phone) . ' (' . xlt('Voice') . ')' . "<br/>\n";
339 print text($practice_phone) . ' ('. xlt('Fax') . ')' . "<br/>\n";
341 print date("l, F jS, Y") . "<br/>\n";
345 print "<div style='font-size:90%;'>";
349 print "<div style='font-weight:bold;'>";
352 if ($_GET['signer'] == 'patient') {
353 print "__________________________________________________________________________________" . "<br/>\n";
354 print xlt("Print name, sign and date.") . "<br/>\n";
355 } elseif ($_GET['signer'] == 'doctor') {
356 print xlt('Sincerely,') . "<br/>\n";
359 print text($physician_name) . "<br/>\n";
364 <script language
='JavaScript'>
365 var win
= top
.printLogPrint ? top
: opener
.top
;
366 win
.printLogPrint(window
);
373 } else { //print letterhead to pdf
375 $pdf->selectFont('Times-Bold');
376 $pdf->ezSetCmMargins(3, 1, 1, 1);
377 $pdf->ezText($physician_name, 12);
378 $pdf->ezText($practice_address, 12);
379 $pdf->ezText($practice_city.', '.$practice_state.' '.$practice_zip, 12);
380 $pdf->ezText($practice_phone . ' (' . xl('Voice') . ')', 12);
381 $pdf->ezText($practice_phone . ' ('. xl('Fax') . ')', 12);
382 $pdf->ezText('', 12);
383 $pdf->ezText(date("l, F jS, Y"), 12);
384 $pdf->ezText('', 12);
385 $pdf->selectFont('Helvetica');
386 $pdf->ezText($content, 10);
387 $pdf->selectFont('Times-Bold');
388 $pdf->ezText('', 12);
389 $pdf->ezText('', 12);
390 if ($_GET['signer'] == 'patient') {
391 $pdf->ezText("__________________________________________________________________________________", 12);
392 $pdf->ezText(xl("Print name, sign and date."), 12);
393 } elseif ($_GET['signer'] == 'doctor') {
394 $pdf->ezText(xl('Sincerely,'), 12);
395 $pdf->ezText('', 12);
396 $pdf->ezText('', 12);
397 $pdf->ezText($physician_name, 12);
401 } //end of html vs pdf print
404 else { //OPTION selection of what to print
408 <?php
html_header_show();?
>
410 <?php
echo xlt('CAMOS'); ?
>
412 <script type
="text/javascript">
413 //below init function just to demonstrate how to do it.
414 //now need to create 'cycle' function triggered by button to go by fours
415 //through selected types of subcategories.
416 //this is to be very very cool.
419 var f
= document
.forms
[0];
420 var x
= f
.elements
.length
;
423 if (f
.elements
[i
].type
== 'checkbox') {
424 f
.elements
[i
].checked
= true;
428 function uncheckall(){
429 var f
= document
.forms
[0];
430 var x
= f
.elements
.length
;
433 if (f
.elements
[i
].type
== 'checkbox') {
434 f
.elements
[i
].checked
= false;
439 var log
= document
.getElementById('log');
440 var cboxes
= document
.getElementById('checkboxes');
441 var cb
= cboxes
.getElementsByTagName('div');
442 if (cycle_engine(cb
,0) == 0) {cycle_engine(cb
,1);}
444 function cycle_engine(cb
,seed
) {
445 //seed determines if we should turn on up to first 4
446 var count_turnon
= 0;
447 var count_turnoff
= 0;
448 for (var i
=0;i
<cb
.length
;i++
) {
449 cbc
= cb
[i
].childNodes
;
450 if (cbc
[2].innerHTML
== 'prescriptions') {
451 if (cbc
[1].checked
== true) {
452 cbc
[1].checked
= false;
455 if ((count_turnoff
> 0 || seed
== 1) && count_turnon
< 4) {
456 cbc
[1].checked
= true;
462 return count_turnoff
;
466 <link rel
="stylesheet" type
="text/css" href
="./rx.css" />
468 <h1
><?php
echo xlt('Select CAMOS Entries for Printing'); ?
></h1
>
469 <form method
=POST name
='pick_items' target
=_new
>
470 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(collectCsrfToken()); ?>" />
471 <input type
=button name
=cyclerx value
='<?php echo xla('Cycle
'); ?>' onClick
='cycle()'><br
/>
472 <input type
='button' value
='<?php echo xla('Select All
'); ?>' onClick
='checkall()'>
473 <input type
='button' value
='<?php echo xla('Unselect All
'); ?>' onClick
='uncheckall()'>
475 <?php
if ($_GET['letterhead']) { ?
>
476 <input type
=submit name
='print_pdf' value
='<?php echo xla('Print (PDF
)'); ?>'>
479 <input type
=submit name
='print_html' value
='<?php echo xla('Print (HTML
)'); ?>'>
482 //check if an encounter is set
483 if ($_SESSION['encounter'] == null) {
484 $query = sqlStatement("select x.id as id, x.category, x.subcategory, x.item from " .
485 mitigateSqlTableUpperCase("form_CAMOS")." as x join forms as y on (x.id = y.form_id) " .
487 " and y.form_name like 'CAMOS%'" .
488 " and x.activity = 1", array($_SESSION['pid']));
490 $query = sqlStatement("select x.id as id, x.category, x.subcategory, x.item from " .
491 mitigateSqlTableUpperCase("form_CAMOS")." as x join forms as y on (x.id = y.form_id) " .
492 "where y.encounter = ?" .
494 " and y.form_name like 'CAMOS%'" .
495 " and x.activity = 1", array($_SESSION['encounter'], $_SESSION['pid']));
499 echo "<div id='checkboxes'>\n";
501 while ($result = sqlFetchArray($query)) {
503 if ($result['category'] == 'prescriptions' && $count < 4) {
505 $checked = 'checked';
509 echo "<input type=checkbox name='ch_" . attr($result['id']) . "' $checked><span>" .
510 text($result['category']) . '</span>:' . text($result['subcategory']) . ':' . text($result['item']) . "<br/>\n";
515 echo "<div id='log'>\n";//temp for debugging
517 //create Prescription object for the purpose of drawing data from the Prescription
518 //table for those who wish to do so
519 $rxarray = Prescription
::prescriptions_factory($_SESSION['pid']);
520 //now give a choice of drugs from the Prescription table
521 foreach ($rxarray as $val) {
522 echo "<input type=checkbox name='chrx_" . attr($val->id
) . "'>" .
523 text($val->drug
) . ':' . text($val->start_date
) . "<br/>\n";
527 <?php
if ($_GET['letterhead']) { ?
>
528 <input type
=submit name
='print_pdf' value
='<?php echo xla('Print (PDF
)'); ?>'>
531 <input type
=submit name
='print_html' value
='<?php echo xla('Print (HTML
)'); ?>'>
533 <h1
><?php
echo xlt('Update User Information'); ?
></h1
>
534 <form method
=POST name
='pick_items'>
535 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(collectCsrfToken()); ?>" />
538 <td
> <?php
echo xlt('First Name'); ?
>: </td
>
539 <td
> <input type
=text name
=practice_fname value
='<?php echo attr($practice_fname); ?>'> </td
>
542 <td
> <?php
echo xlt('Last Name'); ?
>: </td
>
543 <td
> <input type
=text name
=practice_lname value
='<?php echo attr($practice_lname); ?>'> </td
>
546 <td
> <?php
echo xlt('Title'); ?
>: </td
>
547 <td
> <input type
=text name
=practice_title value
='<?php echo attr($practice_title); ?>'> </td
>
550 <td
> <?php
echo xlt('Street Address'); ?
>: </td
>
551 <td
> <input type
=text name
=practice_address value
='<?php echo attr($practice_address); ?>'> </td
>
554 <td
> <?php
echo xlt('City'); ?
>: </td
>
555 <td
> <input type
=text name
=practice_city value
='<?php echo attr($practice_city); ?>'> </td
>
558 <td
> <?php
echo xlt('State'); ?
>: </td
>
559 <td
> <input type
=text name
=practice_state value
='<?php echo attr($practice_state); ?>'> </td
>
562 <td
> <?php
echo xlt('Zip'); ?
>: </td
>
563 <td
> <input type
=text name
=practice_zip value
='<?php echo attr($practice_zip); ?>'> </td
>
566 <td
> <?php
echo xlt('Phone'); ?
>: </td
>
567 <td
> <input type
=text name
=practice_phone value
='<?php echo attr($practice_phone); ?>'> </td
>
570 <td
> <?php
echo xlt('Fax'); ?
>: </td
>
571 <td
> <input type
=text name
=practice_fax value
='<?php echo attr($practice_fax); ?>'> </td
>
574 <td
> <?php
echo xlt('DEA'); ?
>: </td
>
575 <td
> <input type
=text name
=practice_dea value
='<?php echo attr($practice_dea); ?>'> </td
>
578 <input type
=submit name
=update value
='<?php echo xla('Update
'); ?>'>
581 } //end of else statement