b29fa6d62e5ceace90ad68c4c0e5d520cdeeae88
[openemr.git] / interface / patient_file / summary / demographics_full.php
blobb29fa6d62e5ceace90ad68c4c0e5d520cdeeae88
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");
13 // Session pid must be right or bad things can happen when demographics are saved!
15 include_once("$srcdir/pid.inc");
16 $set_pid = $_GET["set_pid"] ? $_GET["set_pid"] : $_GET["pid"];
17 if ($set_pid && $set_pid != $_SESSION["pid"]) {
18 setpid($set_pid);
21 include_once("$srcdir/patient.inc");
23 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
24 $result2 = getEmployerData($pid);
26 // Check authorization.
27 if ($pid) {
28 if (!acl_check('patients', 'demo', '', 'write'))
29 die(xl('Updating demographics is not authorized.'));
30 if ($result['squad'] && ! acl_check('squads', $result['squad']))
31 die(xl('You are not authorized to access this squad.'));
32 } else {
33 if (!acl_check('patients', 'demo', '', array('write','addonly') ))
34 die(xl('Adding demographics is not authorized.'));
37 $CPR = 4; // cells per row
39 // $statii = array('married','single','divorced','widowed','separated','domestic partner');
40 // $langi = getLanguages();
41 // $ethnoraciali = getEthnoRacials();
42 // $provideri = getProviderInfo();
44 $insurancei = getInsuranceProviders();
46 $fres = sqlStatement("SELECT * FROM layout_options " .
47 "WHERE form_id = 'DEM' AND uor > 0 " .
48 "ORDER BY group_name, seq");
50 <html>
51 <head>
52 <?php html_header_show();?>
54 <link rel="stylesheet" href="<?php echo $css_header; ?>" type="text/css">
56 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
58 <script type="text/javascript" src="../../../library/dialog.js"></script>
59 <script type="text/javascript" src="../../../library/textformat.js"></script>
60 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
61 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
62 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
64 <script type="text/javascript" src="../../../library/js/jquery.1.3.2.js"></script>
65 <script type="text/javascript" src="../../../library/js/common.js"></script>
67 <script type="text/javascript" src="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
68 <link rel="stylesheet" type="text/css" href="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
70 <script type="text/javascript">
71 $(document).ready(function(){
72 tabbify();
73 enable_modals();
75 // special size for
76 $(".medium_modal").fancybox( {
77 'overlayOpacity' : 0.0,
78 'showCloseButton' : true,
79 'frameHeight' : 460,
80 'frameWidth' : 650
81 });
83 });
85 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
87 //code used from http://tech.irt.org/articles/js037/
88 function replace(string,text,by) {
89 // Replaces text with by in string
90 var strLength = string.length, txtLength = text.length;
91 if ((strLength == 0) || (txtLength == 0)) return string;
93 var i = string.indexOf(text);
94 if ((!i) && (text != string.substring(0,txtLength))) return string;
95 if (i == -1) return string;
97 var newstr = string.substring(0,i) + by;
99 if (i+txtLength < strLength)
100 newstr += replace(string.substring(i+txtLength,strLength),text,by);
102 return newstr;
105 function upperFirst(string,text) {
106 return replace(string,text,text.charAt(0).toUpperCase() + text.substring(1,text.length));
109 <?php for ($i=1;$i<=3;$i++) { ?>
110 function auto_populate_employer_address<?php echo $i ?>(){
111 var f = document.demographics_form;
112 if (f.form_i<?php echo $i?>subscriber_relationship.options[f.form_i<?php echo $i?>subscriber_relationship.selectedIndex].value == "self")
114 f.i<?php echo $i?>subscriber_fname.value=f.form_fname.value;
115 f.i<?php echo $i?>subscriber_mname.value=f.form_mname.value;
116 f.i<?php echo $i?>subscriber_lname.value=f.form_lname.value;
117 f.i<?php echo $i?>subscriber_street.value=f.form_street.value;
118 f.i<?php echo $i?>subscriber_city.value=f.form_city.value;
119 f.form_i<?php echo $i?>subscriber_state.value=f.form_state.value;
120 f.i<?php echo $i?>subscriber_postal_code.value=f.form_postal_code.value;
121 if (f.form_country_code)
122 f.form_i<?php echo $i?>subscriber_country.value=f.form_country_code.value;
123 f.i<?php echo $i?>subscriber_phone.value=f.form_phone_home.value;
124 f.i<?php echo $i?>subscriber_DOB.value=f.form_DOB.value;
125 f.i<?php echo $i?>subscriber_ss.value=f.form_ss.value;
126 f.form_i<?php echo $i?>subscriber_sex.value = f.form_sex.value;
127 f.i<?php echo $i?>subscriber_employer.value=f.form_em_name.value;
128 f.i<?php echo $i?>subscriber_employer_street.value=f.form_em_street.value;
129 f.i<?php echo $i?>subscriber_employer_city.value=f.form_em_city.value;
130 f.form_i<?php echo $i?>subscriber_employer_state.value=f.form_em_state.value;
131 f.i<?php echo $i?>subscriber_employer_postal_code.value=f.form_em_postal_code.value;
132 if (f.form_em_country)
133 f.form_i<?php echo $i?>subscriber_employer_country.value=f.form_em_country.value;
137 <?php } ?>
139 function popUp(URL) {
140 day = new Date();
141 id = day.getTime();
142 top.restoreSession();
143 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');");
146 function checkNum () {
147 var re= new RegExp();
148 re = /^\d*\.?\d*$/;
149 str=document.demographics_form.monthly_income.value;
150 if(re.exec(str))
152 }else{
153 alert("<?php xl('Please enter a monetary amount using only numbers and a decimal point.','e'); ?>");
157 // Indicates which insurance slot is being updated.
158 var insurance_index = 0;
160 // The OnClick handler for searching/adding the insurance company.
161 function ins_search(ins) {
162 insurance_index = ins;
163 return false;
166 // The ins_search.php window calls this to set the selected insurance.
167 function set_insurance(ins_id, ins_name) {
168 var thesel = document.forms[0]['i' + insurance_index + 'provider'];
169 var theopts = thesel.options; // the array of Option objects
170 var i = 0;
171 for (; i < theopts.length; ++i) {
172 if (theopts[i].value == ins_id) {
173 theopts[i].selected = true;
174 return;
177 // no matching option was found so create one, append it to the
178 // end of the list, and select it.
179 theopts[i] = new Option(ins_name, ins_id, false, true);
182 // This capitalizes the first letter of each word in the passed input
183 // element. It also strips out extraneous spaces.
184 function capitalizeMe(elem) {
185 var a = elem.value.split(' ');
186 var s = '';
187 for(var i = 0; i < a.length; ++i) {
188 if (a[i].length > 0) {
189 if (s.length > 0) s += ' ';
190 s += a[i].charAt(0).toUpperCase() + a[i].substring(1);
193 elem.value = s;
196 function divclick(cb, divid) {
197 var divstyle = document.getElementById(divid).style;
198 if (cb.checked) {
199 divstyle.display = 'block';
200 } else {
201 divstyle.display = 'none';
203 return true;
206 // Compute the length of a string without leading and trailing spaces.
207 function trimlen(s) {
208 var i = 0;
209 var j = s.length - 1;
210 for (; i <= j && s.charAt(i) == ' '; ++i);
211 for (; i <= j && s.charAt(j) == ' '; --j);
212 if (i > j) return 0;
213 return j + 1 - i;
216 function validate(f) {
217 var errCount = 0;
218 var errMsgs = new Array();
219 <?php generate_layout_validation('DEM'); ?>
221 var msg = "";
222 msg += "<?php xl('The following fields are required', 'e' ); ?>:\n\n";
223 for ( var i = 0; i < errMsgs.length; i++ ) {
224 msg += errMsgs[i] + "\n";
226 msg += "\n<?php xl('Please fill them in before continuing.', 'e'); ?>";
228 if ( errMsgs.length > 0 ) {
229 alert(msg);
232 //Patient Data validations
233 <?php if($GLOBALS['erx_enable']){ ?>
234 alertMsg='';
235 for(i=0;i<f.length;i++){
236 if(f[i].type=='text' && f[i].value)
238 if(f[i].name == 'form_fname' || f[i].name == 'form_mname' || f[i].name == 'form_lname')
240 alertMsg += checkLength(f[i].name,f[i].value,35);
241 alertMsg += checkUsername(f[i].name,f[i].value);
243 else if(f[i].name == 'form_street' || f[i].name == 'form_city')
245 alertMsg += checkLength(f[i].name,f[i].value,35);
246 alertMsg += checkAlphaNumericExtended(f[i].name,f[i].value);
248 else if(f[i].name == 'form_phone_home')
250 alertMsg += checkPhone(f[i].name,f[i].value);
254 if(alertMsg)
256 alert(alertMsg);
257 return false;
259 <?php } ?>
260 //return false;
262 // Some insurance validation.
263 for (var i = 1; i <= 3; ++i) {
264 subprov = 'i' + i + 'provider';
265 if (!f[subprov] || f[subprov].selectedIndex <= 0) continue;
266 var subpfx = 'i' + i + 'subscriber_';
267 var subrelat = f['form_' + subpfx + 'relationship'];
268 var samename =
269 f[subpfx + 'fname'].value == f.form_fname.value &&
270 f[subpfx + 'mname'].value == f.form_mname.value &&
271 f[subpfx + 'lname'].value == f.form_lname.value;
272 var samess = f[subpfx + 'ss'].value == f.form_ss.value;
273 if (subrelat.options[subrelat.selectedIndex].value == "self") {
274 if (!samename) {
275 if (!confirm("<?php xl('Subscriber relationship is self but name is different! Is this really OK?','e'); ?>"))
276 return false;
278 if (!samess) {
279 alert("<?php xl('Subscriber relationship is self but SS number is different!','e'); ?>");
280 return false;
282 } // end self
283 else {
284 if (samename) {
285 if (!confirm("<?php xl('Subscriber relationship is not self but name is the same! Is this really OK?','e'); ?>"))
286 return false;
288 if (samess) {
289 alert("<?php xl('Subscriber relationship is not self but SS number is the same!','e'); ?>");
290 return false;
292 } // end not self
293 } // end for
295 return errMsgs.length < 1;
298 function submitme() {
299 var f = document.forms[0];
300 if (validate(f)) {
301 top.restoreSession();
302 f.submit();
306 // Onkeyup handler for policy number. Allows only A-Z and 0-9.
307 function policykeyup(e) {
308 var v = e.value.toUpperCase();
309 for (var i = 0; i < v.length; ++i) {
310 var c = v.charAt(i);
311 if (c >= '0' && c <= '9') continue;
312 if (c >= 'A' && c <= 'Z') continue;
313 if (c == '*') continue;
314 if (c == '-') continue;
315 if (c == '_') continue;
316 if (c == '(') continue;
317 if (c == ')') continue;
318 if (c == '#') continue;
319 v = v.substring(0, i) + v.substring(i + i);
320 --i;
322 e.value = v;
323 return;
326 // Added 06/2009 by BM to make compatible with list_options table and functions - using jquery
327 $(document).ready(function() {
329 <?php for ($i=1;$i<=3;$i++) { ?>
330 $("#form_i<?php echo $i?>subscriber_relationship").change(function() { auto_populate_employer_address<?php echo $i?>(); });
331 <?php } ?>
335 </script>
336 </head>
338 <body class="body_top">
339 <form action='demographics_save.php' name='demographics_form' method='post' onsubmit='return validate(this)'>
340 <input type='hidden' name='mode' value='save' />
341 <input type='hidden' name='db_id' value="<?php echo $result['id']?>" />
342 <table cellpadding='0' cellspacing='0' border='0'>
343 <tr>
344 <td>
345 <?php if ($GLOBALS['concurrent_layout']) { ?>
346 <a href="demographics.php" onclick="top.restoreSession()">
347 <?php } else { ?>
348 <a href="patient_summary.php" target="Main" onclick="top.restoreSession()">
349 <?php } ?>
350 <font class=title><?php xl('Current Patient','e'); ?></font>
351 </a>
352 &nbsp;&nbsp;
353 </td>
354 <td>
355 <a href="javascript:submitme();" class='css_button'>
356 <span><?php xl('Save','e'); ?></span>
357 </a>
358 </td>
359 <td>
360 <?php if ($GLOBALS['concurrent_layout']) { ?>
361 <a class="css_button" href="demographics.php" onclick="top.restoreSession()">
362 <?php } else { ?>
363 <a href="patient_summary.php" target="Main" onclick="top.restoreSession()">
364 <?php } ?>
365 <span><?php xl('Cancel','e'); ?></span>
366 </a>
367 </td>
368 </tr>
369 </table>
370 <?php
372 function end_cell() {
373 global $item_count, $cell_count;
374 if ($item_count > 0) {
375 echo "</td>";
376 $item_count = 0;
380 function end_row() {
381 global $cell_count, $CPR;
382 end_cell();
383 if ($cell_count > 0) {
384 for (; $cell_count < $CPR; ++$cell_count) echo "<td></td>";
385 echo "</tr>\n";
386 $cell_count = 0;
390 function end_group() {
391 global $last_group;
392 if (strlen($last_group) > 0) {
393 end_row();
394 echo " </table>\n";
395 echo "</div>\n";
399 $last_group = '';
400 $cell_count = 0;
401 $item_count = 0;
402 $display_style = 'block';
404 $group_seq=0; // this gives the DIV blocks unique IDs
407 <br>
408 <div class="section-header">
409 <span class="text"><b> <?php xl("Demographics", "e" )?></b></span>
410 </div>
412 <div id="DEM" >
414 <ul class="tabNav">
415 <?php display_layout_tabs('DEM', $result, $result2); ?>
416 </ul>
418 <div class="tabContainer">
419 <?php display_layout_tabs_data_editable('DEM', $result, $result2); ?>
420 </div>
421 </div>
422 <br>
423 <div class="section-header">
424 <span class="text"><b><?php xl("Insurance", "e" )?></b></span>
425 </div>
426 <div id="DEM" >
429 <?php
430 if (! $GLOBALS['simplified_demographics']) {
432 $insurance_headings = array(xl("Primary Insurance Provider"), xl("Secondary Insurance Provider"), xl("Tertiary Insurance provider"));
433 $insurance_info = array();
434 $insurance_info[1] = getInsuranceData($pid,"primary");
435 $insurance_info[2] = getInsuranceData($pid,"secondary");
436 $insurance_info[3] = getInsuranceData($pid,"tertiary");
439 <div id="INSURANCE" >
440 <ul class="tabNav">
441 <?php
442 foreach (array('primary','secondary','tertiary') as $instype) {
443 ?><li <?php echo $instype == 'primary' ? 'class="current"' : '' ?>><a href="/play/javascript-tabbed-navigation/"><?php $CapInstype=ucfirst($instype); xl($CapInstype,'e'); ?></a></li><?php
446 </ul>
448 <div class="tabContainer">
450 <?php
451 for($i=1;$i<=3;$i++) {
452 $result3 = $insurance_info[$i];
455 <div class="tab <?php echo $i == 1 ? 'current': '' ?>" style='height:auto;width:auto'> <!---display icky, fix to auto-->
457 <table border="0">
459 <tr>
460 <td valign=top width="430">
461 <table border="0">
463 <tr>
464 <td valign='top'>
465 <span class='required'><?php echo $insurance_headings[$i -1]."&nbsp;"?></span>
466 </td>
467 <td class='required'>:</td>
468 <td>
469 <a href="../../practice/ins_search.php" class="iframe medium_modal css_button" onclick="ins_search(<?php echo $i?>)">
470 <span><?php echo xl('Search/Add') ?></span>
471 </a>
472 <select name="i<?php echo $i?>provider">
473 <option value=""><?php xl('Unassigned','e'); ?></option>
474 <?php
475 foreach ($insurancei as $iid => $iname) {
476 echo "<option value='" . $iid . "'";
477 if (strtolower($iid) == strtolower($result3{"provider"}))
478 echo " selected";
479 echo ">" . $iname . "</option>\n";
482 </select>
484 </td>
485 </tr>
487 <tr>
488 <td>
489 <span class='required'><?php xl('Plan Name','e'); ?> </span>
490 </td>
491 <td class='required'>:</td>
492 <td>
493 <input type='entry' size='20' name='i<?php echo $i?>plan_name' value="<?php echo $result3{"plan_name"} ?>"
494 onchange="capitalizeMe(this);" />&nbsp;&nbsp;
495 </td>
496 </tr>
498 <tr>
499 <td>
500 <span class='required'><?php xl('Effective Date','e'); ?></span>
501 </td>
502 <td class='required'>:</td>
503 <td>
504 <input type='entry' size='16' id='i<?php echo $i ?>effective_date' name='i<?php echo $i ?>effective_date'
505 value='<?php echo $result3['date'] ?>'
506 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
507 title='yyyy-mm-dd' />
508 <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'); ?>'>
509 </td>
510 </tr>
512 <tr>
513 <td><span class=required><?php xl('Policy Number','e'); ?></span></td>
514 <td class='required'>:</td>
515 <td><input type='entry' size='16' name='i<?php echo $i?>policy_number' value="<?php echo $result3{"policy_number"}?>"
516 onkeyup='policykeyup(this)'></td>
517 </tr>
519 <tr>
520 <td><span class=required><?php xl('Group Number','e'); ?></span></td>
521 <td class='required'>:</td>
522 <td><input type=entry size=16 name=i<?php echo $i?>group_number value="<?php echo $result3{"group_number"}?>" onkeyup='policykeyup(this)'></td>
523 </tr>
525 <tr<?php if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?>>
526 <td class='required'><?php xl('Subscriber Employer (SE)','e'); ?><br><span style='font-weight:normal'>
527 (<?php xl('if unemployed enter Student','e'); ?>,<br><?php xl('PT Student, or leave blank','e'); ?>) </span></td>
528 <td class='required'>:</td>
529 <td><input type=entry size=25 name=i<?php echo $i?>subscriber_employer
530 value="<?php echo $result3{"subscriber_employer"}?>"
531 onchange="capitalizeMe(this);" /></td>
532 </tr>
534 <tr<?php if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?>>
535 <td><span class=required><?php xl('SE Address','e'); ?></span></td>
536 <td class='required'>:</td>
537 <td><input type=entry size=25 name=i<?php echo $i?>subscriber_employer_street
538 value="<?php echo $result3{"subscriber_employer_street"}?>"
539 onchange="capitalizeMe(this);" /></td>
540 </tr>
542 <tr<?php if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?>>
543 <td colspan="3">
544 <table>
545 <tr>
546 <td><span class=required><?php xl('SE City','e'); ?>: </span></td>
547 <td><input type=entry size=15 name=i<?php echo $i?>subscriber_employer_city
548 value="<?php echo $result3{"subscriber_employer_city"}?>"
549 onchange="capitalizeMe(this);" /></td>
550 <td><span class=required><?php echo ($GLOBALS['phone_country_code'] == '1') ? xl('SE State','e') : xl('SE Locality','e') ?>: </span></td>
551 <td>
552 <?php
553 // Modified 7/2009 by BM to incorporate data types
554 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']);
556 </td>
557 </tr>
558 <tr>
559 <td><span class=required><?php echo ($GLOBALS['phone_country_code'] == '1') ? xl('SE Zip Code','e') : xl('SE Postal Code','e') ?>: </span></td>
560 <td><input type=entry size=15 name=i<?php echo $i?>subscriber_employer_postal_code value="<?php echo $result3{"subscriber_employer_postal_code"}?>"></td>
561 <td><span class=required><?php xl('SE Country','e'); ?>: </span></td>
562 <td>
563 <?php
564 // Modified 7/2009 by BM to incorporate data types
565 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']);
567 </td>
568 </tr>
569 </table>
570 </td>
571 </tr>
573 </table>
574 </td>
576 <td valign=top>
577 <table border="0">
578 <tr>
579 <td><span class=required><?php xl('Relationship','e'); ?></span></td>
580 <td class=required>:</td>
581 <td colspan=3><?php
582 // Modified 6/2009 by BM to use list_options and function
583 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_relationship'),'list_id'=>'sub_relation','empty_title'=>' '), $result3['subscriber_relationship']);
586 <a href="javascript:popUp('browse.php?browsenum=<?php echo $i?>')" class=text>(<?php xl('Browse','e'); ?>)</a></td>
587 <td></td><td></td><td></td><td></td>
588 </tr>
589 <tr>
590 <td width=120><span class=required><?php xl('Subscriber','e'); ?> </span></td>
591 <td class=required>:</td>
592 <td colspan=3><input type=entry size=10 name=i<?php echo $i?>subscriber_fname value="<?php echo $result3{"subscriber_fname"}?>" onchange="capitalizeMe(this);" />
593 <input type=entry size=3 name=i<?php echo $i?>subscriber_mname value="<?php echo $result3{"subscriber_mname"}?>" onchange="capitalizeMe(this);" />
594 <input type=entry size=10 name=i<?php echo $i?>subscriber_lname value="<?php echo $result3{"subscriber_lname"}?>" onchange="capitalizeMe(this);" /></td>
595 <td></td><td></td><td></td><td></td>
596 </tr>
597 <tr>
598 <td><span class=bold><?php xl('D.O.B.','e'); ?> </span></td>
599 <td class=required>:</td>
600 <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>
602 <td><span class=bold><?php xl('Sex','e'); ?>: </span></td>
603 <td><?php
604 // Modified 6/2009 by BM to use list_options and function
605 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_sex'),'list_id'=>'sex'), $result3['subscriber_sex']);
607 </td>
608 <td></td><td></td> <td></td><td></td>
609 </tr>
610 <tr>
611 <td class=leftborder><span class=bold><?php xl('S.S.','e'); ?> </span></td>
612 <td class=required>:</td>
613 <td><input type=entry size=11 name=i<?php echo $i?>subscriber_ss value="<?php echo trim($result3{"subscriber_ss"})?>"></td>
614 </tr>
616 <tr>
617 <td><span class=required><?php xl('Subscriber Address','e'); ?> </span></td>
618 <td class=required>:</td>
619 <td><input type=entry size=20 name=i<?php echo $i?>subscriber_street value="<?php echo $result3{"subscriber_street"}?>" onchange="capitalizeMe(this);" /></td>
621 <td><span class=required><?php echo ($GLOBALS['phone_country_code'] == '1') ? xl('State','e') : xl('Locality','e') ?>: </span></td>
622 <td>
623 <?php
624 // Modified 7/2009 by BM to incorporate data types
625 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']);
627 </td>
628 </tr>
629 <tr>
630 <td class=leftborder><span class=required><?php xl('City','e'); ?></span></td>
631 <td class=required>:</td>
632 <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>
633 <?php
634 // Modified 7/2009 by BM to incorporate data types
635 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']);
637 </td>
638 </tr>
639 <tr>
640 <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>
642 <td colspan=2>
643 </td><td></td>
644 </tr>
645 <tr>
646 <td><span class=bold><?php xl('Subscriber Phone','e'); ?></span></td>
647 <td class=required>:</td>
648 <td><input type='text' size='20' name='i<?php echo $i?>subscriber_phone' value='<?php echo $result3["subscriber_phone"] ?>' onkeyup='phonekeyup(this,mypcc)' /></td>
649 <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>
650 <td colspan=2>
651 </td><td></td><td></td>
652 </tr>
653 <tr>
654 <td colspan=0><span class='required'><?php xl('Accept Assignment','e'); ?></span></td>
655 <td class=required>:</td>
656 <td colspan=2>
657 <select name=i<?php echo $i?>accept_assignment>
658 <option value="TRUE" <?php if (strtoupper($result3{"accept_assignment"}) == "TRUE") echo "selected"?>><?php xl('YES','e'); ?></option>
659 <option value="FALSE" <?php if (strtoupper($result3{"accept_assignment"}) == "FALSE") echo "selected"?>><?php xl('NO','e'); ?></option>
660 </select>
661 </td>
662 <td></td><td></td>
663 <td colspan=2>
664 </td><td></td>
665 </tr>
666 <tr>
667 <td><span class='bold'><?php xl('Secondary Medicare Type','e'); ?></span></td>
668 <td class='bold'>:</td>
669 <td colspan='6'>
670 <select name=i<?php echo $i?>policy_type>
671 <?php
672 foreach ($policy_types AS $key => $value) {
673 echo " <option value ='$key'";
674 if ($key == $result3['policy_type']) echo " selected";
675 echo ">" . htmlspecialchars($value) . "</option>\n";
678 </select>
679 </td>
680 </tr>
681 </table>
683 </td>
684 </tr>
685 </table>
687 </div>
689 <?php } //end insurer for loop ?>
691 </div>
692 </div>
694 <?php } // end of "if not simplified_demographics" ?>
695 </div></div>
697 </form>
699 <br>
701 <script language="JavaScript">
703 // fix inconsistently formatted phone numbers from the database
704 var f = document.forms[0];
705 if (f.form_phone_contact) phonekeyup(f.form_phone_contact,mypcc);
706 if (f.form_phone_home ) phonekeyup(f.form_phone_home ,mypcc);
707 if (f.form_phone_biz ) phonekeyup(f.form_phone_biz ,mypcc);
708 if (f.form_phone_cell ) phonekeyup(f.form_phone_cell ,mypcc);
710 <?php if (! $GLOBALS['simplified_demographics']) { ?>
711 phonekeyup(f.i1subscriber_phone,mypcc);
712 phonekeyup(f.i2subscriber_phone,mypcc);
713 phonekeyup(f.i3subscriber_phone,mypcc);
714 <?php } ?>
716 <?php if ($GLOBALS['concurrent_layout'] && $set_pid) { ?>
717 parent.left_nav.setPatient(<?php echo "'" . addslashes($result['fname']) . " " . addslashes($result['lname']) . "',$pid,'" . addslashes($result['pubpid']) . "','', ' " . xl('DOB') . ": " . oeFormatShortDate($result['DOB_YMD']) . " " . xl('Age') . ": " . getPatientAge($result['DOB_YMD']) . "'"; ?>);
718 parent.left_nav.setRadio(window.name, 'dem');
719 <?php } ?>
721 <?php echo $date_init; ?>
722 <?php if (! $GLOBALS['simplified_demographics']) { for ($i=1; $i<=3; $i++): ?>
723 Calendar.setup({inputField:"i<?php echo $i?>effective_date", ifFormat:"%Y-%m-%d", button:"img_i<?php echo $i?>effective_date"});
724 Calendar.setup({inputField:"i<?php echo $i?>subscriber_DOB", ifFormat:"%Y-%m-%d", button:"img_i<?php echo $i?>dob_date"});
725 <?php endfor; } ?>
726 </script>
728 <!-- include support for the list-add selectbox feature -->
729 <?php include $GLOBALS['fileroot']."/library/options_listadd.inc"; ?>
731 </body>
733 </html>