2 include_once("../../globals.php");
3 include_once("$srcdir/acl.inc");
5 // Session pid must be right or bad things can happen when demographics are saved!
7 include_once("$srcdir/pid.inc");
8 $set_pid = $_GET["set_pid"] ?
$_GET["set_pid"] : $_GET["pid"];
9 if ($set_pid && $set_pid != $_SESSION["pid"]) {
13 include_once("$srcdir/patient.inc");
15 $result = getPatientData($pid);
16 $result2 = getEmployerData($pid);
18 // Check authorization.
19 $thisauth = acl_check('patients', 'demo');
21 if ($thisauth != 'write')
22 die("Updating demographics is not authorized.");
23 if ($result['squad'] && ! acl_check('squads', $result['squad']))
24 die("You are not authorized to access this squad.");
26 if ($thisauth != 'write' && $thisauth != 'addonly')
27 die("Adding demographics is not authorized.");
30 $relats = array('','self','spouse','child','other');
31 $statii = array('married','single','divorced','widowed','separated','domestic partner');
33 $langi = getLanguages();
34 $ethnoraciali = getEthnoRacials();
35 $provideri = getProviderInfo();
36 $insurancei = getInsuranceProviders();
41 <link rel
=stylesheet href
="<?php echo $css_header; ?>" type
="text/css">
43 <script type
="text/javascript" src
="../../../library/dialog.js"></script
>
44 <script type
="text/javascript" src
="../../../library/textformat.js"></script
>
46 <SCRIPT LANGUAGE
="JavaScript"><!--
48 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
50 //code used from http://tech.irt.org/articles/js037/
51 function replace(string,text
,by
) {
52 // Replaces text with by in string
53 var strLength
= string.length
, txtLength
= text
.length
;
54 if ((strLength
== 0) ||
(txtLength
== 0)) return string;
56 var i
= string.indexOf(text
);
57 if ((!i
) && (text
!= string.substring(0,txtLength
))) return string;
58 if (i
== -1) return string;
60 var newstr
= string.substring(0,i
) + by
;
62 if (i+txtLength
< strLength
)
63 newstr +
= replace(string.substring(i+txtLength
,strLength
),text
,by
);
68 function upperFirst(string,text
) {
69 return replace(string,text
,text
.charAt(0).toUpperCase() + text
.substring(1,text
.length
));
72 <?php
for ($i=1;$i<=3;$i++
) { ?
>
73 function auto_populate_employer_address
<?php
echo $i ?
>(){
74 if (document
.demographics_form
.i
<?php
echo $i?
>subscriber_relationship
.options
[document
.demographics_form
.i
<?php
echo $i?
>subscriber_relationship
.selectedIndex
].value
== "self") {
75 document
.demographics_form
.i
<?php
echo $i?
>subscriber_fname
.value
=document
.demographics_form
.fname
.value
;
76 document
.demographics_form
.i
<?php
echo $i?
>subscriber_mname
.value
=document
.demographics_form
.mname
.value
;
77 document
.demographics_form
.i
<?php
echo $i?
>subscriber_lname
.value
=document
.demographics_form
.lname
.value
;
78 document
.demographics_form
.i
<?php
echo $i?
>subscriber_street
.value
=document
.demographics_form
.street
.value
;
79 document
.demographics_form
.i
<?php
echo $i?
>subscriber_city
.value
=document
.demographics_form
.city
.value
;
80 document
.demographics_form
.i
<?php
echo $i?
>subscriber_state
.value
=document
.demographics_form
.state
.value
;
81 document
.demographics_form
.i
<?php
echo $i?
>subscriber_postal_code
.value
=document
.demographics_form
.postal_code
.value
;
82 document
.demographics_form
.i
<?php
echo $i?
>subscriber_country
.value
=document
.demographics_form
.country_code
.value
;
83 document
.demographics_form
.i
<?php
echo $i?
>subscriber_phone
.value
=document
.demographics_form
.phone_home
.value
;
84 document
.demographics_form
.i
<?php
echo $i?
>subscriber_DOB
.value
=document
.demographics_form
.dob
.value
;
85 document
.demographics_form
.i
<?php
echo $i?
>subscriber_ss
.value
=document
.demographics_form
.ss
.value
;
86 document
.demographics_form
.i
<?php
echo $i?
>subscriber_sex
.selectedIndex
= document
.demographics_form
.sex
.selectedIndex
;
87 document
.demographics_form
.i
<?php
echo $i?
>subscriber_employer
.value
=document
.demographics_form
.ename
.value
;
88 document
.demographics_form
.i
<?php
echo $i?
>subscriber_employer_street
.value
=document
.demographics_form
.estreet
.value
;
89 document
.demographics_form
.i
<?php
echo $i?
>subscriber_employer_city
.value
=document
.demographics_form
.ecity
.value
;
90 document
.demographics_form
.i
<?php
echo $i?
>subscriber_employer_state
.value
=document
.demographics_form
.estate
.value
;
91 document
.demographics_form
.i
<?php
echo $i?
>subscriber_employer_postal_code
.value
=document
.demographics_form
.epostal_code
.value
;
92 document
.demographics_form
.i
<?php
echo $i?
>subscriber_employer_country
.value
=document
.demographics_form
.ecountry
.value
;
101 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');");
104 function checkNum () {
105 var re
= new RegExp();
107 str
=document
.demographics_form
.monthly_income
.value
;
111 alert("Please enter a dollar amount using only numbers and a decimal point.");
115 // Indicates which insurance slot is being updated.
116 var insurance_index
= 0;
118 // The OnClick handler for searching/adding the insurance company.
119 function ins_search(ins
) {
120 insurance_index
= ins
;
121 dlgopen('../../practice/ins_search.php', '_blank', 550, 400);
125 // The ins_search.php window calls this to set the selected insurance.
126 function set_insurance(ins_id
, ins_name
) {
127 var thesel
= document
.forms
[0]['i' + insurance_index +
'provider'];
128 var theopts
= thesel
.options
; // the array of Option objects
130 for (; i
< theopts
.length
; ++i
) {
131 if (theopts
[i
].value
== ins_id
) {
132 theopts
[i
].selected
= true;
136 // no matching option was found so create one, append it to the
137 // end of the list, and select it.
138 theopts
[i
] = new Option(ins_name
, ins_id
, false, true);
146 <body
<?php
echo $top_bg_line; ?
> topmargin
=0 rightmargin
=0 leftmargin
=2 bottommargin
=0 marginwidth
=2 marginheight
=0>
148 <form action
='demographics_save.php' name
='demographics_form' method
='post'>
149 <input type
=hidden name
=mode value
=save
>
151 <?php
if ($GLOBALS['concurrent_layout']) { ?
>
152 <a href
="demographics.php">
154 <a href
="patient_summary.php" target
=Main
>
156 <font
class=title
><?php
xl('Demographics','e'); ?
></font
>
157 <font
class=back
><?php
echo $tback;?
></font
></a
>
159 <table border
="0" cellpadding
="0" width
='100%'>
162 <td valign
="top"><span
class=required
><?php
xl('Name','e'); ?
>: </span
></td
>
163 <td colspan
="4" nowrap
>
164 <select name
=title tabindex
="1">
165 <option value
="<?php echo $result{"title
"} ?>"><?php
echo $result{"title"} ?
></option
>
166 <option value
="Mrs."><?php
xl('Mrs','e'); ?
>.</option
>
167 <option value
="Ms."><?php
xl('Ms','e'); ?
>.</option
>
168 <option value
="Mr."><?php
xl('Mr','e'); ?
>.</option
>
169 <option value
="Dr."><?php
xl('Dr','e'); ?
>.</option
>
171 <input tabindex
="2" type
=entry size
=15 name
=fname value
="<?php echo $result{"fname
"} ?>">
172 <input tabindex
="3" type
=entry size
=3 name
=mname value
="<?php echo $result{"mname
"} ?>">
173 <input tabindex
="4" type
=entry size
=15 name
=lname value
="<?php echo $result{"lname
"} ?>">
175 <span
class='bold'><?php
echo ($GLOBALS['athletic_team']) ?
'OID ' : '' ?
><?php
xl('Number','e'); ?
>: </span
>
177 <td
><input type
='entry' size
='10' name
='pubpid' value
="<?php echo $result{"pubpid
"} ?>"></td
>
181 <td valign
='top'><span
class='required'><?php
xl('DOB','e'); ?
>: </span
></td
>
183 <input tabindex
='5' type
='entry' size
='11' name
='dob'
184 value
='<?php echo $result['DOB
'] ?>' onkeyup
='datekeyup(this,mypcc)'
185 onblur
='dateblur(this,mypcc)' title
='yyyy-mm-dd' />
187 <td rowspan
="12"> 
;</td
>
188 <td
><span
class='bold'><?php
xl('Emergency Contact','e'); ?
>: </span
></td
>
189 <td rowspan
="12"> 
;</td
>
190 <td
><input type
='entry' size
='10' name
='contact_relationship' value
="<?php echo $result{"contact_relationship
"}?>"></td
>
194 <td
><span
class=required
><?php
xl('Sex','e'); ?
>: </span
></td
>
196 <select name
=sex tabindex
="6">
197 <option value
="Female" <?php
if ($result{"sex"} == "Female") {echo "selected";};?
>><?php
xl('Female','e'); ?
></option
>
198 <option value
="Male" <?php
if ($result{"sex"} == "Male") {echo "selected";};?
>><?php
xl('Male','e'); ?
></option
>
201 <td
><span
class=bold
><?php
xl('Emergency Phone','e'); ?
>:</span
></td
>
202 <td
><input type
='text' size
='20' name
='phone_contact' value
='<?php echo $result['phone_contact
'] ?>' onkeyup
='phonekeyup(this,mypcc)' /></td
>
206 <td
><span
class=bold
><?php
xl('S.S.','e'); ?
>: </span
></td
>
207 <td
><input tabindex
="7" type
=entry size
=11 name
=ss value
="<?php echo $result{"ss
"}?>"></td
>
208 <td
><span
class='bold'><?php
xl('Home Phone','e'); ?
>: </span
></td
>
209 <td
><input type
='text' size
='20' name
='phone_home' value
='<?php echo $result['phone_home
'] ?>' onkeyup
='phonekeyup(this,mypcc)' /></td
>
213 <td
><span
class=required
><?php
xl('Address','e'); ?
>: </span
></td
>
214 <td
><input tabindex
="8" type
=entry size
=25 name
=street value
="<?php echo $result{"street
"}?>"></td
>
215 <td
><span
class=bold
><?php
xl('Work Phone','e'); ?
>:</span
></td
>
216 <td
><input type
='text' size
='20' name
='phone_biz' value
='<?php echo $result['phone_biz
'] ?>' onkeyup
='phonekeyup(this,mypcc)' /></td
>
220 <td
><span
class=required
><?php
xl('City','e'); ?
>: </span
></td
>
221 <td
><input tabindex
="9" type
=entry size
=15 name
=city value
="<?php echo $result{"city
"}?>"></td
>
222 <td
><span
class=bold
><?php
xl('Mobile Phone','e'); ?
>: </span
></td
>
223 <td
><input type
='text' size
='20' name
='phone_cell' value
='<?php echo $result['phone_cell
'] ?>' onkeyup
='phonekeyup(this,mypcc)' /></td
>
227 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
'State' : 'Locality' ?
>: </span
></td
>
228 <td
><input tabindex
="10" type
=entry size
=15 name
=state value
="<?php echo $result{"state
"}?>"></td
>
229 <td
><span
class='bold'><?php
xl('License/ID','e'); ?
>: </span
></td
>
230 <td
><input tabindex
="12" type
='entry' size
='15' name
='drivers_license' value
="<?php echo $result{"drivers_license
"}?>"></td
>
234 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
'Zip' : 'Postal' ?
> <?php
xl('Code','e'); ?
>: </span
></td
>
235 <td
><input tabindex
="11" type
=entry size
=6 name
=postal_code value
="<?php echo $result{"postal_code
"}?>"></td
>
236 <td
><span
class='bold'><?php
xl('Contact Email','e'); ?
>: </span
></td
><td
><input type
=entry size
=30 name
=email value
="<?php echo $result{"email
"}?>"></td
>
240 <td
><span
class='required'<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
241 <?php
xl('Country','e'); ?
>: </span
></td
>
242 <td
><input tabindex
="13" type
='entry' size
='10' name
='country_code'
243 value
="<?php echo $result{"country_code
"}?>"
244 <?php
if ($GLOBALS['omit_employers']) echo "style='display:none'"; ?
>></td
>
245 <?php
if (!$GLOBALS['weight_loss_clinic']) { ?
>
246 <td
><span
class='bold' colspan
='2'>
247 <?php
echo $GLOBALS['omit_employers'] ?
xl('List Immediate Family Members') : xl('User Defined Fields'); ?
>:
253 <td
><span
class=required
><?php
xl('Marital Status','e'); ?
>: </span
></td
>
255 <select name
=status tabindex
="14">
257 print "<!-- ".$result["status"]." -->\n";
258 foreach ($statii as $s) {
259 if ($s == "unassigned") {
260 echo "<option value=''";
262 echo "<option value='".$s."'";
265 if ($s == $result["status"])
268 echo ">".ucwords($s)."</option>\n";
274 <?php
if ($GLOBALS['weight_loss_clinic']) { ?
>
275 <td
class='bold'>Starting Weight
</td
>
277 <input name
="genericname1" size
='4' value
="<?php echo $result{"genericname1
"} ?>" />
279 <input name
="genericval1" size
='10' value
="<?php echo $result{"genericval1
"} ?>" />
282 <td
><input name
="genericname1" size
='20' value
="<?php echo $result{"genericname1
"} ?>" /></td
>
283 <td
><input name
="genericval1" size
='20' value
="<?php echo $result{"genericval1
"} ?>" /></td
>
289 <td
><span
class=required
><?php
xl('Provider','e'); ?
>: </span
></td
>
291 <select tabindex
="15" name
="providerID" onchange
="javascript:document.demographics_form.referrer.value=upperFirst(this.options[this.selectedIndex].text,this.options[this.selectedIndex].text);">
292 <option value
=''><?php
xl('Unassigned','e'); ?
></option
>
294 foreach ($provideri as $s) {
295 //echo "defined provider is: " .trim($s['fname']." ".$s['lname']). " compared to : " .$result["referrer"] . "<br />";
297 echo "<option value='".$s['id']."'";
299 if ($s['id'] == $result["providerID"])
301 echo ">".ucwords($s['fname']." ".$s['lname'])."</option>\n";
307 <?php
if ($GLOBALS['weight_loss_clinic']) { ?
>
308 <td
class='bold'>Ending Weight
</td
>
310 <input name
="genericname2" size
='4' value
="<?php echo $result{"genericname2
"} ?>" />
312 <input name
="genericval2" size
='10' value
="<?php echo $result{"genericval2
"} ?>" />
315 <td
><input name
="genericname2" size
='20' value
="<?php echo $result{"genericname2
"};?>" /></td
>
316 <td
><input name
="genericval2" size
='20' value
="<?php echo $result{"genericval2
"};?>" /></td
>
322 <td
><span
class=bold
><?php
xl('Pharmacy','e'); ?
>: </span
></td
>
324 <select name
='pharmacy_id'>
325 <option value
='0'></option
>
327 $pres = sqlStatement("SELECT d.id, d.name, a.line1, a.city, " .
328 "p.area_code, p.prefix, p.number FROM pharmacies AS d " .
329 "LEFT OUTER JOIN addresses AS a ON a.foreign_id = d.id " .
330 "LEFT OUTER JOIN phone_numbers AS p ON p.foreign_id = d.id AND p.type = 2 " .
331 "ORDER BY name, area_code, prefix, number");
332 while ($prow = sqlFetchArray($pres)) {
334 echo " <option value='$key'";
335 if ($result['pharmacy_id'] == $key) echo " selected";
336 echo '>' . $prow['name'] . ' ' . $prow['area_code'] . '-' .
337 $prow['prefix'] . '-' . $prow['number'] . ' / ' .
338 $prow['line1'] . ' / ' . $prow['city'] . "</option>\n";
347 <a href
="javascript:document.demographics_form.submit();" class='link_submit'>[<?php
xl('Save Patient Demographics','e'); ?
>]</a
>
353 <?php
if (! $GLOBALS['athletic_team']) { ?
>
357 <th colspan
='4' align
='left' class='bold'><?php
xl('HIPAA Choices','e'); ?
>:</th
>
360 <td
class='bold' width
='10%' nowrap
><?php
xl('Did you receive a copy of the HIPAA Notice?','e'); ?
> </td
>
362 <select name
= "hipaa_notice">
364 echo " <option>NO</option>\n";
365 $opt_sel = ($result['hipaa_notice'] == 'YES' ||
($GLOBALS['weight_loss_clinic'] && !$result['hipaa_notice']))
367 echo " <option$opt_sel>YES</option>\n";
371 <td
class='bold' width
='10%' nowrap
><?php
xl('Allow Voice Msg','e'); ?
>:</td
>
373 <select name
="hipaa_voice">
375 echo " <option>NO</option>\n";
376 $opt_sel = ($result['hipaa_voice'] == 'YES' ||
($GLOBALS['weight_loss_clinic'] && !$result['hipaa_voice']))
378 echo " <option$opt_sel>YES</option>\n";
384 <td
class='bold' width
='10%' nowrap
><?php
xl('Allow Mail','e'); ?
>:</td
>
386 <select name
="hipaa_mail">
388 echo " <option>NO</option>\n";
389 $opt_sel = ($result['hipaa_mail'] == 'YES' ||
($GLOBALS['weight_loss_clinic'] && !$result['hipaa_mail']))
391 echo " <option$opt_sel>YES</option>\n";
395 <td
class='bold' width
='10%' nowrap
><?php
xl('Who may we leave a message with?','e'); ?
> </td
>
396 <td
><input name
="hipaa_message" size
='20' value
="<?php echo $result['hipaa_message']; ?>" /></td
>
400 <a href
="javascript:document.demographics_form.submit();" class=link_submit
>[<?php
xl('Save Patient Demographics','e'); ?
>]</a
>
408 <table width
='100%'<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
411 <input type
=hidden size
=30 name
=referrer value
="<?php echo ucfirst($result{"referrer
"});?>">
412 <input type
=hidden size
=20 name
=referrerID value
="<?php echo $result{"referrerID
"}?>">
413 <input type
=hidden size
=20 name
=db_id value
="<?php echo $result{"id
"}?>">
416 <td
><span
class=bold
><?php
xl('Occupation','e'); ?
>: </span
></td
>
417 <td
><input type
=entry size
=20 name
=occupation value
="<?php echo $result{"occupation
"}?>"></td
>
420 <td
class='bold'><?php
xl('Employer','e'); ?
>:</td
>
421 <td
><input type
=entry size
=20 name
=ename value
="<?php echo $result2{"name
"}?>"></td
>
424 <td colspan
='2' class='bold' style
='font-weight:normal'>(<?php
xl('if unemployed enter Student, PT Student, or leave blank','e'); ?
>)</td
>
426 <?php
if ($GLOBALS['athletic_team']) { ?
>
428 <td colspan
='2' class='bold' style
='font-weight:normal'> 
;</td
>
431 <td
><span
class='bold'><?php
xl('Squad','e'); ?
>: </span
></td
>
433 <select name
='squad'>
434 <option value
=''> 
;</option
>
436 $squads = acl_get_squads();
438 foreach ($squads as $key => $value) {
439 echo " <option value='$key'";
440 if ($result['squad'] == $key) echo " selected";
441 echo ">" . $value[3] . "</option>\n";
453 <?php
if (! $GLOBALS['simplified_demographics']) { ?
>
457 <td
><span
class=bold
><?php
xl('Employer Address','e'); ?
></span
></td
><td
><span
class=bold
></span
><input type
=entry size
=25 name
=estreet value
="<?php echo $result2{"street
"}?>"></td
>
460 <td
><span
class=bold
><?php
xl('City','e'); ?
>: </span
></td
><td
><input type
=entry size
=15 name
=ecity value
="<?php echo $result2{"city
"}?>"></td
>
463 <td
><span
class=bold
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
'State' : 'Locality' ?
>: </span
></td
><td
><input type
=entry size
=15 name
=estate value
="<?php echo $result2{"state
"}?>"></td
>
466 <td
><span
class=bold
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
'Zip' : 'Postal' ?
> <?php
xl('Code','e'); ?
>: </span
></td
><td
><input type
=entry size
=10 name
=epostal_code value
="<?php echo $result2{"postal_code
"}?>"></td
>
469 <td
><span
class=bold
><?php
xl('Country','e'); ?
>: </span
></td
><td
><input type
=entry size
=10 name
=ecountry value
="<?php echo $result2{"country
"}?>"></td
>
481 <a href
="javascript:document.demographics_form.submit();" class=link_submit
>[<?php
xl('Save Patient Demographics','e'); ?
>]</a
><hr
></td
>
484 <?php
if (! $GLOBALS['athletic_team'] && ! $GLOBALS['simplified_demographics']) { ?
>
488 <span
class='bold'><?php
xl('Language','e'); ?
>: </span
><br
>
489 <select onchange
="javascript:document.demographics_form.language.value=upperFirst(this.options[this.selectedIndex].value,this.options[this.selectedIndex].value);">
491 foreach ($langi as $s) {
492 if ($s == "unassigned") {
493 echo "<option value=''";
495 echo "<option value='".$s."'";
497 if ($s == strtolower($result["language"]))
499 echo ">".ucwords($s)."</option>\n";
503 <input type
=entry size
=30 name
=language value
="<?php echo ucfirst($result{"language
"});?>"><br
><br
/>
504 <span
class=bold
><?php
xl('Race/Ethnicity','e'); ?
>: </span
><br
>
505 <select onchange
="javascript:document.demographics_form.ethnoracial.value=upperFirst(this.options[this.selectedIndex].value,this.options[this.selectedIndex].value);">
507 foreach ($ethnoraciali as $s) {
508 if ($s == "unassigned") {
509 echo "<option value=''";
511 echo "<option value='".$s."'";
513 if ($s == strtolower($result["ethnoracial"]))
515 echo ">".ucwords($s)."</option>\n";
520 <input type
=entry size
=30 name
=ethnoracial value
="<?php echo ucfirst($result{"ethnoracial
"});?>"><br
>
525 <td
><span
class=bold
><?php
xl('Financial Review Date','e'); ?
>: </span
></td
><td
><input type
=entry size
=11 name
=financial_review value
="<?php if ($result{"financial_review
"} != "0000-00-00 00:00:00") {echo date("m
/d
/Y
",strtotime($result{"financial_review
"}));} else {echo "MM
/DD
/YYYY
";}?>"></td
>
528 <td
><span
class=bold
><?php
xl('Family Size','e'); ?
>: </span
></td
><td
><input type
=entry size
=20 name
=family_size value
="<?php echo $result{"family_size
"}?>"></td
>
531 <td
><span
class=bold
><?php
xl('Monthly Income','e'); ?
>: </span
></td
><td
><input type
=entry size
=20 name
=monthly_income onblur
="javascript:checkNum();" value
="<?php echo $result{"monthly_income
"}?>"><span
class=small
>(<?php
xl('Numbers only','e'); ?
>)</span
></td
>
534 <td
><span
class=bold
><?php
xl('Homeless, etc.','e'); ?
>: </span
></td
><td
><input type
=entry size
=20 name
=homeless value
="<?php echo $result{"homeless
"}?>"></td
>
537 <td
><span
class=bold
><?php
xl('Interpreter','e'); ?
>: </span
></td
><td
><input type
=entry size
=20 name
=interpretter value
="<?php echo $result{"interpretter
"}?>"></td
>
540 <td
><span
class=bold
><?php
xl('Migrant/Seasonal','e'); ?
>: </span
></td
><td
><input type
=entry size
=20 name
=migrantseasonal value
="<?php echo $result{"migrantseasonal
"}?>"></td
>
549 <a href
="javascript:document.demographics_form.submit();" class=link_submit
>[<?php
xl('Save Patient Demographics','e'); ?
>]</a
>
559 if (! $GLOBALS['simplified_demographics']) {
560 $insurance_headings = array("Primary Insurance Provider:", "Secondary Insurance Provider", "Tertiary Insurance provider");
561 $insurance_info = array();
562 $insurance_info[1] = getInsuranceData($pid,"primary");
563 $insurance_info[2] = getInsuranceData($pid,"secondary");
564 $insurance_info[3] = getInsuranceData($pid,"tertiary");
565 for($i=1;$i<=3;$i++
) {
566 $result3 = $insurance_info[$i];
573 <td colspan
="5"><span
class='required'><?php
echo $insurance_headings[$i -1]?
></span
></td
>
577 <select name
="i<?php echo $i?>provider">
578 <option value
=""><?php
xl('Unassigned','e'); ?
></option
>
580 foreach ($insurancei as $iid => $iname) {
581 echo "<option value='" . $iid . "'";
582 if (strtolower($iid) == strtolower($result3{"provider"}))
584 echo ">" . $iname . "</option>\n";
587 </select
> 
;<a href
='' onclick
='return ins_search(<?php echo $i?>)'><?php
xl('Search/Add Insurer','e'); ?
></a
>
591 <td
><span
class=required
><?php
xl('Plan Name','e'); ?
>: </span
></td
><td
><input type
=entry size
=20 name
=i
<?php
echo $i?
>plan_name value
="<?php echo $result3{"plan_name
"}?>"></td
>
594 <td
><span
class=required
><?php
xl('Policy Number','e'); ?
>: </span
></td
><td
><input type
=entry size
=16 name
=i
<?php
echo $i?
>policy_number value
="<?php echo $result3{"policy_number
"}?>"></td
>
597 <td
><span
class=required
><?php
xl('Group Number','e'); ?
>: </span
></td
><td
><input type
=entry size
=16 name
=i
<?php
echo $i?
>group_number value
="<?php echo $result3{"group_number
"}?>"></td
>
600 <tr
<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
601 <td
class='required'><?php
xl('Subscriber Employer (SE)','e'); ?
><br
><span style
='font-weight:normal'>
602 (<?php
xl('if unemployed enter Student','e'); ?
>,<br
><?php
xl('PT Student, or leave blank','e'); ?
>): </span
></td
>
603 <td
><input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_employer value
="<?php echo $result3{"subscriber_employer
"}?>"></td
>
606 <tr
<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
607 <td
><span
class=required
><?php
xl('SE Address','e'); ?
>: </span
></td
><td
><input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_employer_street value
="<?php echo $result3{"subscriber_employer_street
"}?>"></td
>
610 <tr
<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
614 <td
><span
class=required
><?php
xl('SE City','e'); ?
>: </span
></td
>
615 <td
><input type
=entry size
=15 name
=i
<?php
echo $i?
>subscriber_employer_city value
="<?php echo $result3{"subscriber_employer_city
"}?>"></td
>
616 <td
><span
class=required
><?php
xl('SE','e'); ?
> <?php
echo ($GLOBALS['phone_country_code'] == '1') ?
'State' : 'Locality' ?
>: </span
></td
>
617 <td
><input type
=entry size
=15 name
=i
<?php
echo $i?
>subscriber_employer_state value
="<?php echo $result3{"subscriber_employer_state
"}?>"></td
>
620 <td
><span
class=required
><?php
xl('SE','e'); ?
> <?php
echo ($GLOBALS['phone_country_code'] == '1') ?
'Zip' : 'Postal' ?
> <?php
xl('Code','e'); ?
>: </span
></td
>
621 <td
><input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_employer_postal_code value
="<?php echo $result3{"subscriber_employer_postal_code
"}?>"></td
>
622 <td
><span
class=required
><?php
xl('SE Country','e'); ?
>: </span
></td
>
623 <td
><input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_employer_country value
="<?php echo $result3{"subscriber_employer_country
"}?>"></td
>
633 <span
class=required
><?php
xl('Subscriber','e'); ?
>: </span
><input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_fname value
="<?php echo $result3{"subscriber_fname
"}?>"><input type
=entry size
=3 name
=i
<?php
echo $i?
>subscriber_mname value
="<?php echo $result3{"subscriber_mname
"}?>"><input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_lname value
="<?php echo $result3{"subscriber_lname
"}?>">
635 <span
class=required
><?php
xl('Relationship','e'); ?
>: </span
>
636 <select name
=i
<?php
echo $i?
>subscriber_relationship onchange
="javascript:auto_populate_employer_address<?php echo $i?>();">
638 foreach ($relats as $s) {
639 if ($s == "unassigned") {
640 echo "<option value=''";
642 echo "<option value='".$s."'";
644 if ($s == $result3{"subscriber_relationship"})
646 echo ">".ucfirst($s)."</option>\n";
650 <a href
="javascript:popUp('browse.php?browsenum=<?php echo $i?>')" class=text
>(<?php
xl('Browse','e'); ?
>)</a
><br
/>
651 <span
class=bold
><?php
xl('D.O.B.','e'); ?
>: </span
>
652 <input type
='entry' size
='11' name
='i<?php echo $i?>subscriber_DOB'
653 value
='<?php echo $result3['subscriber_DOB
'] ?>'
654 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
655 title
='yyyy-mm-dd' />
656 <span
class=bold
><?php
xl('S.S.','e'); ?
>: </span
><input type
=entry size
=11 name
=i
<?php
echo $i?
>subscriber_ss value
="<?php echo $result3{"subscriber_ss
"}?> "> 
;
657 <span
class=bold
><?php
xl('Sex','e'); ?
>: </span
>
658 <select name
=i
<?php
echo $i?
>subscriber_sex
>
659 <option value
="Male" <?php
if (strtolower($result3{"subscriber_sex"}) == "male") echo "selected"?
>><?php
xl('Male','e'); ?
></option
>
660 <option value
="Female" <?php
if (strtolower($result3{"subscriber_sex"}) == "female") echo "selected"?
>><?php
xl('Female','e'); ?
></option
>
663 <span
class=required
><?php
xl('Subscriber Address','e'); ?
>: </span
><input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_street value
="<?php echo $result3{"subscriber_street
"}?>"><br
>
664 <span
class=required
><?php
xl('City','e'); ?
>: </span
><input type
=entry size
=15 name
=i
<?php
echo $i?
>subscriber_city value
="<?php echo $result3{"subscriber_city
"}?>">
665 <span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
'State' : 'Locality' ?
>: </span
><input type
=entry size
=15 name
=i
<?php
echo $i?
>subscriber_state value
="<?php echo $result3{"subscriber_state
"}?>"><br
>
666 <span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
'Zip' : 'Postal' ?
> <?php
xl('Code','e'); ?
>: </span
><input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_postal_code value
="<?php echo $result3{"subscriber_postal_code
"}?>">
667 <span
class='required'<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
668 <?php
xl('Country','e'); ?
>:
669 <input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_country
670 value
="<?php echo $result3{"subscriber_country
"}?>"><br
></span
>
671 <span
class=bold
><?php
xl('Subscriber Phone','e'); ?
>:
672 <input type
='text' size
='20' name
='i<?php echo $i?>subscriber_phone' value
='<?php echo $result3["subscriber_phone"] ?>' onkeyup
='phonekeyup(this,mypcc)' />
674 <span
class=bold
><?php
xl('CoPay','e'); ?
>: <input type
=text size
="6" name
=i
<?php
echo $i?
>copay value
="<?php echo $result3{"copay
"}?>">
678 <a href
="javascript:document.demographics_form.submit();" class=link_submit
>[<?php
xl('Save Patient Demographics','e'); ?
>]</a
>
682 } //end insurer for loop
683 } // end of "if not simplified_demographics"
690 <script language
="JavaScript">
692 // fix inconsistently formatted phone numbers from the database
693 var f
= document
.forms
[0];
694 phonekeyup(f
.phone_contact
,mypcc
);
695 phonekeyup(f
.phone_home
,mypcc
);
696 phonekeyup(f
.phone_biz
,mypcc
);
697 phonekeyup(f
.phone_cell
,mypcc
);
699 <?php
if (! $GLOBALS['simplified_demographics']) { ?
>
700 phonekeyup(f
.i1subscriber_phone
,mypcc
);
701 phonekeyup(f
.i2subscriber_phone
,mypcc
);
702 phonekeyup(f
.i3subscriber_phone
,mypcc
);
705 <?php
if ($GLOBALS['concurrent_layout'] && $set_pid) { ?
>
706 parent
.left_nav
.setPatient(<?php
echo "'" . $result['fname'] . " " . $result['lname'] . "',$pid,''"; ?
>);
707 parent
.left_nav
.setRadio(window
.name
, 'dem');