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
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 <?php
generate_layout_validation('DEM'); ?
>
254 <?php
if($GLOBALS['erx_enable']){ ?
>
256 for(i
=0;i
<f
.length
;i++
){
257 if(f
[i
].type
=='text' && f
[i
].value
)
259 if(f
[i
].name
== 'form_fname' || f
[i
].name
== 'form_mname' || f
[i
].name
== 'form_lname')
261 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
262 alertMsg +
= checkUsername(f
[i
].name
,f
[i
].value
);
264 else if(f
[i
].name
== 'form_street' || f
[i
].name
== 'form_city')
266 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
267 alertMsg +
= checkAlphaNumericExtended(f
[i
].name
,f
[i
].value
);
269 else if(f
[i
].name
== 'form_phone_home')
271 alertMsg +
= checkPhone(f
[i
].name
,f
[i
].value
);
284 function toggleSearch(elem
) {
285 var f
= document
.forms
[0];
286 <?php
if ($WITH_SEARCH) { ?
>
287 // Toggle background color.
288 if (elem
.style
.backgroundColor
== '')
289 elem
.style
.backgroundColor
= '<?php echo $searchcolor; ?>';
291 elem
.style
.backgroundColor
= '';
294 force_submit
= false;
295 f
.create
.value
= '<?php xl('Create
New Patient
','e
'); ?>';
300 // If a <select> list is dropped down, this is its name.
301 var open_sel_name
= '';
303 function selClick(elem
) {
304 if (open_sel_name
== elem
.name
) {
308 open_sel_name
= elem
.name
;
314 function selBlur(elem
) {
315 if (open_sel_name
== elem
.name
) {
321 // This invokes the patient search dialog.
322 function searchme() {
323 var f
= document
.forms
[0];
324 var url
= '../main/finder/patient_select.php?popup=1';
327 $lres = getLayoutRes();
329 while ($lrow = sqlFetchArray($lres)) {
330 $field_id = $lrow['field_id'];
331 if (strpos($field_id, 'em_') === 0) continue;
332 $data_type = $lrow['data_type'];
333 $fldname = "form_$field_id";
334 switch(getSearchClass($data_type)) {
337 " if (f.$fldname.style.backgroundColor != '' && trimlen(f.$fldname.value) > 0) {\n" .
338 " url += '&$field_id=' + encodeURIComponent(f.$fldname.value);\n" .
343 " if (f.$fldname.style.backgroundColor != '' && f.$fldname.selectedIndex > 0) {\n" .
344 " url += '&$field_id=' + encodeURIComponent(f.$fldname.options[f.$fldname.selectedIndex].value);\n" .
351 dlgopen(url
, '_blank', 700, 500);
359 <body
class="body_top">
361 <form action
='new_comprehensive_save.php' name
='demographics_form' method
='post' onsubmit
='return validate(this)'>
363 <span
class='title'><?php
xl('Search or Add Patient','e'); ?
></span
>
365 <table width
='100%' cellpadding
='0' cellspacing
='8'>
367 <td align
='left' valign
='top'>
368 <?php
if ($SHORT_FORM) echo " <center>\n"; ?
>
371 function end_cell() {
372 global $item_count, $cell_count;
373 if ($item_count > 0) {
380 global $cell_count, $CPR;
382 if ($cell_count > 0) {
383 for (; $cell_count < $CPR; ++
$cell_count) echo "<td></td>";
389 function end_group() {
390 global $last_group, $SHORT_FORM;
391 if (strlen($last_group) > 0) {
394 if (!$SHORT_FORM) echo "</div>\n";
401 $display_style = 'block';
402 $group_seq = 0; // this gives the DIV blocks unique IDs
404 while ($frow = sqlFetchArray($fres)) {
405 $this_group = $frow['group_name'];
406 $titlecols = $frow['titlecols'];
407 $datacols = $frow['datacols'];
408 $data_type = $frow['data_type'];
409 $field_id = $frow['field_id'];
410 $list_id = $frow['list_id'];
413 if (strpos($field_id, 'em_') === 0) {
414 $tmp = substr($field_id, 3);
415 if (isset($result2[$tmp])) $currvalue = $result2[$tmp];
418 if (isset($result[$field_id])) $currvalue = $result[$field_id];
421 // Handle a data category (group) change.
422 if (strcmp($this_group, $last_group) != 0) {
425 $group_seq++
; // ID for DIV tags
426 $group_name = substr($this_group, 1);
427 if (strlen($last_group) > 0) echo "<br />";
428 echo "<span class='bold'><input type='checkbox' name='form_cb_$group_seq' id='form_cb_$group_seq' value='1' " .
429 "onclick='return divclick(this,\"div_$group_seq\");'";
430 if ($display_style == 'block') echo " checked";
432 // Modified 6-09 by BM - Translate if applicable
433 echo " /><b>" . xl_layout_label($group_name) . "</b></span>\n";
435 echo "<div id='div_$group_seq' class='section' style='display:$display_style;'>\n";
436 echo " <table border='0' cellpadding='0'>\n";
437 $display_style = 'none';
439 else if (strlen($last_group) == 0) {
440 echo " <table border='0' cellpadding='0'>\n";
442 $last_group = $this_group;
445 // Handle starting of a new row.
446 if (($titlecols > 0 && $cell_count >= $CPR) ||
$cell_count == 0) {
451 if ($item_count == 0 && $titlecols == 0) $titlecols = 1;
453 // Handle starting of a new label cell.
454 if ($titlecols > 0) {
456 echo "<td colspan='$titlecols'";
457 echo ($frow['uor'] == 2) ?
" class='required'" : " class='bold'";
458 if ($cell_count == 2) echo " style='padding-left:10pt'";
460 $cell_count +
= $titlecols;
466 // Modified 6-09 by BM - Translate if applicable
467 if ($frow['title']) echo (xl_layout_label($frow['title']).":"); else echo " ";
471 // Handle starting of a new data cell.
474 echo "<td colspan='$datacols' class='text'";
475 if ($cell_count > 0) echo " style='padding-left:5pt'";
477 $cell_count +
= $datacols;
481 generate_form_field($frow, $currvalue);
488 if (! $GLOBALS['simplified_demographics']) {
489 $insurancei = getInsuranceProviders();
491 $insurance_headings = array(xl("Primary Insurance Provider"), xl("Secondary Insurance Provider"), xl("Tertiary Insurance provider"));
492 $insurance_info = array();
493 $insurance_info[1] = getInsuranceData($pid,"primary");
494 $insurance_info[2] = getInsuranceData($pid,"secondary");
495 $insurance_info[3] = getInsuranceData($pid,"tertiary");
497 echo "<br /><span class='bold'><input type='checkbox' name='form_cb_ins' value='1' " .
498 "onclick='return divclick(this,\"div_ins\");'";
499 if ($display_style == 'block') echo " checked";
500 echo " /><b>" . xl('Insurance') . "</b></span>\n";
501 echo "<div id='div_ins' class='section' style='display:$display_style;'>\n";
503 for($i=1;$i<=3;$i++
) {
504 $result3 = $insurance_info[$i];
508 <td valign
='top' colspan
='2'>
509 <span
class='required'><?php
echo $insurance_headings[$i -1].":"?
></span
>
510 <select name
="i<?php echo $i?>provider">
511 <option value
=""><?php
xl('Unassigned','e'); ?
></option
>
513 foreach ($insurancei as $iid => $iname) {
514 echo "<option value='" . $iid . "'";
515 if (strtolower($iid) == strtolower($result3{"provider"}))
517 echo ">" . $iname . "</option>\n";
520 </select
> 
;<a href
='' onclick
='return ins_search(<?php echo $i?>)'>
521 <?php
xl('Search/Add Insurer','e'); ?
></a
>
530 <span
class='required'><?php
xl('Plan Name','e'); ?
>: </span
>
533 <input type
='entry' size
='20' name
='i<?php echo $i?>plan_name' value
="<?php echo $result3{"plan_name
"} ?>"
534 onchange
="capitalizeMe(this);" /> 
; 
;
540 <span
class='required'><?php
xl('Effective Date','e'); ?
>: </span
>
543 <input type
='entry' size
='11' name
='i<?php echo $i ?>effective_date'
544 id
='i<?php echo $i ?>effective_date'
545 value
='<?php echo $result3['date
'] ?>'
546 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
547 title
='yyyy-mm-dd' />
549 <img src
='../../interface/pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
550 id
='img_i<?php echo $i ?>effective_date' border
='0' alt
='[?]' style
='cursor:pointer'
551 title
='<?php xl('Click here to choose a date
','e
'); ?>'>
553 <script LANGUAGE
="JavaScript">
554 Calendar
.setup({inputField
:"i<?php echo $i ?>effective_date", ifFormat
:"%Y-%m-%d", button
:"img_i<?php echo $i; ?>effective_date"});
562 <td
><span
class=required
><?php
xl('Policy Number','e'); ?
>: </span
></td
>
563 <td
><input type
='entry' size
='16' name
='i<?php echo $i?>policy_number' value
="<?php echo $result3{"policy_number
"}?>"
564 onkeyup
='policykeyup(this)'></td
>
568 <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
>
571 <tr
<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
572 <td
class='required'><?php
xl('Subscriber Employer (SE)','e'); ?
><br
><span style
='font-weight:normal'>
573 (<?php
xl('if unemployed enter Student','e'); ?
>,<br
><?php
xl('PT Student, or leave blank','e'); ?
>): </span
></td
>
574 <td
><input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_employer
575 value
="<?php echo $result3{"subscriber_employer
"}?>"
576 onchange
="capitalizeMe(this);" /></td
>
579 <tr
<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
580 <td
><span
class=required
><?php
xl('SE Address','e'); ?
>: </span
></td
>
581 <td
><input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_employer_street
582 value
="<?php echo $result3{"subscriber_employer_street
"}?>"
583 onchange
="capitalizeMe(this);" /></td
>
586 <tr
<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
590 <td
><span
class=required
><?php
xl('SE City','e'); ?
>: </span
></td
>
591 <td
><input type
=entry size
=15 name
=i
<?php
echo $i?
>subscriber_employer_city
592 value
="<?php echo $result3{"subscriber_employer_city
"}?>"
593 onchange
="capitalizeMe(this);" /></td
>
594 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('SE State','e') : xl('SE Locality','e') ?
>: </span
></td
>
597 // Modified 7/2009 by BM to incorporate data types
598 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']);
603 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('SE Zip Code','e') : xl('SE Postal Code','e') ?
>: </span
></td
>
604 <td
><input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_employer_postal_code value
="<?php echo $result3{"subscriber_employer_postal_code
"}?>"></td
>
605 <td
><span
class=required
><?php
xl('SE Country','e'); ?
>: </span
></td
>
608 // Modified 7/2009 by BM to incorporate data types
609 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']);
621 <span
class=required
><?php
xl('Subscriber','e'); ?
>: </span
>
622 <input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_fname
623 value
="<?php echo $result3{"subscriber_fname
"}?>"
624 onchange
="capitalizeMe(this);" />
625 <input type
=entry size
=3 name
=i
<?php
echo $i?
>subscriber_mname
626 value
="<?php echo $result3{"subscriber_mname
"}?>"
627 onchange
="capitalizeMe(this);" />
628 <input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_lname
629 value
="<?php echo $result3{"subscriber_lname
"}?>"
630 onchange
="capitalizeMe(this);" />
632 <span
class=required
><?php
xl('Relationship','e'); ?
>: </span
>
634 // Modified 6/2009 by BM to use list_options and function
635 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_relationship'),'list_id'=>'sub_relation','empty_title'=>' '), $result3['subscriber_relationship']);
637 <a href
="javascript:popUp('../../interface/patient_file/summary/browse.php?browsenum=<?php echo $i?>')" class=text
>(<?php
xl('Browse','e'); ?
>)</a
><br
/>
639 <span
class=bold
><?php
xl('D.O.B.','e'); ?
>: </span
>
640 <input type
='entry' size
='11' name
='i<?php echo $i?>subscriber_DOB'
641 id
='i<?php echo $i?>subscriber_DOB'
642 value
='<?php echo $result3['subscriber_DOB
'] ?>'
643 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
644 title
='yyyy-mm-dd' />
646 <img src
='../../interface/pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
647 id
='img_i<?php echo $i; ?>dob_date' border
='0' alt
='[?]' style
='cursor:pointer'
648 title
='<?php xl('Click here to choose a date
','e
'); ?>'>
650 <script LANGUAGE
="JavaScript">
651 Calendar
.setup({inputField
:"i<?php echo $i?>subscriber_DOB", ifFormat
:"%Y-%m-%d", button
:"img_i<?php echo $i; ?>dob_date"});
655 <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
"}?>"> 
;
656 <span
class=bold
><?php
xl('Sex','e'); ?
>: </span
>
658 // Modified 6/2009 by BM to use list_options and function
659 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_sex'),'list_id'=>'sex'), $result3['subscriber_sex']);
662 <span
class=required
><?php
xl('Subscriber Address','e'); ?
>: </span
>
663 <input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_street
664 value
="<?php echo $result3{"subscriber_street
"}?>"
665 onchange
="capitalizeMe(this);" /><br
>
666 <span
class=required
><?php
xl('City','e'); ?
>: </span
>
667 <input type
=entry size
=15 name
=i
<?php
echo $i?
>subscriber_city
668 value
="<?php echo $result3{"subscriber_city
"}?>"
669 onchange
="capitalizeMe(this);" />
670 <span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('State','e') : xl('Locality','e') ?
>: </span
>
672 // Modified 7/2009 by BM to incorporate data types
673 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']);
676 <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
"}?>">
677 <span
class='required'<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
678 <?php
xl('Country','e'); ?
>: </span
>
680 // Modified 7/2009 by BM to incorporate data types
681 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']);
684 <span
class=bold
><?php
xl('Subscriber Phone','e'); ?
>:
685 <input type
='text' size
='20' name
='i<?php echo $i?>subscriber_phone' value
='<?php echo $result3["subscriber_phone"] ?>' onkeyup
='phonekeyup(this,mypcc)' />
687 <span
class=bold
><?php
xl('CoPay','e'); ?
>: <input type
=text size
="6" name
=i
<?php
echo $i?
>copay value
="<?php echo $result3{"copay
"}?>">
689 <span
class='required'><?php
xl('Accept Assignment','e'); ?
>: </span
>
690 <select name
=i
<?php
echo $i?
>accept_assignment
>
691 <option value
="TRUE" <?php
if (strtoupper($result3{"accept_assignment"}) == "TRUE") echo "selected"?
>><?php
xl('YES','e'); ?
></option
>
692 <option value
="FALSE" <?php
if (strtoupper($result3{"accept_assignment"}) == "FALSE") echo "selected"?
>><?php
xl('NO','e'); ?
></option
>
702 } // end of "if not simplified_demographics"
705 <?php
if (!$SHORT_FORM) echo " <center>\n"; ?
>
707 <?php
if ($WITH_SEARCH) { ?
>
708 <input type
="button" id
="search" value
=<?php
xl('Search','e','\'','\''); ?
>
709 style
='background-color:<?php echo $searchcolor; ?>' />
712 <input type
="button" name
='create' id
="create" value
=<?php
xl('Create New Patient','e','\'','\''); ?
> />
717 <td align
='right' valign
='top' width
='1%' nowrap
>
718 <!-- Image upload stuff was here but got moved
. -->
725 <!-- include support
for the
list-add selectbox feature
-->
726 <?php
include($GLOBALS['fileroot']."/library/options_listadd.inc"); ?
>
730 <script language
="JavaScript">
732 // fix inconsistently formatted phone numbers from the database
733 var f
= document
.forms
[0];
734 if (f
.form_phone_contact
) phonekeyup(f
.form_phone_contact
,mypcc
);
735 if (f
.form_phone_home
) phonekeyup(f
.form_phone_home
,mypcc
);
736 if (f
.form_phone_biz
) phonekeyup(f
.form_phone_biz
,mypcc
);
737 if (f
.form_phone_cell
) phonekeyup(f
.form_phone_cell
,mypcc
);
739 <?php
echo $date_init; ?
>
741 // -=- jQuery makes life easier -=-
743 // var matches = 0; // number of patients that match the demographic information being entered
744 // var override = false; // flag that overrides the duplication warning
746 $
(document
).ready(function() {
748 // added to integrate insurance stuff
749 <?php
for ($i=1;$i<=3;$i++
) { ?
>
750 $
("#form_i<?php echo $i?>subscriber_relationship").change(function() { auto_populate_employer_address
<?php
echo $i?
>(); });
753 $
('#search').click(function() { searchme(); });
754 $
('#create').click(function() { submitme(); });
756 var submitme
= function() {
757 top
.restoreSession();
758 var f
= document
.forms
[0];
762 // In this case dups were shown already and Save should just save.
767 // D in edit_options indicates the field is used in duplication checking.
768 // This constructs a list of the names of those fields.
770 $mfres = sqlStatement("SELECT * FROM layout_options " .
771 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' AND " .
772 "edit_options LIKE '%D%' " .
773 "ORDER BY group_name, seq");
774 while ($mfrow = sqlFetchArray($mfres)) {
775 $field_id = $mfrow['field_id'];
776 if (strpos($field_id, 'em_') === 0) continue;
777 if (!empty($mflist)) $mflist .= ",";
778 $mflist .= "'" . htmlentities($field_id) . "'";
781 // Build and invoke the URL to create the dup-checker dialog.
782 var url
= 'new_search_popup.php';
783 var flds
= new Array(<?php
echo $mflist; ?
>);
785 for (var i
= 0; i
< flds
.length
; ++i
) {
786 var fval
= $
('#form_' + flds
[i
]).val();
787 if (fval
&& fval
!= '') {
790 url +
= 'mf_' + flds
[i
] +
'=' +
encodeURIComponent(fval
);
793 dlgopen(url
, '_blank', 700, 500);
798 // Set onclick/onfocus handlers for toggling background color.
800 $lres = getLayoutRes();
801 while ($lrow = sqlFetchArray($lres)) {
802 $field_id = $lrow['field_id'];
803 if (strpos($field_id, 'em_') === 0) continue;
804 switch(getSearchClass($lrow['data_type'])) {
806 echo " \$('#form_$field_id').click(function() { toggleSearch(this); });\n";
809 echo " \$('#form_$field_id').click(function() { selClick(this); });\n";
810 echo " \$('#form_$field_id').blur(function() { selBlur(this); });\n";
816 }); // end document.ready