fixes to nonexistent [webserver_root]
[openemr.git] / interface / forms / eye_mag / SpectacleRx.php
blob3bc4f4cd2767240cc0b661c31b4a4e5df840be12
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
29 require_once("../../globals.php");
30 require_once("$srcdir/api.inc");
31 require_once("$srcdir/acl.inc");
32 require_once("$srcdir/forms.inc");
33 require_once("$srcdir/lists.inc");
34 require_once("$srcdir/options.inc.php");
35 require_once("$srcdir/patient.inc");
36 require_once("$srcdir/report.inc");
38 use OpenEMR\Services\FacilityService;
40 $facilityService = new FacilityService();
42 $form_name = "Eye Form";
43 $form_folder = "eye_mag";
44 require_once("php/" . $form_folder . "_functions.php");
46 $RX_expir = "+1 years";
47 $CTL_expir = "+6 months";
48 //echo "<pre>";var_dump($_REQUEST);exit;
49 if (!$_REQUEST['pid'] && $_REQUEST['id']) {
50 $_REQUEST['pid'] = $_REQUEST['id'];
52 if (!$_REQUEST['pid']) {
53 $_REQUEST['pid'] = $_SESSION['pid'];
56 $query = "select *,form_encounter.date as encounter_date
57 from forms,form_encounter,form_eye_base,
58 form_eye_hpi,form_eye_ros,form_eye_vitals,
59 form_eye_acuity,form_eye_refraction,form_eye_biometrics,
60 form_eye_external, form_eye_antseg,form_eye_postseg,
61 form_eye_neuro,form_eye_locking
62 where
63 forms.deleted != '1' and
64 forms.formdir='eye_mag' and
65 forms.encounter=form_encounter.encounter and
66 forms.form_id=form_eye_base.id and
67 forms.form_id=form_eye_hpi.id and
68 forms.form_id=form_eye_ros.id and
69 forms.form_id=form_eye_vitals.id and
70 forms.form_id=form_eye_acuity.id and
71 forms.form_id=form_eye_refraction.id and
72 forms.form_id=form_eye_biometrics.id and
73 forms.form_id=form_eye_external.id and
74 forms.form_id=form_eye_antseg.id and
75 forms.form_id=form_eye_postseg.id and
76 forms.form_id=form_eye_neuro.id and
77 forms.form_id=form_eye_locking.id and
78 forms.encounter=? and
79 forms.pid=? ";
81 $data = sqlQuery($query, array($_REQUEST['encounter'], $_REQUEST['pid']));
82 $data['ODMPDD'] = $data['ODPDMeasured'];
83 $data['OSMPDD'] = $data['OSPDMeasured'];
84 $data['BPDD'] = $data['ODMPDD'] + $data['OSMPDD'];
85 @extract($data);
87 $ODMPDD = $ODPDMeasured;
88 $OSMPDD = $OSPDMeasured;
89 $BPDD = $ODMPDD + $OSMPDD;
91 $query = "SELECT * FROM users where id = ?";
92 $prov_data = sqlQuery($query, array($data['provider_id']));
94 $query = "SELECT * FROM patient_data where pid=?";
95 $pat_data = sqlQuery($query, array($data['pid']));
97 $practice_data = $facilityService->getPrimaryBusinessEntity();
99 $visit_date = oeFormatShortDate($data['encounter_date']);
101 if ($_REQUEST['mode'] == "update") { //store any changed fields in dispense table
102 $table_name = "form_eye_mag_dispense";
103 $query = "show columns from " . $table_name;
104 $dispense_fields = sqlStatement($query);
105 $fields = array();
107 if (sqlNumRows($dispense_fields) > 0) {
108 while ($row = sqlFetchArray($dispense_fields)) {
109 //exclude critical columns/fields, define below as needed
110 if ($row['Field'] == 'id' ||
111 $row['Field'] == 'pid' ||
112 $row['Field'] == 'user' ||
113 $row['Field'] == 'groupname' ||
114 $row['Field'] == 'authorized' ||
115 $row['Field'] == 'activity' ||
116 $row['Field'] == 'date'
118 continue;
121 if (isset($_POST[$row['Field']])) {
122 $fields[$row['Field']] = $_POST[$row['Field']];
125 $fields['RXTYPE'] = $RXTYPE;
126 $insert_this_id = formUpdate($table_name, $fields, $_POST['id'], $_SESSION['userauthorized']);
129 exit;
130 } else if ($_REQUEST['mode'] == "remove") {
131 $query = "DELETE FROM form_eye_mag_dispense where id=?";
132 sqlStatement($query, array($_REQUEST['delete_id']));
133 echo xlt('Prescription successfully removed.');
134 exit;
135 } else if ($_REQUEST['RXTYPE']) { //store any changed fields
136 $query = "UPDATE form_eye_mag_dispense set RXTYPE=? where id=?";
137 sqlStatement($query, array($_REQUEST['RXTYPE'], $_REQUEST['id']));
138 exit;
141 formHeader("OpenEMR Eye: " . text($prov_data['facility']));
143 if ($_REQUEST['REFTYPE']) {
144 $REFTYPE = $_REQUEST['REFTYPE'];
145 if ($REFTYPE == "AR") {
146 $RXTYPE = "Bifocal";
149 if ($REFTYPE == "MR") {
150 $RXTYPE = "Bifocal";
153 if ($REFTYPE == "CTL") {
154 $RXTYPE = "Bifocal";
157 $id = $_REQUEST['id'];
158 $table_name = "form_eye_mag";
159 if (!$_REQUEST['encounter']) {
160 $encounter = $_SESSION['encounter'];
161 } else {
162 $encounter = $_REQUEST['encounter'];
167 if ($REFTYPE =="W") {
168 //we have rx_number 1-5 to process...
169 $query = "select * from form_eye_mag_wearing where ENCOUNTER=? and FORM_ID=? and PID=? and RX_NUMBER=?";
170 $wear = sqlStatement($query, array($encounter,$_REQUEST['form_id'],$_REQUEST['pid'],$_REQUEST['rx_number']));
171 $wearing = sqlFetchArray($wear);
172 $ODSPH = $wearing['ODSPH'];
173 $ODAXIS = $wearing['ODAXIS'];
174 $ODCYL = $wearing['ODCYL'];
175 $OSSPH = $wearing['OSSPH'];
176 $OSCYL = $wearing['OSCYL'];
177 $OSAXIS = $wearing['OSAXIS'];
178 $COMMENTS = $wearing['COMMENTS'];
179 $ODMIDADD = $wearing['ODMIDADD'];
180 $ODADD2 = $wearing['ODADD'];
181 $OSMIDADD = $wearing['OSMIDADD'];
182 $OSADD2 = $wearing['OSADD'];
183 @extract($wearing);
184 if ($wearing['RX_TYPE']=='0') {
185 $Single="checked='checked'";
186 $RXTYPE="Single";
187 } elseif ($wearing['RX_TYPE']=='1') {
188 $Bifocal ="checked='checked'";
189 $RXTYPE="Bifocal";
190 } elseif ($wearing['RX_TYPE']=='2') {
191 $Trifocal ="checked='checked'";
192 $RXTYPE="Trifocal";
193 } elseif ($wearing['RX_TYPE']=='3') {
194 $Progressive ="checked='checked'";
195 $RXTYPE="Progressive";
198 //do LT and Lens materials
199 } elseif ($REFTYPE == "AR") {
200 $ODSPH = $data['ARODSPH'];
201 $ODAXIS = $data['ARODAXIS'];
202 $ODCYL = $data['ARODCYL'];
203 $ODPRISM = $data['ARODPRISM'];
204 $OSSPH = $data['AROSSPH'];
205 $OSCYL = $data['AROSCYL'];
206 $OSAXIS = $data['AROSAXIS'];
207 $OSPRISM = $data['AROSPRISM'];
208 $COMMENTS = $data['CRCOMMENTS'];
209 $ODADD2 = $data['ARODADD'];
210 $OSADD2 = $data['AROSADD'];
211 $Bifocal = "checked='checked'";
212 } elseif ($REFTYPE == "MR") {
213 $ODSPH = $data['MRODSPH'];
214 $ODAXIS = $data['MRODAXIS'];
215 $ODCYL = $data['MRODCYL'];
216 $ODPRISM = $data['MRODPRISM'];
217 $OSSPH = $data['MROSSPH'];
218 $OSCYL = $data['MROSCYL'];
219 $OSAXIS = $data['MROSAXIS'];
220 $OSPRISM = $data['MROSPRISM'];
221 $COMMENTS = $data['CRCOMMENTS'];
222 $ODADD2 = $data['MRODADD'];
223 $OSADD2 = $data['MROSADD'];
224 $Bifocal = "checked='checked'";
225 } elseif ($REFTYPE == "CR") {
226 $ODSPH = $data['CRODSPH'];
227 $ODAXIS = $data['CRODAXIS'];
228 $ODCYL = $data['CRODCYL'];
229 $ODPRISM = $data['CRODPRISM'];
230 $OSSPH = $data['CROSSPH'];
231 $OSCYL = $data['CROSCYL'];
232 $OSAXIS = $data['CROSAXIS'];
233 $OSPRISM = $data['CROSPRISM'];
234 $COMMENTS = $data['CRCOMMENTS'];
235 } elseif ($REFTYPE == "CTL") {
236 $ODSPH = $data['CTLODSPH'];
237 $ODAXIS = $data['CTLODAXIS'];
238 $ODCYL = $data['CTLODCYL'];
239 $ODPRISM = $data['CTLODPRISM'];
241 $OSSPH = $data['CTLOSSPH'];
242 $OSCYL = $data['CTLOSCYL'];
243 $OSAXIS = $data['CTLOSAXIS'];
244 $OSPRISM = $data['CTLOSPRISM'];
246 $ODBC = $data['CTLODBC'];
247 $ODDIAM = $data['CTLODDIAM'];
248 $ODADD = $data['CTLODADD'];
249 $ODVA = $data['CTLODVA'];
251 $OSBC = $data['CTLOSBC'];
252 $OSDIAM = $data['CTLOSDIAM'];
253 $OSADD = $data['CTLOSADD'];
254 $OSVA = $data['CTLOSVA'];
256 $COMMENTS = $data['COMMENTS'];//in form_eye_mag_dispense there is no leading 'CTL_'
258 $CTLMANUFACTUREROD = getListItemTitle('CTLManufacturer', $data['CTLMANUFACTUREROD']);
259 $CTLMANUFACTUREROS = getListItemTitle('CTLManufacturer', $data['CTLMANUFACTUREROS']);
260 $CTLSUPPLIEROD = getListItemTitle('CTLManufacturer', $data['CTLSUPPLIEROD']);
261 $CTLSUPPLIEROS = getListItemTitle('CTLManufacturer', $data['CTLSUPPLIEROS']);
262 $CTLBRANDOD = getListItemTitle('CTLManufacturer', $data['CTLBRANDOD']);
263 $CTLBRANDOS = getListItemTitle('CTLManufacturer', $data['CTLBRANDOS']);
266 //Since we selected the Print Icon, we must be dispensing this - add to dispensed table now
267 $table_name = "form_eye_mag_dispense";
268 $query = "show columns from " . $table_name;
269 $dispense_fields = sqlStatement($query);
270 $fields = array();
272 if (sqlNumRows($dispense_fields) > 0) {
273 while ($row = sqlFetchArray($dispense_fields)) {
274 //exclude critical columns/fields, define below as needed
275 if ($row['Field'] == 'id' ||
276 $row['Field'] == 'pid' ||
277 $row['Field'] == 'user' ||
278 $row['Field'] == 'groupname' ||
279 $row['Field'] == 'authorized' ||
280 $row['Field'] == 'activity' ||
281 $row['Field'] == 'RXTYPE' ||
282 $row['Field'] == 'REFDATE' ||
283 $row['Field'] == 'date'
285 continue;
287 if (isset(${$row['Field']})) {
288 $fields[$row['Field']] = ${$row['Field']};
292 $fields['RXTYPE'] = $RXTYPE;
293 $fields['REFDATE'] = $data['date'];
294 $insert_this_id = formSubmit($table_name, $fields, $form_id, $_SESSION['userauthorized']);
298 if ($_REQUEST['dispensed']) {
299 $query = "SELECT * from form_eye_mag_dispense where pid =? ORDER BY date DESC";
300 $dispensed = sqlStatement($query, array($_REQUEST['pid']));
301 ?><html>
302 <title><?php echo xlt('Rx Dispensed History'); ?></title>
303 <head>
304 <script src="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-1-10-2/jquery.js"></script>
305 <script src="<?php echo $GLOBALS['assets_static_relative'] ?>/bootstrap/dist/js/bootstrap.min.js"></script>
306 <script src="<?php echo $GLOBALS['assets_static_relative'] ?>/manual-added-packages/qtip2-2-2-1/jquery.qtip.min.js"></script>
307 <script type="text/javascript" src="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js"></script>
309 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/bootstrap/dist/css/bootstrap.min.css">
310 <link rel="stylesheet" href="<?php echo $GLOBALS['css_header']; ?>" type="text/css">
311 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-ui-themes-1-10-4/themes/ui-lightness/jquery-ui.min.css">
312 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/pure/0.5.0/pure-min.css">
313 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/manual-added-packages/qtip2-2-2-1/jquery.qtip.min.css" />
314 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/font-awesome/css/font-awesome.min.css">
315 <link rel="stylesheet" href="../../forms/<?php echo $form_folder; ?>/css/style.css" type="text/css">
317 <style>
318 .title {
319 font-size:1em;
320 position:absolute;
321 right:10px;
322 top:30px;
323 font-size: 1em;
325 .refraction {
326 width:95%;
327 display: -moz-stack;
328 vertical-align: middle;
329 min-height:unset;
331 .refraction td {
332 text-align:center;
333 font-size:12px;
334 width:0.9in;
335 vertical-align: text-middle;
336 text-decoration: unset;
338 table {
339 font-size: 1.0em;
340 padding: 12px;
341 color: black;
342 vertical-align: text-top;
345 input[type=text] {
346 text-align: center;
347 width: 60px;
350 .refraction b {
351 font-weight: bold;
354 .refraction td.right {
355 text-align: right;
356 text-decoration: unset;
357 width: 0.7in;
358 vertical-align: middle; font-size:12px;
361 .refraction td.left {
362 vertical-align: middle;
363 text-align: left;
364 font-size:12px;
367 .right {
368 text-align: right;
369 vertical-align: middle;}
371 .left {
372 vertical-align: middle;
373 text-align: left;
376 .title {
377 font-size: 0.9em;
378 font-weight: normal;
381 .bold {
382 font-weight: 600;
385 input {
386 width: 60px;
389 input[type="radio"] {
390 width: 15px;
392 .underline {
393 text-decoration:underline !important
395 #CTLODQUANTITY, #CTLOSQUANTITY {
396 width: 300px;
398 </style>
399 <script language="JavaScript">
400 <?php
401 require_once("$srcdir/restoreSession.php"); ?>
403 function delete_me(delete_id) {
404 top.restoreSession();
405 var url = "../../forms/eye_mag/SpectacleRx.php";
406 $.ajax({
407 type: 'POST',
408 url: url,
409 data: {
410 mode: 'remove',
411 delete_id: delete_id,
412 dispensed: '1'
413 } // our data object
414 }).done(function (o) {
415 $('#RXID_' + delete_id).hide();
416 alert(o);
420 </script>
421 </head>
422 <?php echo report_header($pid, "web"); ?>
423 <div class="row">
424 <div class="col-sm-8 offset-sm-2" style="margin:5;text-align:center;width:560px;">
425 <table>
426 <tr>
427 <td colspan="2"><h4 class="underline"><?php echo xlt('Rx History'); ?></h4></td>
428 </tr>
429 <?php
430 if (sqlNumRows($dispensed) == 0) {
431 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>";
434 </table>
435 <?php
436 while ($row = sqlFetchArray($dispensed)) {
437 $i++;
438 $Single = '';
439 $Bifocal = '';
440 $Trifocal = '';
441 $Progressive = '';
442 if ($row['RXTYPE'] == "Single") {
443 $Single = "checked='checked'";
446 if ($row['RXTYPE'] == "Bifocal") {
447 $Bifocal = "checked='checked'";
450 if ($row['RXTYPE'] == "Trifocal") {
451 $Trifocal = "checked='checked'";
454 if ($row['RXTYPE'] == "Progressive") {
455 $Progressive = "checked='checked'";
458 $row['date'] = oeFormatShortDate(date('Y-m-d', strtotime($row['date'])));
459 if ($row['REFTYPE'] == "CTL") {
460 $expir = date("Y-m-d", strtotime($CTL_expir, strtotime($row['REFDATE'])));
461 } else {
462 $expir = date("Y-m-d", strtotime($RX_expir, strtotime($row['REFDATE'])));
464 $expir_date = oeFormatShortDate($expir);
465 $row['REFDATE'] = oeFormatShortDate($row['REFDATE']);
468 <div id="RXID_<?php echo attr($row['id']); ?>"
469 style="position:relative;text-align:center;margin: 10 auto;">
470 <i class="pull-right fa fa-close"
471 onclick="delete_me('<?php echo attr(addslashes($row['id'])); ?>');"
472 title="<?php echo xla('Remove this Prescription from the list of RXs dispensed'); ?>"></i>
473 <table style="margin:2px auto;width:490px;">
474 <tr>
475 <td class="right bold" style="width:250px;"><b><?php echo xlt('RX Print Date'); ?>: </b></td>
476 <td>&nbsp;&nbsp;<?php echo text($row['date']); ?></td>
477 </tr>
478 <tr>
479 <td class="right bold"><b><?php echo xlt('Visit Date'); ?>: </b></td>
480 <td>&nbsp;&nbsp;<?php echo text($row['REFDATE']); ?></td>
481 </tr>
482 <tr>
483 <td class="right bold"><b><?php echo xlt('Expiration Date'); ?>: </b></td>
484 <td>&nbsp;&nbsp;<?php
485 echo text($expir_date);
487 </td>
488 </tr>
490 <tr>
491 <td class="right bold"><?php echo xlt('Refraction Method'); ?>:</td>
492 <td>&nbsp;&nbsp;<?php
493 if ($row['REFTYPE'] == "W") {
494 echo xlt('Duplicate Rx -- unchanged from current Rx{{The refraction did not change, New Rx=old Rx}}');
495 } else if ($row['REFTYPE'] == "CR") {
496 echo xlt('Cycloplegic (Wet) Refraction');
497 } else if ($row['REFTYPE'] == "MR") {
498 echo xlt('Manifest (Dry) Refraction');
499 } else if ($row['REFTYPE'] == "AR") {
500 echo xlt('Auto-Refraction');
501 } else if ($row['REFTYPE'] == "CTL") {
502 echo xlt('Contact Lens');
503 } else {
504 echo $row['REFTYPE'];
505 } ?>
506 <input type="hidden" name="REFTYPE" value="<?php echo attr($row['REFTYPE']); ?>"/>
507 </td>
508 </tr>
509 <tr>
510 <td colspan="2" class="text-center"> <?php
511 if ($row['REFTYPE'] != "CTL") { ?>
512 <table id="SpectacleRx" name="SpectacleRx" class="refraction" style="top:0px;">
513 <tr style="font-style:bold;">
514 <td></td>
515 <td></td>
516 <td class="center bold underline"><?php echo xlt('Sph{{Sphere}}'); ?></td>
517 <td class="center bold underline"><?php echo xlt('Cyl{{Cylinder}}'); ?></td>
518 <td class="center bold underline"><?php echo xlt('Axis{{Axis in a glasses prescription}}'); ?></td>
519 <td rowspan="5" class="right bold underline" colspan="2"
520 style="min-width:100px;font-weight:bold;">
521 <?php echo xlt('Rx Type'); ?><br/><br/>
522 <?php echo xlt('Single'); ?>
523 <input type="radio" disabled <?php echo text($Single); ?>><br/>
524 <?php echo xlt('Bifocal'); ?>
525 <input type="radio" disabled <?php echo text($Bifocal); ?>><br/>
526 <?php echo xlt('Trifocal'); ?>
527 <input type="radio" disabled <?php echo text($Trifocal); ?>><br/>
528 <?php echo xlt('Prog.{{Progressive lenses}}'); ?>
529 <input type="radio" disabled <?php echo text($Progressive); ?>><br/>
530 </td>
531 </tr>
532 <tr>
533 <td rowspan="2"
534 style="text-align:right;font-weight:bold;"><?php echo xlt('Distance'); ?></td>
535 <td><b><?php echo xlt('OD{{right eye}}'); ?></b></td>
536 <td><?php echo text($row['ODSPH']); ?></td>
537 <td><?php echo text($row['ODCYL']); ?></td>
538 <td><?php echo text($row['ODAXIS']); ?></td>
539 <td><?php echo text($row['ODPRISM']); ?></td>
540 </tr>
541 <tr>
542 <td><b><?php echo xlt('OS{{left eye}}'); ?></b></td>
543 <td><?php echo text($row['OSSPH']); ?></td>
544 <td><?php echo text($row['OSCYL']); ?></td>
545 <td><?php echo text($row['OSAXIS']); ?></td>
546 <td><?php echo text($row['OSPRISM']); ?></td>
547 </tr>
548 <tr class="NEAR">
549 <td rowspan=2 nowrap><span class="bold"
550 style="text-decoration:none;"><?php echo xlt('ADD'); ?>
551 :<br/><?php echo xlt("Mid{{Middle segment in a trifocal glasses prescription}}"); ?>
552 /<?php echo xlt("Near"); ?></span></td>
553 <td><b><?php echo xlt('OD{{right eye}}'); ?></b></td>
554 <td class="WMid"><?php echo text($row['ODMIDADD']); ?></td>
555 <td class="WAdd2"><?php echo text($row['ODADD2']); ?></td>
556 </tr>
557 <tr class="NEAR">
558 <td><b><?php echo xlt('OS{{left eye}}'); ?></b></td>
559 <td class="WMid"><?php echo text($row['OSMIDADD']); ?></td>
560 <td class="WAdd2"><?php echo text($row['OSADD2']); ?></td>
561 </tr>
562 <tr style="">
563 <td colspan="2" class="up"
564 style="text-align:right;vertical-align:top;top:0px;font-weight:bold;"><?php echo xlt('Comments'); ?>
566 </td>
567 <td colspan="4" class="up left"></td>
568 <?php echo text($row['CRCOMMENTS']); ?>
569 </td>
570 </tr>
571 </table>
572 <?php
573 } else {
574 if (!empty($row['ODADD']) || !empty($row['OSADD'])) {
575 $adds =1;
576 } else {
577 $adds ='';
580 <table id="CTLRx" name="CTLRx" class="refraction">
581 <tr>
582 <td colspan="4"
583 class="bold left text-uppercase text-top" style="display: flex;
584 align-items:top"><u><?php echo xlt('Right Lens'); ?></u>
585 </td>
586 </tr>
587 <tr class="bold underline">
588 <td></td>
589 <td><?php echo xlt('Sph{{Sphere}}'); ?></td>
590 <td><?php echo xlt('Cyl{{Cylinder}}'); ?></td>
591 <td><?php echo xlt('Axis{{Axis in a glasses prescription}}'); ?></td>
592 <td><?php echo xlt('BC{{Base Curve}}'); ?></td>
593 <td><?php echo xlt('Diam{{Diameter}}'); ?></td>
594 <?php
595 if ($adds) {
597 <td><?php echo xlt('ADD'); ?></td>
598 <?php }
600 </tr>
601 <tr>
602 <td></td>
603 <td><?php echo text($row['ODSPH']); ?></td>
604 <td><?php echo text($row['ODCYL']); ?></td>
605 <td><?php echo text($row['ODAXIS']); ?></td>
606 <td><?php echo text($row['ODBC']); ?></td>
607 <td><?php echo text($row['ODDIAM']); ?></td>
608 <?php
609 if ($adds) {
611 <td><?php echo text($row['ODADD']); ?></td>
612 <?php } ?>
613 </tr>
614 <tr>
615 <td colspan="2" class="right bold">
616 <?php echo xlt('Brand'); ?>: <br />
617 <?php echo xlt('Quantity'); ?>: <br />
618 <?php echo xlt('Supplier'); ?>: </td>
619 <td colspan="5" class="left" style="padding-left:10px;vertical-align:top;">
620 <?php echo text($row['CTLBRANDOD']); ?>
621 <?php
622 if (!empty($row['CTLMANUFACTUREROD'])) {
623 echo "(".text($row['CTLMANUFACTUREROD']).")";
624 } ?>
625 <br />
626 <?php echo text($row['CTLODQUANTITY']); ?><br />
627 <?php echo text($row['CTLSUPPLIEROD']); ?>
628 </td>
629 </tr>
630 <tr>
631 <td colspan="7">
632 <hr />
633 </td>
634 </tr>
635 <tr>
636 <td colspan="4"
637 class="bold left text-uppercase text-top" style="display: flex;align-items:top">
638 <u><?php echo xlt('Left Lens'); ?></u>
639 </td>
640 </tr>
641 <tr class="bold underline">
642 <td></td>
643 <td><?php echo xlt('Sph{{Sphere}}'); ?></td>
644 <td><?php echo xlt('Cyl{{Cylinder}}'); ?></td>
645 <td><?php echo xlt('Axis{{Axis in a glasses prescription}}'); ?></td>
646 <td><?php echo xlt('BC{{Base Curve}}'); ?></td>
647 <td><?php echo xlt('Diam{{Diameter}}'); ?></td>
648 <?php
649 if ($adds) {
651 <td><?php echo xlt('ADD'); ?></td>
652 <?php }
654 </tr>
655 <tr>
656 <td></td>
657 <td><?php echo text($row['OSSPH']); ?></td>
658 <td><?php echo text($row['OSCYL']); ?></td>
659 <td><?php echo text($row['OSAXIS']); ?></td>
660 <td><?php echo text($row['OSBC']); ?></td>
661 <td><?php echo text($row['OSDIAM']); ?></td>
662 <?php
663 if ($adds) {
665 <td><?php echo text($row['OSADD']); ?></td>
666 <?php
667 } ?>
668 </tr>
669 <tr>
670 <td colspan="2" class="right bold">
671 <?php echo xlt('Brand'); ?>: <br />
672 <?php echo xlt('Quantity'); ?>: <br />
673 <?php echo xlt('Supplier'); ?>: </td>
674 <td colspan="5" class="left" style="padding-left:10px;vertical-align:top;"><?php echo text($row['CTLBRANDOS']); ?>
675 <?php
676 if (!empty($row['CTLMANUFACTUREROS'])) {
677 echo "(".text($row['CTLMANUFACTUREROS']).")";
678 } ?>
679 <br />
680 <?php echo text($row['CTLOSQUANTITY']); ?><br />
681 <?php echo text($row['CTLSUPPLIEROS']); ?>
682 </td>
683 </tr>
684 <?php if (!empty($row['COMMENTS'])) { ?>
685 <tr><td colspan="7"><hr /></td></tr>
686 <tr>
687 <td colspan="3" class="bold right"><?php echo xlt('Comments'); ?>:
688 </td>
689 <td colspan="3" class="left" style="padding-left:10px;vertical-align:middle;top:0px;">
690 <?php echo text($row['COMMENTS']); ?>
691 </td>
692 </tr>
693 <?php } ?>
694 </table>
696 <?php
697 } ?>
698 </td>
699 </tr>
700 </table>
701 <hr>
703 </div>
704 <?php
705 } ?>
706 </div>
707 </div>
708 </body>
709 </html>
710 <?php
711 exit;
714 ob_start();
716 <html>
717 <head>
718 <script src="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-1-10-2/jquery.js"></script>
719 <script src="<?php echo $GLOBALS['assets_static_relative'] ?>/bootstrap/dist/js/bootstrap.min.js"></script>
720 <script src="<?php echo $GLOBALS['assets_static_relative'] ?>/manual-added-packages/qtip2-2-2-1/jquery.qtip.min.js"></script>
722 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/bootstrap/dist/css/bootstrap.min.css">
723 <link rel="stylesheet" href="<?php echo $GLOBALS['css_header']; ?>" type="text/css">
724 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-ui-themes-1-10-4/themes/ui-lightness/jquery-ui.min.css">
725 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/pure/0.5.0/pure-min.css">
726 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/manual-added-packages/qtip2-2-2-1/jquery.qtip.min.css" />
727 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/font-awesome/css/font-awesome.min.css">
728 <link rel="stylesheet" href="../../forms/<?php echo $form_folder; ?>/css/style.css" type="text/css">
730 <style>
731 .title {
732 font-size:1em;
733 position:absolute;
734 right:10px;
735 top:30px;
736 font-size: 1em;
738 .refraction {
739 width:95%;
740 display: -moz-stack;
741 vertical-align: middle;
742 min-height:unset;
744 .refraction td {
745 text-align:center;
746 font-size:12px;
747 padding:5;
748 width:0.35in;
749 vertical-align: text-middle;
750 text-decoration: unset;
752 table {
753 font-size: 1.0em;
754 padding: 12px;
755 color: black;
756 vertical-align: text-top;
759 input[type=text] {
760 text-align: center;
761 width: 60px;
762 padding: 0.2em 0.4em !important;
765 .refraction b {
766 font-weight: bold;
769 .refraction td.right {
770 text-align: right;
771 text-decoration: unset;
772 width: 0.7in;
773 vertical-align: middle; font-size:12px;
776 .refraction td.left {
777 vertical-align: middle;
778 text-align: left;
779 font-size:12px;
782 .right {
783 text-align: right;
784 vertical-align: middle;}
786 .left {
787 vertical-align: middle;
788 text-align: left;
791 .title {
792 font-size: 0.9em;
793 font-weight: normal;
796 .bold {
797 font-weight: 600;
800 input {
801 width: 60px;
804 input[type="radio"] {
805 width: 15px;
807 .underline {
808 text-decoration:underline !important
810 #CTLODQUANTITY, #CTLOSQUANTITY {
811 width: 300px;
812 text-align: left;
813 padding-left: 10px !important;
815 hr {
816 margin:1px;
818 label {
819 font-size:12px;
822 </style>
823 <!-- jQuery library -->
825 <script language="JavaScript">
826 <?php require_once("$srcdir/restoreSession.php"); ?>
827 function pick_rxType(rxtype, id) {
828 var url = "../../forms/eye_mag/SpectacleRx.php";
829 var formData = {
830 'RXTYPE': rxtype,
831 'id': id
833 top.restoreSession();
834 $.ajax({
835 type: 'POST',
836 url: url,
837 data: formData
839 if (rxtype == 'Trifocal') {
840 $("[name$='MIDADD']").show();
841 $("[name$='ADD2']").show();
842 } else if (rxtype == 'Bifocal') {
843 $("[name$='MIDADD']").hide().val('');
844 $("[name$='ADD2']").show();
845 } else if (rxtype == 'Progressive') {
846 $("[name$='MIDADD']").hide().val('');
847 $("[name$='ADD2']").show();
848 } else if (rxtype == "Single") {
849 $("[name$='MIDADD']").hide().val('');
850 $("[name$='ADD2']").hide().val('');
854 function submit_form() {
855 var url = "../../forms/eye_mag/SpectacleRx.php?mode=update";
856 formData = $("form#Spectacle").serialize();
857 top.restoreSession();
858 $.ajax({
859 type: 'POST',
860 url: url,
861 data: formData
865 //add sph and cyl, flip cyl sign, rotate axis 90.
866 function reverse_cylinder() {
867 var Rsph = $('#ODSPH').val();
868 var Rcyl = $('#ODCYL').val();
869 var Raxis = $('#ODAXIS').val();
870 var Lsph = $('#OSSPH').val();
871 var Lcyl = $('#OSCYL').val();
872 var Laxis = $('#OSAXIS').val();
873 if (Rsph == '' && Rcyl == '' && Lsph == '' && lcyl == '') return;
874 if ((!Rcyl.match(/SPH/i)) && (Rcyl > '')) {
875 if (Rsph.match(/plano/i)) Rsph = '0';
876 Rsph = Number(Rsph);
877 Rcyl = Number(Rcyl);
878 Rnewsph = Rsph + Rcyl;
879 if (Rnewsph == 0) Rnewsph = "PLANO";
880 Rnewcyl = Rcyl * -1;
881 if (Rnewcyl > 0) Rnewcyl = "+" + Rnewcyl;
882 if (parseInt(Raxis) < 90) {
883 Rnewaxis = parseInt(Raxis) + 90;
884 } else {
885 Rnewaxis = parseInt(Raxis) - 90;
887 if (Rnewcyl == '0') Rnewcyl = "SPH";
888 if (Rnewsph == '0') {
889 Rnewsph = "PLANO";
890 if (Rnewcyl == "SPH") Rnewcyl = '';
892 $("#ODSPH").val(Rnewsph);
893 $("#ODCYL").val(Rnewcyl);
894 $("#ODAXIS").val(Rnewaxis);
895 $('#ODAXIS').trigger('blur');
896 $('#ODSPH').trigger('blur');
897 $('#ODCYL').trigger('blur');
899 if ((!Lcyl.match(/SPH/i)) && (Lcyl > '')) {
900 if (!Lsph.match(/\d/)) Lsph = '0';
901 Lsph = Number(Lsph);
902 Lcyl = Number(Lcyl);
903 Lnewsph = Lsph + Lcyl;
904 Lnewcyl = Lcyl * -1;
905 if (Lnewcyl > 0) Lnewcyl = "+" + Lnewcyl;
906 if (parseInt(Laxis) < 90) {
907 Lnewaxis = parseInt(Laxis) + 90;
908 } else {
909 Lnewaxis = parseInt(Laxis) - 90;
912 if (Lnewcyl == '0') Lnewcyl = "SPH";
913 if (Lnewsph == '0') {
914 Lnewsph = "PLANO";
915 if (Lnewcyl == "SPH") Lnewcyl = '';
918 $("#OSSPH").val(Lnewsph);
919 $("#OSCYL").val(Lnewcyl);
920 $("#OSAXIS").val(Lnewaxis);
921 $('#OSAXIS').trigger('blur');
922 $('#OSSPH').trigger('blur');
923 $('#OSCYL').trigger('blur');
926 </script>
927 </head>
928 <body>
929 <?php echo report_header($pid, "web"); ?>
930 <br/><br/>
931 <?php
932 if ($REFTYPE == "CTL") {
933 $expir = date("Y-m-d", strtotime($CTL_expir, strtotime($data['date'])));
934 } else {
935 $expir = date("Y-m-d", strtotime($RX_expir, strtotime($data['date'])));
937 $expir_date = oeFormatShortDate($expir);
939 <p><b><?php echo xlt('Expiration Date'); ?>: </b>
940 &nbsp;&nbsp; <?php echo text($expir_date); ?>
942 <form method="post" action="<?php echo $rootdir; ?>/forms/<?php echo text($form_folder); ?>/SpectacleRx.php?mode=update"
943 id="Spectacle" class="eye_mag pure-form" name="Spectacle" style="text-align:center;">
944 <!-- start container for the main body of the form -->
945 <input type="hidden" name="REFDATE" id="REFDATE" value="<?php echo attr($data['date']); ?>">
946 <input type="hidden" name="RXTYPE" id="RXTYPE" value="<?php echo attr($RXTYPE); ?>">
947 <input type="hidden" name="REFTYPE" value="<?php echo attr($REFTYPE); ?>"/>
948 <input type="hidden" name="pid" id="pid" value="<?php echo attr($pid); ?>">
949 <input type="hidden" name="id" id="id" value="<?php echo attr($insert_this_id); ?>">
950 <input type="hidden" name="encounter" id="encounter" value="<?php echo $encounter; ?>">
952 <div style="width: 650px;">
954 <table style="margin: 0px auto;">
955 <tr>
956 <td>
957 <?php
958 if ($REFTYPE != "CTL") { ?>
959 <table id="SpectacleRx" name="SpectacleRx" class="refraction bordershadow"
960 style="min-width:610px;top:0px;">
961 <tr style="font-weight:bold;text-align:center;">
962 <td><i name="reverse" id="reverse" class="fa fa-gamepad fa-2x"></i></td>
963 <td></td>
964 <td><?php echo xlt('Sph{{Sphere}}'); ?></td>
965 <td><?php echo xlt('Cyl{{Cylinder}}'); ?></td>
966 <td><?php echo xlt('Axis{{Axis of a glasses prescription}}'); ?></td>
967 <td rowspan="5" class="right bold" colspan="1" >
968 <b class="bold underline"><?php echo xlt('Rx Type'); ?></b><br/><br/>
969 <b id="SingleVision_span" name="SingleVision_span"><?php echo xlt('Single'); ?>
970 <input type="radio"
971 onclick="pick_rxType('Single','<?php echo attr(addslashes($insert_this_id)); ?>');"
972 value="Single" id="RXTYPE" name="RXTYPE"
973 class="input-helper--radio input-helper--radio" <?php echo attr($Single); ?>></b><br/>
974 <b id="Bifocal_span" name="Bifocal_span"><?php echo xlt('Bifocal'); ?>
975 <input type="radio"
976 onclick="pick_rxType('Bifocal','<?php echo attr(addslashes($insert_this_id)); ?>');"
977 value="Bifocal" id="RXTYPE" name="RXTYPE" <?php echo attr($Bifocal); ?>></b><br/>
978 <b id="Trifocal_span" name="Trifocal_span"><?php echo xlt('Trifocal'); ?>
979 <input type="radio"
980 onclick="pick_rxType('Trifocal','<?php echo attr(addslashes($insert_this_id)); ?>');"
981 value="Trifocal" id="RXTYPE"
982 name="RXTYPE" <?php echo attr($Trifocal); ?>></b><br/>
983 <b id="Progressive_span"><?php echo xlt('Prog.{{Progressive lenses}}'); ?>
984 <input type="radio"
985 onclick="pick_rxType('Progressive','<?php echo attr(addslashes($insert_this_id)); ?>');"
986 value="Progressive" id="RXTYPE"
987 name="RXTYPE" <?php echo attr($Progressive); ?>></b><br/>
988 </td>
989 <td></td>
990 </tr>
991 <tr class="center">
992 <td rowspan="2" colspan="1" class="right bold"><?php echo xlt('Distance'); ?>: </td>
993 <td class="right bold"><?php echo xlt('OD{{right eye}}'); ?></td>
994 <td><input type=text id="ODSPH" name="ODSPH" value="<?php echo attr($ODSPH); ?>"></td>
995 <td><input type=text id="ODCYL" name="ODCYL" value="<?php echo attr($ODCYL); ?>"></td>
996 <td><input type=text id="ODAXIS" name="ODAXIS" value="<?php echo attr($ODAXIS); ?>">
997 </td>
998 </tr>
999 <tr class="center">
1000 <td name="W_wide" class="right bold"><?php echo xlt('OS{{left eye}}'); ?></td>
1001 <td><input type=text id="OSSPH" name="OSSPH" value="<?php echo attr($OSSPH); ?>"></td>
1002 <td><input type=text id="OSCYL" name="OSCYL" value="<?php echo attr($OSCYL); ?>"></td>
1003 <td><input type=text id="OSAXIS" name="OSAXIS" value="<?php echo attr($OSAXIS); ?>">
1004 </td>
1005 </tr>
1006 <tr class="NEAR center">
1007 <td rowspan="2" colspan="1" nowrap class="right bold"><?php echo xlt('ADD'); ?>:<br/>
1008 <?php echo xlt("Mid{{Middle segment in a trifocal glasses prescription}}"); ?>
1009 /<?php echo xlt("Near"); ?></td>
1010 <td class="right bold"><?php echo xlt('OD{{right eye}}'); ?></td>
1011 <td name="COLADD1"><input type="text" id="ODMIDADD" name="ODMIDADD"
1012 value="<?php echo attr($ODMIDADD); ?>"></td>
1013 <td class="WAdd2"><input type="text" id="ODADD2" name="ODADD2"
1014 value="<?php echo attr($ODADD2); ?>"></td>
1015 </tr>
1016 <tr class="NEAR center">
1017 <td class="right bold"><?php echo xlt('OS{{left eye}}'); ?></td>
1018 <td name="COLADD1">
1019 <input type="text" id="OSMIDADD" name="OSMIDADD" value="<?php echo attr($OSMIDADD); ?>"></td>
1020 <td class="WAdd2">
1021 <input type="text" id="OSADD2" name="OSADD2" value="<?php echo attr($OSADD2); ?>"></td>
1022 </tr>
1023 <tr>
1024 <td colspan="2" class="center bold"><?php echo xlt('Comments'); ?>: </td>
1025 <td colspan="4">
1026 <textarea style="width:100%;height:3em;" id="CRCOMMENTS"
1027 name="CRCOMMENTS"><?php echo text($COMMENTS); ?></textarea>
1028 </td>
1029 </tr>
1030 <!-- start Dispense data -->
1031 <tr class="header closeButton">
1032 <td colspan="9" class="right">
1033 <span><?php
1034 if ($ODHPD || $ODHBASE || $ODVPD || $ODVBASE || $ODSLABOFF || $ODVERTEXDIST ||
1035 $OSHPD || $OSHBASE || $OSVPD || $OSVBASE || $OSSLABOFF || $OSVERTEXDIST ||
1036 $ODMPDD || $ODMPDN || $OSMPDD || $OSMPDN || $BPDD || $BPDN ||
1037 $LENS_MATERIAL || $LENS_TREATMENTS) {
1038 $detailed = '1';
1039 ?><i class="fa fa-minus-square-o"></i><?php
1040 } else {
1041 $detailed = '0';
1042 ?><i class="fa fa-plus-square-o"></i><?php
1045 </span>
1047 </td>
1048 </tr>
1049 <tr>
1050 <td colspan="7">
1051 <hr/>
1052 </td>
1053 </tr>
1054 <tr class="dispense_data" style="font-weight:bold;text-align:center;">
1055 <td name="W_wide" colspan="1"></td>
1056 <td name="W_wide"
1057 title="<?php echo xla('Horizontal Prism Power'); ?>"><?php echo xlt('Horiz Prism{{abbreviation for Horizontal Prism Power}}'); ?></td>
1058 <td name="W_wide"
1059 title="<?php echo xla('Horizontal Prism Base'); ?>"><?php echo xlt('Horiz Base{{abbreviation for Horizontal Prism Base}}'); ?></td>
1060 <td name="W_wide"
1061 title="<?php echo xla('Vertical Prism Power'); ?>"><?php echo xlt('Vert Prism{{abbreviation for Vertical Prism Power}}'); ?></td>
1062 <td name="W_wide"
1063 title="<?php echo xla('Vertical Prism Base'); ?>"><?php echo xlt('Vert Base{{abbreviation for Vertical Prism Base}}'); ?></td>
1064 <td name="W_wide"
1065 title="<?php echo xla('Slab Off'); ?>"><?php echo xlt('Slab Off'); ?></td>
1066 <td name="W_wide"
1067 title="<?php echo xla('Vertex Distance'); ?>"><?php echo xlt('Vert Distance{{abbreviation for Vertex Distance}}'); ?></td>
1068 </tr>
1069 <tr class="dispense_data">
1070 <td name="W_wide" style="text-align:right;font-weight:bold;"
1071 colspan="1"><?php echo xlt('OD{{right eye}}'); ?></td>
1072 <td name="W_wide"><input type="text" class="prism" id="ODHPD" name="ODHPD"
1073 value="<?php echo attr($ODHPD); ?>"></td>
1074 <td name="W_wide"><input type="text" class="prism" id="ODHBASE" name="ODHBASE"
1075 value="<?php echo attr($ODHBASE); ?>"></td>
1076 <td name="W_wide"><input type="text" class="prism" id="ODVPD" name="ODVPD"
1077 value="<?php echo attr($ODVPD); ?>"></td>
1078 <td name="W_wide"><input type="text" class="prism" id="ODVBASE" name="ODVBASE"
1079 value="<?php echo attr($ODVBASE); ?>"></td>
1080 <td name="W_wide"><input type="text" class="prism" id="ODSLABOFF" name="ODSLABOFF"
1081 value="<?php echo attr($ODSLABOFF); ?>"></td>
1082 <td name="W_wide"><input type="text" class="prism" id="ODVERTEXDIST" name="ODVERTEXDIST"
1083 value="<?php echo attr($ODVERTEXDIST); ?>"></td>
1084 </tr>
1085 <tr class="dispense_data">
1086 <td name="W_wide" style="text-align:right;font-weight:bold;"
1087 colspan="1"><?php echo xlt('OS{{left eye}}'); ?></td>
1088 <td name="W_wide"><input type="text" class="prism" id="OSHPD" name="OSHPD"
1089 value="<?php echo attr($OSHPD); ?>"></td>
1090 <td name="W_wide"><input type="text" class="prism" id="OSHBASE" name="OSHBASE"
1091 value="<?php echo attr($OSHBASE); ?>"></td>
1092 <td name="W_wide"><input type="text" class="prism" id="OSVPD" name="OSVPD"
1093 value="<?php echo attr($OSVPD); ?>"></td>
1094 <td name="W_wide"><input type="text" class="prism" id="OSVBASE" name="OSVBASE"
1095 value="<?php echo attr($OSVBASE); ?>"></td>
1096 <td name="W_wide"><input type="text" class="prism" id="OSSLABOFF" name="OSSLABOFF"
1097 value="<?php echo attr($OSSLABOFF); ?>"></td>
1098 <td name="W_wide"><input type="text" class="prism" id="OSVERTEXDIST" name="OSVERTEXDIST"
1099 value="<?php echo attr($OSVERTEXDIST); ?>"></td>
1100 </tr>
1101 <tr class="dispense_data">
1102 <td colspan="7" class="center">
1103 <hr/>
1104 </td>
1105 </tr>
1106 <tr class="dispense_data" style="font-weight:bold;text-align:center;">
1107 <td></td>
1108 <td name="W_wide"
1109 title="<?php echo xla('Monocular Pupillary Diameter - Distance'); ?>"><?php echo xlt('MPD-D{{abbreviation for Monocular Pupillary Diameter - Distance}}'); ?></td>
1110 <td name="W_wide"
1111 title="<?php echo xla('Monocular Pupillary Diameter - Near'); ?>"><?php echo xlt('MPD-N{{abbreviation for Monocular Pupillary Diameter - Near}}'); ?></td>
1112 <td name="W_wide"
1113 title="<?php echo xla('Binocular Pupillary Diameter - Distance'); ?>"><?php echo xlt('BPD-D{{abbreviation for Binocular Pupillary Diameter - Distance}}'); ?></td>
1114 <td name="W_wide"
1115 title="<?php echo xla('Binocular Pupillary Diameter - Near'); ?>"><?php echo xlt('BPD-N{{abbreviation for Binocular Pupillary Diameter - Near}}'); ?></td>
1117 <td colspan="2">Lens Material:</td>
1118 </tr>
1119 <tr>
1120 <td name="W_wide" style="text-align:right;font-weight:bold;"
1121 colspan="1"><?php echo xlt('OD{{right eye}}'); ?></td>
1122 <td name="W_wide"><input type="text" class="prism" id="ODMPDD" name="ODMPDD"
1123 value="<?php echo attr($ODMPDD); ?>"></td>
1124 <td name="W_wide"><input type="text" class="prism" id="ODMPDN" name="ODMPDN"
1125 value="<?php echo attr($ODMPDN); ?>"></td>
1126 <td name="W_wide" rowspan="2" style="vertical-align:middle;"><input type="text"
1127 class="prism"
1128 id="BPDD"
1129 name="BPDD"
1130 value="<?php echo attr($BPDD); ?>">
1131 </td>
1132 <td name="W_wide" rowspan="2" style="vertical-align:middle;"><input type="text"
1133 class="prism"
1134 id="BPDN"
1135 name="BPDN"
1136 value="<?php echo attr($BPDN); ?>">
1137 </td>
1138 <td colspan="2"> <?php
1139 echo generate_select_list("LENS_MATERIAL", "Eye_Lens_Material", "$LENS_MATERIAL", '', ' ', '', 'restoreSession;submit_form();', '', array('style' => 'width:120px'));
1141 </td>
1142 </tr>
1143 <tr>
1144 <td name="W_wide" style="text-align:right;font-weight:bold;"
1145 colspan="1"><?php echo xlt('OS{{left eye}}'); ?></td>
1146 <td name="W_wide"><input type="text" class="prism" id="OSMPDD" name="OSMPDD"
1147 value="<?php echo attr($OSMPDD); ?>"></td>
1148 <td name="W_wide"><input type="text" class="prism" id="OSMPDN" name="OSMPDN"
1149 value="<?php echo attr($OSMPDN); ?>"></td>
1150 </tr>
1151 <tr style="font-weight:bold;text-align:center;">
1152 <td colspan="3"><?php echo xlt('Lens Treatments'); ?>
1153 </td>
1154 </tr>
1155 <tr style="text-align:left;vertical-align:top;">
1156 <td colspan="4" class="bold left">
1157 <?php echo generate_lens_treatments($W, $LENS_TREATMENTS); ?>
1158 </td>
1159 </tr>
1160 </table>&nbsp;<br/><br/><br/>
1161 <?php
1162 } else {
1163 if (!empty($ODADD) || !empty($OSADD)) {
1164 $adds =1;
1165 } else {
1166 $adds ='';
1169 <table id="CTLRx" name="CTLRx" class="refraction bordershadow">
1170 <tr class="bold center">
1171 <td class="right bold underline"><?php echo xlt('Right Lens'); ?></td>
1172 </tr>
1173 <tr>
1174 <td colspan="2" class="right bold text-uppercase"><?php echo xlt('Brand'); ?>:</td>
1175 <td colspan="4" class="left"><?php echo text($CTLBRANDOD); ?> <?php if ($CTLMANUFACTUREROD) {
1176 echo "(".text($CTLMANUFACTUREROD).")";} ?></td>
1177 </tr>
1178 <tr class="bold">
1179 <td><?php echo xlt('SPH{{Sphere}}'); ?></td>
1180 <td><?php echo xlt('CYL{{Cylinder}}'); ?></td>
1181 <td><?php echo xlt('AXIS{{Axis of a glasses prescription}}'); ?></td>
1182 <td><?php echo xlt('BC{{Base Curve}}'); ?></td>
1183 <td><?php echo xlt('DIAM{{Diameter}}'); ?></td>
1184 <?php
1185 if ($adds) {
1187 <td><?php echo xlt('ADD{{Bifocal Add}}'); ?></td>
1188 <?php } ?>
1189 </tr>
1190 <tr>
1191 <td><input type=text id="CTLODSPH" name="CTLODSPH" value="<?php echo attr($ODSPH); ?>">
1192 </td>
1193 <td><input type=text id="CTLODCYL" name="CTLODCYL" value="<?php echo attr($ODCYL); ?>">
1194 </td>
1195 <td><input type=text id="CTLODAXIS" name="CTLODAXIS"
1196 value="<?php echo attr($ODAXIS); ?>"></td>
1197 <td><input type=text id="CTLODBC" name="CTLODBC" value="<?php echo attr($ODBC); ?>">
1198 </td>
1199 <td><input type=text id="CTLODDIAM" name="CTLODDIAM"
1200 value="<?php echo attr($ODDIAM); ?>"></td>
1201 <?php
1202 if ($adds) {
1204 <td><input type=text id="CTLODADD" name="CTLODADD" value="<?php echo attr($ODADD); ?>">
1205 </td>
1206 <?php } ?>
1207 </tr>
1208 <tr>
1209 <td colspan="2" class="right bold text-uppercase"><?php echo xlt('Quantity:'); ?></td>
1210 <td colspan="4" class="left"><input id="CTLODQUANTITY" name="CTLODQUANTITY" value="<?php echo attr($CTLODQUANTITY); ?>" type="text" class="left" /></td>
1211 </tr>
1212 <tr>
1213 <td colspan="7">
1214 <hr />
1215 </td>
1216 </tr>
1217 <tr>
1218 <td class="right bold large underline"><?php echo xlt('Left Lens'); ?></td>
1219 </tr>
1220 <tr>
1221 <td colspan="2" class="right bold text-uppercase"><?php echo xlt('Brand'); ?>:</td>
1222 <td colspan="4" class="left"><?php echo text($CTLBRANDOS); ?> <?php if ($CTLMANUFACTUREROS) {
1223 echo "(".text($CTLMANUFACTUREROS).")";} ?></td>
1224 </tr>
1225 <tr class="bold" style="line-height:0.3em;font-size:0.6em;">
1226 <td><?php echo xlt('SPH{{Sphere}}'); ?></td>
1227 <td><?php echo xlt('CYL{{Cylinder}}'); ?></td>
1228 <td><?php echo xlt('AXIS{{Axis of a glasses prescription}}'); ?></td>
1229 <td><?php echo xlt('BC{{Base Curve}}'); ?></td>
1230 <td><?php echo xlt('DIAM{{Diameter}}'); ?></td>
1231 <?php
1232 if ($adds) {
1234 <td><?php echo xlt('ADD{{Bifocal Add}}'); ?></td>
1235 <?php } ?>
1236 </tr>
1237 <tr>
1238 <td><input type=text id="CTLOSSPH" name="CTLOSSPH" value="<?php echo attr($OSSPH); ?>">
1239 </td>
1240 <td><input type=text id="CTLOSCYL" name="CTLOSCYL" value="<?php echo attr($OSCYL); ?>">
1241 </td>
1242 <td><input type=text id="CTLOSAXIS" name="CTLOSAXIS"
1243 value="<?php echo attr($OSAXIS); ?>"></td>
1244 <td><input type=text id="CTLOSBC" name="CTLOSBC" value="<?php echo attr($OSBC); ?>">
1245 </td>
1246 <td><input type=text id="CTLOSDIAM" name="CTLOSDIAM"
1247 value="<?php echo attr($OSDIAM); ?>"></td>
1248 <?php
1249 if ($adds) {
1251 <td><input type=text id="CTLOSADD" name="CTLOSADD" value="<?php echo attr($OSADD); ?>"></td>
1252 <?php } ?>
1253 </tr>
1254 <tr>
1255 <td colspan="2" class="right bold text-uppercase"><?php echo xlt('Quantity:'); ?></td>
1256 <td colspan="4" class="left"><input id="CTLOSQUANTITY" name="CTLOSQUANTITY" value="<?php echo attr($CTLOSQUANTITY); ?>" type="text" class="left" /></td>
1257 </tr>
1259 <?php if ($CTL_COMMENTS > '') { ?>
1260 <tr>
1261 <td colspan="7">
1262 <hr />
1263 </td>
1264 </tr>
1265 <tr>
1266 <td class="right bold red" colspan="2"
1267 style="vertical-align:top;"><?php echo xlt('Comments'); ?>:</u></td>
1268 <td colspan="4" class="left">
1269 <textarea cols="30" rows="4" id="COMMENTS" name="COMMENTS"><?php echo text($CTL_COMMENTS); ?></textarea>
1270 </td>
1271 </tr>
1272 <?php } ?>
1273 </table>
1274 <?php
1275 } ?>
1276 </td>
1277 </tr>
1278 <tr>
1279 <?php
1280 $signature = $GLOBALS['fileroot'] . "/interface/forms/eye_mag/images/sign_" . attr($_SESSION['authUserID']) . ".jpg";
1281 if (file_exists($signature)) {
1283 <td class="center" style="margin:25px auto;">
1284 <span style="position:relative;padding-left:40px;">
1285 <img src='<?php echo $web_root; ?>/interface/forms/eye_mag/images/sign_<?php echo attr($_SESSION['authUserID']); ?>.jpg'
1286 style="width:240px;height:85px;border-block-end: 1pt solid black;margin:5px;"/>
1287 </span><br/>
1289 <?php
1290 } else {
1292 <td class="center">
1293 <hr style="border:solid 1px black;width:50%;margin:0.5in auto 0;" />
1294 <?php
1295 } ?>
1297 <?php echo xlt('Provider'); ?>
1298 : <?php echo text($prov_data['fname']); ?> <?php echo text($prov_data['lname']);
1299 if ($prov_data['suffix']) {
1300 echo ", " . $prov_data['suffix'];
1301 } ?><br/>
1302 <small><?php echo xlt('e-signed'); ?> <input type="checkbox" checked="checked"></small>
1303 </td>
1304 </tr>
1307 </table>
1308 </div>
1309 </form>
1311 </body>
1312 <script>
1313 $(document).ready(function () {
1314 $('.header').click(function () {
1315 var $this = $(this);
1316 $(this).nextUntil('tr.header').slideToggle(100).promise().done(function () {
1317 $this.find('span').html(function (_, value) {
1318 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>';
1322 <?php
1323 if (!$detailed) {
1324 echo "$('.header').trigger('click');";
1325 } ?>
1327 $("input[name$='PD']").blur(function () {
1328 //make it all caps
1329 var str = $(this).val();
1330 str = str.toUpperCase();
1331 $(this).val(str);
1333 $('input[name$="SPH"]').blur(function () {
1334 var mid = $(this).val();
1335 if (mid.match(/PLANO/i)) {
1336 $(this).val('PLANO');
1337 return;
1339 if (mid.match(/^[\+\-]?\d{1}$/)) {
1340 mid = mid + ".00";
1342 if (mid.match(/\.[27]$/)) {
1343 mid = mid + '5';
1345 if (mid.match(/\.\d$/)) {
1346 mid = mid + '0';
1348 //if near is +2. make it +2.00
1349 if (mid.match(/\.$/)) {
1350 mid = mid + '00';
1352 if ((!mid.match(/\./)) && (mid.match(00 | 25 | 50 | 75))) {
1353 var front = mid.match(/(\d{0,2})(00|25|50|75)/)[1];
1354 var back = mid.match(/(\d{0,2})(00|25|50|75)/)[2];
1355 if (front == '') front = '0';
1356 mid = front + "." + back;
1358 if (!mid.match(/\./)) {
1359 var front = mid.match(/([\+\-]?\d{0,2})(\d{2})/)[1];
1360 var back = mid.match(/(\d{0,2})(\d{2})/)[2];
1361 if (front == '') front = '0';
1362 if (front == '-') front = '-0';
1363 mid = front + "." + back;
1365 if (!mid.match(/^(\+|\-){1}/)) {
1366 mid = "+" + mid;
1368 $(this).val(mid);
1371 $("input[name$='ADD'],input[name$='ADD2']").blur(function () {
1372 var add = $(this).val();
1373 add = add.replace(/=/g, "+");
1374 //if add is one digit, eg. 2, make it +2.00
1375 if (add.match(/^\d{1}$/)) {
1376 add = "+" + add + ".00";
1378 //if add is '+'one digit, eg. +2, make it +2.00
1379 if (add.match(/^\+\d{1}$/)) {
1380 add = add + ".00";
1382 //if add is 2.5 or 2.0 make it 2.50 or 2.00
1383 if (add.match(/\.[05]$/)) {
1384 add = add + '0';
1386 //if add is 2.2 or 2.7 make it 2.25 or 2.75
1387 if (add.match(/\.[27]$/)) {
1388 add = add + '5';
1390 //if add is +2. make it +2.00
1391 if (add.match(/\.$/)) {
1392 add = add + '00';
1394 if ((!add.match(/\./)) && (add.match(/(0|25|50|75)$/))) {
1395 var front = add.match(/([\+]?\d{0,1})(00|25|50|75)/)[1];
1396 var back = add.match(/([\+]?\d{0,1})(00|25|50|75)/)[2];
1397 if (front == '') front = '0';
1398 add = front + "." + back;
1400 if (!add.match(/^(\+)/) && (add.length > 0)) {
1401 add = "+" + add;
1403 $(this).val(add);
1404 if (this.id == "ODADD2") $('#OSADD2').val(add);
1405 if (this.id == "ODMIDADD") $('#OSMIDADD').val(add);
1406 if (this.id == "CTLODADD") $('#CTLOSADD').val(add);
1409 $("input[name$='AXIS']").blur(function () {
1410 // Make this a 3 digit leading zeros number.
1411 // we are not translating text to numbers, just numbers to
1412 // a 3 digit format with leading zeroes as needed.
1413 // assume the end user KNOWS there are only numbers presented and
1414 // more than 3 digits is a mistake...
1415 // (although this may change with topographic answer)
1416 var axis = $(this).val();
1417 var group = this.name.replace("AXIS", "CYL");
1419 var cyl = $("#" + group).val();
1420 if ((cyl > '') && (cyl != 'SPH')) {
1421 if (!axis.match(/\d\d\d/)) {
1422 if (!axis.match(/\d\d/)) {
1423 if (!axis.match(/\d/)) {
1424 axis = '0';
1426 axis = '0' + axis;
1428 axis = '0' + axis;
1430 } else {
1431 axis = '';
1433 $(this).val(axis);
1435 $("[name$='CYL']").blur(function () {
1436 var mid = $(this).val();
1437 var group = this.name.replace("CYL", "SPH");
1439 var sphere = $("#" + group).val();
1440 if (((mid.length == 0) && (sphere.length > 0)) || (mid.match(/sph/i))) {
1441 $(this).val('SPH');
1442 var axis = this.name.replace("CYL", "AXIS");
1443 $("#" + axis).val('');
1444 return;
1445 } else if (sphere.length > 0) {
1446 if (mid.match(/^[\+\-]?\d{1}$/)) {
1447 mid = mid + ".00";
1449 if (mid.match(/^(\d)(\d)$/)) {
1450 mid = mid[0] + '.' + mid[1];
1452 //if mid is 2.5 or 2.0 make it 2.50 or 2.00
1453 if (mid.match(/\.[05]$/)) {
1454 mid = mid + '0';
1456 //if mid is 2.2 or 2.7 make it 2.25 or 2.75
1457 if (mid.match(/\.[27]$/)) {
1458 mid = mid + '5';
1460 //if mid is +2. make it +2.00
1461 if (mid.match(/\.$/)) {
1462 mid = mid + '00';
1464 if (mid.match(/([\+\-]?\d{0,2})\.?(00|25|50|75)/)) {
1465 var front = mid.match(/([\+\-]?\d{0,2})\.?(00|25|50|75)/)[1];
1466 var back = mid.match(/([\+\-]?\d{0,2})\.?(00|25|50|75)/)[2];
1467 if (front == '') front = '0';
1468 mid = front + "." + back;
1470 if (!mid.match(/^(\+|\-){1}/) && (sphere.length > 0)) {
1471 //Since it doesn't start with + or - then give it '+'
1472 mid = "+" + mid;
1474 $(this).val(mid);
1477 $("input,textarea,text,checkbox").change(function () {
1478 submit_form($(this));
1480 $("#reverse").click(function () {
1481 //alert('Start');
1482 reverse_cylinder('');
1483 //alert('Finish');
1486 $("input[name$='SPH'],input[name$='CYL']").on('keyup', function (e) {
1487 if (e.keyCode == '61' || e.keyCode == '74') {
1488 now = $(this).val();
1489 now = now.replace(/=/g, "+").replace(/^j/g, "J");
1490 $(this).val(now);
1495 </script>
1496 </html>
1498 <?php
1499 $content = ob_get_clean();
1500 echo $content;
1501 exit;