psr2 fixes for prior commit
[openemr.git] / interface / forms / eye_mag / SpectacleRx.php
blob167d5c0df25eab7f6a040cc54c56dbffc9966d99
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 //echo "<pre>";var_dump($_REQUEST);exit;
47 if (!$_REQUEST['pid'] && $_REQUEST['id']) {
48 $_REQUEST['pid'] = $_REQUEST['id'];
50 if (!$_REQUEST['pid']) {
51 $_REQUEST['pid'] = $_SESSION['pid'];
54 $query = "select *,form_encounter.date as encounter_date
55 from forms,form_encounter,form_eye_base,
56 form_eye_hpi,form_eye_ros,form_eye_vitals,
57 form_eye_acuity,form_eye_refraction,form_eye_biometrics,
58 form_eye_external, form_eye_antseg,form_eye_postseg,
59 form_eye_neuro,form_eye_locking
60 where
61 forms.deleted != '1' and
62 forms.formdir='eye_mag' and
63 forms.encounter=form_encounter.encounter and
64 forms.form_id=form_eye_base.id and
65 forms.form_id=form_eye_hpi.id and
66 forms.form_id=form_eye_ros.id and
67 forms.form_id=form_eye_vitals.id and
68 forms.form_id=form_eye_acuity.id and
69 forms.form_id=form_eye_refraction.id and
70 forms.form_id=form_eye_biometrics.id and
71 forms.form_id=form_eye_external.id and
72 forms.form_id=form_eye_antseg.id and
73 forms.form_id=form_eye_postseg.id and
74 forms.form_id=form_eye_neuro.id and
75 forms.form_id=form_eye_locking.id and
76 forms.encounter=? and
77 forms.pid=? ";
79 $data = sqlQuery($query, array($_REQUEST['encounter'], $_REQUEST['pid']));
80 $data['ODMPDD'] = $data['ODPDMeasured'];
81 $data['OSMPDD'] = $data['OSPDMeasured'];
82 $data['BPDD'] = $data['ODMPDD'] + $data['OSMPDD'];
83 @extract($data);
85 $ODMPDD = $ODPDMeasured;
86 $OSMPDD = $OSPDMeasured;
87 $BPDD = $ODMPDD + $OSMPDD;
89 $query = "SELECT * FROM users where id = ?";
90 $prov_data = sqlQuery($query, array($data['provider_id']));
92 $query = "SELECT * FROM patient_data where pid=?";
93 $pat_data = sqlQuery($query, array($data['pid']));
95 $practice_data = $facilityService->getPrimaryBusinessEntity();
97 $visit_date = oeFormatShortDate($data['encounter_date']);
99 if ($_REQUEST['mode'] == "update") { //store any changed fields in dispense table
100 $table_name = "form_eye_mag_dispense";
101 $query = "show columns from " . $table_name;
102 $dispense_fields = sqlStatement($query);
103 $fields = array();
105 if (sqlNumRows($dispense_fields) > 0) {
106 while ($row = sqlFetchArray($dispense_fields)) {
107 //exclude critical columns/fields, define below as needed
108 if ($row['Field'] == 'id' ||
109 $row['Field'] == 'pid' ||
110 $row['Field'] == 'user' ||
111 $row['Field'] == 'groupname' ||
112 $row['Field'] == 'authorized' ||
113 $row['Field'] == 'activity' ||
114 $row['Field'] == 'date'
116 continue;
119 if (isset($_POST[$row['Field']])) {
120 $fields[$row['Field']] = $_POST[$row['Field']];
123 $fields['RXTYPE'] = $RXTYPE;
125 $insert_this_id = formUpdate($table_name, $fields, $_POST['id'], $_SESSION['userauthorized']);
128 exit;
129 } else if ($_REQUEST['mode'] == "remove") {
130 $query = "DELETE FROM form_eye_mag_dispense where id=?";
131 sqlStatement($query, array($_REQUEST['delete_id']));
132 echo xlt('Prescription successfully removed.');
133 exit;
134 } else if ($_REQUEST['RXTYPE']) { //store any changed fields
135 $query = "UPDATE form_eye_mag_dispense set RXTYPE=? where id=?";
136 sqlStatement($query, array($_REQUEST['RXTYPE'], $_REQUEST['id']));
137 exit;
140 formHeader("OpenEMR Eye: " . $prov_data[facility]);
142 if ($_REQUEST['REFTYPE']) {
143 $REFTYPE = $_REQUEST['REFTYPE'];
144 if ($REFTYPE == "AR") {
145 $RXTYPE = "Bifocal";
148 if ($REFTYPE == "MR") {
149 $RXTYPE = "Bifocal";
152 if ($REFTYPE == "CTL") {
153 $RXTYPE = "Bifocal";
156 $id = $_REQUEST['id'];
157 $table_name = "form_eye_mag";
158 if (!$_REQUEST['encounter']) {
159 $encounter = $_SESSION['encounter'];
160 } else {
161 $encounter = $_REQUEST['encounter'];
166 if ($REFTYPE =="W") {
167 //we have rx_number 1-5 to process...
168 $query = "select * from form_eye_mag_wearing where ENCOUNTER=? and FORM_ID=? and PID=? and RX_NUMBER=?";
169 $wear = sqlStatement($query, array($encounter,$_REQUEST['form_id'],$_REQUEST['pid'],$_REQUEST['rx_number']));
170 $wearing = sqlFetchArray($wear);
171 $ODSPH = $wearing['ODSPH'];
172 $ODAXIS = $wearing['ODAXIS'];
173 $ODCYL = $wearing['ODCYL'];
174 $OSSPH = $wearing['OSSPH'];
175 $OSCYL = $wearing['OSCYL'];
176 $OSAXIS = $wearing['OSAXIS'];
177 $COMMENTS = $wearing['COMMENTS'];
178 $ODMIDADD = $wearing['ODMIDADD'];
179 $ODADD2 = $wearing['ODADD'];
180 $OSMIDADD = $wearing['OSMIDADD'];
181 $OSADD2 = $wearing['OSADD'];
182 @extract($wearing);
183 if ($wearing['RX_TYPE']=='0') {
184 $Single="checked='checked'";
185 $RXTYPE="Single";
186 } elseif ($wearing['RX_TYPE']=='1') {
187 $Bifocal ="checked='checked'";
188 $RXTYPE="Bifocal";
189 } elseif ($wearing['RX_TYPE']=='2') {
190 $Trifocal ="checked='checked'";
191 $RXTYPE="Trifocal";
192 } elseif ($wearing['RX_TYPE']=='3') {
193 $Progressive ="checked='checked'";
194 $RXTYPE="Progressive";
197 //do LT and Lens materials
198 } elseif ($REFTYPE == "AR") {
199 $ODSPH = $data['ARODSPH'];
200 $ODAXIS = $data['ARODAXIS'];
201 $ODCYL = $data['ARODCYL'];
202 $ODPRISM = $data['ARODPRISM'];
203 $OSSPH = $data['AROSSPH'];
204 $OSCYL = $data['AROSCYL'];
205 $OSAXIS = $data['AROSAXIS'];
206 $OSPRISM = $data['AROSPRISM'];
207 $COMMENTS = $data['CRCOMMENTS'];
208 $ODADD2 = $data['ARODADD'];
209 $OSADD2 = $data['AROSADD'];
210 $Bifocal = "checked='checked'";
211 } elseif ($REFTYPE == "MR") {
212 $ODSPH = $data['MRODSPH'];
213 $ODAXIS = $data['MRODAXIS'];
214 $ODCYL = $data['MRODCYL'];
215 $ODPRISM = $data['MRODPRISM'];
216 $OSSPH = $data['MROSSPH'];
217 $OSCYL = $data['MROSCYL'];
218 $OSAXIS = $data['MROSAXIS'];
219 $OSPRISM = $data['MROSPRISM'];
220 $COMMENTS = $data['CR_COMMENTS'];
221 $ODADD2 = $data['MRODADD'];
222 $OSADD2 = $data['MROSADD'];
223 $Bifocal = "checked='checked'";
224 } elseif ($REFTYPE == "CR") {
225 $ODSPH = $data['CRODSPH'];
226 $ODAXIS = $data['CRODAXIS'];
227 $ODCYL = $data['CRODCYL'];
228 $ODPRISM = $data['CRODPRISM'];
229 $OSSPH = $data['CROSSPH'];
230 $OSCYL = $data['CROSCYL'];
231 $OSAXIS = $data['CROSAXIS'];
232 $OSPRISM = $data['CROSPRISM'];
233 $COMMENTS = $data['CRCOMMENTS'];
234 } elseif ($REFTYPE == "CTL") {
235 $ODSPH = $data['CTLODSPH'];
236 $ODAXIS = $data['CTLODAXIS'];
237 $ODCYL = $data['CTLODCYL'];
238 $ODPRISM = $data['CTLODPRISM'];
240 $OSSPH = $data['CTLOSSPH'];
241 $OSCYL = $data['CTLOSCYL'];
242 $OSAXIS = $data['CTLOSAXIS'];
243 $OSPRISM = $data['CTLOSPRISM'];
245 $ODBC = $data['CTLODBC'];
246 $ODDIAM = $data['CTLODDIAM'];
247 $ODADD = $data['CTLODADD'];
248 $ODVA = $data['CTLODVA'];
250 $OSBC = $data['CTLOSBC'];
251 $OSDIAM = $data['CTLOSDIAM'];
252 $OSADD = $data['CTLOSADD'];
253 $OSVA = $data['CTLOSVA'];
255 $COMMENTS = $data['CTL_COMMENTS'];
257 $CTLMANUFACTUREROD = getListItemTitle('CTLManufacturer', $data['CTLMANUFACTUREROD']);
258 $CTLMANUFACTUREROS = getListItemTitle('CTLManufacturer', $data['CTLMANUFACTUREROS']);
259 $CTLSUPPLIEROD = getListItemTitle('CTLManufacturer', $data['CTLSUPPLIEROD']);
260 $CTLSUPPLIEROS = getListItemTitle('CTLManufacturer', $data['CTLSUPPLIEROS']);
261 $CTLBRANDOD = getListItemTitle('CTLManufacturer', $data['CTLBRANDOD']);
262 $CTLBRANDOS = getListItemTitle('CTLManufacturer', $data['CTLBRANDOS']);
265 //Since we selected the Print Icon, we must be dispensing this - add to dispensed table now
266 $table_name = "form_eye_mag_dispense";
267 $query = "show columns from " . $table_name;
268 $dispense_fields = sqlStatement($query);
269 $fields = array();
271 if (sqlNumRows($dispense_fields) > 0) {
272 while ($row = sqlFetchArray($dispense_fields)) {
273 //exclude critical columns/fields, define below as needed
274 if ($row['Field'] == 'id' ||
275 $row['Field'] == 'pid' ||
276 $row['Field'] == 'user' ||
277 $row['Field'] == 'groupname' ||
278 $row['Field'] == 'authorized' ||
279 $row['Field'] == 'activity' ||
280 $row['Field'] == 'RXTYPE' ||
281 $row['Field'] == 'REFDATE' ||
282 $row['Field'] == 'date'
284 continue;
286 if (isset(${$row['Field']})) {
287 $fields[$row['Field']] = ${$row['Field']};
291 $fields['RXTYPE'] = $RXTYPE;
292 $fields['REFDATE'] = $data['date'];
293 $insert_this_id = formSubmit($table_name, $fields, $form_id, $_SESSION['userauthorized']);
297 if ($_REQUEST['dispensed']) {
298 $query = "SELECT * from form_eye_mag_dispense where pid =? ORDER BY date DESC";
299 $dispensed = sqlStatement($query, array($_REQUEST['pid']));
300 //could put Robert's header here
302 <html>
303 <title><?php echo xlt('Rx Dispensed History'); ?></title>
304 <head>
305 <script src="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-min-1-10-2/index.js"></script>
306 <script src="<?php echo $GLOBALS['assets_static_relative'] ?>/bootstrap-3-3-4/dist/js/bootstrap.min.js"></script>
307 <script src="<?php echo $GLOBALS['assets_static_relative'] ?>/qtip2-2-2-1/jquery.qtip.min.js"></script>
308 <script type="text/javascript" src="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js"></script>
310 <link rel="stylesheet"
311 href="<?php echo $GLOBALS['assets_static_relative'] ?>/bootstrap-3-3-4/dist/css/bootstrap.min.css">
312 <link rel="stylesheet" href="<?php echo $GLOBALS['css_header']; ?>" type="text/css">
313 <link rel="stylesheet"
314 href="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-ui-1-10-4/themes/ui-lightness/jquery-ui.min.css">
315 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/pure-0-5-0/pure-min.css">
316 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/qtip2-2-2-1/jquery.qtip.min.css"/>
317 <link rel="stylesheet"
318 href="<?php echo $GLOBALS['assets_static_relative'] ?>/font-awesome-4-6-3/css/font-awesome.min.css">
319 <link rel="stylesheet" href="../../forms/<?php echo $form_folder; ?>/css/style.css" type="text/css">
321 <style>
322 .refraction {
323 top: 1in;
324 float: left;
325 min-height: 1.0in;
326 border: 1.00pt solid #000000;
327 padding: 5px;
328 border-radius: 8px;
329 margin: 5px auto;
332 .refraction td {
333 text-align: center;
334 font-size: 8pt;
335 padding: 2;
336 text-decoration: none;
339 table {
340 font-size: 1.0em;
341 padding: 2px;
342 color: black;
343 vertical-align: text-top;
346 input[type=text] {
347 text-align: right;
348 width: 50px;
349 background-color: white;
352 .refraction b {
353 text-decoration: bold;
356 .refraction td.right {
357 text-align: right;
358 text-decoration: none;
359 vertical-align: text-top;
362 .refraction td.left {
363 text-align: left;
364 vertical-align: top;
367 .right {
368 text-align: right;
369 vertical-align: text-top;
372 .left {
373 text-align: left;
374 vertical-align: top;
377 .title {
378 font-size: 0.9em;
379 font-weight: normal;
381 </style>
382 <script language="JavaScript">
383 <?php require_once("$srcdir/restoreSession.php"); ?>
385 function delete_me(delete_id) {
386 top.restoreSession();
387 var url = "../../forms/eye_mag/SpectacleRx.php";
388 $.ajax({
389 type: 'POST',
390 url: url,
391 data: {
392 mode: 'remove',
393 delete_id: delete_id,
394 dispensed: '1'
395 } // our data object
396 }).done(function (o) {
397 $('#RXID_' + delete_id).hide();
398 alert(o);
402 </script>
403 </head>
404 <?php echo report_header($pid, "web"); ?>
405 <div class="row">
406 <div class="col-sm-8 offset-sm-2" style="margin:5;text-align:center;">
407 <table>
408 <tr>
409 <td colspan="2"><h4 class="underline"><?php echo xlt('Rx History'); ?></h4></td>
410 </tr>
411 <?php
412 if (sqlNumRows($dispensed) == 0) {
413 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>";
416 </table>
417 <?php
418 while ($row = sqlFetchArray($dispensed)) {
419 $i++;
420 $Single = '';
421 $Bifocal = '';
422 $Trifocal = '';
423 $Progressive = '';
424 if ($row['RXTYPE'] == "Single") {
425 $Single = "checked='checked'";
428 if ($row['RXTYPE'] == "Bifocal") {
429 $Bifocal = "checked='checked'";
432 if ($row['RXTYPE'] == "Trifocal") {
433 $Trifocal = "checked='checked'";
436 if ($row['RXTYPE'] == "Progressive") {
437 $Progressive = "checked='checked'";
440 $row['REFDATE'] = oeFormatShortDate($row['REFDATE']);
441 $row['date'] = oeFormatShortDate(date('Y-m-d', strtotime($row['date'])));
442 if ($REFTYPE == "CTL") {
443 $expir = date("Y-m-d", strtotime("+1 years", strtotime($row['REFDATE'])));
444 } else {
445 $expir = date("Y-m-d", strtotime("+6 months", strtotime($row['REFDATE'])));
447 $expir_date = oeFormatShortDate($expir);
450 <div id="RXID_<?php echo attr($row['id']); ?>"
451 style="position:relative;text-align:center;width:80%;margin: 10 auto;">
452 <i class="pull-right fa fa-close"
453 onclick="delete_me('<?php echo attr(addslashes($row['id'])); ?>');"
454 title="<?php echo xla('Remove this Prescription from the list of RXs dispensed'); ?>"></i>
455 <table style="margin:2px auto;">
456 <tr>
457 <td class="right bold" style="width:250px;"><b><?php echo xlt('RX Date'); ?>: </b></td>
458 <td>&nbsp;&nbsp;<?php echo text($row['date']); ?></td>
459 </tr>
460 <tr>
461 <td class="right bold"><b><?php echo xlt('Visit Date'); ?>: </b></td>
462 <td>&nbsp;&nbsp;<?php echo text($row['REFDATE']); ?></td>
463 </tr>
464 <tr>
465 <td class="right bold"><b><?php echo xlt('Expiration Date'); ?>: </b></td>
466 <td>&nbsp;&nbsp;<?php
467 echo text($expir_date);
469 </td>
470 </tr>
472 <tr>
473 <td class="right bold"><?php echo xlt('Refraction Method'); ?>:</td>
474 <td>&nbsp;&nbsp;<?php
475 if ($row['REFTYPE'] == "W") {
476 echo xlt('Duplicate Rx -- unchanged from current Rx{{The refraction did not change, New Rx=old Rx}}');
477 } else if ($row['REFTYPE'] == "CR") {
478 echo xlt('Cycloplegic (Wet) Refraction');
479 } else if ($row['REFTYPE'] == "MR") {
480 echo xlt('Manifest (Dry) Refraction');
481 } else if ($row['REFTYPE'] == "AR") {
482 echo xlt('Auto-Refraction');
483 } else if ($row['REFTYPE'] == "CTL") {
484 echo xlt('Contact Lens');
485 } else {
486 echo $row['REFTYPE'];
487 } ?>
488 <input type="hidden" name="REFTYPE" value="<?php echo attr($row['REFTYPE']); ?>"/>
489 </td>
490 </tr>
491 <tr>
492 <td colspan="2"> <?php
493 if ($row['REFTYPE'] != "CTL") { ?>
494 <table id="SpectacleRx" name="SpectacleRx" class="refraction" style="top:0px;">
495 <tr style="font-style:bold;">
496 <td></td>
497 <td></td>
498 <td class="center"><?php echo xlt('Sph{{Sphere}}'); ?></td>
499 <td class="center"><?php echo xlt('Cyl{{Cylinder}}'); ?></td>
500 <td class="center"><?php echo xlt('Axis{{Axis in a glasses prescription}}'); ?></td>
501 <td rowspan="5" class="right bold underline" colspan="2"
502 style="min-width:200px;font-weight:bold;">
503 <?php echo xlt('Rx Type'); ?><br/><br/>
504 <?php echo xlt('Single'); ?>
505 <input type="radio" disabled <?php echo text($Single); ?>><br/>
506 <?php echo xlt('Bifocal'); ?>
507 <input type="radio" disabled <?php echo text($Bifocal); ?>><br/>
508 <?php echo xlt('Trifocal'); ?>
509 <input type="radio" disabled <?php echo text($Trifocal); ?>><br/>
510 <?php echo xlt('Prog.{{Progressive lenses}}'); ?>
511 <input type="radio" disabled <?php echo text($Progressive); ?>><br/>
512 </td>
513 </tr>
514 <tr>
515 <td rowspan="2"
516 style="text-align:right;font-weight:bold;"><?php echo xlt('Distance'); ?></td>
517 <td><b><?php echo xlt('OD{{right eye}}'); ?></b></td>
518 <td><?php echo text($row['ODSPH']); ?></td>
519 <td><?php echo text($row['ODCYL']); ?></td>
520 <td><?php echo text($row['ODAXIS']); ?></td>
521 <td><?php echo text($row['ODPRISM']); ?></td>
522 </tr>
523 <tr>
524 <td><b><?php echo xlt('OS{{left eye}}'); ?></b></td>
525 <td><?php echo text($row['OSSPH']); ?></td>
526 <td><?php echo text($row['OSCYL']); ?></td>
527 <td><?php echo text($row['OSAXIS']); ?></td>
528 <td><?php echo text($row['OSPRISM']); ?></td>
529 </tr>
530 <tr class="NEAR">
531 <td rowspan=2 nowrap><span
532 style="text-decoration:none;"><?php echo xlt('ADD'); ?>
533 :<br/><?php echo xlt("Mid{{Middle segment in a trifocal glasses prescription}}"); ?>
534 /<?php echo xlt("Near"); ?></span></td>
535 <td><b><?php echo xlt('OD{{right eye}}'); ?></b></td>
536 <td class="WMid"><?php echo text($row['ODMIDADD']); ?></td>
537 <td class="WAdd2"><?php echo text($row['ODADD2']); ?></td>
538 </tr>
539 <tr class="NEAR">
540 <td><b><?php echo xlt('OS{{left eye}}'); ?></b></td>
541 <td class="WMid"><?php echo text($row['OSMIDADD']); ?></td>
542 <td class="WAdd2"><?php echo text($row['OSADD2']); ?></td>
543 </tr>
544 <tr style="">
545 <td colspan="2" class="up"
546 style="text-align:right;vertical-align:top;top:0px;font-weight:bold;"><?php echo xlt('Comments'); ?>
548 </td>
549 <td colspan="4" class="up"
550 style="text-align:left;vertical-align:middle;top:0px;">
551 <textarea style="width:100%;height:2.1em;" id="COMMENTS" disabled
552 name="COMMENTS"><?php echo text($row['COMMENTS']); ?></textarea>
553 </td>
554 </tr>
555 </table>
556 <?php
557 } else { ?>
558 <table id="CTLRx" name="CTLRx" class="refraction">
559 <tr>
560 <td colspan="4"
561 class="bold underline left"><?php echo xlt('Right Lens'); ?></u></td>
562 </tr>
563 <tr>
564 <td colspan="3" class="left"><?php echo text($row['CTLBRANDOD']); ?></td>
565 </tr>
566 <tr class="bold" style="text-decoration:underline;">
567 <td></td>
568 <td><?php echo xlt('Sph{{Sphere}}'); ?></td>
569 <td><?php echo xlt('Cyl{{Cylinder}}'); ?></td>
570 <td><?php echo xlt('Axis{{Axis in a glasses prescription}}'); ?></td>
571 <td><?php echo xlt('BC{{Base Curve}}'); ?></td>
572 <td><?php echo xlt('Diam{{Diameter}}'); ?></td>
573 <td><?php echo xlt('ADD'); ?></td>
574 <td>
575 <td>
576 <td><?php echo xlt('Supplier'); ?></td>
577 </tr>
578 <tr>
579 <td></td>
580 <td><?php echo text($row['ODSPH']); ?></td>
581 <td><?php echo text($row['ODCYL']); ?></td>
582 <td><?php echo text($row['ODAXIS']); ?></td>
583 <td><?php echo text($row['ODBC']); ?></td>
584 <td><?php echo text($row['ODDIAM']); ?></td>
585 <td><?php echo text($row['ODADD']); ?></td>
586 <td colspan="3" class="right"><?php echo text($row['CTLSUPPLIEROD']); ?></td>
587 </tr>
588 <tr>
589 <td colspan="4" class="bold underline left">
590 <u><?php echo xlt('Left Lens'); ?></u>
591 </td>
592 </tr>
593 <tr>
594 <td colspan="3" class="left"><?php echo text($row['CTLBRANDOS']); ?></td>
595 </tr>
596 <tr class="bold" style="text-decoration:underline;">
597 <td></td>
598 <td><?php echo xlt('Sph{{Sphere}}'); ?></td>
599 <td><?php echo xlt('Cyl{{Cylinder}}'); ?></td>
600 <td><?php echo xlt('Axis{{Axis in a glasses prescription}}'); ?></td>
601 <td><?php echo xlt('BC{{Base Curve}}'); ?></td>
602 <td><?php echo xlt('Diam{{Diameter}}'); ?></td>
603 <td><?php echo xlt('ADD'); ?></td>
604 <td>
605 <td>
606 <td><?php echo xlt('Supplier'); ?></td>
607 </tr>
608 <tr>
609 <td></td>
610 <td><?php echo text($row['OSSPH']); ?></td>
611 <td><?php echo text($row['OSCYL']); ?></td>
612 <td><?php echo text($row['OSAXIS']); ?></td>
613 <td><?php echo text($row['OSBC']); ?></td>
614 <td><?php echo text($row['OSDIAM']); ?></td>
615 <td><?php echo text($row['OSADD']); ?></td>
616 <td colspan="3" class="right"><?php echo text($row['CTLSUPPLIEROS']); ?></td>
618 </tr>
619 </table>
621 <?php
622 } ?>
623 </td>
624 </tr>
625 </table>
626 <hr>
628 </div>
629 <?php
630 } ?>
631 </div>
632 </div>
633 </body>
634 </html>
635 <?php
636 exit;
639 ob_start();
641 <html>
642 <head>
643 <script src="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-min-1-10-2/index.js"></script>
644 <script src="<?php echo $GLOBALS['assets_static_relative'] ?>/bootstrap-3-3-4/dist/js/bootstrap.min.js"></script>
645 <script src="<?php echo $GLOBALS['assets_static_relative'] ?>/qtip2-2-2-1/jquery.qtip.min.js"></script>
647 <link rel="stylesheet"
648 href="<?php echo $GLOBALS['assets_static_relative'] ?>/bootstrap-3-3-4/dist/css/bootstrap.min.css">
649 <link rel="stylesheet" href="<?php echo $GLOBALS['css_header']; ?>" type="text/css">
650 <link rel="stylesheet"
651 href="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-ui-1-10-4/themes/ui-lightness/jquery-ui.min.css">
652 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/pure-0-5-0/pure-min.css">
653 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/qtip2-2-2-1/jquery.qtip.min.css"/>
654 <link rel="stylesheet"
655 href="<?php echo $GLOBALS['assets_static_relative'] ?>/font-awesome-4-6-3/css/font-awesome.min.css">
656 <link rel="stylesheet" href="../../forms/<?php echo $form_folder; ?>/css/style.css" type="text/css">
658 <style>
659 .title {
660 font-size: 1em;
661 position: absolute;
662 right: 10px;
663 top: 30px;
664 font-size: 1em;
667 .refraction {
668 top: 1in;
669 float: left;
670 min-height: 1.0in;
671 border: 1.00pt solid #000000;
672 padding: 5;
673 box-shadow: 10px 10px 5px #888888;
674 border-radius: 8px;
675 margin: 5 auto 10 10;
676 width: 5.0in;
679 .refraction td {
680 text-align: center;
681 font-size: 8pt;
682 padding: 5;
683 width: 0.35in;
684 vertical-align: text-middle;
685 text-decoration: none;
688 table {
689 font-size: 1.0em;
690 padding: 2px;
691 color: black;
692 vertical-align: text-top;
695 input[type=text] {
696 text-align: center;
697 width: 60px;
700 .refraction b {
701 text-decoration: bold;
704 .refraction td.right {
705 text-align: right;
706 text-decoration: none;
707 width: 0.7in;
708 vertical-align: text-top;
711 .refraction td.left {
712 vertical-align: text-top;
713 text-align: left;
716 .right {
717 text-align: right;
718 vertical-align: text-top;
719 xwidth: 10%;
722 .left {
723 vertical-align: text-top;
724 text-align: left;
727 .title {
728 font-size: 0.9em;
729 font-weight: normal;
732 .bold {
733 font-weight: 600;
736 input {
737 width: 60px;
740 input[type="radio"] {
741 width: 15px;
743 </style>
744 <!-- jQuery library -->
746 <script language="JavaScript">
747 <?php require_once("$srcdir/restoreSession.php"); ?>
748 function pick_rxType(rxtype, id) {
749 var url = "../../forms/eye_mag/SpectacleRx.php";
750 var formData = {
751 'RXTYPE': rxtype,
752 'id': id
754 top.restoreSession();
755 $.ajax({
756 type: 'POST',
757 url: url,
758 data: formData
760 if (rxtype == 'Trifocal') {
761 $("[name$='MIDADD']").show();
762 $("[name$='ADD2']").show();
763 } else if (rxtype == 'Bifocal') {
764 $("[name$='MIDADD']").hide().val('');
765 $("[name$='ADD2']").show();
766 } else if (rxtype == 'Progressive') {
767 $("[name$='MIDADD']").hide().val('');
768 $("[name$='ADD2']").show();
769 } else if (rxtype == "Single") {
770 $("[name$='MIDADD']").hide().val('');
771 $("[name$='ADD2']").hide().val('');
775 function submit_form() {
776 var url = "../../forms/eye_mag/SpectacleRx.php?mode=update";
777 formData = $("form#Spectacle").serialize();
778 top.restoreSession();
779 $.ajax({
780 type: 'POST',
781 url: url,
782 data: formData
786 //add sph and cyl, flip cyl sign, rotate axis 90.
787 function reverse_cylinder() {
788 var Rsph = $('#ODSPH').val();
789 var Rcyl = $('#ODCYL').val();
790 var Raxis = $('#ODAXIS').val();
791 var Lsph = $('#OSSPH').val();
792 var Lcyl = $('#OSCYL').val();
793 var Laxis = $('#OSAXIS').val();
794 if (Rsph == '' && Rcyl == '' && Lsph == '' && lcyl == '') return;
795 if ((!Rcyl.match(/SPH/i)) && (Rcyl > '')) {
796 if (Rsph.match(/plano/i)) Rsph = '0';
797 Rsph = Number(Rsph);
798 Rcyl = Number(Rcyl);
799 Rnewsph = Rsph + Rcyl;
800 if (Rnewsph == 0) Rnewsph = "PLANO";
801 Rnewcyl = Rcyl * -1;
802 if (Rnewcyl > 0) Rnewcyl = "+" + Rnewcyl;
803 if (parseInt(Raxis) < 90) {
804 Rnewaxis = parseInt(Raxis) + 90;
805 } else {
806 Rnewaxis = parseInt(Raxis) - 90;
808 if (Rnewcyl == '0') Rnewcyl = "SPH";
809 if (Rnewsph == '0') {
810 Rnewsph = "PLANO";
811 if (Rnewcyl == "SPH") Rnewcyl = '';
813 $("#ODSPH").val(Rnewsph);
814 $("#ODCYL").val(Rnewcyl);
815 $("#ODAXIS").val(Rnewaxis);
816 $('#ODAXIS').trigger('blur');
817 $('#ODSPH').trigger('blur');
818 $('#ODCYL').trigger('blur');
820 if ((!Lcyl.match(/SPH/i)) && (Lcyl > '')) {
821 if (!Lsph.match(/\d/)) Lsph = '0';
822 Lsph = Number(Lsph);
823 Lcyl = Number(Lcyl);
824 Lnewsph = Lsph + Lcyl;
825 Lnewcyl = Lcyl * -1;
826 if (Lnewcyl > 0) Lnewcyl = "+" + Lnewcyl;
827 if (parseInt(Laxis) < 90) {
828 Lnewaxis = parseInt(Laxis) + 90;
829 } else {
830 Lnewaxis = parseInt(Laxis) - 90;
833 if (Lnewcyl == '0') Lnewcyl = "SPH";
834 if (Lnewsph == '0') {
835 Lnewsph = "PLANO";
836 if (Lnewcyl == "SPH") Lnewcyl = '';
839 $("#OSSPH").val(Lnewsph);
840 $("#OSCYL").val(Lnewcyl);
841 $("#OSAXIS").val(Lnewaxis);
842 $('#OSAXIS').trigger('blur');
843 $('#OSSPH').trigger('blur');
844 $('#OSCYL').trigger('blur');
847 </script>
848 </head>
849 <body>
850 <?php echo report_header($pid, "web"); ?>
851 <br/><br/>
852 <form method="post" action="<?php echo $rootdir; ?>/forms/<?php echo text($form_folder); ?>/SpectacleRx.php?mode=update"
853 id="Spectacle" class="eye_mag pure-form" name="Spectacle" style="text-align:center;">
854 <!-- start container for the main body of the form -->
855 <input type="hidden" name="REFDATE" id="REFDATE" value="<?php echo attr($data['date']); ?>">
856 <input type="hidden" name="RXTYPE" id="RXTYPE" value="<?php echo attr($RXTYPE); ?>">
857 <input type="hidden" name="REFTYPE" value="<?php echo attr($REFTYPE); ?>"/>
858 <input type="hidden" name="pid" id="pid" value="<?php echo attr($pid); ?>">
859 <input type="hidden" name="id" id="id" value="<?php echo attr($insert_this_id); ?>">
860 <input type="hidden" name="encounter" id="encounter" value="<?php echo $encounter; ?>">
862 <div style="margin:5;text-align:center;display:inline-block;">
864 <table style="min-width:615px;">
865 <tr>
866 <td>
867 <?php
869 if ($REFTYPE != "CTL") { ?>
870 <table id="SpectacleRx" name="SpectacleRx" class="refraction bordershadow"
871 style="min-width:610px;top:0px;">
872 <tr style="font-weight:bold;text-align:center;">
873 <td><i name="reverse" id="reverse" class="fa fa-gamepad fa-2x"></i></td>
874 <td></td>
875 <td><?php echo xlt('Sph{{Sphere}}'); ?></td>
876 <td><?php echo xlt('Cyl{{Cylinder}}'); ?></td>
877 <td><?php echo xlt('Axis{{Axis of a glasses prescription}}'); ?></td>
878 <td rowspan="5" class="right" colspan="3" style="min-width:200px;font-weight:bold;">
879 <b style="font-weight:bold;text-decoration:underline;"><?php echo xlt('Rx Type'); ?></b><br/><br/>
880 <b id="SingleVision_span" name="SingleVision_span"><?php echo xlt('Single'); ?>
881 <input type="radio"
882 onclick="pick_rxType('Single','<?php echo attr(addslashes($insert_this_id)); ?>');"
883 value="Single" id="RXTYPE" name="RXTYPE"
884 class="input-helper--radio input-helper--radio" <?php echo attr($Single); ?>></b><br/>
885 <b id="Bifocal_span" name="Bifocal_span"><?php echo xlt('Bifocal'); ?>
886 <input type="radio"
887 onclick="pick_rxType('Bifocal','<?php echo attr(addslashes($insert_this_id)); ?>');"
888 value="Bifocal" id="RXTYPE" name="RXTYPE" <?php echo attr($Bifocal); ?>></b><br/>
889 <b id="Trifocal_span" name="Trifocal_span"><?php echo xlt('Trifocal'); ?>
890 <input type="radio"
891 onclick="pick_rxType('Trifocal','<?php echo attr(addslashes($insert_this_id)); ?>');"
892 value="Trifocal" id="RXTYPE"
893 name="RXTYPE" <?php echo attr($Trifocal); ?>></b><br/>
894 <b id="Progressive_span"><?php echo xlt('Prog.{{Progressive lenses}}'); ?>
895 <input type="radio"
896 onclick="pick_rxType('Progressive','<?php echo attr(addslashes($insert_this_id)); ?>');"
897 value="Progressive" id="RXTYPE"
898 name="RXTYPE" <?php echo attr($Progressive); ?>></b><br/>
899 </td>
900 </tr>
901 <tr class="center">
902 <td rowspan="2"
903 style="text-align:right;font-weight:bold;"><?php echo xlt('Distance'); ?></td>
904 <td style="text-align:right;font-weight:bold;"><?php echo xlt('OD{{right eye}}'); ?></td>
905 <td><input type=text id="ODSPH" name="ODSPH" value="<?php echo attr($ODSPH); ?>"></td>
906 <td><input type=text id="ODCYL" name="ODCYL" value="<?php echo attr($ODCYL); ?>"></td>
907 <td><input type=text id="ODAXIS" name="ODAXIS" value="<?php echo attr($ODAXIS); ?>">
908 </td>
909 </tr>
910 <tr class="center">
911 <td name="W_wide"
912 style="text-align:right;font-weight:bold;"><?php echo xlt('OS{{left eye}}'); ?></td>
913 <td><input type=text id="OSSPH" name="OSSPH" value="<?php echo attr($OSSPH); ?>"></td>
914 <td><input type=text id="OSCYL" name="OSCYL" value="<?php echo attr($OSCYL); ?>"></td>
915 <td><input type=text id="OSAXIS" name="OSAXIS" value="<?php echo attr($OSAXIS); ?>">
916 </td>
917 </tr>
918 <tr class="NEAR center">
919 <td rowspan=2 nowrap
920 style="text-decoration:none;text-align:right;font-weight:bold;"><?php echo xlt('ADD'); ?>
921 :<br/><?php echo xlt("Mid{{Middle segment in a trifocal glasses prescription}}"); ?>
922 /<?php echo xlt("Near"); ?></td>
923 <td style="text-align:right;font-weight:bold;"><?php echo xlt('OD{{right eye}}'); ?></td>
924 <td name="COLADD1"><input type="text" id="ODMIDADD" name="ODMIDADD"
925 value="<?php echo attr($ODMIDADD); ?>"></td>
926 <td class="WAdd2"><input type="text" id="ODADD2" name="ODADD2"
927 value="<?php echo attr($ODADD2); ?>"></td>
928 </tr>
929 <tr class="NEAR center">
930 <td style="text-align:right;font-weight:bold;"><?php echo xlt('OS{{left eye}}'); ?></td>
931 <td name="COLADD1"><input type="text" id="OSMIDADD" name="OSMIDADD"
932 value="<?php echo attr($OSMIDADD); ?>"></td>
933 <td class="WAdd2"><input type="text" id="OSADD2" name="OSADD2"
934 value="<?php echo attr($OSADD2); ?>"></td>
935 </tr>
936 <tr>
937 <td colspan="2"
938 style="text-align:right;font-weight:bold;"><?php echo xlt('Comments'); ?>:
939 </td>
940 <td colspan="4">
941 <textarea style="width:100%;height:5em;" id="COMMENTS"
942 name="COMMENTS"><?php echo text($COMMENTS); ?></textarea>
943 </td>
944 </tr>
945 <!-- start Dispense data -->
946 <tr class="header closeButton">
947 <td colspan="9" class="right">
948 <span><?php
949 if ($ODHPD || $ODHBASE || $ODVPD || $ODVBASE || $ODSLABOFF || $ODVERTEXDIST ||
950 $OSHPD || $OSHBASE || $OSVPD || $OSVBASE || $OSSLABOFF || $OSVERTEXDIST ||
951 $ODMPDD || $ODMPDN || $OSMPDD || $OSMPDN || $BPDD || $BPDN ||
952 $LENS_MATERIAL || $LENS_TREATMENTS) {
953 $detailed = '1';
954 ?><i class="fa fa-minus-square-o"></i><?php
955 } else {
956 $detailed = '0';
957 ?><i class="fa fa-plus-square-o"></i><?php
960 </span>
962 </td>
963 </tr>
964 <tr>
965 <td colspan="9" class="right">
966 <xhr/>
967 </td>
968 </tr>
969 <tr class="dispense_data" style="font-weight:bold;text-align:center;">
970 <td name="W_wide" colspan="2"></td>
971 <td name="W_wide"
972 title="<?php echo xla('Horizontal Prism Power'); ?>"><?php echo xlt('Horiz Prism{{abbreviation for Horizontal Prism Power}}'); ?></td>
973 <td name="W_wide"
974 title="<?php echo xla('Horizontal Prism Base'); ?>"><?php echo xlt('Horiz Base{{abbreviation for Horizontal Prism Base}}'); ?></td>
975 <td name="W_wide"
976 title="<?php echo xla('Vertical Prism Power'); ?>"><?php echo xlt('Vert Prism{{abbreviation for Vertical Prism Power}}'); ?></td>
977 <td name="W_wide"
978 title="<?php echo xla('Vertical Prism Base'); ?>"><?php echo xlt('Vert Base{{abbreviation for Vertical Prism Base}}'); ?></td>
979 <td name="W_wide"
980 title="<?php echo xla('Slab Off'); ?>"><?php echo xlt('Slab Off'); ?></td>
981 <td name="W_wide"
982 title="<?php echo xla('Vertex Distance'); ?>"><?php echo xlt('Vert Distance{{abbreviation for Vertex Distance}}'); ?></td>
983 </tr>
984 <tr class="dispense_data">
985 <td name="W_wide" style="text-align:right;font-weight:bold;"
986 colspan="2"><?php echo xlt('OD{{right eye}}'); ?></td>
987 <td name="W_wide"><input type="text" class="prism" id="ODHPD" name="ODHPD"
988 value="<?php echo attr($ODHPD); ?>"></td>
989 <td name="W_wide"><input type="text" class="prism" id="ODHBASE" name="ODHBASE"
990 value="<?php echo attr($ODHBASE); ?>"></td>
991 <td name="W_wide"><input type="text" class="prism" id="ODVPD" name="ODVPD"
992 value="<?php echo attr($ODVPD); ?>"></td>
993 <td name="W_wide"><input type="text" class="prism" id="ODVBASE" name="ODVBASE"
994 value="<?php echo attr($ODVBASE); ?>"></td>
995 <td name="W_wide"><input type="text" class="prism" id="ODSLABOFF" name="ODSLABOFF"
996 value="<?php echo attr($ODSLABOFF); ?>"></td>
997 <td name="W_wide"><input type="text" class="prism" id="ODVERTEXDIST" name="ODVERTEXDIST"
998 value="<?php echo attr($ODVERTEXDIST); ?>"></td>
999 </tr>
1000 <tr class="dispense_data">
1001 <td name="W_wide" style="text-align:right;font-weight:bold;"
1002 colspan="2"><?php echo xlt('OS{{left eye}}'); ?></td>
1003 <td name="W_wide"><input type="text" class="prism" id="OSHPD" name="OSHPD"
1004 value="<?php echo attr($OSHPD); ?>"></td>
1005 <td name="W_wide"><input type="text" class="prism" id="OSHBASE" name="OSHBASE"
1006 value="<?php echo attr($OSHBASE); ?>"></td>
1007 <td name="W_wide"><input type="text" class="prism" id="OSVPD" name="OSVPD"
1008 value="<?php echo attr($OSVPD); ?>"></td>
1009 <td name="W_wide"><input type="text" class="prism" id="OSVBASE" name="OSVBASE"
1010 value="<?php echo attr($OSVBASE); ?>"></td>
1011 <td name="W_wide"><input type="text" class="prism" id="OSSLABOFF" name="OSSLABOFF"
1012 value="<?php echo attr($OSSLABOFF); ?>"></td>
1013 <td name="W_wide"><input type="text" class="prism" id="OSVERTEXDIST" name="OSVERTEXDIST"
1014 value="<?php echo attr($OSVERTEXDIST); ?>"></td>
1015 </tr>
1016 <tr class="dispense_data">
1017 <td colspan="9" class="center">
1018 <xhr/>
1019 </td>
1020 </tr>
1021 <tr class="dispense_data" style="font-weight:bold;text-align:center;">
1022 <td></td>
1023 <td></td>
1024 <td name="W_wide"
1025 title="<?php echo xla('Monocular Pupillary Diameter - Distance'); ?>"><?php echo xlt('MPD-D{{abbreviation for Monocular Pupillary Diameter - Distance}}'); ?></td>
1026 <td name="W_wide"
1027 title="<?php echo xla('Monocular Pupillary Diameter - Near'); ?>"><?php echo xlt('MPD-N{{abbreviation for Monocular Pupillary Diameter - Near}}'); ?></td>
1028 <td name="W_wide"
1029 title="<?php echo xla('Binocular Pupillary Diameter - Distance'); ?>"><?php echo xlt('BPD-D{{abbreviation for Binocular Pupillary Diameter - Distance}}'); ?></td>
1030 <td name="W_wide"
1031 title="<?php echo xla('Binocular Pupillary Diameter - Near'); ?>"><?php echo xlt('BPD-N{{abbreviation for Binocular Pupillary Diameter - Near}}'); ?></td>
1033 <td colspan="2">Lens Material:</td>
1034 </tr>
1035 <tr>
1036 <td name="W_wide" style="text-align:right;font-weight:bold;"
1037 colspan="2"><?php echo xlt('OD{{right eye}}'); ?></td>
1038 <td name="W_wide"><input type="text" class="prism" id="ODMPDD" name="ODMPDD"
1039 value="<?php echo attr($ODMPDD); ?>"></td>
1040 <td name="W_wide"><input type="text" class="prism" id="ODMPDN" name="ODMPDN"
1041 value="<?php echo attr($ODMPDN); ?>"></td>
1042 <td name="W_wide" rowspan="2" style="vertical-align:middle;"><input type="text"
1043 class="prism"
1044 id="BPDD"
1045 name="BPDD"
1046 value="<?php echo attr($BPDD); ?>">
1047 </td>
1048 <td name="W_wide" rowspan="2" style="vertical-align:middle;"><input type="text"
1049 class="prism"
1050 id="BPDN"
1051 name="BPDN"
1052 value="<?php echo attr($BPDN); ?>">
1053 </td>
1054 <td colspan="2"> <?php
1055 echo generate_select_list("LENS_MATERIAL", "Eye_Lens_Material", "$LENS_MATERIAL", '', ' ', '', 'restoreSession;submit_form();', '', array('style' => 'width:120px'));
1057 </td>
1058 </tr>
1059 <tr>
1060 <td name="W_wide" style="text-align:right;font-weight:bold;"
1061 colspan="2"><?php echo xlt('OS{{left eye}}'); ?></td>
1062 <td name="W_wide"><input type="text" class="prism" id="OSMPDD" name="OSMPDD"
1063 value="<?php echo attr($OSMPDD); ?>"></td>
1064 <td name="W_wide"><input type="text" class="prism" id="OSMPDN" name="OSMPDN"
1065 value="<?php echo attr($OSMPDN); ?>"></td>
1066 </tr>
1067 <tr class="dispense_data">
1068 <td colspan="9" class="center">
1069 <xhr/>
1070 </td>
1071 </tr>
1072 <tr style="font-weight:bold;text-align:center;">
1073 <td colspan="3"><?php echo xlt('Lens Treatments'); ?>
1074 </td>
1075 </tr>
1076 <tr style="text-align:left;vertical-align:top;">
1077 <td colspan="5" style="font-weight:bold;text-align:left;">
1078 <?php echo generate_lens_treatments($W, $LENS_TREATMENTS); ?>
1079 </td>
1080 </tr>
1081 <tr class="dispense_data">
1082 <td colspan="9" class="center">
1083 <hr/>
1084 </td>
1085 </tr>
1087 </table>&nbsp;<br/><br/><br/>
1088 <?php
1089 } else { ?>
1090 <table id="CTLRx" name="CTLRx" class="refraction">
1091 <tr>
1092 <td class="right bold underline"><?php echo xlt('Right Lens'); ?></td>
1093 </tr>
1094 <tr>
1095 <td colspan="2" class="right bold"><?php echo xlt('Manufacturer'); ?>:</td>
1096 <td colspan="2" class="left"><?php echo text($CTLMANUFACTUREROD); ?></td>
1097 <td class="right bold"><?php echo xlt('Brand'); ?>:</td>
1098 <td colspan="2" class="left"><?php echo text($CTLBRANDOD); ?></td>
1099 </tr>
1100 <tr class="bold" style="line-height:0.3em;font-size:0.6em;">
1101 <td><?php echo xlt('SPH{{Sphere}}'); ?></td>
1102 <td><?php echo xlt('CYL{{Cylinder}}'); ?></td>
1103 <td><?php echo xlt('AXIS{{Axis of a glasses prescription}}'); ?></td>
1104 <td><?php echo xlt('BC{{Base Curve}}'); ?></td>
1105 <td><?php echo xlt('DIAM{{Diameter}}'); ?></td>
1106 <td><?php echo xlt('ADD{{Bifocal Add}}'); ?></td>
1107 <td><?php echo xlt('ACUITY'); ?></td>
1108 </tr>
1109 <tr>
1110 <td><input type=text id="CTLODSPH" name="CTLODSPH" value="<?php echo attr($ODSPH); ?>">
1111 </td>
1112 <td><input type=text id="CTLODCYL" name="CTLODCYL" value="<?php echo attr($ODCYL); ?>">
1113 </td>
1114 <td><input type=text id="CTLODAXIS" name="CTLODAXIS"
1115 value="<?php echo attr($ODAXIS); ?>"></td>
1116 <td><input type=text id="CTLODBC" name="CTLODBC" value="<?php echo attr($ODBC); ?>">
1117 </td>
1118 <td><input type=text id="CTLODDIAM" name="CTLODDIAM"
1119 value="<?php echo attr($ODDIAM); ?>"></td>
1120 <td><input type=text id="CTLODADD" name="CTLODADD" value="<?php echo attr($ODADD); ?>">
1121 </td>
1122 <td><input type=text id="CTLODVA" name="CTLODVA" value="<?php echo attr($ODVA); ?>">
1123 </td>
1124 </tr>
1125 <tr>
1126 <td colspan="8">
1127 <hr/>
1128 </td>
1129 </tr>
1130 <tr>
1131 <td class="right bold underline"><?php echo xlt('Left Lens'); ?></td>
1132 </tr>
1133 <tr>
1134 <td colspan="2" class="right bold"><?php echo xlt('Manufacturer'); ?>:</td>
1135 <td colspan="2" class="left"><?php echo text($CTLMANUFACTUREROS); ?></td>
1136 <td class="right bold"><?php echo xlt('Brand'); ?>:</td>
1137 <td colspan="2" class="left"><?php echo text($CTLBRANDOS); ?></td>
1138 </tr>
1139 <tr class="bold" style="line-height:0.3em;font-size:0.6em;">
1140 <td><?php echo xlt('SPH{{Sphere}}'); ?></td>
1141 <td><?php echo xlt('CYL{{Cylinder}}'); ?></td>
1142 <td><?php echo xlt('AXIS{{Axis of a glasses prescription}}'); ?></td>
1143 <td><?php echo xlt('BC{{Base Curve}}'); ?></td>
1144 <td><?php echo xlt('DIAM{{Diameter}}'); ?></td>
1145 <td><?php echo xlt('ADD{{Bifocal Add}}'); ?></td>
1146 <td><?php echo xlt('ACUITY'); ?></td>
1147 </tr>
1148 <tr>
1149 <td><input type=text id="CTLOSSPH" name="CTLOSSPH" value="<?php echo attr($OSSPH); ?>">
1150 </td>
1151 <td><input type=text id="CTLOSCYL" name="CTLOSCYL" value="<?php echo attr($OSCYL); ?>">
1152 </td>
1153 <td><input type=text id="CTLOSAXIS" name="CTLOSAXIS"
1154 value="<?php echo attr($OSAXIS); ?>"></td>
1155 <td><input type=text id="CTLOSBC" name="CTLOSBC" value="<?php echo attr($OSBC); ?>">
1156 </td>
1157 <td><input type=text id="CTLOSDIAM" name="CTLOSDIAM"
1158 value="<?php echo attr($OSDIAM); ?>"></td>
1159 <td><input type=text id="CTLOSADD" name="CTLOSADD" value="<?php echo attr($OSADD); ?>">
1160 </td>
1161 <td><input type=text id="CTLOSVA" name="CTLOSVA" value="<?php echo attr($OSVA); ?>">
1162 </td>
1163 </tr>
1164 <?php if ($COMMENTS > '') { ?>
1165 <tr>
1166 <td colspan="8">
1167 <hr/>
1168 </td>
1169 </tr>
1170 <tr>
1171 <td class="right bold red" colspan="2"
1172 style="vertical-align:top;"><?php echo xlt('Comments'); ?>:</u></td>
1173 <td colspan="6" class="left">
1174 <textarea cols="30" rows="4"><?php echo text($COMMENTS); ?></textarea>
1175 </td>
1176 </tr>
1177 <?php } ?>
1178 </table>
1179 <?php
1180 } ?>
1181 </td>
1182 </tr>
1183 <tr>
1184 <td style="margin:25px auto;text-align:center;">
1185 <?php
1186 $signature = $GLOBALS["webserver_root"] . "/interface/forms/eye_mag/images/sign_" . attr($_SESSION['authUserID']) . ".jpg";
1187 if (file_exists($signature)) {
1189 <span style="position:relative;padding-left:40px;">
1190 <img src='<?php echo $web_root; ?>/interface/forms/eye_mag/images/sign_<?php echo attr($_SESSION['authUserID']); ?>.jpg'
1191 style="width:240px;height:85px;border-block-end: 1pt solid black;margin:5px;"/>
1192 </span><br/>
1194 <?php
1195 } ?>
1197 <?php echo xlt('Provider'); ?>
1198 : <?php echo text($prov_data['fname']); ?> <?php echo text($prov_data['lname']);
1199 if ($prov_data['suffix']) {
1200 echo ", " . $prov_data['suffix'];
1201 } ?><br/>
1202 <small><?php echo xlt('e-signed'); ?> <input type="checkbox" checked="checked"></small>
1203 </td>
1204 </tr>
1205 </table>
1206 </div>
1207 </form>
1209 </body>
1210 <script>
1211 $(document).ready(function () {
1212 $('.header').click(function () {
1213 var $this = $(this);
1214 $(this).nextUntil('tr.header').slideToggle(100).promise().done(function () {
1215 $this.find('span').html(function (_, value) {
1216 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>';
1220 <?php
1221 if (!$detailed) {
1222 echo "$('.header').trigger('click');";
1223 } ?>
1225 $("input[name$='PD']").blur(function () {
1226 //make it all caps
1227 var str = $(this).val();
1228 str = str.toUpperCase();
1229 $(this).val(str);
1231 $('input[name$="SPH"]').blur(function () {
1232 var mid = $(this).val();
1233 if (mid.match(/PLANO/i)) {
1234 $(this).val('PLANO');
1235 return;
1237 if (mid.match(/^[\+\-]?\d{1}$/)) {
1238 mid = mid + ".00";
1240 if (mid.match(/\.[27]$/)) {
1241 mid = mid + '5';
1243 if (mid.match(/\.\d$/)) {
1244 mid = mid + '0';
1246 //if near is +2. make it +2.00
1247 if (mid.match(/\.$/)) {
1248 mid = mid + '00';
1250 if ((!mid.match(/\./)) && (mid.match(00 | 25 | 50 | 75))) {
1251 var front = mid.match(/(\d{0,2})(00|25|50|75)/)[1];
1252 var back = mid.match(/(\d{0,2})(00|25|50|75)/)[2];
1253 if (front == '') front = '0';
1254 mid = front + "." + back;
1256 if (!mid.match(/\./)) {
1257 var front = mid.match(/([\+\-]?\d{0,2})(\d{2})/)[1];
1258 var back = mid.match(/(\d{0,2})(\d{2})/)[2];
1259 if (front == '') front = '0';
1260 if (front == '-') front = '-0';
1261 mid = front + "." + back;
1263 if (!mid.match(/^(\+|\-){1}/)) {
1264 mid = "+" + mid;
1266 $(this).val(mid);
1269 $("input[name$='ADD'],input[name$='ADD2']").blur(function () {
1270 var add = $(this).val();
1271 add = add.replace(/=/g, "+");
1272 //if add is one digit, eg. 2, make it +2.00
1273 if (add.match(/^\d{1}$/)) {
1274 add = "+" + add + ".00";
1276 //if add is '+'one digit, eg. +2, make it +2.00
1277 if (add.match(/^\+\d{1}$/)) {
1278 add = add + ".00";
1280 //if add is 2.5 or 2.0 make it 2.50 or 2.00
1281 if (add.match(/\.[05]$/)) {
1282 add = add + '0';
1284 //if add is 2.2 or 2.7 make it 2.25 or 2.75
1285 if (add.match(/\.[27]$/)) {
1286 add = add + '5';
1288 //if add is +2. make it +2.00
1289 if (add.match(/\.$/)) {
1290 add = add + '00';
1292 if ((!add.match(/\./)) && (add.match(/(0|25|50|75)$/))) {
1293 var front = add.match(/([\+]?\d{0,1})(00|25|50|75)/)[1];
1294 var back = add.match(/([\+]?\d{0,1})(00|25|50|75)/)[2];
1295 if (front == '') front = '0';
1296 add = front + "." + back;
1298 if (!add.match(/^(\+)/) && (add.length > 0)) {
1299 add = "+" + add;
1301 $(this).val(add);
1302 if (this.id == "ODADD2") $('#OSADD2').val(add);
1303 if (this.id == "ODMIDADD") $('#OSMIDADD').val(add);
1304 if (this.id == "CTLODADD") $('#CTLOSADD').val(add);
1307 $("input[name$='AXIS']").blur(function () {
1308 // Make this a 3 digit leading zeros number.
1309 // we are not translating text to numbers, just numbers to
1310 // a 3 digit format with leading zeroes as needed.
1311 // assume the end user KNOWS there are only numbers presented and
1312 // more than 3 digits is a mistake...
1313 // (although this may change with topographic answer)
1314 var axis = $(this).val();
1315 var group = this.name.replace("AXIS", "CYL");
1317 var cyl = $("#" + group).val();
1318 if ((cyl > '') && (cyl != 'SPH')) {
1319 if (!axis.match(/\d\d\d/)) {
1320 if (!axis.match(/\d\d/)) {
1321 if (!axis.match(/\d/)) {
1322 axis = '0';
1324 axis = '0' + axis;
1326 axis = '0' + axis;
1328 } else {
1329 axis = '';
1331 $(this).val(axis);
1333 $("[name$='CYL']").blur(function () {
1334 var mid = $(this).val();
1335 var group = this.name.replace("CYL", "SPH");
1337 var sphere = $("#" + group).val();
1338 if (((mid.length == 0) && (sphere.length > 0)) || (mid.match(/sph/i))) {
1339 $(this).val('SPH');
1340 var axis = this.name.replace("CYL", "AXIS");
1341 $("#" + axis).val('');
1342 return;
1343 } else if (sphere.length > 0) {
1344 if (mid.match(/^[\+\-]?\d{1}$/)) {
1345 mid = mid + ".00";
1347 if (mid.match(/^(\d)(\d)$/)) {
1348 mid = mid[0] + '.' + mid[1];
1350 //if mid is 2.5 or 2.0 make it 2.50 or 2.00
1351 if (mid.match(/\.[05]$/)) {
1352 mid = mid + '0';
1354 //if mid is 2.2 or 2.7 make it 2.25 or 2.75
1355 if (mid.match(/\.[27]$/)) {
1356 mid = mid + '5';
1358 //if mid is +2. make it +2.00
1359 if (mid.match(/\.$/)) {
1360 mid = mid + '00';
1362 if (mid.match(/([\+\-]?\d{0,2})\.?(00|25|50|75)/)) {
1363 var front = mid.match(/([\+\-]?\d{0,2})\.?(00|25|50|75)/)[1];
1364 var back = mid.match(/([\+\-]?\d{0,2})\.?(00|25|50|75)/)[2];
1365 if (front == '') front = '0';
1366 mid = front + "." + back;
1368 if (!mid.match(/^(\+|\-){1}/) && (sphere.length > 0)) {
1369 //Since it doesn't start with + or - then give it '+'
1370 mid = "+" + mid;
1372 $(this).val(mid);
1375 $("input,textarea,text,checkbox").change(function () {
1376 submit_form($(this));
1378 $("#reverse").click(function () {
1379 //alert('Start');
1380 reverse_cylinder('');
1381 //alert('Finish');
1384 $("input[name$='SPH'],input[name$='CYL']").on('keyup', function (e) {
1385 if (e.keyCode == '61' || e.keyCode == '74') {
1386 now = $(this).val();
1387 now = now.replace(/=/g, "+").replace(/^j/g, "J");
1388 $(this).val(now);
1393 </script>
1394 </html>
1396 <?php
1397 $content = ob_get_clean();
1398 echo $content;
1399 exit;