2 // Copyright (C) 2009-2010 Rod Roark <rod@sunsetsystems.com>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 require_once("../globals.php");
10 require_once("$srcdir/acl.inc");
11 require_once("$srcdir/options.inc.php");
12 require_once("$srcdir/patient.inc");
13 require_once("$srcdir/erx_javascript.inc.php");
15 // Check authorization.
16 $thisauth = acl_check('patients', 'demo');
17 if ($thisauth != 'write' && $thisauth != 'addonly')
18 die("Adding demographics is not authorized.");
20 $CPR = 4; // cells per row
22 $searchcolor = empty($GLOBALS['layout_search_color']) ?
23 '#ffff55' : $GLOBALS['layout_search_color'];
25 $WITH_SEARCH = ($GLOBALS['full_new_patient_form'] == '1' ||
$GLOBALS['full_new_patient_form'] == '2');
26 $SHORT_FORM = ($GLOBALS['full_new_patient_form'] == '2' ||
$GLOBALS['full_new_patient_form'] == '3');
28 function getLayoutRes() {
30 return sqlStatement("SELECT * FROM layout_options " .
31 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' " .
32 ($SHORT_FORM ?
"AND ( uor > 1 OR edit_options LIKE '%N%' ) " : "") .
33 "ORDER BY group_name, seq");
36 // Determine layout field search treatment from its data type:
41 function getSearchClass($data_type) {
43 case 1: // single-selection list
44 case 10: // local provider list
45 case 11: // provider list
46 case 12: // pharmacy list
48 case 14: // address book list
49 case 26: // single-selection list with add
50 case 35: // facilities
60 $fres = getLayoutRes();
64 <?php
html_header_show(); ?
>
66 <link rel
="stylesheet" href
="<?php echo $css_header; ?>" type
="text/css">
69 body
, td
, input
, select
, textarea
{
70 font
-family
: Arial
, Helvetica
, sans
-serif
;
75 padding
: 5pt
5pt
5pt
5pt
;
81 border
-color
: #0000ff;
88 <style type
="text/css">@import
url(../../library
/dynarch_calendar
.css
);</style
>
90 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
91 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
92 <script type
="text/javascript" src
="../../library/dynarch_calendar.js"></script
>
93 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
94 <script type
="text/javascript" src
="../../library/dynarch_calendar_setup.js"></script
>
95 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/js/jquery.js"></script
>
97 <SCRIPT LANGUAGE
="JavaScript"><!--
98 //Visolve - sync the radio buttons - Start
99 if((top
.window
.parent
) && (parent
.window
)){
100 var wname
= top
.window
.parent
.left_nav
;
101 fname
= (parent
.window
.name
)?parent
.window
.name
:window
.name
;
103 wname
.setRadio(fname
, "new");
104 }//Visolve - sync the radio buttons - End
106 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
108 // This may be changed to true by the AJAX search script.
109 var force_submit
= false;
111 //code used from http://tech.irt.org/articles/js037/
112 function replace(string,text
,by
) {
113 // Replaces text with by in string
114 var strLength
= string.length
, txtLength
= text
.length
;
115 if ((strLength
== 0) ||
(txtLength
== 0)) return string;
117 var i
= string.indexOf(text
);
118 if ((!i
) && (text
!= string.substring(0,txtLength
))) return string;
119 if (i
== -1) return string;
121 var newstr
= string.substring(0,i
) + by
;
123 if (i+txtLength
< strLength
)
124 newstr +
= replace(string.substring(i+txtLength
,strLength
),text
,by
);
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") {
133 f
.i
<?php
echo $i?
>subscriber_fname
.value
=f
.form_fname
.value
;
134 f
.i
<?php
echo $i?
>subscriber_mname
.value
=f
.form_mname
.value
;
135 f
.i
<?php
echo $i?
>subscriber_lname
.value
=f
.form_lname
.value
;
136 f
.i
<?php
echo $i?
>subscriber_street
.value
=f
.form_street
.value
;
137 f
.i
<?php
echo $i?
>subscriber_city
.value
=f
.form_city
.value
;
138 f
.form_i
<?php
echo $i?
>subscriber_state
.value
=f
.form_state
.value
;
139 f
.i
<?php
echo $i?
>subscriber_postal_code
.value
=f
.form_postal_code
.value
;
140 if (f
.form_country_code
)
141 f
.form_i
<?php
echo $i?
>subscriber_country
.value
=f
.form_country_code
.value
;
142 f
.i
<?php
echo $i?
>subscriber_phone
.value
=f
.form_phone_home
.value
;
143 f
.i
<?php
echo $i?
>subscriber_DOB
.value
=f
.form_DOB
.value
;
144 f
.i
<?php
echo $i?
>subscriber_ss
.value
=f
.form_ss
.value
;
145 f
.form_i
<?php
echo $i?
>subscriber_sex
.value
= f
.form_sex
.value
;
146 f
.i
<?php
echo $i?
>subscriber_employer
.value
=f
.form_em_name
.value
;
147 f
.i
<?php
echo $i?
>subscriber_employer_street
.value
=f
.form_em_street
.value
;
148 f
.i
<?php
echo $i?
>subscriber_employer_city
.value
=f
.form_em_city
.value
;
149 f
.form_i
<?php
echo $i?
>subscriber_employer_state
.value
=f
.form_em_state
.value
;
150 f
.i
<?php
echo $i?
>subscriber_employer_postal_code
.value
=f
.form_em_postal_code
.value
;
151 if (f
.form_em_country
)
152 f
.form_i
<?php
echo $i?
>subscriber_employer_country
.value
=f
.form_em_country
.value
;
158 function upperFirst(string,text
) {
159 return replace(string,text
,text
.charAt(0).toUpperCase() + text
.substring(1,text
.length
));
162 // The ins_search.php window calls this to set the selected insurance.
163 function set_insurance(ins_id
, ins_name
) {
164 var thesel
= document
.forms
[0]['i' + insurance_index +
'provider'];
165 var theopts
= thesel
.options
; // the array of Option objects
167 for (; i
< theopts
.length
; ++i
) {
168 if (theopts
[i
].value
== ins_id
) {
169 theopts
[i
].selected
= true;
173 // no matching option was found so create one, append it to the
174 // end of the list, and select it.
175 theopts
[i
] = new Option(ins_name
, ins_id
, false, true);
178 // Indicates which insurance slot is being updated.
179 var insurance_index
= 0;
181 // The OnClick handler for searching/adding the insurance company.
182 function ins_search(ins
) {
183 insurance_index
= ins
;
184 dlgopen('../../interface/practice/ins_search.php', '_blank', 550, 400);
188 function checkNum () {
189 var re
= new RegExp();
191 str
=document
.forms
[0].monthly_income
.value
;
195 alert("Please enter a dollar amount using only numbers and a decimal point.");
199 // This capitalizes the first letter of each word in the passed input
200 // element. It also strips out extraneous spaces.
201 function capitalizeMe(elem
) {
202 var a
= elem
.value
.split(' ');
204 for(var i
= 0; i
< a
.length
; ++i
) {
205 if (a
[i
].length
> 0) {
206 if (s
.length
> 0) s +
= ' ';
207 s +
= a
[i
].charAt(0).toUpperCase() + a
[i
].substring(1);
213 // Onkeyup handler for policy number. Allows only A-Z and 0-9.
214 function policykeyup(e
) {
215 var v
= e
.value
.toUpperCase();
216 for (var i
= 0; i
< v
.length
; ++i
) {
218 if (c
>= '0' && c
<= '9') continue;
219 if (c
>= 'A' && c
<= 'Z') continue;
220 if (c
== '*') continue;
221 if (c
== '-') continue;
222 if (c
== '_') continue;
223 if (c
== '(') continue;
224 if (c
== ')') continue;
225 if (c
== '#') continue;
226 v
= v
.substring(0, i
) + v
.substring(i + i
);
233 function divclick(cb
, divid
) {
234 var divstyle
= document
.getElementById(divid
).style
;
236 divstyle
.display
= 'block';
238 divstyle
.display
= 'none';
243 // Compute the length of a string without leading and trailing spaces.
244 function trimlen(s
) {
246 var j
= s
.length
- 1;
247 for (; i
<= j
&& s
.charAt(i
) == ' '; ++i
);
248 for (; i
<= j
&& s
.charAt(j
) == ' '; --j
);
253 function validate(f
) {
254 <?php
generate_layout_validation('DEM'); ?
>
255 <?php
if($GLOBALS['erx_enable']){ ?
>
257 for(i
=0;i
<f
.length
;i++
){
258 if(f
[i
].type
=='text' && f
[i
].value
)
260 if(f
[i
].name
== 'form_fname' || f
[i
].name
== 'form_mname' || f
[i
].name
== 'form_lname')
262 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
263 alertMsg +
= checkUsername(f
[i
].name
,f
[i
].value
);
265 else if(f
[i
].name
== 'form_street' || f
[i
].name
== 'form_city')
267 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
268 alertMsg +
= checkAlphaNumericExtended(f
[i
].name
,f
[i
].value
);
270 else if(f
[i
].name
== 'form_phone_home')
272 alertMsg +
= checkPhone(f
[i
].name
,f
[i
].value
);
285 function toggleSearch(elem
) {
286 var f
= document
.forms
[0];
287 <?php
if ($WITH_SEARCH) { ?
>
288 // Toggle background color.
289 if (elem
.style
.backgroundColor
== '')
290 elem
.style
.backgroundColor
= '<?php echo $searchcolor; ?>';
292 elem
.style
.backgroundColor
= '';
295 force_submit
= false;
296 f
.create
.value
= '<?php xl('Create
New Patient
','e
'); ?>';
301 // If a <select> list is dropped down, this is its name.
302 var open_sel_name
= '';
304 function selClick(elem
) {
305 if (open_sel_name
== elem
.name
) {
309 open_sel_name
= elem
.name
;
315 function selBlur(elem
) {
316 if (open_sel_name
== elem
.name
) {
322 // This invokes the patient search dialog.
323 function searchme() {
324 var f
= document
.forms
[0];
325 var url
= '../main/finder/patient_select.php?popup=1';
328 $lres = getLayoutRes();
330 while ($lrow = sqlFetchArray($lres)) {
331 $field_id = $lrow['field_id'];
332 if (strpos($field_id, 'em_') === 0) continue;
333 $data_type = $lrow['data_type'];
334 $fldname = "form_$field_id";
335 switch(getSearchClass($data_type)) {
338 " if (f.$fldname.style.backgroundColor != '' && trimlen(f.$fldname.value) > 0) {\n" .
339 " url += '&$field_id=' + encodeURIComponent(f.$fldname.value);\n" .
344 " if (f.$fldname.style.backgroundColor != '' && f.$fldname.selectedIndex > 0) {\n" .
345 " url += '&$field_id=' + encodeURIComponent(f.$fldname.options[f.$fldname.selectedIndex].value);\n" .
352 dlgopen(url
, '_blank', 700, 500);
360 <body
class="body_top">
362 <form action
='new_comprehensive_save.php' name
='demographics_form' method
='post' onsubmit
='return validate(this)'>
364 <span
class='title'><?php
xl('Search or Add Patient','e'); ?
></span
>
366 <table width
='100%' cellpadding
='0' cellspacing
='8'>
368 <td align
='left' valign
='top'>
369 <?php
if ($SHORT_FORM) echo " <center>\n"; ?
>
372 function end_cell() {
373 global $item_count, $cell_count;
374 if ($item_count > 0) {
381 global $cell_count, $CPR;
383 if ($cell_count > 0) {
384 for (; $cell_count < $CPR; ++
$cell_count) echo "<td></td>";
390 function end_group() {
391 global $last_group, $SHORT_FORM;
392 if (strlen($last_group) > 0) {
395 if (!$SHORT_FORM) echo "</div>\n";
402 $display_style = 'block';
403 $group_seq = 0; // this gives the DIV blocks unique IDs
405 while ($frow = sqlFetchArray($fres)) {
406 $this_group = $frow['group_name'];
407 $titlecols = $frow['titlecols'];
408 $datacols = $frow['datacols'];
409 $data_type = $frow['data_type'];
410 $field_id = $frow['field_id'];
411 $list_id = $frow['list_id'];
414 if (strpos($field_id, 'em_') === 0) {
415 $tmp = substr($field_id, 3);
416 if (isset($result2[$tmp])) $currvalue = $result2[$tmp];
419 if (isset($result[$field_id])) $currvalue = $result[$field_id];
422 // Handle a data category (group) change.
423 if (strcmp($this_group, $last_group) != 0) {
426 $group_seq++
; // ID for DIV tags
427 $group_name = substr($this_group, 1);
428 if (strlen($last_group) > 0) echo "<br />";
429 echo "<span class='bold'><input type='checkbox' name='form_cb_$group_seq' id='form_cb_$group_seq' value='1' " .
430 "onclick='return divclick(this,\"div_$group_seq\");'";
431 if ($display_style == 'block') echo " checked";
433 // Modified 6-09 by BM - Translate if applicable
434 echo " /><b>" . xl_layout_label($group_name) . "</b></span>\n";
436 echo "<div id='div_$group_seq' class='section' style='display:$display_style;'>\n";
437 echo " <table border='0' cellpadding='0'>\n";
438 $display_style = 'none';
440 else if (strlen($last_group) == 0) {
441 echo " <table border='0' cellpadding='0'>\n";
443 $last_group = $this_group;
446 // Handle starting of a new row.
447 if (($titlecols > 0 && $cell_count >= $CPR) ||
$cell_count == 0) {
452 if ($item_count == 0 && $titlecols == 0) $titlecols = 1;
454 // Handle starting of a new label cell.
455 if ($titlecols > 0) {
457 echo "<td colspan='$titlecols'";
458 echo ($frow['uor'] == 2) ?
" class='required'" : " class='bold'";
459 if ($cell_count == 2) echo " style='padding-left:10pt'";
461 $cell_count +
= $titlecols;
467 // Modified 6-09 by BM - Translate if applicable
468 if ($frow['title']) echo (xl_layout_label($frow['title']).":"); else echo " ";
472 // Handle starting of a new data cell.
475 echo "<td colspan='$datacols' class='text'";
476 if ($cell_count > 0) echo " style='padding-left:5pt'";
478 $cell_count +
= $datacols;
482 generate_form_field($frow, $currvalue);
489 if (! $GLOBALS['simplified_demographics']) {
490 $insurancei = getInsuranceProviders();
492 $insurance_headings = array(xl("Primary Insurance Provider"), xl("Secondary Insurance Provider"), xl("Tertiary Insurance provider"));
493 $insurance_info = array();
494 $insurance_info[1] = getInsuranceData($pid,"primary");
495 $insurance_info[2] = getInsuranceData($pid,"secondary");
496 $insurance_info[3] = getInsuranceData($pid,"tertiary");
498 echo "<br /><span class='bold'><input type='checkbox' name='form_cb_ins' value='1' " .
499 "onclick='return divclick(this,\"div_ins\");'";
500 if ($display_style == 'block') echo " checked";
501 echo " /><b>" . xl('Insurance') . "</b></span>\n";
502 echo "<div id='div_ins' class='section' style='display:$display_style;'>\n";
504 for($i=1;$i<=3;$i++
) {
505 $result3 = $insurance_info[$i];
509 <td valign
='top' colspan
='2'>
510 <span
class='required'><?php
echo $insurance_headings[$i -1].":"?
></span
>
511 <select name
="i<?php echo $i?>provider">
512 <option value
=""><?php
xl('Unassigned','e'); ?
></option
>
514 foreach ($insurancei as $iid => $iname) {
515 echo "<option value='" . $iid . "'";
516 if (strtolower($iid) == strtolower($result3{"provider"}))
518 echo ">" . $iname . "</option>\n";
521 </select
> 
;<a href
='' onclick
='return ins_search(<?php echo $i?>)'>
522 <?php
xl('Search/Add Insurer','e'); ?
></a
>
531 <span
class='required'><?php
xl('Plan Name','e'); ?
>: </span
>
534 <input type
='entry' size
='20' name
='i<?php echo $i?>plan_name' value
="<?php echo $result3{"plan_name
"} ?>"
535 onchange
="capitalizeMe(this);" /> 
; 
;
541 <span
class='required'><?php
xl('Effective Date','e'); ?
>: </span
>
544 <input type
='entry' size
='11' name
='i<?php echo $i ?>effective_date'
545 id
='i<?php echo $i ?>effective_date'
546 value
='<?php echo $result3['date
'] ?>'
547 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
548 title
='yyyy-mm-dd' />
550 <img src
='../../interface/pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
551 id
='img_i<?php echo $i ?>effective_date' border
='0' alt
='[?]' style
='cursor:pointer'
552 title
='<?php xl('Click here to choose a date
','e
'); ?>'>
554 <script LANGUAGE
="JavaScript">
555 Calendar
.setup({inputField
:"i<?php echo $i ?>effective_date", ifFormat
:"%Y-%m-%d", button
:"img_i<?php echo $i; ?>effective_date"});
563 <td
><span
class=required
><?php
xl('Policy Number','e'); ?
>: </span
></td
>
564 <td
><input type
='entry' size
='16' name
='i<?php echo $i?>policy_number' value
="<?php echo $result3{"policy_number
"}?>"
565 onkeyup
='policykeyup(this)'></td
>
569 <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
"}?>" onkeyup
='policykeyup(this)'></td
>
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
><input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_employer
576 value
="<?php echo $result3{"subscriber_employer
"}?>"
577 onchange
="capitalizeMe(this);" /></td
>
580 <tr
<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
581 <td
><span
class=required
><?php
xl('SE Address','e'); ?
>: </span
></td
>
582 <td
><input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_employer_street
583 value
="<?php echo $result3{"subscriber_employer_street
"}?>"
584 onchange
="capitalizeMe(this);" /></td
>
587 <tr
<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
591 <td
><span
class=required
><?php
xl('SE City','e'); ?
>: </span
></td
>
592 <td
><input type
=entry size
=15 name
=i
<?php
echo $i?
>subscriber_employer_city
593 value
="<?php echo $result3{"subscriber_employer_city
"}?>"
594 onchange
="capitalizeMe(this);" /></td
>
595 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('SE State','e') : xl('SE Locality','e') ?
>: </span
></td
>
598 // Modified 7/2009 by BM to incorporate data types
599 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']);
604 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('SE Zip Code','e') : xl('SE Postal Code','e') ?
>: </span
></td
>
605 <td
><input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_employer_postal_code value
="<?php echo $result3{"subscriber_employer_postal_code
"}?>"></td
>
606 <td
><span
class=required
><?php
xl('SE Country','e'); ?
>: </span
></td
>
609 // Modified 7/2009 by BM to incorporate data types
610 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']);
622 <span
class=required
><?php
xl('Subscriber','e'); ?
>: </span
>
623 <input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_fname
624 value
="<?php echo $result3{"subscriber_fname
"}?>"
625 onchange
="capitalizeMe(this);" />
626 <input type
=entry size
=3 name
=i
<?php
echo $i?
>subscriber_mname
627 value
="<?php echo $result3{"subscriber_mname
"}?>"
628 onchange
="capitalizeMe(this);" />
629 <input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_lname
630 value
="<?php echo $result3{"subscriber_lname
"}?>"
631 onchange
="capitalizeMe(this);" />
633 <span
class=required
><?php
xl('Relationship','e'); ?
>: </span
>
635 // Modified 6/2009 by BM to use list_options and function
636 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_relationship'),'list_id'=>'sub_relation','empty_title'=>' '), $result3['subscriber_relationship']);
638 <a href
="javascript:popUp('../../interface/patient_file/summary/browse.php?browsenum=<?php echo $i?>')" class=text
>(<?php
xl('Browse','e'); ?
>)</a
><br
/>
640 <span
class=bold
><?php
xl('D.O.B.','e'); ?
>: </span
>
641 <input type
='entry' size
='11' name
='i<?php echo $i?>subscriber_DOB'
642 id
='i<?php echo $i?>subscriber_DOB'
643 value
='<?php echo $result3['subscriber_DOB
'] ?>'
644 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
645 title
='yyyy-mm-dd' />
647 <img src
='../../interface/pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
648 id
='img_i<?php echo $i; ?>dob_date' border
='0' alt
='[?]' style
='cursor:pointer'
649 title
='<?php xl('Click here to choose a date
','e
'); ?>'>
651 <script LANGUAGE
="JavaScript">
652 Calendar
.setup({inputField
:"i<?php echo $i?>subscriber_DOB", ifFormat
:"%Y-%m-%d", button
:"img_i<?php echo $i; ?>dob_date"});
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
>
659 // Modified 6/2009 by BM to use list_options and function
660 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_sex'),'list_id'=>'sex'), $result3['subscriber_sex']);
663 <span
class=required
><?php
xl('Subscriber Address','e'); ?
>: </span
>
664 <input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_street
665 value
="<?php echo $result3{"subscriber_street
"}?>"
666 onchange
="capitalizeMe(this);" /><br
>
667 <span
class=required
><?php
xl('City','e'); ?
>: </span
>
668 <input type
=entry size
=15 name
=i
<?php
echo $i?
>subscriber_city
669 value
="<?php echo $result3{"subscriber_city
"}?>"
670 onchange
="capitalizeMe(this);" />
671 <span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('State','e') : xl('Locality','e') ?
>: </span
>
673 // Modified 7/2009 by BM to incorporate data types
674 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']);
677 <span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('Zip Code','e') : xl('Postal Code','e') ?
>: </span
><input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_postal_code value
="<?php echo $result3{"subscriber_postal_code
"}?>">
678 <span
class='required'<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
679 <?php
xl('Country','e'); ?
>: </span
>
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']);
685 <span
class=bold
><?php
xl('Subscriber Phone','e'); ?
>:
686 <input type
='text' size
='20' name
='i<?php echo $i?>subscriber_phone' value
='<?php echo $result3["subscriber_phone"] ?>' onkeyup
='phonekeyup(this,mypcc)' />
688 <span
class=bold
><?php
xl('CoPay','e'); ?
>: <input type
=text size
="6" name
=i
<?php
echo $i?
>copay value
="<?php echo $result3{"copay
"}?>">
690 <span
class='required'><?php
xl('Accept Assignment','e'); ?
>: </span
>
691 <select name
=i
<?php
echo $i?
>accept_assignment
>
692 <option value
="TRUE" <?php
if (strtoupper($result3{"accept_assignment"}) == "TRUE") echo "selected"?
>><?php
xl('YES','e'); ?
></option
>
693 <option value
="FALSE" <?php
if (strtoupper($result3{"accept_assignment"}) == "FALSE") echo "selected"?
>><?php
xl('NO','e'); ?
></option
>
703 } // end of "if not simplified_demographics"
706 <?php
if (!$SHORT_FORM) echo " <center>\n"; ?
>
708 <?php
if ($WITH_SEARCH) { ?
>
709 <input type
="button" id
="search" value
=<?php
xl('Search','e','\'','\''); ?
>
710 style
='background-color:<?php echo $searchcolor; ?>' />
713 <input type
="button" name
='create' id
="create" value
=<?php
xl('Create New Patient','e','\'','\''); ?
> />
718 <td align
='right' valign
='top' width
='1%' nowrap
>
719 <!-- Image upload stuff was here but got moved
. -->
726 <!-- include support
for the
list-add selectbox feature
-->
727 <?php
include($GLOBALS['fileroot']."/library/options_listadd.inc"); ?
>
731 <script language
="JavaScript">
733 // fix inconsistently formatted phone numbers from the database
734 var f
= document
.forms
[0];
735 if (f
.form_phone_contact
) phonekeyup(f
.form_phone_contact
,mypcc
);
736 if (f
.form_phone_home
) phonekeyup(f
.form_phone_home
,mypcc
);
737 if (f
.form_phone_biz
) phonekeyup(f
.form_phone_biz
,mypcc
);
738 if (f
.form_phone_cell
) phonekeyup(f
.form_phone_cell
,mypcc
);
740 <?php
echo $date_init; ?
>
742 // -=- jQuery makes life easier -=-
744 // var matches = 0; // number of patients that match the demographic information being entered
745 // var override = false; // flag that overrides the duplication warning
747 $
(document
).ready(function() {
749 // added to integrate insurance stuff
750 <?php
for ($i=1;$i<=3;$i++
) { ?
>
751 $
("#form_i<?php echo $i?>subscriber_relationship").change(function() { auto_populate_employer_address
<?php
echo $i?
>(); });
754 $
('#search').click(function() { searchme(); });
755 $
('#create').click(function() { submitme(); });
757 var submitme
= function() {
758 top
.restoreSession();
759 var f
= document
.forms
[0];
763 // In this case dups were shown already and Save should just save.
768 // D in edit_options indicates the field is used in duplication checking.
769 // This constructs a list of the names of those fields.
771 $mfres = sqlStatement("SELECT * FROM layout_options " .
772 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' AND " .
773 "edit_options LIKE '%D%' " .
774 "ORDER BY group_name, seq");
775 while ($mfrow = sqlFetchArray($mfres)) {
776 $field_id = $mfrow['field_id'];
777 if (strpos($field_id, 'em_') === 0) continue;
778 if (!empty($mflist)) $mflist .= ",";
779 $mflist .= "'" . htmlentities($field_id) . "'";
782 // Build and invoke the URL to create the dup-checker dialog.
783 var url
= 'new_search_popup.php';
784 var flds
= new Array(<?php
echo $mflist; ?
>);
786 for (var i
= 0; i
< flds
.length
; ++i
) {
787 var fval
= $
('#form_' + flds
[i
]).val();
788 if (fval
&& fval
!= '') {
791 url +
= 'mf_' + flds
[i
] +
'=' +
encodeURIComponent(fval
);
794 dlgopen(url
, '_blank', 700, 500);
799 // Set onclick/onfocus handlers for toggling background color.
801 $lres = getLayoutRes();
802 while ($lrow = sqlFetchArray($lres)) {
803 $field_id = $lrow['field_id'];
804 if (strpos($field_id, 'em_') === 0) continue;
805 switch(getSearchClass($lrow['data_type'])) {
807 echo " \$('#form_$field_id').click(function() { toggleSearch(this); });\n";
810 echo " \$('#form_$field_id').click(function() { selClick(this); });\n";
811 echo " \$('#form_$field_id').blur(function() { selBlur(this); });\n";
817 }); // end document.ready