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 if (!acl_check('patients','demo','',array('write',addonly
) ))
17 die("Adding demographics is not authorized.");
19 $CPR = 4; // cells per row
21 $searchcolor = empty($GLOBALS['layout_search_color']) ?
22 '#ffff55' : $GLOBALS['layout_search_color'];
24 $WITH_SEARCH = ($GLOBALS['full_new_patient_form'] == '1' ||
$GLOBALS['full_new_patient_form'] == '2');
25 $SHORT_FORM = ($GLOBALS['full_new_patient_form'] == '2' ||
$GLOBALS['full_new_patient_form'] == '3');
27 function getLayoutRes() {
29 return sqlStatement("SELECT * FROM layout_options " .
30 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' " .
31 ($SHORT_FORM ?
"AND ( uor > 1 OR edit_options LIKE '%N%' ) " : "") .
32 "ORDER BY group_name, seq");
35 // Determine layout field search treatment from its data type:
40 function getSearchClass($data_type) {
42 case 1: // single-selection list
43 case 10: // local provider list
44 case 11: // provider list
45 case 12: // pharmacy list
47 case 14: // address book list
48 case 26: // single-selection list with add
49 case 35: // facilities
59 $fres = getLayoutRes();
63 <?php
html_header_show(); ?
>
65 <link rel
="stylesheet" href
="<?php echo $css_header; ?>" type
="text/css">
68 body
, td
, input
, select
, textarea
{
69 font
-family
: Arial
, Helvetica
, sans
-serif
;
74 padding
: 5pt
5pt
5pt
5pt
;
80 border
-color
: #0000ff;
87 <style type
="text/css">@import
url(../../library
/dynarch_calendar
.css
);</style
>
89 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
90 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
91 <script type
="text/javascript" src
="../../library/dynarch_calendar.js"></script
>
92 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
93 <script type
="text/javascript" src
="../../library/dynarch_calendar_setup.js"></script
>
94 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/js/jquery.js"></script
>
96 <SCRIPT LANGUAGE
="JavaScript"><!--
97 //Visolve - sync the radio buttons - Start
98 if((top
.window
.parent
) && (parent
.window
)){
99 var wname
= top
.window
.parent
.left_nav
;
100 fname
= (parent
.window
.name
)?parent
.window
.name
:window
.name
;
102 wname
.setRadio(fname
, "new");
103 }//Visolve - sync the radio buttons - End
105 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
107 // This may be changed to true by the AJAX search script.
108 var force_submit
= false;
110 //code used from http://tech.irt.org/articles/js037/
111 function replace(string,text
,by
) {
112 // Replaces text with by in string
113 var strLength
= string.length
, txtLength
= text
.length
;
114 if ((strLength
== 0) ||
(txtLength
== 0)) return string;
116 var i
= string.indexOf(text
);
117 if ((!i
) && (text
!= string.substring(0,txtLength
))) return string;
118 if (i
== -1) return string;
120 var newstr
= string.substring(0,i
) + by
;
122 if (i+txtLength
< strLength
)
123 newstr +
= replace(string.substring(i+txtLength
,strLength
),text
,by
);
128 <?php
for ($i=1;$i<=3;$i++
) { ?
>
129 function auto_populate_employer_address
<?php
echo $i ?
>(){
130 var f
= document
.demographics_form
;
131 if (f
.form_i
<?php
echo $i?
>subscriber_relationship
.options
[f
.form_i
<?php
echo $i?
>subscriber_relationship
.selectedIndex
].value
== "self") {
132 f
.i
<?php
echo $i?
>subscriber_fname
.value
=f
.form_fname
.value
;
133 f
.i
<?php
echo $i?
>subscriber_mname
.value
=f
.form_mname
.value
;
134 f
.i
<?php
echo $i?
>subscriber_lname
.value
=f
.form_lname
.value
;
135 f
.i
<?php
echo $i?
>subscriber_street
.value
=f
.form_street
.value
;
136 f
.i
<?php
echo $i?
>subscriber_city
.value
=f
.form_city
.value
;
137 f
.form_i
<?php
echo $i?
>subscriber_state
.value
=f
.form_state
.value
;
138 f
.i
<?php
echo $i?
>subscriber_postal_code
.value
=f
.form_postal_code
.value
;
139 if (f
.form_country_code
)
140 f
.form_i
<?php
echo $i?
>subscriber_country
.value
=f
.form_country_code
.value
;
141 f
.i
<?php
echo $i?
>subscriber_phone
.value
=f
.form_phone_home
.value
;
142 f
.i
<?php
echo $i?
>subscriber_DOB
.value
=f
.form_DOB
.value
;
143 f
.i
<?php
echo $i?
>subscriber_ss
.value
=f
.form_ss
.value
;
144 f
.form_i
<?php
echo $i?
>subscriber_sex
.value
= f
.form_sex
.value
;
145 f
.i
<?php
echo $i?
>subscriber_employer
.value
=f
.form_em_name
.value
;
146 f
.i
<?php
echo $i?
>subscriber_employer_street
.value
=f
.form_em_street
.value
;
147 f
.i
<?php
echo $i?
>subscriber_employer_city
.value
=f
.form_em_city
.value
;
148 f
.form_i
<?php
echo $i?
>subscriber_employer_state
.value
=f
.form_em_state
.value
;
149 f
.i
<?php
echo $i?
>subscriber_employer_postal_code
.value
=f
.form_em_postal_code
.value
;
150 if (f
.form_em_country
)
151 f
.form_i
<?php
echo $i?
>subscriber_employer_country
.value
=f
.form_em_country
.value
;
157 function upperFirst(string,text
) {
158 return replace(string,text
,text
.charAt(0).toUpperCase() + text
.substring(1,text
.length
));
161 // The ins_search.php window calls this to set the selected insurance.
162 function set_insurance(ins_id
, ins_name
) {
163 var thesel
= document
.forms
[0]['i' + insurance_index +
'provider'];
164 var theopts
= thesel
.options
; // the array of Option objects
166 for (; i
< theopts
.length
; ++i
) {
167 if (theopts
[i
].value
== ins_id
) {
168 theopts
[i
].selected
= true;
172 // no matching option was found so create one, append it to the
173 // end of the list, and select it.
174 theopts
[i
] = new Option(ins_name
, ins_id
, false, true);
177 // Indicates which insurance slot is being updated.
178 var insurance_index
= 0;
180 // The OnClick handler for searching/adding the insurance company.
181 function ins_search(ins
) {
182 insurance_index
= ins
;
183 dlgopen('../../interface/practice/ins_search.php', '_blank', 550, 400);
187 function checkNum () {
188 var re
= new RegExp();
190 str
=document
.forms
[0].monthly_income
.value
;
194 alert("Please enter a dollar amount using only numbers and a decimal point.");
198 // This capitalizes the first letter of each word in the passed input
199 // element. It also strips out extraneous spaces.
200 function capitalizeMe(elem
) {
201 var a
= elem
.value
.split(' ');
203 for(var i
= 0; i
< a
.length
; ++i
) {
204 if (a
[i
].length
> 0) {
205 if (s
.length
> 0) s +
= ' ';
206 s +
= a
[i
].charAt(0).toUpperCase() + a
[i
].substring(1);
212 // Onkeyup handler for policy number. Allows only A-Z and 0-9.
213 function policykeyup(e
) {
214 var v
= e
.value
.toUpperCase();
215 for (var i
= 0; i
< v
.length
; ++i
) {
217 if (c
>= '0' && c
<= '9') continue;
218 if (c
>= 'A' && c
<= 'Z') continue;
219 if (c
== '*') continue;
220 if (c
== '-') continue;
221 if (c
== '_') continue;
222 if (c
== '(') continue;
223 if (c
== ')') continue;
224 if (c
== '#') continue;
225 v
= v
.substring(0, i
) + v
.substring(i + i
);
232 function divclick(cb
, divid
) {
233 var divstyle
= document
.getElementById(divid
).style
;
235 divstyle
.display
= 'block';
237 divstyle
.display
= 'none';
242 // Compute the length of a string without leading and trailing spaces.
243 function trimlen(s
) {
245 var j
= s
.length
- 1;
246 for (; i
<= j
&& s
.charAt(i
) == ' '; ++i
);
247 for (; i
<= j
&& s
.charAt(j
) == ' '; --j
);
252 function validate(f
) {
253 var errMsgs
= new Array();
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
);
283 msg +
= "<?php echo htmlspecialchars(xl('The following fields are required'),ENT_QUOTES); ?>:\n\n";
284 for ( var i
= 0; i
< errMsgs
.length
; i++
) {
285 msg +
= errMsgs
[i
] +
"\n";
287 msg +
= "\n<?php echo htmlspecialchars(xl('Please fill them in before continuing.'),ENT_QUOTES); ?>";
289 if ( errMsgs
.length
> 0 ) {
296 function toggleSearch(elem
) {
297 var f
= document
.forms
[0];
298 <?php
if ($WITH_SEARCH) { ?
>
299 // Toggle background color.
300 if (elem
.style
.backgroundColor
== '')
301 elem
.style
.backgroundColor
= '<?php echo $searchcolor; ?>';
303 elem
.style
.backgroundColor
= '';
306 force_submit
= false;
307 f
.create
.value
= '<?php xl('Create
New Patient
','e
'); ?>';
312 // If a <select> list is dropped down, this is its name.
313 var open_sel_name
= '';
315 function selClick(elem
) {
316 if (open_sel_name
== elem
.name
) {
320 open_sel_name
= elem
.name
;
326 function selBlur(elem
) {
327 if (open_sel_name
== elem
.name
) {
333 // This invokes the patient search dialog.
334 function searchme() {
335 var f
= document
.forms
[0];
336 var url
= '../main/finder/patient_select.php?popup=1';
339 $lres = getLayoutRes();
341 while ($lrow = sqlFetchArray($lres)) {
342 $field_id = $lrow['field_id'];
343 if (strpos($field_id, 'em_') === 0) continue;
344 $data_type = $lrow['data_type'];
345 $fldname = "form_$field_id";
346 switch(getSearchClass($data_type)) {
349 " if (f.$fldname.style.backgroundColor != '' && trimlen(f.$fldname.value) > 0) {\n" .
350 " url += '&$field_id=' + encodeURIComponent(f.$fldname.value);\n" .
355 " if (f.$fldname.style.backgroundColor != '' && f.$fldname.selectedIndex > 0) {\n" .
356 " url += '&$field_id=' + encodeURIComponent(f.$fldname.options[f.$fldname.selectedIndex].value);\n" .
363 dlgopen(url
, '_blank', 700, 500);
371 <body
class="body_top">
373 <form action
='new_comprehensive_save.php' name
='demographics_form' method
='post' onsubmit
='return validate(this)'>
375 <span
class='title'><?php
xl('Search or Add Patient','e'); ?
></span
>
377 <table width
='100%' cellpadding
='0' cellspacing
='8'>
379 <td align
='left' valign
='top'>
380 <?php
if ($SHORT_FORM) echo " <center>\n"; ?
>
383 function end_cell() {
384 global $item_count, $cell_count;
385 if ($item_count > 0) {
392 global $cell_count, $CPR;
394 if ($cell_count > 0) {
395 for (; $cell_count < $CPR; ++
$cell_count) echo "<td></td>";
401 function end_group() {
402 global $last_group, $SHORT_FORM;
403 if (strlen($last_group) > 0) {
406 if (!$SHORT_FORM) echo "</div>\n";
413 $display_style = 'block';
414 $group_seq = 0; // this gives the DIV blocks unique IDs
416 while ($frow = sqlFetchArray($fres)) {
417 $this_group = $frow['group_name'];
418 $titlecols = $frow['titlecols'];
419 $datacols = $frow['datacols'];
420 $data_type = $frow['data_type'];
421 $field_id = $frow['field_id'];
422 $list_id = $frow['list_id'];
425 if (strpos($field_id, 'em_') === 0) {
426 $tmp = substr($field_id, 3);
427 if (isset($result2[$tmp])) $currvalue = $result2[$tmp];
430 if (isset($result[$field_id])) $currvalue = $result[$field_id];
433 // Handle a data category (group) change.
434 if (strcmp($this_group, $last_group) != 0) {
437 $group_seq++
; // ID for DIV tags
438 $group_name = substr($this_group, 1);
439 if (strlen($last_group) > 0) echo "<br />";
440 echo "<span class='bold'><input type='checkbox' name='form_cb_$group_seq' id='form_cb_$group_seq' value='1' " .
441 "onclick='return divclick(this,\"div_$group_seq\");'";
442 if ($display_style == 'block') echo " checked";
444 // Modified 6-09 by BM - Translate if applicable
445 echo " /><b>" . xl_layout_label($group_name) . "</b></span>\n";
447 echo "<div id='div_$group_seq' class='section' style='display:$display_style;'>\n";
448 echo " <table border='0' cellpadding='0'>\n";
449 $display_style = 'none';
451 else if (strlen($last_group) == 0) {
452 echo " <table border='0' cellpadding='0'>\n";
454 $last_group = $this_group;
457 // Handle starting of a new row.
458 if (($titlecols > 0 && $cell_count >= $CPR) ||
$cell_count == 0) {
463 if ($item_count == 0 && $titlecols == 0) $titlecols = 1;
465 // Handle starting of a new label cell.
466 if ($titlecols > 0) {
468 echo "<td colspan='$titlecols'";
469 echo ($frow['uor'] == 2) ?
" class='required'" : " class='bold'";
470 if ($cell_count == 2) echo " style='padding-left:10pt'";
472 $cell_count +
= $titlecols;
478 // Modified 6-09 by BM - Translate if applicable
479 if ($frow['title']) echo (xl_layout_label($frow['title']).":"); else echo " ";
483 // Handle starting of a new data cell.
486 echo "<td colspan='$datacols' class='text'";
487 if ($cell_count > 0) echo " style='padding-left:5pt'";
489 $cell_count +
= $datacols;
493 generate_form_field($frow, $currvalue);
500 if (! $GLOBALS['simplified_demographics']) {
501 $insurancei = getInsuranceProviders();
503 $insurance_headings = array(xl("Primary Insurance Provider"), xl("Secondary Insurance Provider"), xl("Tertiary Insurance provider"));
504 $insurance_info = array();
505 $insurance_info[1] = getInsuranceData($pid,"primary");
506 $insurance_info[2] = getInsuranceData($pid,"secondary");
507 $insurance_info[3] = getInsuranceData($pid,"tertiary");
509 echo "<br /><span class='bold'><input type='checkbox' name='form_cb_ins' value='1' " .
510 "onclick='return divclick(this,\"div_ins\");'";
511 if ($display_style == 'block') echo " checked";
512 echo " /><b>" . xl('Insurance') . "</b></span>\n";
513 echo "<div id='div_ins' class='section' style='display:$display_style;'>\n";
515 for($i=1;$i<=3;$i++
) {
516 $result3 = $insurance_info[$i];
520 <td valign
='top' colspan
='2'>
521 <span
class='required'><?php
echo $insurance_headings[$i -1].":"?
></span
>
522 <select name
="i<?php echo $i?>provider">
523 <option value
=""><?php
xl('Unassigned','e'); ?
></option
>
525 foreach ($insurancei as $iid => $iname) {
526 echo "<option value='" . $iid . "'";
527 if (strtolower($iid) == strtolower($result3{"provider"}))
529 echo ">" . $iname . "</option>\n";
532 </select
> 
;<a href
='' onclick
='return ins_search(<?php echo $i?>)'>
533 <?php
xl('Search/Add Insurer','e'); ?
></a
>
542 <span
class='required'><?php
xl('Plan Name','e'); ?
>: </span
>
545 <input type
='entry' size
='20' name
='i<?php echo $i?>plan_name' value
="<?php echo $result3{"plan_name
"} ?>"
546 onchange
="capitalizeMe(this);" /> 
; 
;
552 <span
class='required'><?php
xl('Effective Date','e'); ?
>: </span
>
555 <input type
='entry' size
='11' name
='i<?php echo $i ?>effective_date'
556 id
='i<?php echo $i ?>effective_date'
557 value
='<?php echo $result3['date
'] ?>'
558 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
559 title
='yyyy-mm-dd' />
561 <img src
='../../interface/pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
562 id
='img_i<?php echo $i ?>effective_date' border
='0' alt
='[?]' style
='cursor:pointer'
563 title
='<?php xl('Click here to choose a date
','e
'); ?>'>
565 <script LANGUAGE
="JavaScript">
566 Calendar
.setup({inputField
:"i<?php echo $i ?>effective_date", ifFormat
:"%Y-%m-%d", button
:"img_i<?php echo $i; ?>effective_date"});
574 <td
><span
class=required
><?php
xl('Policy Number','e'); ?
>: </span
></td
>
575 <td
><input type
='entry' size
='16' name
='i<?php echo $i?>policy_number' value
="<?php echo $result3{"policy_number
"}?>"
576 onkeyup
='policykeyup(this)'></td
>
580 <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
>
583 <tr
<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
584 <td
class='required'><?php
xl('Subscriber Employer (SE)','e'); ?
><br
><span style
='font-weight:normal'>
585 (<?php
xl('if unemployed enter Student','e'); ?
>,<br
><?php
xl('PT Student, or leave blank','e'); ?
>): </span
></td
>
586 <td
><input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_employer
587 value
="<?php echo $result3{"subscriber_employer
"}?>"
588 onchange
="capitalizeMe(this);" /></td
>
591 <tr
<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
592 <td
><span
class=required
><?php
xl('SE Address','e'); ?
>: </span
></td
>
593 <td
><input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_employer_street
594 value
="<?php echo $result3{"subscriber_employer_street
"}?>"
595 onchange
="capitalizeMe(this);" /></td
>
598 <tr
<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
602 <td
><span
class=required
><?php
xl('SE City','e'); ?
>: </span
></td
>
603 <td
><input type
=entry size
=15 name
=i
<?php
echo $i?
>subscriber_employer_city
604 value
="<?php echo $result3{"subscriber_employer_city
"}?>"
605 onchange
="capitalizeMe(this);" /></td
>
606 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('SE State','e') : xl('SE Locality','e') ?
>: </span
></td
>
609 // Modified 7/2009 by BM to incorporate data types
610 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']);
615 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('SE Zip Code','e') : xl('SE Postal Code','e') ?
>: </span
></td
>
616 <td
><input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_employer_postal_code value
="<?php echo $result3{"subscriber_employer_postal_code
"}?>"></td
>
617 <td
><span
class=required
><?php
xl('SE Country','e'); ?
>: </span
></td
>
620 // Modified 7/2009 by BM to incorporate data types
621 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']);
633 <span
class=required
><?php
xl('Subscriber','e'); ?
>: </span
>
634 <input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_fname
635 value
="<?php echo $result3{"subscriber_fname
"}?>"
636 onchange
="capitalizeMe(this);" />
637 <input type
=entry size
=3 name
=i
<?php
echo $i?
>subscriber_mname
638 value
="<?php echo $result3{"subscriber_mname
"}?>"
639 onchange
="capitalizeMe(this);" />
640 <input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_lname
641 value
="<?php echo $result3{"subscriber_lname
"}?>"
642 onchange
="capitalizeMe(this);" />
644 <span
class=required
><?php
xl('Relationship','e'); ?
>: </span
>
646 // Modified 6/2009 by BM to use list_options and function
647 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_relationship'),'list_id'=>'sub_relation','empty_title'=>' '), $result3['subscriber_relationship']);
649 <a href
="javascript:popUp('../../interface/patient_file/summary/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 id
='i<?php echo $i?>subscriber_DOB'
654 value
='<?php echo $result3['subscriber_DOB
'] ?>'
655 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
656 title
='yyyy-mm-dd' />
658 <img src
='../../interface/pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
659 id
='img_i<?php echo $i; ?>dob_date' border
='0' alt
='[?]' style
='cursor:pointer'
660 title
='<?php xl('Click here to choose a date
','e
'); ?>'>
662 <script LANGUAGE
="JavaScript">
663 Calendar
.setup({inputField
:"i<?php echo $i?>subscriber_DOB", ifFormat
:"%Y-%m-%d", button
:"img_i<?php echo $i; ?>dob_date"});
667 <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
"}?>"> 
;
668 <span
class=bold
><?php
xl('Sex','e'); ?
>: </span
>
670 // Modified 6/2009 by BM to use list_options and function
671 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_sex'),'list_id'=>'sex'), $result3['subscriber_sex']);
674 <span
class=required
><?php
xl('Subscriber Address','e'); ?
>: </span
>
675 <input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_street
676 value
="<?php echo $result3{"subscriber_street
"}?>"
677 onchange
="capitalizeMe(this);" /><br
>
678 <span
class=required
><?php
xl('City','e'); ?
>: </span
>
679 <input type
=entry size
=15 name
=i
<?php
echo $i?
>subscriber_city
680 value
="<?php echo $result3{"subscriber_city
"}?>"
681 onchange
="capitalizeMe(this);" />
682 <span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('State','e') : xl('Locality','e') ?
>: </span
>
684 // Modified 7/2009 by BM to incorporate data types
685 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']);
688 <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
"}?>">
689 <span
class='required'<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
690 <?php
xl('Country','e'); ?
>: </span
>
692 // Modified 7/2009 by BM to incorporate data types
693 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']);
696 <span
class=bold
><?php
xl('Subscriber Phone','e'); ?
>:
697 <input type
='text' size
='20' name
='i<?php echo $i?>subscriber_phone' value
='<?php echo $result3["subscriber_phone"] ?>' onkeyup
='phonekeyup(this,mypcc)' />
699 <span
class=bold
><?php
xl('CoPay','e'); ?
>: <input type
=text size
="6" name
=i
<?php
echo $i?
>copay value
="<?php echo $result3{"copay
"}?>">
701 <span
class='required'><?php
xl('Accept Assignment','e'); ?
>: </span
>
702 <select name
=i
<?php
echo $i?
>accept_assignment
>
703 <option value
="TRUE" <?php
if (strtoupper($result3{"accept_assignment"}) == "TRUE") echo "selected"?
>><?php
xl('YES','e'); ?
></option
>
704 <option value
="FALSE" <?php
if (strtoupper($result3{"accept_assignment"}) == "FALSE") echo "selected"?
>><?php
xl('NO','e'); ?
></option
>
714 } // end of "if not simplified_demographics"
717 <?php
if (!$SHORT_FORM) echo " <center>\n"; ?
>
719 <?php
if ($WITH_SEARCH) { ?
>
720 <input type
="button" id
="search" value
=<?php
xl('Search','e','\'','\''); ?
>
721 style
='background-color:<?php echo $searchcolor; ?>' />
724 <input type
="button" name
='create' id
="create" value
=<?php
xl('Create New Patient','e','\'','\''); ?
> />
729 <td align
='right' valign
='top' width
='1%' nowrap
>
730 <!-- Image upload stuff was here but got moved
. -->
737 <!-- include support
for the
list-add selectbox feature
-->
738 <?php
include($GLOBALS['fileroot']."/library/options_listadd.inc"); ?
>
742 <script language
="JavaScript">
744 // fix inconsistently formatted phone numbers from the database
745 var f
= document
.forms
[0];
746 if (f
.form_phone_contact
) phonekeyup(f
.form_phone_contact
,mypcc
);
747 if (f
.form_phone_home
) phonekeyup(f
.form_phone_home
,mypcc
);
748 if (f
.form_phone_biz
) phonekeyup(f
.form_phone_biz
,mypcc
);
749 if (f
.form_phone_cell
) phonekeyup(f
.form_phone_cell
,mypcc
);
751 <?php
echo $date_init; ?
>
753 // -=- jQuery makes life easier -=-
755 // var matches = 0; // number of patients that match the demographic information being entered
756 // var override = false; // flag that overrides the duplication warning
758 $
(document
).ready(function() {
760 // added to integrate insurance stuff
761 <?php
for ($i=1;$i<=3;$i++
) { ?
>
762 $
("#form_i<?php echo $i?>subscriber_relationship").change(function() { auto_populate_employer_address
<?php
echo $i?
>(); });
765 $
('#search').click(function() { searchme(); });
766 $
('#create').click(function() { submitme(); });
768 var submitme
= function() {
769 top
.restoreSession();
770 var f
= document
.forms
[0];
774 // In this case dups were shown already and Save should just save.
779 // D in edit_options indicates the field is used in duplication checking.
780 // This constructs a list of the names of those fields.
782 $mfres = sqlStatement("SELECT * FROM layout_options " .
783 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' AND " .
784 "edit_options LIKE '%D%' " .
785 "ORDER BY group_name, seq");
786 while ($mfrow = sqlFetchArray($mfres)) {
787 $field_id = $mfrow['field_id'];
788 if (strpos($field_id, 'em_') === 0) continue;
789 if (!empty($mflist)) $mflist .= ",";
790 $mflist .= "'" . htmlentities($field_id) . "'";
793 // Build and invoke the URL to create the dup-checker dialog.
794 var url
= 'new_search_popup.php';
795 var flds
= new Array(<?php
echo $mflist; ?
>);
797 for (var i
= 0; i
< flds
.length
; ++i
) {
798 var fval
= $
('#form_' + flds
[i
]).val();
799 if (fval
&& fval
!= '') {
802 url +
= 'mf_' + flds
[i
] +
'=' +
encodeURIComponent(fval
);
805 dlgopen(url
, '_blank', 700, 500);
810 // Set onclick/onfocus handlers for toggling background color.
812 $lres = getLayoutRes();
813 while ($lrow = sqlFetchArray($lres)) {
814 $field_id = $lrow['field_id'];
815 if (strpos($field_id, 'em_') === 0) continue;
816 switch(getSearchClass($lrow['data_type'])) {
818 echo " \$('#form_$field_id').click(function() { toggleSearch(this); });\n";
821 echo " \$('#form_$field_id').click(function() { selClick(this); });\n";
822 echo " \$('#form_$field_id').blur(function() { selBlur(this); });\n";
828 }); // end document.ready