3 * New patient or search patient.
6 * @link http://www.open-emr.org
7 * @author Rod Roark <rod@sunsetsystems.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2009-2010 Rod Roark <rod@sunsetsystems.com>
10 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
14 require_once("../globals.php");
15 require_once("$srcdir/acl.inc");
16 require_once("$srcdir/options.inc.php");
17 require_once("$srcdir/patient.inc");
18 require_once("$srcdir/erx_javascript.inc.php");
19 require_once("$srcdir/validation/LBF_Validation.php");
20 require_once("$srcdir/patientvalidation.inc.php");
22 // Check authorization.
23 if (!acl_check('patients', 'demo', '', array('write','addonly'))) {
24 die(xlt("Adding demographics is not authorized."));
27 $CPR = 4; // cells per row
29 $searchcolor = empty($GLOBALS['layout_search_color']) ?
30 '#ffff55' : $GLOBALS['layout_search_color'];
32 $WITH_SEARCH = ($GLOBALS['full_new_patient_form'] == '1' ||
$GLOBALS['full_new_patient_form'] == '2' );
33 $SHORT_FORM = ($GLOBALS['full_new_patient_form'] == '2' ||
$GLOBALS['full_new_patient_form'] == '3' ||
$GLOBALS['full_new_patient_form'] == '4');
35 function getLayoutRes()
38 return sqlStatement("SELECT * FROM layout_options " .
39 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' " .
40 ($SHORT_FORM ?
"AND ( uor > 1 OR edit_options LIKE '%N%' ) " : "") .
41 "ORDER BY group_name, seq");
44 // Determine layout field search treatment from its data type:
49 function getSearchClass($data_type)
52 case 1: // single-selection list
53 case 10: // local provider list
54 case 11: // provider list
55 case 12: // pharmacy list
57 case 14: // address book list
58 case 26: // single-selection list with add
59 case 35: // facilities
70 $fres = getLayoutRes();
74 <?php
html_header_show(); ?
>
76 <title
><?php
echo xlt("Search or Add Patient"); ?
></title
>
78 <link rel
="stylesheet" href
="<?php echo $css_header; ?>" type
="text/css">
79 <link rel
="stylesheet" href
="<?php echo $GLOBALS['assets_static_relative'] ?>/bootstrap-3-3-4/dist/css/bootstrap.min.css">
80 <?php
if ($_SESSION['language_direction'] == 'rtl') { ?
>
81 <link rel
="stylesheet" href
="<?php echo $GLOBALS['assets_static_relative'] ?>/bootstrap-rtl-3-3-4/dist/css/bootstrap-rtl.min.css">
83 <link rel
="stylesheet" href
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.min.css">
84 <link rel
="stylesheet" type
="text/css" href
="../../library/js/fancybox/jquery.fancybox-1.2.6.css" media
="screen" />
88 padding
: 5pt
5pt
5pt
5pt
;
94 border
-color
: #0000ff;
106 <script type
="text/javascript" src
="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
107 <script type
="text/javascript" src
="../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script
>
108 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-7-2/index.js"></script
>
109 <script type
="text/javascript" src
="../../library/js/common.js?v=<?php echo $v_js_includes; ?>"></script
>
110 <script type
="text/javascript" src
="../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script
>
111 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.full.min.js"></script
>
113 <?php
include_once("{$GLOBALS['srcdir']}/options.js.php"); ?
>
115 <SCRIPT LANGUAGE
="JavaScript"><!--
116 //Visolve - sync the radio buttons - Start
117 if((top
.window
.parent
) && (parent
.window
)){
118 var wname
= top
.window
.parent
.left_nav
;
119 fname
= (parent
.window
.name
)?parent
.window
.name
:window
.name
;
121 }//Visolve - sync the radio buttons - End
123 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
125 // This may be changed to true by the AJAX search script.
126 var force_submit
= false;
128 //code used from http://tech.irt.org/articles/js037/
129 function replace(string,text
,by
) {
130 // Replaces text with by in string
131 var strLength
= string.length
, txtLength
= text
.length
;
132 if ((strLength
== 0) ||
(txtLength
== 0)) return string;
134 var i
= string.indexOf(text
);
135 if ((!i
) && (text
!= string.substring(0,txtLength
))) return string;
136 if (i
== -1) return string;
138 var newstr
= string.substring(0,i
) + by
;
140 if (i+txtLength
< strLength
)
141 newstr +
= replace(string.substring(i+txtLength
,strLength
),text
,by
);
146 <?php
for ($i=1; $i<=3; $i++
) { ?
>
147 function auto_populate_employer_address
<?php
echo $i ?
>(){
148 var f
= document
.demographics_form
;
149 if (f
.form_i
<?php
echo $i?
>subscriber_relationship
.options
[f
.form_i
<?php
echo $i?
>subscriber_relationship
.selectedIndex
].value
== "self") {
150 f
.i
<?php
echo $i?
>subscriber_fname
.value
=f
.form_fname
.value
;
151 f
.i
<?php
echo $i?
>subscriber_mname
.value
=f
.form_mname
.value
;
152 f
.i
<?php
echo $i?
>subscriber_lname
.value
=f
.form_lname
.value
;
153 f
.i
<?php
echo $i?
>subscriber_street
.value
=f
.form_street
.value
;
154 f
.i
<?php
echo $i?
>subscriber_city
.value
=f
.form_city
.value
;
155 f
.form_i
<?php
echo $i?
>subscriber_state
.value
=f
.form_state
.value
;
156 f
.i
<?php
echo $i?
>subscriber_postal_code
.value
=f
.form_postal_code
.value
;
157 if (f
.form_country_code
)
158 f
.form_i
<?php
echo $i?
>subscriber_country
.value
=f
.form_country_code
.value
;
159 f
.i
<?php
echo $i?
>subscriber_phone
.value
=f
.form_phone_home
.value
;
160 f
.i
<?php
echo $i?
>subscriber_DOB
.value
=f
.form_DOB
.value
;
161 f
.i
<?php
echo $i?
>subscriber_ss
.value
=f
.form_ss
.value
;
162 f
.form_i
<?php
echo $i?
>subscriber_sex
.value
= f
.form_sex
.value
;
163 f
.i
<?php
echo $i?
>subscriber_employer
.value
=f
.form_em_name
.value
;
164 f
.i
<?php
echo $i?
>subscriber_employer_street
.value
=f
.form_em_street
.value
;
165 f
.i
<?php
echo $i?
>subscriber_employer_city
.value
=f
.form_em_city
.value
;
166 f
.form_i
<?php
echo $i?
>subscriber_employer_state
.value
=f
.form_em_state
.value
;
167 f
.i
<?php
echo $i?
>subscriber_employer_postal_code
.value
=f
.form_em_postal_code
.value
;
168 if (f
.form_em_country
)
169 f
.form_i
<?php
echo $i?
>subscriber_employer_country
.value
=f
.form_em_country
.value
;
175 function upperFirst(string,text
) {
176 return replace(string,text
,text
.charAt(0).toUpperCase() + text
.substring(1,text
.length
));
179 // The ins_search.php window calls this to set the selected insurance.
180 function set_insurance(ins_id
, ins_name
) {
181 var thesel
= document
.forms
[0]['i' + insurance_index +
'provider'];
182 var theopts
= thesel
.options
; // the array of Option objects
184 for (; i
< theopts
.length
; ++i
) {
185 if (theopts
[i
].value
== ins_id
) {
186 theopts
[i
].selected
= true;
190 // no matching option was found so create one, append it to the
191 // end of the list, and select it.
192 theopts
[i
] = new Option(ins_name
, ins_id
, false, true);
195 // Indicates which insurance slot is being updated.
196 var insurance_index
= 0;
198 // The OnClick handler for searching/adding the insurance company.
199 function ins_search(ins
) {
200 insurance_index
= ins
;
204 function checkNum () {
205 var re
= new RegExp();
207 str
=document
.forms
[0].monthly_income
.value
;
211 alert("<?php echo xls("Please enter a dollar amount using only numbers
and a decimal point
."); ?>");
215 // This capitalizes the first letter of each word in the passed input
216 // element. It also strips out extraneous spaces.
217 function capitalizeMe(elem
) {
218 var a
= elem
.value
.split(' ');
220 for(var i
= 0; i
< a
.length
; ++i
) {
221 if (a
[i
].length
> 0) {
222 if (s
.length
> 0) s +
= ' ';
223 s +
= a
[i
].charAt(0).toUpperCase() + a
[i
].substring(1);
229 // Onkeyup handler for policy number. Allows only A-Z and 0-9.
230 function policykeyup(e
) {
231 var v
= e
.value
.toUpperCase();
232 var filteredString
="";
233 for (var i
= 0; i
< v
.length
; ++i
) {
235 if ((c
>= '0' && c
<= '9') ||
236 (c
>= 'A' && c
<= 'Z') ||
247 e
.value
= filteredString
;
251 function divclick(cb
, divid
) {
252 var divstyle
= document
.getElementById(divid
).style
;
254 divstyle
.display
= 'block';
256 divstyle
.display
= 'none';
261 // Compute the length of a string without leading and trailing spaces.
262 function trimlen(s
) {
264 var j
= s
.length
- 1;
265 for (; i
<= j
&& s
.charAt(i
) == ' '; ++i
);
266 for (; i
<= j
&& s
.charAt(j
) == ' '; --j
);
271 function validate(f
) {
272 var errMsgs
= new Array();
273 <?php
generate_layout_validation('DEM'); ?
>
274 <?php
if ($GLOBALS['erx_enable']) { ?
>
276 for(i
=0;i
<f
.length
;i++
){
277 if(f
[i
].type
=='text' && f
[i
].value
)
279 if(f
[i
].name
== 'form_fname' || f
[i
].name
== 'form_mname' || f
[i
].name
== 'form_lname')
281 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
282 alertMsg +
= checkUsername(f
[i
].name
,f
[i
].value
);
284 else if(f
[i
].name
== 'form_street' || f
[i
].name
== 'form_city')
286 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
287 alertMsg +
= checkAlphaNumericExtended(f
[i
].name
,f
[i
].value
);
289 else if(f
[i
].name
== 'form_phone_home')
291 alertMsg +
= checkPhone(f
[i
].name
,f
[i
].value
);
302 msg +
= "<?php echo xla('The following fields are required'); ?>:\n\n";
303 for ( var i
= 0; i
< errMsgs
.length
; i++
) {
304 msg +
= errMsgs
[i
] +
"\n";
306 msg +
= "\n<?php echo xla('Please fill them in before continuing.'); ?>";
309 //Misc Deceased Date Validation for Future Date
310 var dateVal
= document
.getElementById("form_deceased_date").value
;
313 month
= '' +
(d
.getMonth() +
1),
314 day
= '' + d
.getDate(),
315 year
= d
.getFullYear();
316 if (month
.length
< 2) month
= '0' + month
;
317 if (day
.length
< 2) day
= '0' + day
;
318 currentDate
= year+
'-'+month+
'-'+day
;
319 if(errMsgs
.length
> 0 || dateVal
> currentDate
)
321 if(errMsgs
.length
> 0)
323 if(dateVal
> currentDate
)
324 alert ('<?php echo xls("Deceased Date should not be greater than Today"); ?>');
330 function toggleSearch(elem
) {
331 var f
= document
.forms
[0];
332 <?php
if ($WITH_SEARCH) { ?
>
333 // Toggle background color.
334 if (elem
.style
.backgroundColor
== '')
335 elem
.style
.backgroundColor
= '<?php echo $searchcolor; ?>';
337 elem
.style
.backgroundColor
= '';
340 force_submit
= false;
341 f
.create
.value
= '<?php echo xla('Create
New Patient
'); ?>';
346 // If a <select> list is dropped down, this is its name.
347 var open_sel_name
= '';
349 function selClick(elem
) {
350 if (open_sel_name
== elem
.name
) {
354 open_sel_name
= elem
.name
;
360 function selBlur(elem
) {
361 if (open_sel_name
== elem
.name
) {
367 // This invokes the patient search dialog.
368 function searchme() {
369 var f
= document
.forms
[0];
370 var url
= '../main/finder/patient_select.php?popup=1';
373 $lres = getLayoutRes();
375 while ($lrow = sqlFetchArray($lres)) {
376 $field_id = $lrow['field_id'];
377 if (strpos($field_id, 'em_') === 0) {
381 $data_type = $lrow['data_type'];
382 $fldname = "form_$field_id";
383 switch (getSearchClass($data_type)) {
386 " if (f.$fldname.style.backgroundColor != '' && trimlen(f.$fldname.value) > 0) {\n" .
387 " url += '&$field_id=' + encodeURIComponent(f.$fldname.value);\n" .
392 " if (f.$fldname.style.backgroundColor != '' && f.$fldname.selectedIndex > 0) {\n" .
393 " url += '&$field_id=' + encodeURIComponent(f.$fldname.options[f.$fldname.selectedIndex].value);\n" .
400 dlgopen(url
, '_blank', 700, 500);
408 <body
class="body_top">
411 /*Get the constraint from the DB-> LBF forms accordinf the form_id*/
412 $constraints = LBF_Validation
::generate_validate_constraints("DEM");
414 <script
> var constraints
= <?php
echo $constraints;?
>; </script
>
416 <form action
='new_comprehensive_save.php' name
='demographics_form' id
="DEM" method
='post' onsubmit
='return submitme(<?php echo $GLOBALS['new_validate
'] ? 1 : 0;?>,event,"DEM",constraints)'>
418 <div
class="container-fluid">
420 <div
class="col-xs-12">
421 <div
class="page-header">
422 <h2
><?php
echo xlt('Search or Add Patient');?
></h2
>
425 <div
class="col-xs-12">
426 <div
class="btn-group">
427 <?php
if ($WITH_SEARCH) { ?
>
428 <button type
="button" class="btn btn-default btn-search" id
="search" value
="<?php echo xla('Search'); ?>">
429 <?php
echo xlt('Search'); ?
>
432 <button type
="button" class="btn btn-default btn-save" name
='create' id
="create" value
="<?php echo xla('Create New Patient'); ?>">
433 <?php
echo xlt('Create New Patient'); ?
>
441 <table width
='100%' cellpadding
='0' cellspacing
='8'>
443 <td align
='left' valign
='top'>
444 <?php
if ($SHORT_FORM) {
451 global $item_count, $cell_count;
452 if ($item_count > 0) {
460 global $cell_count, $CPR;
462 if ($cell_count > 0) {
463 for (; $cell_count < $CPR;
475 global $last_group, $SHORT_FORM;
476 if (strlen($last_group) > 0) {
488 $display_style = 'block';
489 $group_seq = 0; // this gives the DIV blocks unique IDs
491 while ($frow = sqlFetchArray($fres)) {
492 $this_group = $frow['group_name'];
493 $titlecols = $frow['titlecols'];
494 $datacols = $frow['datacols'];
495 $data_type = $frow['data_type'];
496 $field_id = $frow['field_id'];
497 $list_id = $frow['list_id'];
499 $condition_str = get_conditions_str($condition_str, $group_fields);
501 if (strpos($field_id, 'em_') === 0) {
502 $tmp = substr($field_id, 3);
503 if (isset($result2[$tmp])) {
504 $currvalue = $result2[$tmp];
507 if (isset($result[$field_id])) {
508 $currvalue = $result[$field_id];
512 // Handle a data category (group) change.
513 if (strcmp($this_group, $last_group) != 0) {
516 $group_seq++
; // ID for DIV tags
517 $group_name = substr($this_group, 1);
518 if (strlen($last_group) > 0) {
522 echo "<span class='bold'><input type='checkbox' name='form_cb_$group_seq' id='form_cb_$group_seq' value='1' " .
523 "onclick='return divclick(this,\"div_$group_seq\");'";
524 if ($display_style == 'block') {
528 // Modified 6-09 by BM - Translate if applicable
529 echo " /><b>" . xl_layout_label($group_name) . "</b></span>\n";
531 echo "<div id='div_$group_seq' class='section' style='display:$display_style;'>\n";
532 echo " <table border='0' cellpadding='0'>\n";
533 $display_style = 'none';
534 } else if (strlen($last_group) == 0) {
535 echo " <table border='0' cellpadding='0'>\n";
538 $last_group = $this_group;
541 // Handle starting of a new row.
542 if (($titlecols > 0 && $cell_count >= $CPR) ||
$cell_count == 0) {
547 if ($item_count == 0 && $titlecols == 0) {
551 $field_id_label='label_'.$frow['field_id'];
552 // Handle starting of a new label cell.
553 if ($titlecols > 0) {
555 echo "<td colspan='$titlecols' id='$field_id_label'";
556 echo ($frow['uor'] == 2) ?
" class='required'" : " class='bold'";
557 if ($cell_count == 2) {
558 echo " style='padding-left:10pt'";
562 $cell_count +
= $titlecols;
569 // Modified 6-09 by BM - Translate if applicable
570 if ($frow['title']) {
571 echo (xl_layout_label($frow['title']).":");
578 // Handle starting of a new data cell.
580 $id_field_text = "text_".$frow['field_id'];
582 echo "<td colspan='$datacols' class='text data'";
583 if ($cell_count > 0) {
584 echo " style='padding-left:5pt'". " id='".$id_field_text."'";
588 $cell_count +
= $datacols;
592 generate_form_field($frow, $currvalue);
599 if (! $GLOBALS['simplified_demographics']) {
600 $insurancei = getInsuranceProviders();
602 $insurance_headings = array(xl("Primary Insurance Provider"), xl("Secondary Insurance Provider"), xl("Tertiary Insurance provider"));
603 $insurance_info = array();
604 $insurance_info[1] = getInsuranceData($pid, "primary");
605 $insurance_info[2] = getInsuranceData($pid, "secondary");
606 $insurance_info[3] = getInsuranceData($pid, "tertiary");
608 echo "<br /><span class='bold'><input type='checkbox' name='form_cb_ins' value='1' " .
609 "onclick='return divclick(this,\"div_ins\");'";
610 if ($display_style == 'block') {
614 echo " /><b>" . xlt('Insurance') . "</b></span>\n";
615 echo "<div id='div_ins' class='section' style='display:$display_style;'>\n";
617 for ($i=1; $i<=3; $i++
) {
618 $result3 = $insurance_info[$i];
622 <td valign
='top' colspan
='2'>
623 <span
class='required'><?php
echo text($insurance_headings[$i -1]).":"?
></span
>
624 <select name
="i<?php echo $i?>provider" class="form-control">
625 <option value
=""><?php
echo xlt('Unassigned'); ?
></option
>
627 foreach ($insurancei as $iid => $iname) {
628 echo "<option value='" . attr($iid) . "'";
629 if (strtolower($iid) == strtolower($result3{"provider"})) {
633 echo ">" . text($iname) . "</option>\n";
636 </select
> 
;<a
class='iframe medium_modal' href
='../practice/ins_search.php' onclick
='ins_search(<?php echo $i?>)'>
637 <span
> <?php
echo xlt('Search/Add Insurer'); ?
></span
></a
>
646 <span
class='required'><?php
echo xlt('Plan Name'); ?
>: </span
>
649 <input type
='entry' class='form-control' size
='20' name
='i<?php echo $i?>plan_name' value
="<?php echo attr($result3{"plan_name
"}); ?>"
650 onchange
="capitalizeMe(this);" /> 
; 
;
656 <span
class='required'><?php
echo xlt('Effective Date'); ?
>: </span
>
659 <input type
='entry' size
='11' class='datepicker form-control' name
='i<?php echo $i ?>effective_date'
660 id
='i<?php echo $i ?>effective_date'
661 value
='<?php echo attr($result3['date
']); ?>'
662 title
='yyyy-mm-dd' />
667 <td
><span
class=required
><?php
echo xlt('Policy Number'); ?
>: </span
></td
>
668 <td
><input type
='entry' class='form-control' size
='16' name
='i<?php echo $i?>policy_number' value
="<?php echo attr($result3{"policy_number
"}); ?>"
669 onkeyup
='policykeyup(this)'></td
>
673 <td
><span
class=required
><?php
echo xlt('Group Number'); ?
>: </span
></td
>
674 <td
><input type
=entry
class='form-control' size
=16 name
=i
<?php
echo $i?
>group_number value
="<?php echo attr($result3{"group_number
"}); ?>" onkeyup
='policykeyup(this)'></td
>
677 <tr
<?php
echo ($GLOBALS['omit_employers']) ?
" style='display:none'" : ""; ?
>>
678 <td
class='required'><?php
echo xlt('Subscriber Employer (SE)'); ?
><br
><span style
='font-weight:normal'>
679 (<?php
echo xlt('if unemployed enter Student'); ?
>,<br
><?php
echo xlt('PT Student, or leave blank'); ?
>): </span
></td
>
680 <td
><input type
=entry
class='form-control' size
=25 name
=i
<?php
echo $i?
>subscriber_employer
681 value
="<?php echo attr($result3{"subscriber_employer
"}); ?>"
682 onchange
="capitalizeMe(this);" /></td
>
685 <tr
<?php
echo ($GLOBALS['omit_employers']) ?
" style='display:none'" : ""; ?
>>
686 <td
><span
class=required
><?php
echo xlt('SE Address'); ?
>: </span
></td
>
687 <td
><input type
=entry
class='form-control' size
=25 name
=i
<?php
echo $i?
>subscriber_employer_street
688 value
="<?php echo attr($result3{"subscriber_employer_street
"}); ?>"
689 onchange
="capitalizeMe(this);" /></td
>
692 <tr
<?php
echo ($GLOBALS['omit_employers']) ?
" style='display:none'" : ""; ?
>>
696 <td
><span
class=required
><?php
echo xlt('SE City'); ?
>: </span
></td
>
697 <td
><input type
=entry
class='form-control' size
=15 name
=i
<?php
echo $i?
>subscriber_employer_city
698 value
="<?php echo attr($result3{"subscriber_employer_city
"}); ?>"
699 onchange
="capitalizeMe(this);" /></td
>
700 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('SE State') : xlt('SE Locality') ?
>: </span
></td
>
703 // Modified 7/2009 by BM to incorporate data types
704 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']);
709 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('SE Zip Code') : xlt('SE Postal Code') ?
>: </span
></td
>
710 <td
><input type
=entry
class='form-control' size
=10 name
=i
<?php
echo $i?
>subscriber_employer_postal_code value
="<?php echo attr($result3{"subscriber_employer_postal_code
"}); ?>"></td
>
711 <td
><span
class=required
><?php
xl('SE Country', 'e'); ?
>: </span
></td
>
714 // Modified 7/2009 by BM to incorporate data types
715 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']);
727 <span
class=required
><?php
echo xlt('Subscriber'); ?
>: </span
>
728 <input type
=entry
class='form-control' size
=10 name
=i
<?php
echo $i?
>subscriber_fname
729 value
="<?php echo attr($result3{"subscriber_fname
"}); ?>"
730 onchange
="capitalizeMe(this);" />
731 <input type
=entry
class='form-control' size
=3 name
=i
<?php
echo $i?
>subscriber_mname
732 value
="<?php echo attr($result3{"subscriber_mname
"}); ?>"
733 onchange
="capitalizeMe(this);" />
734 <input type
=entry
class='form-control' size
=10 name
=i
<?php
echo $i?
>subscriber_lname
735 value
="<?php echo attr($result3{"subscriber_lname
"}); ?>"
736 onchange
="capitalizeMe(this);" />
738 <span
class=required
><?php
echo xlt('Relationship'); ?
>: </span
>
740 // Modified 6/2009 by BM to use list_options and function
741 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_relationship'),'list_id'=>'sub_relation','empty_title'=>' '), $result3['subscriber_relationship']);
743 <a href
="javascript:popUp('../../interface/patient_file/summary/browse.php?browsenum=<?php echo $i?>')" class=text
>(<?php
echo xla('Browse'); ?
>)</a
><br
/>
745 <span
class=bold
><?php
echo xlt('D.O.B.'); ?
>: </span
>
746 <input type
='entry' size
='11' class='datepicker form-control' name
='i<?php echo $i?>subscriber_DOB'
747 id
='i<?php echo $i?>subscriber_DOB'
748 value
='<?php echo attr($result3['subscriber_DOB
']); ?>'
749 title
='yyyy-mm-dd' />
751 <span
class=bold
><?php
echo xlt('S.S.'); ?
>: </span
>
752 <input type
=entry
class='form-control' size
=11 name
=i
<?php
echo $i?
>subscriber_ss value
="<?php echo attr($result3{"subscriber_ss
"}); ?>"> 
;
753 <span
class=bold
><?php
echo xlt('Sex'); ?
>: </span
>
755 // Modified 6/2009 by BM to use list_options and function
756 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_sex'),'list_id'=>'sex'), $result3['subscriber_sex']);
759 <span
class=required
><?php
echo xlt('Subscriber Address'); ?
>: </span
>
760 <input type
=entry
class='form-control' size
=25 name
=i
<?php
echo $i?
>subscriber_street
761 value
="<?php echo attr($result3{"subscriber_street
"}); ?>"
762 onchange
="capitalizeMe(this);" /><br
>
763 <span
class=required
><?php
echo xlt('City'); ?
>: </span
>
764 <input type
=entry
class='form-control' size
=15 name
=i
<?php
echo $i?
>subscriber_city
765 value
="<?php echo attr($result3{"subscriber_city
"}); ?>"
766 onchange
="capitalizeMe(this);" />
767 <span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('State') : xlt('Locality') ?
>: </span
>
769 // Modified 7/2009 by BM to incorporate data types
770 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']);
773 <span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('Zip Code') : xlt('Postal Code') ?
>: </span
>
774 <input type
=entry
class='form-control' size
=10 name
=i
<?php
echo $i?
>subscriber_postal_code value
="<?php echo attr($result3{"subscriber_postal_code
"}); ?>">
775 <span
class='required'<?php
echo ($GLOBALS['omit_employers']) ?
" style='display:none'" : ""; ?
>>
776 <?php
echo xlt('Country'); ?
>: </span
>
778 // Modified 7/2009 by BM to incorporate data types
779 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']);
782 <span
class=bold
><?php
echo xlt('Subscriber Phone'); ?
>:
783 <input type
='text' class='form-control' size
='20' name
='i<?php echo $i?>subscriber_phone' value
='<?php echo attr($result3["subscriber_phone"]); ?>' onkeyup
='phonekeyup(this,mypcc)' />
785 <span
class=bold
><?php
echo xlt('CoPay'); ?
>: <input type
=text
class='form-control' size
="6" name
=i
<?php
echo $i?
>copay value
="<?php echo attr($result3{"copay
"}); ?>">
787 <span
class='required'><?php
echo xlt('Accept Assignment'); ?
>: </span
>
788 <select
class='form-control' name
=i
<?php
echo $i?
>accept_assignment
>
789 <option value
="TRUE" <?php
echo (strtoupper($result3{"accept_assignment"}) == "TRUE") ?
"selected" : ""; ?
>><?php
echo xlt('YES'); ?
></option
>
790 <option value
="FALSE" <?php
echo (strtoupper($result3{"accept_assignment"}) == "FALSE") ?
"selected" : ""; ?
>><?php
echo xlt('NO'); ?
></option
>
801 } // end of "if not simplified_demographics"
804 <?php
if ($SHORT_FORM) {
809 <td align
='right' valign
='top' width
='1%' nowrap
>
810 <!-- Image upload stuff was here but got moved
. -->
817 <!-- include support
for the
list-add selectbox feature
-->
818 <?php
include($GLOBALS['fileroot']."/library/options_listadd.inc"); ?
>
822 <script language
="JavaScript">
824 // hard code validation for old validation, in the new validation possible to add match rules
825 <?php
if ($GLOBALS['new_validate'] == 0) { ?
>
827 // fix inconsistently formatted phone numbers from the database
828 var f
= document
.forms
[0];
829 if (f
.form_phone_contact
) phonekeyup(f
.form_phone_contact
,mypcc
);
830 if (f
.form_phone_home
) phonekeyup(f
.form_phone_home
,mypcc
);
831 if (f
.form_phone_biz
) phonekeyup(f
.form_phone_biz
,mypcc
);
832 if (f
.form_phone_cell
) phonekeyup(f
.form_phone_cell
,mypcc
);
836 <?php
echo $date_init; ?
>
838 // -=- jQuery makes life easier -=-
840 // var matches = 0; // number of patients that match the demographic information being entered
841 // var override = false; // flag that overrides the duplication warning
843 $
(document
).ready(function() {
845 $
(".medium_modal").fancybox( {
846 'overlayOpacity' : 0.0,
847 'showCloseButton' : true,
851 // added to integrate insurance stuff
852 <?php
for ($i=1; $i<=3; $i++
) { ?
>
853 $
("#form_i<?php echo $i?>subscriber_relationship").change(function() { auto_populate_employer_address
<?php
echo $i?
>(); });
856 $
('#search').click(function() { searchme(); });
857 $
('#create').click(function() { check()});
859 var check
= function(e
) {
860 <?php
if ($GLOBALS['new_validate']) {?
>
861 var valid
= submitme(<?php
echo $GLOBALS['new_validate'] ?
1 : 0;?
>,e
,"DEM",constraints
);
863 top
.restoreSession();
864 var f
= document
.forms
[0];
865 var valid
= validate(f
);
869 // In this case dups were shown already and Save should just save.
870 top
.restoreSession();
876 // D in edit_options indicates the field is used in duplication checking.
877 // This constructs a list of the names of those fields.
879 $mfres = sqlStatement("SELECT * FROM layout_options " .
880 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' AND " .
881 "(edit_options LIKE '%D%' OR edit_options LIKE '%W%' )" .
882 "ORDER BY group_name, seq");
883 while ($mfrow = sqlFetchArray($mfres)) {
884 $field_id = $mfrow['field_id'];
885 if (strpos($field_id, 'em_') === 0) {
889 if (!empty($mflist)) {
893 $mflist .= "'" . htmlentities($field_id) . "'";
896 <?php
if (($GLOBALS['full_new_patient_form'] == '4') && (checkIfPatientValidationHookIsActive())) :?
>
897 // Use zend module patient validation hook to open the controller and send the dup-checker fields.
898 var url
='<?php echo $GLOBALS['web_root
']."/interface/modules/zend_modules/public/patientvalidation";?>';
900 // Build and invoke the URL to create the dup-checker dialog.
901 var url
= 'new_search_popup.php';
904 var flds
= new Array(<?php
echo $mflist; ?
>);
906 for (var i
= 0; i
< flds
.length
; ++i
) {
907 var fval
= $
('#form_' + flds
[i
]).val();
908 if (fval
&& fval
!= '') {
911 url +
= 'mf_' + flds
[i
] +
'=' +
encodeURIComponent(fval
);
915 dlgopen(url
, '_blank', 700, 500);
920 // Set onclick/onfocus handlers for toggling background color.
922 $lres = getLayoutRes();
923 while ($lrow = sqlFetchArray($lres)) {
924 $field_id = $lrow['field_id'];
925 if (strpos($field_id, 'em_') === 0) {
929 switch (getSearchClass($lrow['data_type'])) {
931 echo " \$('#form_$field_id').click(function() { toggleSearch(this); });\n";
934 echo " \$('#form_$field_id').click(function() { selClick(this); });\n";
935 echo " \$('#form_$field_id').blur(function() { selBlur(this); });\n";
941 $
('.datepicker').datetimepicker({
942 <?php
$datetimepicker_timepicker = false; ?
>
943 <?php
$datetimepicker_showseconds = false; ?
>
944 <?php
$datetimepicker_formatInput = false; ?
>
945 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
946 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
948 $
('.datetimepicker').datetimepicker({
949 <?php
$datetimepicker_timepicker = true; ?
>
950 <?php
$datetimepicker_showseconds = false; ?
>
951 <?php
$datetimepicker_formatInput = false; ?
>
952 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
953 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
956 }); // end document.ready
959 <?php
/*Include the validation script and rules for this form*/
964 //LBF forms use the new validation depending on the global value
965 $use_validate_js=$GLOBALS['new_validate'];
966 include_once("$srcdir/validation/validation_script.js.php");?
>
967 <script language
='JavaScript'>
968 // Array of skip conditions for the checkSkipConditions() function.
970 <?php
echo $condition_str; ?
>
972 checkSkipConditions();
973 $
("input").change(function() {
974 checkSkipConditions();
976 $
("select").change(function() {
977 checkSkipConditions();