more organization of autoloaded files (#424)
[openemr.git] / interface / forms / eye_mag / SpectacleRx.php
blob5ca74d4668479744a0b56bf72b00f61bcb7c3f25
1 <?php
3 /**
4 * forms/eye_mag/SpectacleRx.php
6 * Functions for printing a glasses prescription
8 * Copyright (C) 2016 Raymond Magauran <magauran@MedFetch.com>
10 * LICENSE: This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Affero General Public License as
12 * published by the Free Software Foundation, either version 3 of the
13 * License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Affero General Public License for more details.
20 * You should have received a copy of the GNU Affero General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 * @package OpenEMR
24 * @author Ray Magauran <magauran@MedFetch.com>
25 * @link http://www.open-emr.org
28 $fake_register_globals=false;
29 $sanitize_all_escapes=true;
31 require_once("../../globals.php");
32 require_once("$srcdir/html2pdf/vendor/autoload.php");
33 require_once("$srcdir/api.inc");
34 require_once("$srcdir/acl.inc");
35 require_once("$srcdir/forms.inc");
36 require_once("$srcdir/lists.inc");
37 require_once("$srcdir/options.inc.php");
38 require_once("$srcdir/formatting.inc.php");
40 require_once($srcdir . "/../controllers/C_Document.class.php");
41 require_once($srcdir . "/documents.php");
42 require_once("$srcdir/patient.inc");
43 require_once("$srcdir/report.inc");
44 require_once("$srcdir/classes/Document.class.php");
45 require_once("$srcdir/classes/Note.class.php");
46 require_once("$srcdir/html2pdf/html2pdf.class.php");
49 $form_name = "Eye Form";
50 $form_folder = "eye_mag";
51 require_once("php/".$form_folder."_functions.php");
53 $query = "SELECT * FROM patient_data where pid=?";
54 $pat_data = sqlQuery($query,array($data['pid']));
56 $providerID = getProviderIdOfEncounter($encounter);
57 $providerNAME = getProviderName($providerID);
58 $query = "SELECT * FROM users where id = ?";
59 $prov_data = sqlQuery($query,array($providerID));
61 $query = "SELECT * FROM facility WHERE primary_business_entity='1'";
62 $practice_data = sqlQuery($query);
64 if (!$_REQUEST['pid']) $_REQUEST['pid'] = $_REQUEST['id'];
65 $query = "SELECT * FROM patient_data where pid=?";
66 $pat_data = sqlQuery($query,array($_REQUEST['pid']));
68 if ($_REQUEST['mode'] =="update") { //store any changed fields in dispense table
69 $table_name = "form_eye_mag_dispense";
70 $query = "show columns from ".$table_name;
71 $dispense_fields = sqlStatement($query);
72 $fields = array();
74 if (sqlNumRows($dispense_fields) > 0) {
75 while ($row = sqlFetchArray($dispense_fields)) {
76 //exclude critical columns/fields, define below as needed
77 if ($row['Field'] == 'id' ||
78 $row['Field'] == 'pid' ||
79 $row['Field'] == 'user' ||
80 $row['Field'] == 'groupname' ||
81 $row['Field'] == 'authorized' ||
82 $row['Field'] == 'activity'
83 ) continue;
84 if (isset($_POST[$row['Field']])) $fields[$row['Field']] = $_POST[$row['Field']];
86 $fields['RXTYPE']=$RXTYPE;
88 $insert_this_id = formUpdate($table_name, $fields, $_POST['id'], $_SESSION['userauthorized']);
90 exit;
91 } elseif ($_REQUEST['mode'] =="remove") {
92 $query ="DELETE FROM form_eye_mag_dispense where id=?";
93 sqlStatement($query,array($_REQUEST['delete_id']));
94 echo xlt('Prescription successfully removed.');
95 exit;
96 } elseif ($_REQUEST['RXTYPE']) { //store any changed fields
97 $query ="UPDATE form_eye_mag_dispense set RXTYPE=? where id=?";
98 sqlStatement($query,array($_REQUEST['RXTYPE'],$_REQUEST['id']));
99 exit;
103 formHeader("Rx Vision: ".$prov_data[facility]);
105 if ($_REQUEST['REFTYPE']) {
106 $REFTYPE = $_REQUEST['REFTYPE'];
107 if ($REFTYPE == "AR") $RXTYPE = "Bifocal";
108 if ($REFTYPE == "MR") $RXTYPE = "Bifocal";
109 if ($REFTYPE == "CTL") $RXTYPE = "Bifocal";
111 $id = $_REQUEST['id'];
112 $table_name = "form_eye_mag";
113 if (!$_REQUEST['encounter']) {
114 $encounter = $_SESSION['encounter'];
115 } else {
116 $encounter = $_REQUEST['encounter'];
118 $query = "SELECT * FROM form_eye_mag JOIN forms on forms.form_id = form_eye_mag.id
119 where form_eye_mag.pid =? and forms.encounter=? and forms.deleted !='1'";
121 $data = sqlQuery($query, array($id,$encounter) );
123 if ($REFTYPE =="W") {
124 //we have rx_number 1-5 to process...
125 $query = "select * from form_eye_mag_wearing where ENCOUNTER=? and FORM_ID=? and PID=? and RX_NUMBER=?";
126 $wear = sqlStatement($query,array($encounter,$_REQUEST['form_id'],$_REQUEST['pid'],$_REQUEST['rx_number']));
127 $wearing = sqlFetchArray($wear);
128 $ODSPH = $wearing['ODSPH'];
129 $ODAXIS = $wearing['ODAXIS'];
130 $ODCYL = $wearing['ODCYL'];
131 $OSSPH = $wearing['OSSPH'];
132 $OSCYL = $wearing['OSCYL'];
133 $OSAXIS = $wearing['OSAXIS'];
134 $COMMENTS = $wearing['COMMENTS'];
135 $ODMIDADD = $wearing['ODMIDADD'];
136 $ODADD2 = $wearing['ODADD'];
137 $OSMIDADD = $wearing['OSMIDADD'];
138 $OSADD2 = $wearing['OSADD'];
139 @extract($wearing);
140 if ($wearing['RX_TYPE']=='0') {
141 $Single="checked='checked'";
142 $RXTYPE="Single";
143 } elseif ($wearing['RX_TYPE']=='1'){
144 $Bifocal ="checked='checked'";
145 $RXTYPE="Bifocal";
146 } elseif ($wearing['RX_TYPE']=='2'){
147 $Trifocal ="checked='checked'";
148 $RXTYPE="Trifocal";
149 } elseif ($wearing['RX_TYPE']=='3'){
150 $Progressive ="checked='checked'";
151 $RXTYPE="Progressive";
153 //do LT and Lens materials
154 } elseif ($REFTYPE =="AR") {
155 $ODSPH = $data['ARODSPH'];
156 $ODAXIS = $data['ARODAXIS'];
157 $ODCYL = $data['ARODCYL'];
158 $ODPRISM = $data['ARODPRISM'];
159 $OSSPH = $data['AROSSPH'];
160 $OSCYL = $data['AROSCYL'];
161 $OSAXIS = $data['AROSAXIS'];
162 $OSPRISM = $data['AROSPRISM'];
163 $COMMENTS = $data['CRCOMMENTS'];
164 $ODADD2 = $data['ARODADD'];
165 $OSADD2 = $data['AROSADD'];
166 $Bifocal ="checked='checked'";
167 } elseif ($REFTYPE =="MR") {
168 $ODSPH = $data['MRODSPH'];
169 $ODAXIS = $data['MRODAXIS'];
170 $ODCYL = $data['MRODCYL'];
171 $ODPRISM = $data['MRODPRISM'];
172 $OSSPH = $data['MROSSPH'];
173 $OSCYL = $data['MROSCYL'];
174 $OSAXIS = $data['MROSAXIS'];
175 $OSPRISM = $data['MROSPRISM'];
176 $COMMENTS = $data['CR_COMMENTS'];
177 $ODADD2 = $data['MRODADD'];
178 $OSADD2 = $data['MROSADD'];
179 $Bifocal ="checked='checked'";
180 } elseif ($REFTYPE =="CR") {
181 $ODSPH = $data['CRODSPH'];
182 $ODAXIS = $data['CRODAXIS'];
183 $ODCYL = $data['CRODCYL'];
184 $ODPRISM = $data['CRODPRISM'];
185 $OSSPH = $data['CROSSPH'];
186 $OSCYL = $data['CROSCYL'];
187 $OSAXIS = $data['CROSAXIS'];
188 $OSPRISM = $data['CROSPRISM'];
189 $COMMENTS = $data['CRCOMMENTS'];
190 } elseif ($REFTYPE=="CTL") {
191 $ODSPH = $data['CTLODSPH'];
192 $ODAXIS = $data['CTLODAXIS'];
193 $ODCYL = $data['CTLODCYL'];
194 $ODPRISM = $data['CTLODPRISM'];
196 $OSSPH = $data['CTLOSSPH'];
197 $OSCYL = $data['CTLOSCYL'];
198 $OSAXIS = $data['CTLOSAXIS'];
199 $OSPRISM = $data['CTLOSPRISM'];
201 $ODBC = $data['CTLODBC'];
202 $ODDIAM = $data['CTLODDIAM'];
203 $ODADD = $data['CTLODADD'];
204 $ODVA = $data['CTLODVA'];
206 $OSBC = $data['CTLOSBC'];
207 $OSDIAM = $data['CTLOSDIAM'];
208 $OSADD = $data['CTLOSADD'];
209 $OSVA = $data['CTLOSVA'];
211 $COMMENTS = $data['CTL_COMMENTS'];
213 $CTLMANUFACTUREROD = getListItemTitle('CTLManufacturer', $data['CTLMANUFACTUREROD']);
214 $CTLMANUFACTUREROS = getListItemTitle('CTLManufacturer', $data['CTLMANUFACTUREROS']);
215 $CTLSUPPLIEROD = getListItemTitle('CTLManufacturer', $data['CTLSUPPLIEROD']);
216 $CTLSUPPLIEROS = getListItemTitle('CTLManufacturer', $data['CTLSUPPLIEROS']);
217 $CTLBRANDOD = getListItemTitle('CTLManufacturer', $data['CTLBRANDOD']);
218 $CTLBRANDOS = getListItemTitle('CTLManufacturer', $data['CTLBRANDOS']);
221 //Since we selected the Print Icon, we must be dispensing this - add to dispensed table now
222 $table_name = "form_eye_mag_dispense";
223 $query = "show columns from ".$table_name;
224 $dispense_fields = sqlStatement($query);
225 $fields = array();
227 if (sqlNumRows($dispense_fields) > 0) {
228 while ($row = sqlFetchArray($dispense_fields)) {
229 //exclude critical columns/fields, define below as needed
230 if ($row['Field'] == 'id' ||
231 $row['Field'] == 'pid' ||
232 $row['Field'] == 'user' ||
233 $row['Field'] == 'groupname' ||
234 $row['Field'] == 'authorized' ||
235 $row['Field'] == 'activity' ||
236 $row['Field'] == 'RXTYPE' ||
237 $row['Field'] == 'REFDATE'
239 continue;
240 if (isset(${$row['Field']})) $fields[$row['Field']] = ${$row['Field']};
242 $fields['RXTYPE']=$RXTYPE;
243 $fields['REFDATE'] = $data['date'];
245 $insert_this_id = formSubmit($table_name, $fields, $form_id, $_SESSION['userauthorized']);
248 if ($_REQUEST['dispensed']) {
250 $query = "SELECT * from form_eye_mag_dispense where pid =? ORDER BY date DESC";
251 $dispensed = sqlStatement($query,array($_REQUEST['pid']));
252 ?><html>
253 <title><?php echo xlt('Rx Dispensed History'); ?></title>
254 <head>
255 <script src="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-min-1-10-2/index.js"></script>
256 <script src="<?php echo $GLOBALS['assets_static_relative'] ?>/bootstrap-3-3-4/dist/js/bootstrap.min.js"></script>
257 <script src="<?php echo $GLOBALS['assets_static_relative'] ?>/qtip2-2-2-1/jquery.qtip.min.js"></script>
258 <script type="text/javascript" src="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js"></script>
260 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-ui-1-10-4/themes/ui-lightness/jquery-ui.min.css">
261 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/pure-0-5-0/pure-min.css">
262 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/bootstrap-3-3-4/dist/css/bootstrap.min.css">
263 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/qtip2-2-2-1/jquery.qtip.min.css" />
264 <link rel="stylesheet" href="<?php echo $GLOBALS['css_header']; ?>" type="text/css">
265 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/font-awesome-4-6-3/css/font-awesome.min.css">
266 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
267 <link rel="stylesheet" href="../../forms/<?php echo $form_folder; ?>/css/style.css" type="text/css">
269 <style>
270 .refraction {
271 top:1in;
272 float:left;
273 min-height:1.0in;
274 border: 1.00pt solid #000000;
275 padding: 5;
276 border-radius: 8px;
277 margin: 5 auto;
279 .refraction td {
280 text-align:center;
281 font-size:8pt;
282 padding:2;
283 text-align: text-middle;
284 text-decoration: none;
286 table {
287 font-size: 1.0em;
288 padding: 2px;
289 color: black;
290 vertical-align: text-top;
293 input[type=text] {
294 text-align: right;
295 width:50px;
296 background-color: white;
298 .refraction b{
299 text-decoration:bold;
301 .refraction td.right {
302 text-align: right;
303 text-decoration: none;
304 vertical-align: text-top;
306 .refraction td.left {
307 text-align: left;
308 vertical-align: top;
311 .right {
312 text-align:right;
313 vertical-align: text-top;
315 .left {
316 text-align:left;
317 vertical-align: top;
319 .title {
320 font-size: 0.9em;
321 font-weight:normal;
323 </style>
324 <script language="JavaScript">
325 <?php require_once("$srcdir/restoreSession.php"); ?>
327 function delete_me(delete_id){
328 top.restoreSession();
329 var url = "../../forms/eye_mag/SpectacleRx.php";
330 $.ajax({
331 type : 'POST',
332 url : url,
333 data : {
334 mode : 'remove',
335 delete_id : delete_id,
336 dispensed : '1'
337 } // our data object
338 }).done(function(o) {
339 $('#RXID_'+delete_id).hide();
340 alert(o);
344 </script>
345 </head>
346 <body>
347 <?php echo report_header($pid,"web"); ?>
348 <div style="margin:5;text-align:center;">
349 <table>
350 <tr>
351 <td colspan="2"><h4 class="underline"><?php echo xlt('Rx History'); ?></h4></td>
352 </tr>
353 <?php
354 if (sqlNumRows($dispensed) == 0) {
355 echo "<tr><td colspan='2' style='font-size:1.2em;text-align:middle;padding:25px;'>".xlt('There are no Glasses or Contact Lens Presciptions on file for this patient')."</td></tr>";
358 </table>
359 <?php
360 while ($row = sqlFetchArray($dispensed)) {
361 $i++;
362 $Single ='';$Bifocal='';$Trifocal='';$Progressive='';
363 if ($row['RXTYPE'] == "Single") $Single = "checked='checked'";
364 if ($row['RXTYPE'] == "Bifocal") $Bifocal = "checked='checked'";
365 if ($row['RXTYPE'] == "Trifocal") $Trifocal = "checked='checked'";
366 if ($row['RXTYPE'] == "Progressive") $Progressive = "checked='checked'";
368 $row['REFDATE'] = oeFormatShortDate($row['REFDATE']);
369 $row['date'] = oeFormatShortDate($row['REFDATE']);
371 <div id="RXID_<?php echo attr($row['id']); ?>" style="position:relative;width:640px;text-align:center;margin: 10 auto;">
372 <i class="pull-right fa fa-close" onclick="delete_me('<?php echo attr(addslashes($row['id'])); ?>');" title="<?php echo xla('Remove this Prescription from the list of RXs dispensed'); ?>"></i>
373 <table style="min-width:615px;">
374 <tr>
375 <td class="right bold" style="width:250px;"><b><?php echo xlt('RX Date'); ?>: </b></td>
376 <td>&nbsp;&nbsp;<?php echo text($row['date']); ?></td>
377 </tr>
378 <tr>
379 <td class="right bold"><b><?php echo xlt('Visit Date'); ?>: </b></td>
380 <td>&nbsp;&nbsp;<?php echo text($row['REFDATE']); ?></td>
381 </tr>
383 <tr>
384 <td class="right bold"><?php echo xlt('Refraction Method'); ?>: </td>
385 <td>&nbsp;&nbsp;<?php
386 if ($row['REFTYPE'] == "W") {
387 echo xlt('Duplicate Rx -- unchanged from current Rx{{The refraction did not change, New Rx=old Rx}}');
388 } else if ($row['REFTYPE'] == "CR") {
389 echo xlt('Cycloplegic (Wet) Refraction');
390 } else if ($row['REFTYPE'] == "MR") {
391 echo xlt('Manifest (Dry) Refraction');
392 } else if ($row['REFTYPE'] == "AR") {
393 echo xlt('Auto Refraction');
394 } else if ($row['REFTYPE'] == "CTL") {
395 echo xlt('Contact Lens');
396 } ?>
397 </td>
398 </tr>
399 <tr>
400 <td colspan="2"> <?php
401 if ($row['REFTYPE'] != "CTL") { ?>
402 <table id="SpectacleRx" name="SpectacleRx" class="refraction" style="top:0px;">
403 <tr style="font-style:bold;">
404 <td></td>
405 <td></td>
406 <td class="center"><?php echo xlt('Sph{{Sphere}}'); ?></td>
407 <td class="center"><?php echo xlt('Cyl{{Cylinder}}'); ?></td>
408 <td class="center"><?php echo xlt('Axis{{Axis of a glasses prescription}}'); ?></td>
409 <td rowspan="5" class="right bold underline" colspan="2" style="min-width:200px;font-weight:bold;">
410 <?php echo xlt('Rx Type'); ?><br /><br />
411 <?php echo xlt('Single'); ?>
412 <input type="radio" disabled <?php echo text($Single); ?>><br />
413 <?php echo xlt('Bifocal'); ?>
414 <input type="radio" disabled <?php echo text($Bifocal); ?>><br />
415 <?php echo xlt('Trifocal'); ?>
416 <input type="radio" disabled <?php echo text($Trifocal); ?>><br />
417 <?php echo xlt('Prog.{{Progressive lenses}}'); ?>
418 <input type="radio" disabled <?php echo text($Progressive); ?>><br />
419 </td>
420 </tr>
421 <tr>
422 <td rowspan="2" style="text-align:right;font-weight:bold;"><?php echo xlt('Distance'); ?></td>
423 <td><b><?php echo xlt('OD{{right eye}}'); ?></b></td>
424 <td><?php echo text($row['ODSPH']); ?></td>
425 <td><?php echo text($row['ODCYL']); ?></td>
426 <td><?php echo text($row['ODAXIS']); ?></td>
427 <td><?php echo text($row['ODPRISM']); ?></td>
428 </tr>
429 <tr>
430 <td><b><?php echo xlt('OS{{left eye}}'); ?></b></td>
431 <td><?php echo text($row['OSSPH']); ?></td>
432 <td><?php echo text($row['OSCYL']); ?></td>
433 <td><?php echo text($row['OSAXIS']); ?></td>
434 <td><?php echo text($row['OSPRISM']); ?></td>
435 </tr>
436 <tr class="NEAR">
437 <td rowspan=2 nowrap><span style="text-decoration:none;"><?php echo xlt('ADD'); ?>:<br /><?php echo xlt("Mid{{Middle segment in a trifocal glasses prescription}}"); ?>/<?php echo xlt("Near"); ?></span></td>
438 <td><b><?php echo xlt('OD{{right eye}}'); ?></b></td>
439 <td class="WMid"><?php echo text($row['ODMIDADD']); ?></td>
440 <td class="WAdd2"><?php echo text($row['ODADD2']); ?></td>
441 </tr>
442 <tr class="NEAR">
443 <td><b><?php echo xlt('OS{{left eye}}'); ?></b></td>
444 <td class="WMid"><?php echo text($row['OSMIDADD']); ?></td>
445 <td class="WAdd2"><?php echo text($row['OSADD2']); ?></td>
446 </tr>
447 <tr style="">
448 <td colspan="2" class="up" style="text-align:right;vertical-align:top;top:0px;font-weight:bold;"><?php echo xlt('Comments'); ?>:
449 </td>
450 <td colspan="4" class="up" style="text-align:left;vertical-align:middle;top:0px;">
451 <textarea style="width:100%;height:2.1em;" id="COMMENTS" disabled name="COMMENTS"><?php echo text($row['COMMENTS']); ?></textarea>
452 </td>
453 </tr>
454 </table>
455 <?php
456 } else { ?>
457 <center>
458 <table id="CTLRx" name="CTLRx" class="refraction">
459 <tr>
460 <td colspan="4" class="bold underline left"><?php echo xlt('Right Lens'); ?></u></td>
461 </tr>
462 <tr>
463 <td colspan="3" class="left"><?php echo text($row['CTLBRANDOD']); ?></td>
464 </tr>
465 <tr class="bold" style="text-decoration:underline;">
466 <td></td>
467 <td><?php echo xlt('Sph{{Sphere}}'); ?></td>
468 <td><?php echo xlt('Cyl{{Cylinder}}'); ?></td>
469 <td><?php echo xlt('Axis{{Axis of a glasses prescription}}'); ?></td>
470 <td><?php echo xlt('BC{{Base Curve}}'); ?></td>
471 <td><?php echo xlt('Diam{{Diameter}}'); ?></td>
472 <td><?php echo xlt('ADD'); ?></td>
473 <td><td>
474 <td><?php echo xlt('Supplier'); ?></td>
475 </tr>
476 <tr>
477 <td></td>
478 <td><?php echo text($row['ODSPH']); ?></td>
479 <td><?php echo text($row['ODCYL']); ?></td>
480 <td><?php echo text($row['ODAXIS']); ?></td>
481 <td><?php echo text($row['ODBC']); ?></td>
482 <td><?php echo text($row['ODDIAM']); ?></td>
483 <td><?php echo text($row['ODADD']); ?></td>
484 <td colspan="3" class="right"><?php echo text($row['CTLSUPPLIEROD']); ?></td>
485 </tr>
486 <tr>
487 <td colspan="4" class="bold underline left"><u><?php echo xlt('Left Lens'); ?></u>
488 </td>
489 </tr>
490 <tr>
491 <td colspan="3" class="left"><?php echo text($row['CTLBRANDOS']); ?></td>
492 </tr>
493 <tr class="bold" style="text-decoration:underline;">
494 <td></td>
495 <td><?php echo xlt('Sph{{Sphere}}'); ?></td>
496 <td><?php echo xlt('Cyl{{Cylinder}}'); ?></td>
497 <td><?php echo xlt('Axis{{Axis of a glasses prescription}}'); ?></td>
498 <td><?php echo xlt('BC{{Base Curve}}'); ?></td>
499 <td><?php echo xlt('Diam{{Diameter}}'); ?></td>
500 <td><?php echo xlt('ADD'); ?></td>
501 <td><td>
502 <td><?php echo xlt('Supplier'); ?></td>
503 </tr>
504 <tr>
505 <td></td>
506 <td><?php echo text($row['OSSPH']); ?></td>
507 <td><?php echo text($row['OSCYL']); ?></td>
508 <td><?php echo text($row['OSAXIS']); ?></td>
509 <td><?php echo text($row['OSBC']); ?></td>
510 <td><?php echo text($row['OSDIAM']); ?></td>
511 <td><?php echo text($row['OSADD']); ?></td>
512 <td colspan="3" class="right"><?php echo text($row['CTLSUPPLIEROS']); ?></td>
514 </tr>
515 </table>
516 </center>
517 <?php
518 } ?>
519 </td>
520 </tr>
521 </table>
522 <hr>
524 </div>
525 <?php
528 </div>
529 </body>
530 </html>
531 <?php
532 exit;
534 $filename = $pid."_".$encounter."_RX_".$REFTYPE.".pdf";
535 $pdf = new HTML2PDF ($GLOBALS['pdf_layout'],
536 $GLOBALS['pdf_size'],
537 $GLOBALS['pdf_language'],
538 true, // default unicode setting is true
539 'UTF-8', // default encoding setting is UTF-8
540 array($GLOBALS['pdf_left_margin'],$GLOBALS['pdf_top_margin'],$GLOBALS['pdf_right_margin'],$GLOBALS['pdf_bottom_margin']),
541 $_SESSION['language_direction'] == 'rtl' ? true : false
543 ob_start();
545 <html>
546 <head>
547 <script src="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-min-1-10-2/index.js"></script>
548 <script src="<?php echo $GLOBALS['assets_static_relative'] ?>/bootstrap-3-3-4/dist/js/bootstrap.min.js"></script>
549 <script src="<?php echo $GLOBALS['assets_static_relative'] ?>/qtip2-2-2-1/jquery.qtip.min.js"></script>
551 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-ui-1-10-4/themes/ui-lightness/jquery-ui.min.css">
552 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/pure-0-5-0/pure-min.css">
553 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/bootstrap-3-3-4/dist/css/bootstrap.min.css">
554 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/qtip2-2-2-1/jquery.qtip.min.css" />
555 <link rel="stylesheet" href="<?php echo $GLOBALS['css_header']; ?>" type="text/css">
556 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/font-awesome-4-6-3/css/font-awesome.min.css">
557 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
558 <link rel="stylesheet" href="../../forms/<?php echo $form_folder; ?>/css/style.css" type="text/css">
560 <style>
561 .title {
562 font-size:1em;
563 position:absolute;
564 right:10px;
565 top:30px;
566 font-size: 1em;
568 .refraction {
569 top:1in;
570 float:left;
571 min-height:1.0in;
572 border: 1.00pt solid #000000;
573 padding: 5;
574 box-shadow: 10px 10px 5px #888888;
575 border-radius: 8px;
576 margin: 5 auto 10 10;
577 width:5.0in;
579 .refraction td {
580 text-align:center;
581 font-size:8pt;
582 padding:5;
583 width:0.35in;
584 vertical-align: text-middle;
585 text-decoration: none;
587 table {
588 font-size: 1.0em;
589 padding: 2px;
590 color: black;
591 vertical-align: text-top;
594 input[type=text] {
595 text-align: center;
596 width:60px;
598 .refraction b{
599 text-decoration:bold;
601 .refraction td.right {
602 text-align: right;
603 text-decoration: none;
604 width:0.7in;
605 vertical-align: text-top;
607 .refraction td.left {
608 vertical-align: text-top;
609 text-align:left;
612 .right {
613 text-align:right;
614 vertical-align: text-top;
615 xwidth:10%;
617 .left {
618 vertical-align: text-top;
619 text-align:left;
621 .title {
622 font-size: 0.9em;
623 font-weight:normal;
625 .bold {
626 font-weight:600;
628 input {
629 width:60px;
631 input[type="radio"] {
632 width:15px;
634 </style>
635 <!-- jQuery library -->
637 <script language="JavaScript">
638 <?php require_once("$srcdir/restoreSession.php"); ?>
639 function pick_rxType(rxtype,id) {
640 var url = "../../forms/eye_mag/SpectacleRx.php";
641 var formData = {
642 'RXTYPE' : rxtype,
643 'id' : id
645 top.restoreSession();
646 $.ajax({
647 type : 'POST',
648 url : url,
649 data : formData
651 if (rxtype == 'Trifocal') {
652 $("[name$='MIDADD']").show();
653 $("[name$='ADD2']").show();
654 } else if (rxtype == 'Bifocal') {
655 $("[name$='MIDADD']").hide().val('');
656 $("[name$='ADD2']").show();
657 } else if (rxtype == 'Progressive') {
658 $("[name$='MIDADD']").hide().val('');
659 $("[name$='ADD2']").show();
660 } else if (rxtype =="Single") {
661 $("[name$='MIDADD']").hide().val('');
662 $("[name$='ADD2']").hide().val('');
665 function submit_form(){
666 var url = "../../forms/eye_mag/SpectacleRx.php?mode=update";
667 formData = $("form#Spectacle").serialize();
668 top.restoreSession();
669 $.ajax({
670 type : 'POST',
671 url : url,
672 data : formData
675 //add sph and cyl, flip cyl sign, rotate axis 90.
676 function reverse_cylinder() {
677 var Rsph = $('#ODSPH').val();
678 var Rcyl = $('#ODCYL').val();
679 var Raxis = $('#ODAXIS').val();
680 var Lsph = $('#OSSPH').val();
681 var Lcyl = $('#OSCYL').val();
682 var Laxis = $('#OSAXIS').val();
683 if (Rsph=='' && Rcyl =='' && Lsph=='' && lcyl =='') return;
684 if ((!Rcyl.match(/SPH/i)) && (Rcyl >'')) {
685 if (Rsph.match(/plano/i)) Rsph ='0';
686 Rsph = Number(Rsph);
687 Rcyl = Number(Rcyl);
688 Rnewsph = Rsph + Rcyl;
689 if (Rnewsph ==0) Rnewsph ="PLANO";
690 Rnewcyl = Rcyl * -1;
691 if (Rnewcyl > 0) Rnewcyl = "+"+Rnewcyl;
692 if (parseInt(Raxis) < 90) {
693 Rnewaxis = parseInt(Raxis) + 90;
694 } else {
695 Rnewaxis = parseInt(Raxis) - 90;
697 if (Rnewcyl=='0') Rnewcyl = "SPH";
698 if (Rnewsph =='0') {
699 Rnewsph ="PLANO";
700 if (Rnewcyl =="SPH") Rnewcyl = '';
702 $("#ODSPH").val(Rnewsph);
703 $("#ODCYL").val(Rnewcyl);
704 $("#ODAXIS").val(Rnewaxis);
705 $('#ODAXIS').trigger('blur');
706 $('#ODSPH').trigger('blur');
707 $('#ODCYL').trigger('blur');
709 if ((!Lcyl.match(/SPH/i)) && (Lcyl >'')) {
710 if (!Lsph.match(/\d/)) Lsph ='0';
711 Lsph = Number(Lsph);
712 Lcyl = Number(Lcyl);
713 Lnewsph = Lsph + Lcyl;
714 Lnewcyl = Lcyl * -1;
715 if (Lnewcyl > 0) Lnewcyl = "+"+ Lnewcyl;
716 if (parseInt(Laxis) < 90) {
717 Lnewaxis = parseInt(Laxis) + 90;
718 } else {
719 Lnewaxis = parseInt(Laxis) - 90;
722 if (Lnewcyl=='0') Lnewcyl = "SPH";
723 if (Lnewsph =='0') {
724 Lnewsph ="PLANO";
725 if (Lnewcyl =="SPH") Lnewcyl = '';
728 $("#OSSPH").val(Lnewsph);
729 $("#OSCYL").val(Lnewcyl);
730 $("#OSAXIS").val(Lnewaxis);
731 $('#OSAXIS').trigger('blur');
732 $('#OSSPH').trigger('blur');
733 $('#OSCYL').trigger('blur');
736 </script>
737 </head>
738 <body>
739 <?php echo report_header($pid,"web");
740 $visit= getEncounterDateByEncounter($encounter);
741 $visit_date = $visit['date'];
743 <br /><br />
744 <form method="post" action="<?php echo $rootdir;?>/forms/<?php echo text($form_folder); ?>/SpectacleRx.php?mode=update" id="Spectacle" class="eye_mag pure-form" name="Spectacle" style="text-align:center;">
745 <!-- start container for the main body of the form -->
746 <input type="hidden" name="REFDATE" id="REFDATE" value="<?php echo attr($data['date']); ?>">
747 <input type="hidden" name="RXTYPE" id="RXTYPE" value="<?php echo attr($RXTYPE); ?>">
748 <input type="hidden" name="pid" id="pid" value="<?php echo attr($pid); ?>">
749 <input type="hidden" name="id" id="id" value="<?php echo attr($insert_this_id); ?>">
750 <div style="margin:5;text-align:center;display:inline-block;">
752 <table style="min-width:615px;">
753 <tr>
754 <td>
755 <?php
757 if ($REFTYPE !="CTL") { ?>
758 <table id="SpectacleRx" name="SpectacleRx" class="refraction bordershadow" style="min-width:610px;top:0px;">
759 <tr style="font-weight:bold;text-align:center;">
760 <td><i name="reverse" id="reverse" class="fa fa-gamepad fa-2x"></i></td>
761 <td></td>
762 <td><?php echo xlt('Sph{{Sphere}}'); ?></td>
763 <td><?php echo xlt('Cyl{{Cylinder}}'); ?></td>
764 <td><?php echo xlt('Axis{{Axis of a glasses prescription}}'); ?></td>
765 <td rowspan="5" class="right" colspan="3" style="min-width:200px;font-weight:bold;">
766 <b style="font-weight:bold;text-decoration:underline;"><?php echo xlt('Rx Type'); ?></b><br /><br />
767 <b id="SingleVision_span" name="SingleVision_span"><?php echo xlt('Single'); ?>
768 <input type="radio" onclick="pick_rxType('Single','<?php echo attr(addslashes($insert_this_id)); ?>');" value="Single" id="RXTYPE" name="RXTYPE" class="input-helper--radio input-helper--radio" <?php echo attr($Single); ?>></b><br />
769 <b id="Bifocal_span" name="Bifocal_span"><?php echo xlt('Bifocal'); ?>
770 <input type="radio" onclick="pick_rxType('Bifocal','<?php echo attr(addslashes($insert_this_id)); ?>');" value="Bifocal" id="RXTYPE" name="RXTYPE" <?php echo attr($Bifocal); ?>></b><br />
771 <b id="Trifocal_span" name="Trifocal_span"><?php echo xlt('Trifocal'); ?>
772 <input type="radio" onclick="pick_rxType('Trifocal','<?php echo attr(addslashes($insert_this_id)); ?>');" value="Trifocal" id="RXTYPE" name="RXTYPE" <?php echo attr($Trifocal); ?>></b><br />
773 <b id="Progressive_span"><?php echo xlt('Prog.{{Progressive lenses}}'); ?>
774 <input type="radio" onclick="pick_rxType('Progressive','<?php echo attr(addslashes($insert_this_id)); ?>');" value="Progressive" id="RXTYPE" name="RXTYPE" <?php echo attr($Progressive); ?>></b><br />
775 </td>
776 </tr>
777 <tr class="center">
778 <td rowspan="2" style="text-align:right;font-weight:bold;"><?php echo xlt('Distance'); ?></td>
779 <td style="text-align:right;font-weight:bold;"><?php echo xlt('OD{{right eye}}'); ?></td>
780 <td><input type=text id="ODSPH" name="ODSPH" value="<?php echo attr($ODSPH); ?>"></td>
781 <td><input type=text id="ODCYL" name="ODCYL" value="<?php echo attr($ODCYL); ?>"></td>
782 <td><input type=text id="ODAXIS" name="ODAXIS" value="<?php echo attr($ODAXIS); ?>"></td>
783 </tr>
784 <tr class="center">
785 <td name="W_wide" style="text-align:right;font-weight:bold;"><?php echo xlt('OS{{left eye}}'); ?></td>
786 <td><input type=text id="OSSPH" name="OSSPH" value="<?php echo attr($OSSPH); ?>"></td>
787 <td><input type=text id="OSCYL" name="OSCYL" value="<?php echo attr($OSCYL); ?>"></td>
788 <td><input type=text id="OSAXIS" name="OSAXIS" value="<?php echo attr($OSAXIS); ?>"></td>
789 </tr>
790 <tr class="NEAR center">
791 <td rowspan=2 nowrap style="text-decoration:none;text-align:right;font-weight:bold;"><?php echo xlt('ADD'); ?>:<br /><?php echo xlt("Mid{{Middle segment in a trifocal glasses prescription}}"); ?>/<?php echo xlt("Near"); ?></td>
792 <td style="text-align:right;font-weight:bold;"><?php echo xlt('OD{{right eye}}'); ?></td>
793 <td name="COLADD1"><input type="text" id="ODMIDADD" name="ODMIDADD" value="<?php echo attr($ODMIDADD); ?>"></td>
794 <td class="WAdd2"><input type="text" id="ODADD2" name="ODADD2" value="<?php echo attr($ODADD2); ?>"></td>
795 </tr>
796 <tr class="NEAR center">
797 <td style="text-align:right;font-weight:bold;"><?php echo xlt('OS{{left eye}}'); ?></td>
798 <td name="COLADD1"><input type="text" id="OSMIDADD" name="OSMIDADD" value="<?php echo attr($OSMIDADD); ?>"></td>
799 <td class="WAdd2"><input type="text" id="OSADD2" name="OSADD2" value="<?php echo attr($OSADD2); ?>"></td>
800 </tr>
801 <tr>
802 <td colspan="2" style="text-align:right;font-weight:bold;"><?php echo xlt('Comments'); ?>:</td>
803 <td colspan="4">
804 <textarea style="width:100%;height:5em;" id="COMMENTS" name="COMMENTS"><?php echo text($COMMENTS); ?></textarea>
805 </td>
806 </tr>
807 <!-- start Dispense data -->
808 <tr class="header closeButton">
809 <td colspan="9" class="right">
810 <span><?php
811 if ($ODHPD||$ODHBASE||$ODVPD||$ODVBASE||$ODSLABOFF||$ODVERTEXDIST||
812 $OSHPD||$OSHBASE||$OSVPD||$OSVBASE||$OSSLABOFF||$OSVERTEXDIST||
813 $ODMPDD||$ODMPDN||$OSMPDD||$OSMPDN||$BPDD||$BPDN||
814 $LENS_MATERIAL||$LENS_TREATMENTS)
816 $detailed = '1';
817 ?><i class="fa fa-minus-square-o"></i><?php
818 } else {
819 $detailed ='0';
820 ?><i class="fa fa-plus-square-o"></i><?php
823 </span>
825 </td>
826 </tr>
827 <tr><td colspan="9" class="right"><xhr /></td></tr>
828 <tr class="dispense_data" style="font-weight:bold;text-align:center;">
829 <td name="W_wide" colspan="2"></td>
830 <td name="W_wide" title="<?php echo xla('Horizontal Prism Power'); ?>"><?php echo xlt('Horiz Prism{{abbreviation for Horizontal Prism Power}}'); ?></td>
831 <td name="W_wide" title="<?php echo xla('Horizontal Prism Base'); ?>"><?php echo xlt('Horiz Base{{abbreviation for Horizontal Prism Base}}'); ?></td>
832 <td name="W_wide" title="<?php echo xla('Vertical Prism Power'); ?>"><?php echo xlt('Vert Prism{{abbreviation for Vertical Prism Power}}'); ?></td>
833 <td name="W_wide" title="<?php echo xla('Vertical Prism Base'); ?>"><?php echo xlt('Vert Base{{abbreviation for Vertical Prism Base}}'); ?></td>
834 <td name="W_wide" title="<?php echo xla('Slab Off'); ?>"><?php echo xlt('Slab Off'); ?></td>
835 <td name="W_wide" title="<?php echo xla('Vertex Distance'); ?>"><?php echo xlt('Vert Distance{{abbreviation for Vertex Distance}}'); ?></td>
836 </tr>
837 <tr class="dispense_data">
838 <td name="W_wide" style="text-align:right;font-weight:bold;" colspan="2"><?php echo xlt('OD{{right eye}}'); ?></td>
839 <td name="W_wide"><input type="text" class="prism" id="ODHPD" name="ODHPD" value="<?php echo attr($ODHPD); ?>"></td>
840 <td name="W_wide"><input type="text" class="prism" id="ODHBASE" name="ODHBASE" value="<?php echo attr($ODHBASE); ?>"></td>
841 <td name="W_wide"><input type="text" class="prism" id="ODVPD" name="ODVPD" value="<?php echo attr($ODVPD); ?>"></td>
842 <td name="W_wide"><input type="text" class="prism" id="ODVBASE" name="ODVBASE" value="<?php echo attr($ODVBASE); ?>"></td>
843 <td name="W_wide"><input type="text" class="prism" id="ODSLABOFF" name="ODSLABOFF" value="<?php echo attr($ODSLABOFF); ?>"></td>
844 <td name="W_wide"><input type="text" class="prism" id="ODVERTEXDIST" name="ODVERTEXDIST" value="<?php echo attr($ODVERTEXDIST); ?>"></td>
845 </tr>
846 <tr class="dispense_data">
847 <td name="W_wide" style="text-align:right;font-weight:bold;" colspan="2"><?php echo xlt('OS{{left eye}}'); ?></td>
848 <td name="W_wide"><input type="text" class="prism" id="OSHPD" name="OSHPD" value="<?php echo attr($OSHPD); ?>"></td>
849 <td name="W_wide"><input type="text" class="prism" id="OSHBASE" name="OSHBASE" value="<?php echo attr($OSHBASE); ?>"></td>
850 <td name="W_wide"><input type="text" class="prism" id="OSVPD" name="OSVPD" value="<?php echo attr($OSVPD); ?>"></td>
851 <td name="W_wide"><input type="text" class="prism" id="OSVBASE" name="OSVBASE" value="<?php echo attr($OSVBASE); ?>"></td>
852 <td name="W_wide"><input type="text" class="prism" id="OSSLABOFF" name="OSSLABOFF" value="<?php echo attr($OSSLABOFF); ?>"></td>
853 <td name="W_wide"><input type="text" class="prism" id="OSVERTEXDIST" name="OSVERTEXDIST" value="<?php echo attr($OSVERTEXDIST); ?>"></td>
854 </tr>
855 <tr class="dispense_data"><td colspan="9" class="center"><xhr /></td></tr>
856 <tr class="dispense_data" style="font-weight:bold;text-align:center;">
857 <td></td>
858 <td></td>
859 <td name="W_wide" title="<?php echo xla('Monocular Pupillary Diameter - Distance'); ?>"><?php echo xlt('MPD-D{{abbreviation for Monocular Pupillary Diameter - Distance}}'); ?></td>
860 <td name="W_wide" title="<?php echo xla('Monocular Pupillary Diameter - Near'); ?>"><?php echo xlt('MPD-N{{abbreviation for Monocular Pupillary Diameter - Near}}'); ?></td>
861 <td name="W_wide" title="<?php echo xla('Binocular Pupillary Diameter - Distance'); ?>"><?php echo xlt('BPD-D{{abbreviation for Binocular Pupillary Diameter - Distance}}'); ?></td>
862 <td name="W_wide" title="<?php echo xla('Binocular Pupillary Diameter - Near'); ?>"><?php echo xlt('BPD-N{{abbreviation for Binocular Pupillary Diameter - Near}}'); ?></td>
864 <td colspan="2">Lens Material:</td>
865 </tr>
866 <tr>
867 <td name="W_wide" style="text-align:right;font-weight:bold;" colspan="2"><?php echo xlt('OD{{right eye}}'); ?></td>
868 <td name="W_wide"><input type="text" class="prism" id="ODMPDD" name="ODMPDD" value="<?php echo attr($ODMPDD); ?>"></td>
869 <td name="W_wide"><input type="text" class="prism" id="ODMPDN" name="ODMPDN" value="<?php echo attr($ODMPDN); ?>"></td>
870 <td name="W_wide" rowspan="2" style="vertical-align:middle;"><input type="text" class="prism" id="BPDD" name="BPDD" value="<?php echo attr($BPDD); ?>"></td>
871 <td name="W_wide" rowspan="2" style="vertical-align:middle;"><input type="text" class="prism" id="BPDN" name="BPDN" value="<?php echo attr($BPDN); ?>"></td>
872 <td colspan="2"> <?php
873 echo generate_select_list("LENS_MATERIAL", "Eye_Lens_Material", "$LENS_MATERIAL",'',' ','','restoreSession;submit_form();','',array('style'=>'width:120px'));
875 </td>
876 </tr>
877 <tr>
878 <td name="W_wide" style="text-align:right;font-weight:bold;" colspan="2"><?php echo xlt('OS{{left eye}}'); ?></td>
879 <td name="W_wide"><input type="text" class="prism" id="OSMPDD" name="OSMPDD" value="<?php echo attr($OSMPDD); ?>"></td>
880 <td name="W_wide"><input type="text" class="prism" id="OSMPDN" name="OSMPDN" value="<?php echo attr($OSMPDN); ?>"></td>
881 </tr>
882 <tr class="dispense_data"><td colspan="9" class="center"><xhr /></td></tr>
883 <tr style="font-weight:bold;text-align:center;">
884 <td colspan="3"><?php echo xlt('Lens Treatments'); ?>
885 </td>
886 </tr>
887 <tr style="text-align:left;vertical-align:top;">
888 <td colspan="5" style="font-weight:bold;text-align:left;">
889 <?php echo generate_lens_treatments($W,$LENS_TREATMENTS); ?>
890 </td>
891 </tr>
892 <tr class="dispense_data"><td colspan="9" class="center"><hr /></td></tr>
894 </table>&nbsp;<br /><br /><br />
895 <?php
896 } else { ?>
897 <table id="CTLRx" name="CTLRx" class="refraction">
898 <tr>
899 <td class="right bold underline"><?php echo xlt('Right Lens'); ?></td>
900 </tr>
901 <tr>
902 <td colspan="2" class="right bold"><?php echo xlt('Manufacturer'); ?>:</td>
903 <td colspan="2" class="left"><?php echo text($CTLMANUFACTUREROD); ?></td>
904 <td class="right bold"><?php echo xlt('Brand'); ?>:</td>
905 <td colspan="2" class="left"><?php echo text($CTLBRANDOD); ?></td>
906 </tr>
907 <tr class="bold" style="line-height:0.3em;font-size:0.6em;">
908 <td><?php echo xlt('SPH{{Sphere}}'); ?></td>
909 <td><?php echo xlt('CYL{{Cylinder}}'); ?></td>
910 <td><?php echo xlt('AXIS{{Axis of a glasses prescription}}'); ?></td>
911 <td><?php echo xlt('BC{{Base Curve}}'); ?></td>
912 <td><?php echo xlt('DIAM{{Diameter}}'); ?></td>
913 <td><?php echo xlt('ADD{{Bifocal Add}}'); ?></td>
914 <td><?php echo xlt('ACUITY'); ?></td>
915 </tr>
916 <tr>
917 <td><input type=text id="CTLODSPH" name="CTLODSPH" value="<?php echo attr($ODSPH); ?>"></td>
918 <td><input type=text id="CTLODCYL" name="CTLODCYL" value="<?php echo attr($ODCYL); ?>"></td>
919 <td><input type=text id="CTLODAXIS" name="CTLODAXIS" value="<?php echo attr($ODAXIS); ?>"></td>
920 <td><input type=text id="CTLODBC" name="CTLODBC" value="<?php echo attr($ODBC); ?>"></td>
921 <td><input type=text id="CTLODDIAM" name="CTLODDIAM" value="<?php echo attr($ODDIAM); ?>"></td>
922 <td><input type=text id="CTLODADD" name="CTLODADD" value="<?php echo attr($ODADD); ?>"></td>
923 <td><input type=text id="CTLODVA" name="CTLODVA" value="<?php echo attr($ODVA); ?>"></td>
924 </tr>
925 <tr><td colspan="8"><hr /></td></tr>
926 <tr>
927 <td class="right bold underline"><?php echo xlt('Left Lens'); ?></td>
928 </tr>
929 <tr>
930 <td colspan="2" class="right bold"><?php echo xlt('Manufacturer'); ?>:</td>
931 <td colspan="2" class="left"><?php echo text($CTLMANUFACTUREROS); ?></td>
932 <td class="right bold"><?php echo xlt('Brand'); ?>:</td>
933 <td colspan="2" class="left"><?php echo text($CTLBRANDOS); ?></td>
934 </tr>
935 <tr class="bold" style="line-height:0.3em;font-size:0.6em;">
936 <td><?php echo xlt('SPH{{Sphere}}'); ?></td>
937 <td><?php echo xlt('CYL{{Cylinder}}'); ?></td>
938 <td><?php echo xlt('AXIS{{Axis of a glasses prescription}}'); ?></td>
939 <td><?php echo xlt('BC{{Base Curve}}'); ?></td>
940 <td><?php echo xlt('DIAM{{Diameter}}'); ?></td>
941 <td><?php echo xlt('ADD{{Bifocal Add}}'); ?></td>
942 <td><?php echo xlt('ACUITY'); ?></td>
943 </tr>
944 <tr>
945 <td><input type=text id="CTLOSSPH" name="CTLOSSPH" value="<?php echo attr($OSSPH); ?>"></td>
946 <td><input type=text id="CTLOSCYL" name="CTLOSCYL" value="<?php echo attr($OSCYL); ?>"></td>
947 <td><input type=text id="CTLOSAXIS" name="CTLOSAXIS" value="<?php echo attr($OSAXIS); ?>"></td>
948 <td><input type=text id="CTLOSBC" name="CTLOSBC" value="<?php echo attr($OSBC); ?>"></td>
949 <td><input type=text id="CTLOSDIAM" name="CTLOSDIAM" value="<?php echo attr($OSDIAM); ?>"></td>
950 <td><input type=text id="CTLOSADD" name="CTLOSADD" value="<?php echo attr($OSADD); ?>"></td>
951 <td><input type=text id="CTLOSVA" name="CTLOSVA" value="<?php echo attr($OSVA); ?>"></td>
952 </tr>
953 <?php if ($COMMENTS >'') { ?>
954 <tr><td colspan="8"><hr /></td></tr>
955 <tr>
956 <td class="right bold red" colspan="2" style="vertical-align:top;"><?php echo xlt('Comments'); ?>:</u></td>
957 <td colspan="6" class="left">
958 <textarea cols="30" rows="4"><?php echo text($COMMENTS); ?></textarea>
959 </td>
960 </tr>
961 <?php } ?>
962 </table>
963 <?php
964 } ?>
965 </td>
966 </tr>
967 <tr>
968 <td style="margin:25px auto;text-align:center;">
969 <?php
970 $signature = $GLOBALS["webserver_root"]."/interface/forms/eye_mag/images/sign_".attr($_SESSION['authUserID']).".jpg";
971 if (file_exists($signature)) {
973 <span style="position:relative;padding-left:40px;">
974 <img src='<?php echo $web_root; ?>/interface/forms/eye_mag/images/sign_<?php echo attr($_SESSION['authUserID']); ?>.jpg'
975 style="width:240px;height:85px;border-block-end: 1pt solid black;margin:5px;" />
976 </span><br />
978 <?php } ?>
980 <?php echo xlt('Provider'); ?>: <?php echo text($prov_data['fname']); ?> <?php echo text($prov_data['lname']);
981 if ($prov_data['suffix']) { echo ", ".$prov_data['suffix'];} ?><br />
982 <small><?php echo xlt('e-signed'); ?> <input type="checkbox" checked="checked"></small>
983 </td>
984 </tr>
985 </table>
986 </div>
987 </form>
989 </body>
990 <script>
991 $(document).ready(function() {
992 $('.header').click(function () {
993 var $this = $(this);
994 $(this).nextUntil('tr.header').slideToggle(100).promise().done(function () {
995 $this.find('span').html(function (_, value) {
996 return value == '<i class="fa fa-plus-square-o"></i>' ? '<i class="fa fa-minus-square-o"></i>' : '<i class="fa fa-plus-square-o"></i>';
1000 <?php if (!$detailed) { echo "$('.header').trigger('click');"; } ?>
1002 $("input[name$='PD']").blur(function() {
1003 //make it all caps
1004 var str = $(this).val();
1005 str = str.toUpperCase();
1006 $(this).val(str);
1008 $('input[name$="SPH"]').blur(function() {
1009 var mid = $(this).val();
1010 if (mid.match(/PLANO/i)) {
1011 $(this).val('PLANO');
1012 return;
1014 if (mid.match(/^[\+\-]?\d{1}$/)) {
1015 mid = mid+".00";
1017 if (mid.match(/\.[27]$/)) {
1018 mid = mid + '5';
1020 if (mid.match(/\.\d$/)) {
1021 mid = mid + '0';
1023 //if near is +2. make it +2.00
1024 if (mid.match(/\.$/)) {
1025 mid= mid + '00';
1027 if ((!mid.match(/\./))&&(mid.match(00|25|50|75))) {
1028 var front = mid.match(/(\d{0,2})(00|25|50|75)/)[1];
1029 var back = mid.match(/(\d{0,2})(00|25|50|75)/)[2];
1030 if (front =='') front ='0';
1031 mid = front + "." + back;
1033 if (!mid.match(/\./)) {
1034 var front = mid.match(/([\+\-]?\d{0,2})(\d{2})/)[1];
1035 var back = mid.match(/(\d{0,2})(\d{2})/)[2];
1036 if (front =='') front ='0';
1037 if (front =='-') front ='-0';
1038 mid = front + "." + back;
1040 if (!mid.match(/^(\+|\-){1}/)) {
1041 mid = "+" + mid;
1043 $(this).val(mid);
1046 $("input[name$='ADD'],input[name$='ADD2']").blur(function() {
1047 var add = $(this).val();
1048 add = add.replace(/=/g,"+");
1049 //if add is one digit, eg. 2, make it +2.00
1050 if (add.match(/^\d{1}$/)) {
1051 add = "+"+add+".00";
1053 //if add is '+'one digit, eg. +2, make it +2.00
1054 if (add.match(/^\+\d{1}$/)) {
1055 add = add+".00";
1057 //if add is 2.5 or 2.0 make it 2.50 or 2.00
1058 if (add.match(/\.[05]$/)) {
1059 add = add + '0';
1061 //if add is 2.2 or 2.7 make it 2.25 or 2.75
1062 if (add.match(/\.[27]$/)) {
1063 add = add + '5';
1065 //if add is +2. make it +2.00
1066 if (add.match(/\.$/)) {
1067 add = add + '00';
1069 if ((!add.match(/\./))&&(add.match(/(0|25|50|75)$/))) {
1070 var front = add.match(/([\+]?\d{0,1})(00|25|50|75)/)[1];
1071 var back = add.match(/([\+]?\d{0,1})(00|25|50|75)/)[2];
1072 if (front =='') front ='0';
1073 add = front + "." + back;
1075 if (!add.match(/^(\+)/) && (add.length > 0)) {
1076 add= "+" + add;
1078 $(this).val(add);
1079 if (this.id=="ODADD2") $('#OSADD2').val(add);
1080 if (this.id=="ODMIDADD") $('#OSMIDADD').val(add);
1081 if (this.id=="CTLODADD") $('#CTLOSADD').val(add);
1084 $("input[name$='AXIS']").blur(function() {
1085 // Make this a 3 digit leading zeros number.
1086 // we are not translating text to numbers, just numbers to
1087 // a 3 digit format with leading zeroes as needed.
1088 // assume the end user KNOWS there are only numbers presented and
1089 // more than 3 digits is a mistake...
1090 // (although this may change with topographic answer)
1091 var axis = $(this).val();
1092 var group = this.name.replace("AXIS", "CYL");;
1093 var cyl = $("#"+group).val();
1094 if ((cyl > '') && (cyl != 'SPH')) {
1095 if (!axis.match(/\d\d\d/)) {
1096 if (!axis.match(/\d\d/)) {
1097 if (!axis.match(/\d/)) {
1098 axis = '0';
1100 axis = '0' + axis;
1102 axis = '0' + axis;
1104 } else {
1105 axis = '';
1107 $(this).val(axis);
1109 $("[name$='CYL']").blur(function() {
1110 var mid = $(this).val();
1111 var group = this.name.replace("CYL", "SPH");;
1112 var sphere = $("#"+group).val();
1113 if (((mid.length == 0) && (sphere.length > 0))||(mid.match(/sph/i))) {
1114 $(this).val('SPH');
1115 var axis = this.name.replace("CYL", "AXIS");
1116 $("#"+axis).val('');
1117 return;
1118 } else if (sphere.length > 0) {
1119 if (mid.match(/^[\+\-]?\d{1}$/)) {
1120 mid = mid+".00";
1122 if (mid.match(/^(\d)(\d)$/)) {
1123 mid = mid[0] + '.' +mid[1];
1125 //if mid is 2.5 or 2.0 make it 2.50 or 2.00
1126 if (mid.match(/\.[05]$/)) {
1127 mid = mid + '0';
1129 //if mid is 2.2 or 2.7 make it 2.25 or 2.75
1130 if (mid.match(/\.[27]$/)) {
1131 mid = mid + '5';
1133 //if mid is +2. make it +2.00
1134 if (mid.match(/\.$/)) {
1135 mid = mid + '00';
1137 if (mid.match(/([\+\-]?\d{0,2})\.?(00|25|50|75)/)) {
1138 var front = mid.match(/([\+\-]?\d{0,2})\.?(00|25|50|75)/)[1];
1139 var back = mid.match(/([\+\-]?\d{0,2})\.?(00|25|50|75)/)[2];
1140 if (front =='') front ='0';
1141 mid = front + "." + back;
1143 if (!mid.match(/^(\+|\-){1}/) && (sphere.length > 0)) {
1144 //Since it doesn't start with + or - then give it '+'
1145 mid = "+" + mid;
1147 $(this).val(mid);
1150 $("input,textarea,text,checkbox").change(function(){
1151 //$(this).css("background-color","#F0F8FF");
1152 //submit_form($(this));
1154 $("#reverse").click(function() {
1155 //alert('Start');
1156 reverse_cylinder('');
1157 //alert('Finish');
1160 $("input[name$='SPH'],input[name$='CYL']").on('keyup', function(e) {
1161 if (e.keyCode=='61' || e.keyCode=='74') {
1162 now = $(this).val();
1163 now = now.replace(/=/g,"+").replace(/^j/g,"J");
1164 $(this).val(now);
1169 </script>
1170 </html>
1172 <?php
1173 exit;
1174 global $web_root, $webserver_root;
1175 $content = ob_get_clean();
1176 echo $content;
1178 //display Rx to user, now store it too...
1179 // Fix a nasty html2pdf bug - it ignores document root!
1180 $i = 0;
1181 $wrlen = strlen($web_root);
1182 $wsrlen = strlen($webserver_root);
1183 while (true) {
1184 $i = stripos($content, " src='/", $i + 1);
1185 if ($i === false) break;
1186 if (substr($content, $i+6, $wrlen) === $web_root &&
1187 substr($content, $i+6, $wsrlen) !== $webserver_root)
1189 $content = substr($content, 0, $i + 6) . $webserver_root . substr($content, $i + 6 + $wrlen);
1192 $temp_filename = '/tmp/'.$filename;
1194 $query = "select id from categories where name like 'Communication'";
1195 $result = sqlStatement($query);
1196 $ID = sqlFetchArray($result);
1197 $category_id = $ID['id'];
1198 $pdf->writeHTML($content, false);
1199 $content_pdf = $pdf->Output($temp_filename, 'F');
1200 $type = "application/pdf";
1202 $size = filesize($temp_filename);
1204 $return = addNewDocument($filename,$type,$temp_filename,0,$size,$_SESSION['authUserID'],$pid,$category_id);
1205 $doc_id = $return['doc_id'];
1206 $sql = "UPDATE documents set encounter_id=? where id=?"; //link it to this encounter
1207 sqlQuery($sql,array($encounter,$doc_id));
1208 exit;