Minor fixes in client side validation, take 2.
[openemr.git] / interface / patient_file / summary / demographics_full.php
bloba069367348df36172a6d812ec1e90cd5494d0d1e
1 <?php
2 // This program is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU General Public License
4 // as published by the Free Software Foundation; either version 2
5 // of the License, or (at your option) any later version.
7 require_once("../../globals.php");
8 require_once("$srcdir/acl.inc");
9 require_once("$srcdir/options.inc.php");
10 require_once("$srcdir/formatting.inc.php");
11 require_once("$srcdir/erx_javascript.inc.php");
12 require_once("$srcdir/validation/LBF_Validation.php");
14 // Session pid must be right or bad things can happen when demographics are saved!
16 include_once("$srcdir/pid.inc");
17 $set_pid = $_GET["set_pid"] ? $_GET["set_pid"] : $_GET["pid"];
18 if ($set_pid && $set_pid != $_SESSION["pid"]) {
19 setpid($set_pid);
22 include_once("$srcdir/patient.inc");
24 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
25 $result2 = getEmployerData($pid);
27 // Check authorization.
28 if ($pid) {
29 if (!acl_check('patients', 'demo', '', 'write'))
30 die(xl('Updating demographics is not authorized.'));
31 if ($result['squad'] && ! acl_check('squads', $result['squad']))
32 die(xl('You are not authorized to access this squad.'));
33 } else {
34 if (!acl_check('patients', 'demo', '', array('write','addonly') ))
35 die(xl('Adding demographics is not authorized.'));
38 $CPR = 4; // cells per row
40 // $statii = array('married','single','divorced','widowed','separated','domestic partner');
41 // $langi = getLanguages();
42 // $ethnoraciali = getEthnoRacials();
43 // $provideri = getProviderInfo();
44 if ($GLOBALS['insurance_information'] != '0') {
45 $insurancei = getInsuranceProvidersExtra();
46 }else{
47 $insurancei = getInsuranceProviders();
50 $fres = sqlStatement("SELECT * FROM layout_options " .
51 "WHERE form_id = 'DEM' AND uor > 0 " .
52 "ORDER BY group_name, seq");
54 <html>
55 <head>
56 <?php html_header_show();?>
58 <link rel="stylesheet" href="<?php echo $css_header; ?>" type="text/css">
60 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
62 <script type="text/javascript" src="../../../library/dialog.js"></script>
63 <script type="text/javascript" src="../../../library/textformat.js"></script>
64 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
65 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
66 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
67 <script type="text/javascript" src="../../../library/js/jquery-1.9.1.min.js"></script>
68 <script type="text/javascript" src="../../../library/js/common.js"></script>
69 <script type="text/javascript" src="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
71 <?php include_once("{$GLOBALS['srcdir']}/options.js.php"); ?>
73 <link rel="stylesheet" type="text/css" href="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
75 <script type="text/javascript">
77 // Support for beforeunload handler.
78 var somethingChanged = false;
80 $(document).ready(function(){
81 tabbify();
82 enable_modals();
84 // special size for
85 $(".medium_modal").fancybox( {
86 'overlayOpacity' : 0.0,
87 'showCloseButton' : true,
88 'frameHeight' : 460,
89 'frameWidth' : 650
90 });
92 // Support for beforeunload handler.
93 $('.tab input, .tab select, .tab textarea').change(function() {
94 somethingChanged = true;
95 });
96 window.addEventListener("beforeunload", function (e) {
97 if (somethingChanged && !top.timed_out) {
98 var msg = "<?php echo xls('You have unsaved changes.'); ?>";
99 e.returnValue = msg; // Gecko, Trident, Chrome 34+
100 return msg; // Gecko, WebKit, Chrome <34
105 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
107 //code used from http://tech.irt.org/articles/js037/
108 function replace(string,text,by) {
109 // Replaces text with by in string
110 var strLength = string.length, txtLength = text.length;
111 if ((strLength == 0) || (txtLength == 0)) return string;
113 var i = string.indexOf(text);
114 if ((!i) && (text != string.substring(0,txtLength))) return string;
115 if (i == -1) return string;
117 var newstr = string.substring(0,i) + by;
119 if (i+txtLength < strLength)
120 newstr += replace(string.substring(i+txtLength,strLength),text,by);
122 return newstr;
125 function upperFirst(string,text) {
126 return replace(string,text,text.charAt(0).toUpperCase() + text.substring(1,text.length));
129 <?php for ($i=1;$i<=3;$i++) { ?>
130 function auto_populate_employer_address<?php echo $i ?>(){
131 var f = document.demographics_form;
132 if (f.form_i<?php echo $i?>subscriber_relationship.options[f.form_i<?php echo $i?>subscriber_relationship.selectedIndex].value == "self")
134 f.i<?php echo $i?>subscriber_fname.value=f.form_fname.value;
135 f.i<?php echo $i?>subscriber_mname.value=f.form_mname.value;
136 f.i<?php echo $i?>subscriber_lname.value=f.form_lname.value;
137 f.i<?php echo $i?>subscriber_street.value=f.form_street.value;
138 f.i<?php echo $i?>subscriber_city.value=f.form_city.value;
139 f.form_i<?php echo $i?>subscriber_state.value=f.form_state.value;
140 f.i<?php echo $i?>subscriber_postal_code.value=f.form_postal_code.value;
141 if (f.form_country_code)
142 f.form_i<?php echo $i?>subscriber_country.value=f.form_country_code.value;
143 f.i<?php echo $i?>subscriber_phone.value=f.form_phone_home.value;
144 f.i<?php echo $i?>subscriber_DOB.value=f.form_DOB.value;
145 if(typeof f.form_ss!="undefined")
147 f.i<?php echo $i?>subscriber_ss.value=f.form_ss.value;
149 f.form_i<?php echo $i?>subscriber_sex.value = f.form_sex.value;
150 f.i<?php echo $i?>subscriber_employer.value=f.form_em_name.value;
151 f.i<?php echo $i?>subscriber_employer_street.value=f.form_em_street.value;
152 f.i<?php echo $i?>subscriber_employer_city.value=f.form_em_city.value;
153 f.form_i<?php echo $i?>subscriber_employer_state.value=f.form_em_state.value;
154 f.i<?php echo $i?>subscriber_employer_postal_code.value=f.form_em_postal_code.value;
155 if (f.form_em_country)
156 f.form_i<?php echo $i?>subscriber_employer_country.value=f.form_em_country.value;
160 <?php } ?>
162 function popUp(URL) {
163 day = new Date();
164 id = day.getTime();
165 top.restoreSession();
166 eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=300,left = 440,top = 362');");
169 function checkNum () {
170 var re= new RegExp();
171 re = /^\d*\.?\d*$/;
172 str=document.demographics_form.monthly_income.value;
173 if(re.exec(str))
175 }else{
176 alert("<?php xl('Please enter a monetary amount using only numbers and a decimal point.','e'); ?>");
180 // Indicates which insurance slot is being updated.
181 var insurance_index = 0;
183 // The OnClick handler for searching/adding the insurance company.
184 function ins_search(ins) {
185 insurance_index = ins;
186 return false;
189 // The ins_search.php window calls this to set the selected insurance.
190 function set_insurance(ins_id, ins_name) {
191 var thesel = document.forms[0]['i' + insurance_index + 'provider'];
192 var theopts = thesel.options; // the array of Option objects
193 var i = 0;
194 for (; i < theopts.length; ++i) {
195 if (theopts[i].value == ins_id) {
196 theopts[i].selected = true;
197 return;
200 // no matching option was found so create one, append it to the
201 // end of the list, and select it.
202 theopts[i] = new Option(ins_name, ins_id, false, true);
205 // This capitalizes the first letter of each word in the passed input
206 // element. It also strips out extraneous spaces.
207 function capitalizeMe(elem) {
208 var a = elem.value.split(' ');
209 var s = '';
210 for(var i = 0; i < a.length; ++i) {
211 if (a[i].length > 0) {
212 if (s.length > 0) s += ' ';
213 s += a[i].charAt(0).toUpperCase() + a[i].substring(1);
216 elem.value = s;
219 function divclick(cb, divid) {
220 var divstyle = document.getElementById(divid).style;
221 if (cb.checked) {
222 divstyle.display = 'block';
223 } else {
224 divstyle.display = 'none';
226 return true;
229 // Compute the length of a string without leading and trailing spaces.
230 function trimlen(s) {
231 var i = 0;
232 var j = s.length - 1;
233 for (; i <= j && s.charAt(i) == ' '; ++i);
234 for (; i <= j && s.charAt(j) == ' '; --j);
235 if (i > j) return 0;
236 return j + 1 - i;
239 function validate(f) {
240 var errCount = 0;
241 var errMsgs = new Array();
242 <?php generate_layout_validation('DEM'); ?>
244 var msg = "";
245 msg += "<?php xl('The following fields are required', 'e' ); ?>:\n\n";
246 for ( var i = 0; i < errMsgs.length; i++ ) {
247 msg += errMsgs[i] + "\n";
249 msg += "\n<?php xl('Please fill them in before continuing.', 'e'); ?>";
251 if ( errMsgs.length > 0 ) {
252 alert(msg);
255 //Misc Deceased Date Validation for Future Date
256 var dateVal = document.getElementById("form_deceased_date").value;
257 var currentDate;
258 var d = new Date();
259 month = '' + (d.getMonth() + 1),
260 day = '' + d.getDate(),
261 year = d.getFullYear();
262 if (month.length < 2) month = '0' + month;
263 if (day.length < 2) day = '0' + day;
264 currentDate = year+'-'+month+'-'+day;
265 if(dateVal > currentDate)
267 alert ('<?php echo xls("Deceased Date should not be greater than Today"); ?>');
268 return false;
271 //Patient Data validations
272 <?php if($GLOBALS['erx_enable']){ ?>
273 alertMsg='';
274 for(i=0;i<f.length;i++){
275 if(f[i].type=='text' && f[i].value)
277 if(f[i].name == 'form_fname' || f[i].name == 'form_mname' || f[i].name == 'form_lname')
279 alertMsg += checkLength(f[i].name,f[i].value,35);
280 alertMsg += checkUsername(f[i].name,f[i].value);
282 else if(f[i].name == 'form_street' || f[i].name == 'form_city')
284 alertMsg += checkLength(f[i].name,f[i].value,35);
285 alertMsg += checkAlphaNumericExtended(f[i].name,f[i].value);
287 else if(f[i].name == 'form_phone_home')
289 alertMsg += checkPhone(f[i].name,f[i].value);
293 if(alertMsg)
295 alert(alertMsg);
296 return false;
298 <?php } ?>
299 //return false;
301 // Some insurance validation.
302 for (var i = 1; i <= 3; ++i) {
303 subprov = 'i' + i + 'provider';
304 if (!f[subprov] || f[subprov].selectedIndex <= 0) continue;
305 var subpfx = 'i' + i + 'subscriber_';
306 var subrelat = f['form_' + subpfx + 'relationship'];
307 var samename =
308 f[subpfx + 'fname'].value == f.form_fname.value &&
309 f[subpfx + 'mname'].value == f.form_mname.value &&
310 f[subpfx + 'lname'].value == f.form_lname.value;
311 var ss_regexp=/[0-9][0-9][0-9]-?[0-9][0-9]-?[0-9][0-9][0-9][0-9]/;
312 var samess=true;
313 var ss_valid=false;
314 if(typeof f.form_ss!="undefined")
316 samess = f[subpfx + 'ss'].value == f.form_ss.value;
317 ss_valid=ss_regexp.test(f[subpfx + 'ss'].value) && ss_regexp.test(f.form_ss.value);
319 if (subrelat.options[subrelat.selectedIndex].value == "self") {
320 if (!samename) {
321 if (!confirm("<?php echo xls('Subscriber relationship is self but name is different! Is this really OK?'); ?>"))
322 return false;
324 if (!samess && ss_valid) {
325 if(!confirm("<?php echo xls('Subscriber relationship is self but SS number is different!')." ". xls("Is this really OK?"); ?>"))
326 return false;
328 } // end self
329 else {
330 if (samename) {
331 if (!confirm("<?php echo xls('Subscriber relationship is not self but name is the same! Is this really OK?'); ?>"))
332 return false;
334 if (samess && ss_valid) {
335 if(!confirm("<?php echo xls('Subscriber relationship is not self but SS number is the same!') ." ". xls("Is this really OK?"); ?>"))
336 return false;
338 } // end not self
339 } // end for
341 return errMsgs.length < 1;
346 // Onkeyup handler for policy number. Allows only A-Z and 0-9.
347 function policykeyup(e) {
348 var v = e.value.toUpperCase();
349 var filteredString="";
350 for (var i = 0; i < v.length; ++i) {
351 var c = v.charAt(i);
352 if ((c >= '0' && c <= '9') ||
353 (c >= 'A' && c <= 'Z') ||
354 (c == '*') ||
355 (c == '-') ||
356 (c == '_') ||
357 (c == '(') ||
358 (c == ')') ||
359 (c == '#'))
361 filteredString+=c;
364 e.value = filteredString;
365 return;
368 // Added 06/2009 by BM to make compatible with list_options table and functions - using jquery
369 $(document).ready(function() {
371 <?php for ($i=1;$i<=3;$i++) { ?>
372 $("#form_i<?php echo $i?>subscriber_relationship").change(function() { auto_populate_employer_address<?php echo $i?>(); });
373 <?php } ?>
377 </script>
378 </head>
380 <?php
381 /*Get the constraint from the DB-> LBF forms accordinf the form_id*/
382 $constraints = LBF_Validation::generate_validate_constraints("DEM");
384 <script> var constraints = <?php echo $constraints;?>; </script>
386 <body class="body_top">
387 <form action='demographics_save.php' name='demographics_form' id="DEM" method='post' onsubmit="submitme(<?php echo $GLOBALS['new_validate'] ? 1 : 0;?>,event,'DEM',constraints)">
388 <input type='hidden' name='mode' value='save' />
389 <input type='hidden' name='db_id' value="<?php echo $result['id']?>" />
390 <table cellpadding='0' cellspacing='0' border='0'>
391 <tr>
392 <td>
393 <?php if ($GLOBALS['concurrent_layout']) { ?>
394 <a href="demographics.php" onclick="top.restoreSession()">
395 <?php } else { ?>
396 <a href="patient_summary.php" target="Main" onclick="top.restoreSession()">
397 <?php } ?>
398 <font class=title><?php xl('Current Patient','e'); ?></font>
399 </a>
400 &nbsp;&nbsp;
401 </td>
402 <td>
403 <input id="submit_btn" class="css_btn" type="submit" disabled="disabled" value="<?php xl('Save','e'); ?>">
404 </td>
405 <td>
406 <?php if ($GLOBALS['concurrent_layout']) { ?>
407 <a class="css_button" href="demographics.php" onclick="top.restoreSession()">
408 <?php } else { ?>
409 <a href="patient_summary.php" target="Main" onclick="top.restoreSession()">
410 <?php } ?>
411 <span><?php xl('Cancel','e'); ?></span>
412 </a>
413 </td>
414 </tr>
415 </table>
416 <?php
418 function end_cell() {
419 global $item_count, $cell_count;
420 if ($item_count > 0) {
421 echo "</td>";
422 $item_count = 0;
426 function end_row() {
427 global $cell_count, $CPR;
428 end_cell();
429 if ($cell_count > 0) {
430 for (; $cell_count < $CPR; ++$cell_count) echo "<td></td>";
431 echo "</tr>\n";
432 $cell_count = 0;
436 function end_group() {
437 global $last_group;
438 if (strlen($last_group) > 0) {
439 end_row();
440 echo " </table>\n";
441 echo "</div>\n";
445 $last_group = '';
446 $cell_count = 0;
447 $item_count = 0;
448 $display_style = 'block';
450 $group_seq=0; // this gives the DIV blocks unique IDs
453 <br>
454 <div class="section-header">
455 <span class="text"><b> <?php xl("Demographics", "e" )?></b></span>
456 </div>
458 <div id="DEM" >
460 <ul class="tabNav">
461 <?php display_layout_tabs('DEM', $result, $result2); ?>
462 </ul>
464 <div class="tabContainer">
465 <?php display_layout_tabs_data_editable('DEM', $result, $result2); ?>
466 </div>
467 </div>
468 <br>
470 <div id="DEM" >
473 <?php
474 if (! $GLOBALS['simplified_demographics']) {
476 $insurance_headings = array(xl("Primary Insurance Provider"), xl("Secondary Insurance Provider"), xl("Tertiary Insurance provider"));
477 $insurance_info = array();
478 $insurance_info[1] = getInsuranceData($pid,"primary");
479 $insurance_info[2] = getInsuranceData($pid,"secondary");
480 $insurance_info[3] = getInsuranceData($pid,"tertiary");
483 <div class="section-header">
484 <span class="text"><b><?php xl("Insurance", "e" )?></b></span>
485 </div>
486 <div id="INSURANCE" >
487 <ul class="tabNav">
488 <?php
489 foreach (array('primary','secondary','tertiary') as $instype) {
490 ?><li <?php echo $instype == 'primary' ? 'class="current"' : '' ?>><a href="#"><?php $CapInstype=ucfirst($instype); xl($CapInstype,'e'); ?></a></li><?php
493 </ul>
495 <div class="tabContainer">
497 <?php
498 for($i=1;$i<=3;$i++) {
499 $result3 = $insurance_info[$i];
502 <div class="tab <?php echo $i == 1 ? 'current': '' ?>" style='height:auto;width:auto'> <!---display icky, fix to auto-->
504 <table border="0">
506 <tr>
507 <td valign=top width="430">
508 <table border="0">
510 <tr>
511 <td valign='top'>
512 <span class='required'><?php echo $insurance_headings[$i -1]."&nbsp;"?></span>
513 </td>
514 <td class='required'>:</td>
515 <td>
516 <a href="../../practice/ins_search.php" class="iframe medium_modal css_button" onclick="ins_search(<?php echo $i?>)">
517 <span><?php echo xl('Search/Add') ?></span>
518 </a>
519 <select name="i<?php echo $i?>provider">
520 <option value=""><?php xl('Unassigned','e'); ?></option>
521 <?php
522 foreach ($insurancei as $iid => $iname) {
523 echo "<option value='" . $iid . "'";
524 if (strtolower($iid) == strtolower($result3{"provider"}))
525 echo " selected";
526 echo ">" . $iname . "</option>\n";
529 </select>
531 </td>
532 </tr>
534 <tr>
535 <td>
536 <span class='required'><?php xl('Plan Name','e'); ?> </span>
537 </td>
538 <td class='required'>:</td>
539 <td>
540 <input type='entry' size='20' name='i<?php echo $i?>plan_name' value="<?php echo $result3{"plan_name"} ?>"
541 onchange="capitalizeMe(this);" />&nbsp;&nbsp;
542 </td>
543 </tr>
545 <tr>
546 <td>
547 <span class='required'><?php xl('Effective Date','e'); ?></span>
548 </td>
549 <td class='required'>:</td>
550 <td>
551 <input type='entry' size='16' id='i<?php echo $i ?>effective_date' name='i<?php echo $i ?>effective_date'
552 value='<?php echo $result3['date'] ?>'
553 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
554 title='yyyy-mm-dd' />
555 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' id='img_i<?php echo $i ?>effective_date' border='0' alt='[?]' style='cursor:pointer' title='<?php xl('Click here to choose a date','e'); ?>'>
556 </td>
557 </tr>
559 <tr>
560 <td><span class=required><?php xl('Policy Number','e'); ?></span></td>
561 <td class='required'>:</td>
562 <td><input type='entry' size='16' name='i<?php echo $i?>policy_number' value="<?php echo $result3{"policy_number"}?>"
563 onkeyup='policykeyup(this)'></td>
564 </tr>
566 <tr>
567 <td><span class=required><?php xl('Group Number','e'); ?></span></td>
568 <td class='required'>:</td>
569 <td><input type=entry size=16 name=i<?php echo $i?>group_number value="<?php echo $result3{"group_number"}?>" onkeyup='policykeyup(this)'></td>
570 </tr>
572 <tr<?php if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?>>
573 <td class='required'><?php xl('Subscriber Employer (SE)','e'); ?><br><span style='font-weight:normal'>
574 (<?php xl('if unemployed enter Student','e'); ?>,<br><?php xl('PT Student, or leave blank','e'); ?>) </span></td>
575 <td class='required'>:</td>
576 <td><input type=entry size=25 name=i<?php echo $i?>subscriber_employer
577 value="<?php echo $result3{"subscriber_employer"}?>"
578 onchange="capitalizeMe(this);" /></td>
579 </tr>
581 <tr<?php if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?>>
582 <td><span class=required><?php xl('SE Address','e'); ?></span></td>
583 <td class='required'>:</td>
584 <td><input type=entry size=25 name=i<?php echo $i?>subscriber_employer_street
585 value="<?php echo $result3{"subscriber_employer_street"}?>"
586 onchange="capitalizeMe(this);" /></td>
587 </tr>
589 <tr<?php if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?>>
590 <td colspan="3">
591 <table>
592 <tr>
593 <td><span class=required><?php xl('SE City','e'); ?>: </span></td>
594 <td><input type=entry size=15 name=i<?php echo $i?>subscriber_employer_city
595 value="<?php echo $result3{"subscriber_employer_city"}?>"
596 onchange="capitalizeMe(this);" /></td>
597 <td><span class=required><?php echo ($GLOBALS['phone_country_code'] == '1') ? xl('SE State','e') : xl('SE Locality','e') ?>: </span></td>
598 <td>
599 <?php
600 // Modified 7/2009 by BM to incorporate data types
601 generate_form_field(array('data_type'=>$GLOBALS['state_data_type'],'field_id'=>('i'.$i.'subscriber_employer_state'),'list_id'=>$GLOBALS['state_list'],'fld_length'=>'15','max_length'=>'63','edit_options'=>'C'), $result3['subscriber_employer_state']);
603 </td>
604 </tr>
605 <tr>
606 <td><span class=required><?php echo ($GLOBALS['phone_country_code'] == '1') ? xl('SE Zip Code','e') : xl('SE Postal Code','e') ?>: </span></td>
607 <td><input type=entry size=15 name=i<?php echo $i?>subscriber_employer_postal_code value="<?php echo $result3{"subscriber_employer_postal_code"}?>"></td>
608 <td><span class=required><?php xl('SE Country','e'); ?>: </span></td>
609 <td>
610 <?php
611 // Modified 7/2009 by BM to incorporate data types
612 generate_form_field(array('data_type'=>$GLOBALS['country_data_type'],'field_id'=>('i'.$i.'subscriber_employer_country'),'list_id'=>$GLOBALS['country_list'],'fld_length'=>'10','max_length'=>'63','edit_options'=>'C'), $result3['subscriber_employer_country']);
614 </td>
615 </tr>
616 </table>
617 </td>
618 </tr>
620 </table>
621 </td>
623 <td valign=top>
624 <table border="0">
625 <tr>
626 <td><span class=required><?php xl('Relationship','e'); ?></span></td>
627 <td class=required>:</td>
628 <td colspan=3><?php
629 // Modified 6/2009 by BM to use list_options and function
630 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_relationship'),'list_id'=>'sub_relation','empty_title'=>' '), $result3['subscriber_relationship']);
633 <a href="javascript:popUp('browse.php?browsenum=<?php echo $i?>')" class=text>(<?php xl('Browse','e'); ?>)</a></td>
634 <td></td><td></td><td></td><td></td>
635 </tr>
636 <tr>
637 <td width=120><span class=required><?php xl('Subscriber','e'); ?> </span></td>
638 <td class=required>:</td>
639 <td colspan=3><input type=entry size=10 name=i<?php echo $i?>subscriber_fname value="<?php echo $result3{"subscriber_fname"}?>" onchange="capitalizeMe(this);" />
640 <input type=entry size=3 name=i<?php echo $i?>subscriber_mname value="<?php echo $result3{"subscriber_mname"}?>" onchange="capitalizeMe(this);" />
641 <input type=entry size=10 name=i<?php echo $i?>subscriber_lname value="<?php echo $result3{"subscriber_lname"}?>" onchange="capitalizeMe(this);" /></td>
642 <td></td><td></td><td></td><td></td>
643 </tr>
644 <tr>
645 <td><span class=bold><?php xl('D.O.B.','e'); ?> </span></td>
646 <td class=required>:</td>
647 <td><input type='entry' size='11' id='i<?php echo $i?>subscriber_DOB' name='i<?php echo $i?>subscriber_DOB' value='<?php echo $result3['subscriber_DOB'] ?>' onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' title='yyyy-mm-dd' /><img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' id='img_i<?php echo $i; ?>dob_date' border='0' alt='[?]' style='cursor:pointer' title='<?php xl('Click here to choose a date','e'); ?>'></td>
649 <td><span class=bold><?php xl('Sex','e'); ?>: </span></td>
650 <td><?php
651 // Modified 6/2009 by BM to use list_options and function
652 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_sex'),'list_id'=>'sex'), $result3['subscriber_sex']);
654 </td>
655 <td></td><td></td> <td></td><td></td>
656 </tr>
657 <tr>
658 <td class=leftborder><span class=bold><?php xl('S.S.','e'); ?> </span></td>
659 <td class=required>:</td>
660 <td><input type=entry size=11 name=i<?php echo $i?>subscriber_ss value="<?php echo trim($result3{"subscriber_ss"})?>"></td>
661 </tr>
663 <tr>
664 <td><span class=required><?php xl('Subscriber Address','e'); ?> </span></td>
665 <td class=required>:</td>
666 <td><input type=entry size=20 name=i<?php echo $i?>subscriber_street value="<?php echo $result3{"subscriber_street"}?>" onchange="capitalizeMe(this);" /></td>
668 <td><span class=required><?php echo ($GLOBALS['phone_country_code'] == '1') ? xl('State','e') : xl('Locality','e') ?>: </span></td>
669 <td>
670 <?php
671 // Modified 7/2009 by BM to incorporate data types
672 generate_form_field(array('data_type'=>$GLOBALS['state_data_type'],'field_id'=>('i'.$i.'subscriber_state'),'list_id'=>$GLOBALS['state_list'],'fld_length'=>'15','max_length'=>'63','edit_options'=>'C'), $result3['subscriber_state']);
674 </td>
675 </tr>
676 <tr>
677 <td class=leftborder><span class=required><?php xl('City','e'); ?></span></td>
678 <td class=required>:</td>
679 <td><input type=entry size=11 name=i<?php echo $i?>subscriber_city value="<?php echo $result3{"subscriber_city"}?>" onchange="capitalizeMe(this);" /></td><td class=leftborder><span class='required'<?php if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?>><?php xl('Country','e'); ?>: </span></td><td>
680 <?php
681 // Modified 7/2009 by BM to incorporate data types
682 generate_form_field(array('data_type'=>$GLOBALS['country_data_type'],'field_id'=>('i'.$i.'subscriber_country'),'list_id'=>$GLOBALS['country_list'],'fld_length'=>'10','max_length'=>'63','edit_options'=>'C'), $result3['subscriber_country']);
684 </td>
685 </tr>
686 <tr>
687 <td><span class=required><?php echo ($GLOBALS['phone_country_code'] == '1') ? xl('Zip Code','e') : xl('Postal Code','e') ?> </span></td><td class=required>:</td><td><input type=entry size=10 name=i<?php echo $i?>subscriber_postal_code value="<?php echo $result3{"subscriber_postal_code"}?>"></td>
689 <td colspan=2>
690 </td><td></td>
691 </tr>
692 <tr>
693 <td><span class=bold><?php xl('Subscriber Phone','e'); ?></span></td>
694 <td class=required>:</td>
695 <td><input type='text' size='20' name='i<?php echo $i?>subscriber_phone' value='<?php echo $result3["subscriber_phone"] ?>' onkeyup='phonekeyup(this,mypcc)' /></td>
696 <td colspan=2><span class=bold><?php xl('CoPay','e'); ?>: <input type=text size="6" name=i<?php echo $i?>copay value="<?php echo $result3{"copay"}?>"></span></td>
697 <td colspan=2>
698 </td><td></td><td></td>
699 </tr>
700 <tr>
701 <td colspan=0><span class='required'><?php xl('Accept Assignment','e'); ?></span></td>
702 <td class=required>:</td>
703 <td colspan=2>
704 <select name=i<?php echo $i?>accept_assignment>
705 <option value="TRUE" <?php if (strtoupper($result3{"accept_assignment"}) == "TRUE") echo "selected"?>><?php xl('YES','e'); ?></option>
706 <option value="FALSE" <?php if (strtoupper($result3{"accept_assignment"}) == "FALSE") echo "selected"?>><?php xl('NO','e'); ?></option>
707 </select>
708 </td>
709 <td></td><td></td>
710 <td colspan=2>
711 </td><td></td>
712 </tr>
713 <tr>
714 <td><span class='bold'><?php xl('Secondary Medicare Type','e'); ?></span></td>
715 <td class='bold'>:</td>
716 <td colspan='6'>
717 <select name=i<?php echo $i?>policy_type>
718 <?php
719 foreach ($policy_types AS $key => $value) {
720 echo " <option value ='$key'";
721 if ($key == $result3['policy_type']) echo " selected";
722 echo ">" . htmlspecialchars($value) . "</option>\n";
725 </select>
726 </td>
727 </tr>
728 </table>
730 </td>
731 </tr>
732 </table>
734 </div>
736 <?php } //end insurer for loop ?>
738 </div>
739 </div>
741 <?php } // end of "if not simplified_demographics" ?>
742 </div></div>
744 </form>
746 <br>
748 <script language="JavaScript">
749 // hard code validation for old validation, in the new validation possible to add match rules
750 <?php if($GLOBALS['new_validate'] == 0) { ?>
751 // fix inconsistently formatted phone numbers from the database
752 var f = document.forms[0];
753 if (f.form_phone_contact) phonekeyup(f.form_phone_contact,mypcc);
754 if (f.form_phone_home ) phonekeyup(f.form_phone_home ,mypcc);
755 if (f.form_phone_biz ) phonekeyup(f.form_phone_biz ,mypcc);
756 if (f.form_phone_cell ) phonekeyup(f.form_phone_cell ,mypcc);
758 <?php if (! $GLOBALS['simplified_demographics']) { ?>
759 phonekeyup(f.i1subscriber_phone,mypcc);
760 phonekeyup(f.i2subscriber_phone,mypcc);
761 phonekeyup(f.i3subscriber_phone,mypcc);
762 <?php } ?>
764 <?php }?>
766 <?php if ($GLOBALS['concurrent_layout'] && $set_pid) { ?>
767 parent.left_nav.setPatient(<?php echo "'" . addslashes($result['fname']) . " " . addslashes($result['lname']) . "',$pid,'" . addslashes($result['pubpid']) . "','', ' " . xl('DOB') . ": " . oeFormatShortDate($result['DOB_YMD']) . " " . xl('Age') . ": " . getPatientAgeDisplay($result['DOB_YMD']) . "'"; ?>);
768 parent.left_nav.setRadio(window.name, 'dem');
769 <?php } ?>
771 <?php echo $date_init; ?>
772 <?php if (! $GLOBALS['simplified_demographics']) { for ($i=1; $i<=3; $i++): ?>
773 Calendar.setup({inputField:"i<?php echo $i?>effective_date", ifFormat:"%Y-%m-%d", button:"img_i<?php echo $i?>effective_date"});
774 Calendar.setup({inputField:"i<?php echo $i?>subscriber_DOB", ifFormat:"%Y-%m-%d", button:"img_i<?php echo $i?>dob_date"});
775 <?php endfor; } ?>
776 </script>
778 <!-- include support for the list-add selectbox feature -->
779 <?php include $GLOBALS['fileroot']."/library/options_listadd.inc"; ?>
781 <?php /*Include the validation script and rules for this form*/
782 $form_id="DEM";
784 <?php include_once("$srcdir/validation/validation_script.js.php");?>
787 </body>
788 <script language='JavaScript'>
789 // Array of skip conditions for the checkSkipConditions() function.
790 var skipArray = [
791 <?php echo $condition_str; ?>
793 checkSkipConditions();
794 $("input").change(function() {
795 checkSkipConditions();
797 $("select").change(function() {
798 checkSkipConditions();
800 </script>
803 </html>