Fixed
[openemr.git] / interface / patient_file / summary / demographics_full.php
blob26a2dc98b7826f78069b4e2569115cdf9733150c
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();
43 if ($GLOBALS['insurance_information'] != '0') {
44 $insurancei = getInsuranceProvidersExtra();
45 }else{
46 $insurancei = getInsuranceProviders();
49 $fres = sqlStatement("SELECT * FROM layout_options " .
50 "WHERE form_id = 'DEM' AND uor > 0 " .
51 "ORDER BY group_name, seq");
53 <html>
54 <head>
55 <?php html_header_show();?>
57 <link rel="stylesheet" href="<?php echo $css_header; ?>" type="text/css">
59 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
61 <script type="text/javascript" src="../../../library/dialog.js"></script>
62 <script type="text/javascript" src="../../../library/textformat.js"></script>
63 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
64 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
65 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
66 <script type="text/javascript" src="../../../library/js/jquery.1.3.2.js"></script>
67 <script type="text/javascript" src="../../../library/js/common.js"></script>
68 <script type="text/javascript" src="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
69 <?php include_once("{$GLOBALS['srcdir']}/options.js.php"); ?>
71 <link rel="stylesheet" type="text/css" href="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
73 <script type="text/javascript">
74 $(document).ready(function(){
75 tabbify();
76 enable_modals();
78 // special size for
79 $(".medium_modal").fancybox( {
80 'overlayOpacity' : 0.0,
81 'showCloseButton' : true,
82 'frameHeight' : 460,
83 'frameWidth' : 650
84 });
86 });
88 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
90 //code used from http://tech.irt.org/articles/js037/
91 function replace(string,text,by) {
92 // Replaces text with by in string
93 var strLength = string.length, txtLength = text.length;
94 if ((strLength == 0) || (txtLength == 0)) return string;
96 var i = string.indexOf(text);
97 if ((!i) && (text != string.substring(0,txtLength))) return string;
98 if (i == -1) return string;
100 var newstr = string.substring(0,i) + by;
102 if (i+txtLength < strLength)
103 newstr += replace(string.substring(i+txtLength,strLength),text,by);
105 return newstr;
108 function upperFirst(string,text) {
109 return replace(string,text,text.charAt(0).toUpperCase() + text.substring(1,text.length));
112 <?php for ($i=1;$i<=3;$i++) { ?>
113 function auto_populate_employer_address<?php echo $i ?>(){
114 var f = document.demographics_form;
115 if (f.form_i<?php echo $i?>subscriber_relationship.options[f.form_i<?php echo $i?>subscriber_relationship.selectedIndex].value == "self")
117 f.i<?php echo $i?>subscriber_fname.value=f.form_fname.value;
118 f.i<?php echo $i?>subscriber_mname.value=f.form_mname.value;
119 f.i<?php echo $i?>subscriber_lname.value=f.form_lname.value;
120 f.i<?php echo $i?>subscriber_street.value=f.form_street.value;
121 f.i<?php echo $i?>subscriber_city.value=f.form_city.value;
122 f.form_i<?php echo $i?>subscriber_state.value=f.form_state.value;
123 f.i<?php echo $i?>subscriber_postal_code.value=f.form_postal_code.value;
124 if (f.form_country_code)
125 f.form_i<?php echo $i?>subscriber_country.value=f.form_country_code.value;
126 f.i<?php echo $i?>subscriber_phone.value=f.form_phone_home.value;
127 f.i<?php echo $i?>subscriber_DOB.value=f.form_DOB.value;
128 if(typeof f.form_ss!="undefined")
130 f.i<?php echo $i?>subscriber_ss.value=f.form_ss.value;
132 f.form_i<?php echo $i?>subscriber_sex.value = f.form_sex.value;
133 f.i<?php echo $i?>subscriber_employer.value=f.form_em_name.value;
134 f.i<?php echo $i?>subscriber_employer_street.value=f.form_em_street.value;
135 f.i<?php echo $i?>subscriber_employer_city.value=f.form_em_city.value;
136 f.form_i<?php echo $i?>subscriber_employer_state.value=f.form_em_state.value;
137 f.i<?php echo $i?>subscriber_employer_postal_code.value=f.form_em_postal_code.value;
138 if (f.form_em_country)
139 f.form_i<?php echo $i?>subscriber_employer_country.value=f.form_em_country.value;
143 <?php } ?>
145 function popUp(URL) {
146 day = new Date();
147 id = day.getTime();
148 top.restoreSession();
149 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');");
152 function checkNum () {
153 var re= new RegExp();
154 re = /^\d*\.?\d*$/;
155 str=document.demographics_form.monthly_income.value;
156 if(re.exec(str))
158 }else{
159 alert("<?php xl('Please enter a monetary amount using only numbers and a decimal point.','e'); ?>");
163 // Indicates which insurance slot is being updated.
164 var insurance_index = 0;
166 // The OnClick handler for searching/adding the insurance company.
167 function ins_search(ins) {
168 insurance_index = ins;
169 return false;
172 // The ins_search.php window calls this to set the selected insurance.
173 function set_insurance(ins_id, ins_name) {
174 var thesel = document.forms[0]['i' + insurance_index + 'provider'];
175 var theopts = thesel.options; // the array of Option objects
176 var i = 0;
177 for (; i < theopts.length; ++i) {
178 if (theopts[i].value == ins_id) {
179 theopts[i].selected = true;
180 return;
183 // no matching option was found so create one, append it to the
184 // end of the list, and select it.
185 theopts[i] = new Option(ins_name, ins_id, false, true);
188 // This capitalizes the first letter of each word in the passed input
189 // element. It also strips out extraneous spaces.
190 function capitalizeMe(elem) {
191 var a = elem.value.split(' ');
192 var s = '';
193 for(var i = 0; i < a.length; ++i) {
194 if (a[i].length > 0) {
195 if (s.length > 0) s += ' ';
196 s += a[i].charAt(0).toUpperCase() + a[i].substring(1);
199 elem.value = s;
202 function divclick(cb, divid) {
203 var divstyle = document.getElementById(divid).style;
204 if (cb.checked) {
205 divstyle.display = 'block';
206 } else {
207 divstyle.display = 'none';
209 return true;
212 // Compute the length of a string without leading and trailing spaces.
213 function trimlen(s) {
214 var i = 0;
215 var j = s.length - 1;
216 for (; i <= j && s.charAt(i) == ' '; ++i);
217 for (; i <= j && s.charAt(j) == ' '; --j);
218 if (i > j) return 0;
219 return j + 1 - i;
222 function validate(f) {
223 var errCount = 0;
224 var errMsgs = new Array();
225 <?php generate_layout_validation('DEM'); ?>
227 var msg = "";
228 msg += "<?php xl('The following fields are required', 'e' ); ?>:\n\n";
229 for ( var i = 0; i < errMsgs.length; i++ ) {
230 msg += errMsgs[i] + "\n";
232 msg += "\n<?php xl('Please fill them in before continuing.', 'e'); ?>";
234 if ( errMsgs.length > 0 ) {
235 alert(msg);
238 //Patient Data validations
239 <?php if($GLOBALS['erx_enable']){ ?>
240 alertMsg='';
241 for(i=0;i<f.length;i++){
242 if(f[i].type=='text' && f[i].value)
244 if(f[i].name == 'form_fname' || f[i].name == 'form_mname' || f[i].name == 'form_lname')
246 alertMsg += checkLength(f[i].name,f[i].value,35);
247 alertMsg += checkUsername(f[i].name,f[i].value);
249 else if(f[i].name == 'form_street' || f[i].name == 'form_city')
251 alertMsg += checkLength(f[i].name,f[i].value,35);
252 alertMsg += checkAlphaNumericExtended(f[i].name,f[i].value);
254 else if(f[i].name == 'form_phone_home')
256 alertMsg += checkPhone(f[i].name,f[i].value);
260 if(alertMsg)
262 alert(alertMsg);
263 return false;
265 <?php } ?>
266 //return false;
268 // Some insurance validation.
269 for (var i = 1; i <= 3; ++i) {
270 subprov = 'i' + i + 'provider';
271 if (!f[subprov] || f[subprov].selectedIndex <= 0) continue;
272 var subpfx = 'i' + i + 'subscriber_';
273 var subrelat = f['form_' + subpfx + 'relationship'];
274 var samename =
275 f[subpfx + 'fname'].value == f.form_fname.value &&
276 f[subpfx + 'mname'].value == f.form_mname.value &&
277 f[subpfx + 'lname'].value == f.form_lname.value;
278 var ss_regexp=/[0-9][0-9][0-9]-?[0-9][0-9]-?[0-9][0-9][0-9][0-9]/;
279 var samess=true;
280 var ss_valid=false;
281 if(typeof f.form_ss!="undefined")
283 samess = f[subpfx + 'ss'].value == f.form_ss.value;
284 ss_valid=ss_regexp.test(f[subpfx + 'ss'].value) && ss_regexp.test(f.form_ss.value);
286 if (subrelat.options[subrelat.selectedIndex].value == "self") {
287 if (!samename) {
288 if (!confirm("<?php echo xls('Subscriber relationship is self but name is different! Is this really OK?'); ?>"))
289 return false;
291 if (!samess && ss_valid) {
292 if(!confirm("<?php echo xls('Subscriber relationship is self but SS number is different!')." ". xls("Is this really OK?"); ?>"))
293 return false;
295 } // end self
296 else {
297 if (samename) {
298 if (!confirm("<?php echo xls('Subscriber relationship is not self but name is the same! Is this really OK?'); ?>"))
299 return false;
301 if (samess && ss_valid) {
302 if(!confirm("<?php echo xls('Subscriber relationship is not self but SS number is the same!') ." ". xls("Is this really OK?"); ?>"))
303 return false;
305 } // end not self
306 } // end for
308 return errMsgs.length < 1;
311 function submitme() {
312 var f = document.forms[0];
313 if (validate(f)) {
314 top.restoreSession();
315 f.submit();
319 // Onkeyup handler for policy number. Allows only A-Z and 0-9.
320 function policykeyup(e) {
321 var v = e.value.toUpperCase();
322 var filteredString="";
323 for (var i = 0; i < v.length; ++i) {
324 var c = v.charAt(i);
325 if ((c >= '0' && c <= '9') ||
326 (c >= 'A' && c <= 'Z') ||
327 (c == '*') ||
328 (c == '-') ||
329 (c == '_') ||
330 (c == '(') ||
331 (c == ')') ||
332 (c == '#'))
334 filteredString+=c;
337 e.value = filteredString;
338 return;
341 // Added 06/2009 by BM to make compatible with list_options table and functions - using jquery
342 $(document).ready(function() {
344 <?php for ($i=1;$i<=3;$i++) { ?>
345 $("#form_i<?php echo $i?>subscriber_relationship").change(function() { auto_populate_employer_address<?php echo $i?>(); });
346 <?php } ?>
350 </script>
351 </head>
353 <body class="body_top">
354 <form action='demographics_save.php' name='demographics_form' method='post' onsubmit='return validate(this)'>
355 <input type='hidden' name='mode' value='save' />
356 <input type='hidden' name='db_id' value="<?php echo $result['id']?>" />
357 <table cellpadding='0' cellspacing='0' border='0'>
358 <tr>
359 <td>
360 <?php if ($GLOBALS['concurrent_layout']) { ?>
361 <a href="demographics.php" onclick="top.restoreSession()">
362 <?php } else { ?>
363 <a href="patient_summary.php" target="Main" onclick="top.restoreSession()">
364 <?php } ?>
365 <font class=title><?php xl('Current Patient','e'); ?></font>
366 </a>
367 &nbsp;&nbsp;
368 </td>
369 <td>
370 <a href="javascript:submitme();" class='css_button'>
371 <span><?php xl('Save','e'); ?></span>
372 </a>
373 </td>
374 <td>
375 <?php if ($GLOBALS['concurrent_layout']) { ?>
376 <a class="css_button" href="demographics.php" onclick="top.restoreSession()">
377 <?php } else { ?>
378 <a href="patient_summary.php" target="Main" onclick="top.restoreSession()">
379 <?php } ?>
380 <span><?php xl('Cancel','e'); ?></span>
381 </a>
382 </td>
383 </tr>
384 </table>
385 <?php
387 function end_cell() {
388 global $item_count, $cell_count;
389 if ($item_count > 0) {
390 echo "</td>";
391 $item_count = 0;
395 function end_row() {
396 global $cell_count, $CPR;
397 end_cell();
398 if ($cell_count > 0) {
399 for (; $cell_count < $CPR; ++$cell_count) echo "<td></td>";
400 echo "</tr>\n";
401 $cell_count = 0;
405 function end_group() {
406 global $last_group;
407 if (strlen($last_group) > 0) {
408 end_row();
409 echo " </table>\n";
410 echo "</div>\n";
414 $last_group = '';
415 $cell_count = 0;
416 $item_count = 0;
417 $display_style = 'block';
419 $group_seq=0; // this gives the DIV blocks unique IDs
422 <br>
423 <div class="section-header">
424 <span class="text"><b> <?php xl("Demographics", "e" )?></b></span>
425 </div>
427 <div id="DEM" >
429 <ul class="tabNav">
430 <?php display_layout_tabs('DEM', $result, $result2); ?>
431 </ul>
433 <div class="tabContainer">
434 <?php display_layout_tabs_data_editable('DEM', $result, $result2); ?>
435 </div>
436 </div>
437 <br>
439 <div id="DEM" >
442 <?php
443 if (! $GLOBALS['simplified_demographics']) {
445 $insurance_headings = array(xl("Primary Insurance Provider"), xl("Secondary Insurance Provider"), xl("Tertiary Insurance provider"));
446 $insurance_info = array();
447 $insurance_info[1] = getInsuranceData($pid,"primary");
448 $insurance_info[2] = getInsuranceData($pid,"secondary");
449 $insurance_info[3] = getInsuranceData($pid,"tertiary");
452 <div class="section-header">
453 <span class="text"><b><?php xl("Insurance", "e" )?></b></span>
454 </div>
455 <div id="INSURANCE" >
456 <ul class="tabNav">
457 <?php
458 foreach (array('primary','secondary','tertiary') as $instype) {
459 ?><li <?php echo $instype == 'primary' ? 'class="current"' : '' ?>><a href="/play/javascript-tabbed-navigation/"><?php $CapInstype=ucfirst($instype); xl($CapInstype,'e'); ?></a></li><?php
462 </ul>
464 <div class="tabContainer">
466 <?php
467 for($i=1;$i<=3;$i++) {
468 $result3 = $insurance_info[$i];
471 <div class="tab <?php echo $i == 1 ? 'current': '' ?>" style='height:auto;width:auto'> <!---display icky, fix to auto-->
473 <table border="0">
475 <tr>
476 <td valign=top width="430">
477 <table border="0">
479 <tr>
480 <td valign='top'>
481 <span class='required'><?php echo $insurance_headings[$i -1]."&nbsp;"?></span>
482 </td>
483 <td class='required'>:</td>
484 <td>
485 <a href="../../practice/ins_search.php" class="iframe medium_modal css_button" onclick="ins_search(<?php echo $i?>)">
486 <span><?php echo xl('Search/Add') ?></span>
487 </a>
488 <select name="i<?php echo $i?>provider">
489 <option value=""><?php xl('Unassigned','e'); ?></option>
490 <?php
491 foreach ($insurancei as $iid => $iname) {
492 echo "<option value='" . $iid . "'";
493 if (strtolower($iid) == strtolower($result3{"provider"}))
494 echo " selected";
495 echo ">" . $iname . "</option>\n";
498 </select>
500 </td>
501 </tr>
503 <tr>
504 <td>
505 <span class='required'><?php xl('Plan Name','e'); ?> </span>
506 </td>
507 <td class='required'>:</td>
508 <td>
509 <input type='entry' size='20' name='i<?php echo $i?>plan_name' value="<?php echo $result3{"plan_name"} ?>"
510 onchange="capitalizeMe(this);" />&nbsp;&nbsp;
511 </td>
512 </tr>
514 <tr>
515 <td>
516 <span class='required'><?php xl('Effective Date','e'); ?></span>
517 </td>
518 <td class='required'>:</td>
519 <td>
520 <input type='entry' size='16' id='i<?php echo $i ?>effective_date' name='i<?php echo $i ?>effective_date'
521 value='<?php echo $result3['date'] ?>'
522 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
523 title='yyyy-mm-dd' />
524 <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'); ?>'>
525 </td>
526 </tr>
528 <tr>
529 <td><span class=required><?php xl('Policy Number','e'); ?></span></td>
530 <td class='required'>:</td>
531 <td><input type='entry' size='16' name='i<?php echo $i?>policy_number' value="<?php echo $result3{"policy_number"}?>"
532 onkeyup='policykeyup(this)'></td>
533 </tr>
535 <tr>
536 <td><span class=required><?php xl('Group Number','e'); ?></span></td>
537 <td class='required'>:</td>
538 <td><input type=entry size=16 name=i<?php echo $i?>group_number value="<?php echo $result3{"group_number"}?>" onkeyup='policykeyup(this)'></td>
539 </tr>
541 <tr<?php if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?>>
542 <td class='required'><?php xl('Subscriber Employer (SE)','e'); ?><br><span style='font-weight:normal'>
543 (<?php xl('if unemployed enter Student','e'); ?>,<br><?php xl('PT Student, or leave blank','e'); ?>) </span></td>
544 <td class='required'>:</td>
545 <td><input type=entry size=25 name=i<?php echo $i?>subscriber_employer
546 value="<?php echo $result3{"subscriber_employer"}?>"
547 onchange="capitalizeMe(this);" /></td>
548 </tr>
550 <tr<?php if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?>>
551 <td><span class=required><?php xl('SE Address','e'); ?></span></td>
552 <td class='required'>:</td>
553 <td><input type=entry size=25 name=i<?php echo $i?>subscriber_employer_street
554 value="<?php echo $result3{"subscriber_employer_street"}?>"
555 onchange="capitalizeMe(this);" /></td>
556 </tr>
558 <tr<?php if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?>>
559 <td colspan="3">
560 <table>
561 <tr>
562 <td><span class=required><?php xl('SE City','e'); ?>: </span></td>
563 <td><input type=entry size=15 name=i<?php echo $i?>subscriber_employer_city
564 value="<?php echo $result3{"subscriber_employer_city"}?>"
565 onchange="capitalizeMe(this);" /></td>
566 <td><span class=required><?php echo ($GLOBALS['phone_country_code'] == '1') ? xl('SE State','e') : xl('SE Locality','e') ?>: </span></td>
567 <td>
568 <?php
569 // Modified 7/2009 by BM to incorporate data types
570 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']);
572 </td>
573 </tr>
574 <tr>
575 <td><span class=required><?php echo ($GLOBALS['phone_country_code'] == '1') ? xl('SE Zip Code','e') : xl('SE Postal Code','e') ?>: </span></td>
576 <td><input type=entry size=15 name=i<?php echo $i?>subscriber_employer_postal_code value="<?php echo $result3{"subscriber_employer_postal_code"}?>"></td>
577 <td><span class=required><?php xl('SE Country','e'); ?>: </span></td>
578 <td>
579 <?php
580 // Modified 7/2009 by BM to incorporate data types
581 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']);
583 </td>
584 </tr>
585 </table>
586 </td>
587 </tr>
589 </table>
590 </td>
592 <td valign=top>
593 <table border="0">
594 <tr>
595 <td><span class=required><?php xl('Relationship','e'); ?></span></td>
596 <td class=required>:</td>
597 <td colspan=3><?php
598 // Modified 6/2009 by BM to use list_options and function
599 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_relationship'),'list_id'=>'sub_relation','empty_title'=>' '), $result3['subscriber_relationship']);
602 <a href="javascript:popUp('browse.php?browsenum=<?php echo $i?>')" class=text>(<?php xl('Browse','e'); ?>)</a></td>
603 <td></td><td></td><td></td><td></td>
604 </tr>
605 <tr>
606 <td width=120><span class=required><?php xl('Subscriber','e'); ?> </span></td>
607 <td class=required>:</td>
608 <td colspan=3><input type=entry size=10 name=i<?php echo $i?>subscriber_fname value="<?php echo $result3{"subscriber_fname"}?>" onchange="capitalizeMe(this);" />
609 <input type=entry size=3 name=i<?php echo $i?>subscriber_mname value="<?php echo $result3{"subscriber_mname"}?>" onchange="capitalizeMe(this);" />
610 <input type=entry size=10 name=i<?php echo $i?>subscriber_lname value="<?php echo $result3{"subscriber_lname"}?>" onchange="capitalizeMe(this);" /></td>
611 <td></td><td></td><td></td><td></td>
612 </tr>
613 <tr>
614 <td><span class=bold><?php xl('D.O.B.','e'); ?> </span></td>
615 <td class=required>:</td>
616 <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>
618 <td><span class=bold><?php xl('Sex','e'); ?>: </span></td>
619 <td><?php
620 // Modified 6/2009 by BM to use list_options and function
621 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_sex'),'list_id'=>'sex'), $result3['subscriber_sex']);
623 </td>
624 <td></td><td></td> <td></td><td></td>
625 </tr>
626 <tr>
627 <td class=leftborder><span class=bold><?php xl('S.S.','e'); ?> </span></td>
628 <td class=required>:</td>
629 <td><input type=entry size=11 name=i<?php echo $i?>subscriber_ss value="<?php echo trim($result3{"subscriber_ss"})?>"></td>
630 </tr>
632 <tr>
633 <td><span class=required><?php xl('Subscriber Address','e'); ?> </span></td>
634 <td class=required>:</td>
635 <td><input type=entry size=20 name=i<?php echo $i?>subscriber_street value="<?php echo $result3{"subscriber_street"}?>" onchange="capitalizeMe(this);" /></td>
637 <td><span class=required><?php echo ($GLOBALS['phone_country_code'] == '1') ? xl('State','e') : xl('Locality','e') ?>: </span></td>
638 <td>
639 <?php
640 // Modified 7/2009 by BM to incorporate data types
641 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']);
643 </td>
644 </tr>
645 <tr>
646 <td class=leftborder><span class=required><?php xl('City','e'); ?></span></td>
647 <td class=required>:</td>
648 <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>
649 <?php
650 // Modified 7/2009 by BM to incorporate data types
651 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']);
653 </td>
654 </tr>
655 <tr>
656 <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>
658 <td colspan=2>
659 </td><td></td>
660 </tr>
661 <tr>
662 <td><span class=bold><?php xl('Subscriber Phone','e'); ?></span></td>
663 <td class=required>:</td>
664 <td><input type='text' size='20' name='i<?php echo $i?>subscriber_phone' value='<?php echo $result3["subscriber_phone"] ?>' onkeyup='phonekeyup(this,mypcc)' /></td>
665 <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>
666 <td colspan=2>
667 </td><td></td><td></td>
668 </tr>
669 <tr>
670 <td colspan=0><span class='required'><?php xl('Accept Assignment','e'); ?></span></td>
671 <td class=required>:</td>
672 <td colspan=2>
673 <select name=i<?php echo $i?>accept_assignment>
674 <option value="TRUE" <?php if (strtoupper($result3{"accept_assignment"}) == "TRUE") echo "selected"?>><?php xl('YES','e'); ?></option>
675 <option value="FALSE" <?php if (strtoupper($result3{"accept_assignment"}) == "FALSE") echo "selected"?>><?php xl('NO','e'); ?></option>
676 </select>
677 </td>
678 <td></td><td></td>
679 <td colspan=2>
680 </td><td></td>
681 </tr>
682 <tr>
683 <td><span class='bold'><?php xl('Secondary Medicare Type','e'); ?></span></td>
684 <td class='bold'>:</td>
685 <td colspan='6'>
686 <select name=i<?php echo $i?>policy_type>
687 <?php
688 foreach ($policy_types AS $key => $value) {
689 echo " <option value ='$key'";
690 if ($key == $result3['policy_type']) echo " selected";
691 echo ">" . htmlspecialchars($value) . "</option>\n";
694 </select>
695 </td>
696 </tr>
697 </table>
699 </td>
700 </tr>
701 </table>
703 </div>
705 <?php } //end insurer for loop ?>
707 </div>
708 </div>
710 <?php } // end of "if not simplified_demographics" ?>
711 </div></div>
713 </form>
715 <br>
717 <script language="JavaScript">
719 // fix inconsistently formatted phone numbers from the database
720 var f = document.forms[0];
721 if (f.form_phone_contact) phonekeyup(f.form_phone_contact,mypcc);
722 if (f.form_phone_home ) phonekeyup(f.form_phone_home ,mypcc);
723 if (f.form_phone_biz ) phonekeyup(f.form_phone_biz ,mypcc);
724 if (f.form_phone_cell ) phonekeyup(f.form_phone_cell ,mypcc);
726 <?php if (! $GLOBALS['simplified_demographics']) { ?>
727 phonekeyup(f.i1subscriber_phone,mypcc);
728 phonekeyup(f.i2subscriber_phone,mypcc);
729 phonekeyup(f.i3subscriber_phone,mypcc);
730 <?php } ?>
732 <?php if ($GLOBALS['concurrent_layout'] && $set_pid) { ?>
733 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']) . "'"; ?>);
734 parent.left_nav.setRadio(window.name, 'dem');
735 <?php } ?>
737 <?php echo $date_init; ?>
738 <?php if (! $GLOBALS['simplified_demographics']) { for ($i=1; $i<=3; $i++): ?>
739 Calendar.setup({inputField:"i<?php echo $i?>effective_date", ifFormat:"%Y-%m-%d", button:"img_i<?php echo $i?>effective_date"});
740 Calendar.setup({inputField:"i<?php echo $i?>subscriber_DOB", ifFormat:"%Y-%m-%d", button:"img_i<?php echo $i?>dob_date"});
741 <?php endfor; } ?>
742 </script>
744 <!-- include support for the list-add selectbox feature -->
745 <?php include $GLOBALS['fileroot']."/library/options_listadd.inc"; ?>
747 </body>
748 <script language='JavaScript'>
749 // Array of skip conditions for the checkSkipConditions() function.
750 var skipArray = [
751 <?php echo $condition_str; ?>
753 checkSkipConditions();
754 $("input").change(function() {
755 checkSkipConditions();
757 $("select").change(function() {
758 checkSkipConditions();
760 </script>
763 </html>