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-2017 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 use OpenEMR\Core\Header
;
24 // Check authorization.
25 if (!acl_check('patients', 'demo', '', array('write','addonly'))) {
26 die(xlt("Adding demographics is not authorized."));
29 $CPR = 4; // cells per row
31 $searchcolor = empty($GLOBALS['layout_search_color']) ?
32 '#ffff55' : $GLOBALS['layout_search_color'];
34 $WITH_SEARCH = ($GLOBALS['full_new_patient_form'] == '1' ||
$GLOBALS['full_new_patient_form'] == '2' );
35 $SHORT_FORM = ($GLOBALS['full_new_patient_form'] == '2' ||
$GLOBALS['full_new_patient_form'] == '3' ||
$GLOBALS['full_new_patient_form'] == '4');
38 getLayoutProperties('DEM', $grparr);
40 function getLayoutRes()
43 return sqlStatement("SELECT * FROM layout_options " .
44 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' " .
45 ($SHORT_FORM ?
"AND ( uor > 1 OR edit_options LIKE '%N%' ) " : "") .
46 "ORDER BY group_id, seq");
49 // Determine layout field search treatment from its data type:
54 function getSearchClass($data_type)
57 case 1: // single-selection list
58 case 10: // local provider list
59 case 11: // provider list
60 case 12: // pharmacy list
62 case 14: // address book list
63 case 26: // single-selection list with add
64 case 35: // facilities
75 $fres = getLayoutRes();
79 <?php Header
::setupHeader(['common','datetime-picker', 'jquery-ui']); ?
>
80 <title
><?php
echo xlt("Search or Add Patient"); ?
></title
>
84 padding
: 5pt
5pt
5pt
5pt
;
90 border
-color
: #0000ff;
102 <?php
include_once("{$GLOBALS['srcdir']}/options.js.php"); ?
>
104 <SCRIPT LANGUAGE
="JavaScript"><!--
105 //Visolve - sync the radio buttons - Start
106 if((top
.window
.parent
) && (parent
.window
)){
107 var wname
= top
.window
.parent
.left_nav
;
108 fname
= (parent
.window
.name
)?parent
.window
.name
:window
.name
;
110 }//Visolve - sync the radio buttons - End
112 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
114 // This may be changed to true by the AJAX search script.
115 var force_submit
= false;
117 //code used from http://tech.irt.org/articles/js037/
118 function replace(string,text
,by
) {
119 // Replaces text with by in string
120 var strLength
= string.length
, txtLength
= text
.length
;
121 if ((strLength
== 0) ||
(txtLength
== 0)) return string;
123 var i
= string.indexOf(text
);
124 if ((!i
) && (text
!= string.substring(0,txtLength
))) return string;
125 if (i
== -1) return string;
127 var newstr
= string.substring(0,i
) + by
;
129 if (i+txtLength
< strLength
)
130 newstr +
= replace(string.substring(i+txtLength
,strLength
),text
,by
);
135 <?php
for ($i=1; $i<=3; $i++
) { ?
>
136 function auto_populate_employer_address
<?php
echo $i ?
>(){
137 var f
= document
.demographics_form
;
138 if (f
.form_i
<?php
echo $i?
>subscriber_relationship
.options
[f
.form_i
<?php
echo $i?
>subscriber_relationship
.selectedIndex
].value
== "self") {
139 f
.i
<?php
echo $i?
>subscriber_fname
.value
=f
.form_fname
.value
;
140 f
.i
<?php
echo $i?
>subscriber_mname
.value
=f
.form_mname
.value
;
141 f
.i
<?php
echo $i?
>subscriber_lname
.value
=f
.form_lname
.value
;
142 f
.i
<?php
echo $i?
>subscriber_street
.value
=f
.form_street
.value
;
143 f
.i
<?php
echo $i?
>subscriber_city
.value
=f
.form_city
.value
;
144 f
.form_i
<?php
echo $i?
>subscriber_state
.value
=f
.form_state
.value
;
145 f
.i
<?php
echo $i?
>subscriber_postal_code
.value
=f
.form_postal_code
.value
;
146 if (f
.form_country_code
)
147 f
.form_i
<?php
echo $i?
>subscriber_country
.value
=f
.form_country_code
.value
;
148 f
.i
<?php
echo $i?
>subscriber_phone
.value
=f
.form_phone_home
.value
;
149 f
.i
<?php
echo $i?
>subscriber_DOB
.value
=f
.form_DOB
.value
;
150 f
.i
<?php
echo $i?
>subscriber_ss
.value
=f
.form_ss
.value
;
151 f
.form_i
<?php
echo $i?
>subscriber_sex
.value
= f
.form_sex
.value
;
152 f
.i
<?php
echo $i?
>subscriber_employer
.value
=f
.form_em_name
.value
;
153 f
.i
<?php
echo $i?
>subscriber_employer_street
.value
=f
.form_em_street
.value
;
154 f
.i
<?php
echo $i?
>subscriber_employer_city
.value
=f
.form_em_city
.value
;
155 f
.form_i
<?php
echo $i?
>subscriber_employer_state
.value
=f
.form_em_state
.value
;
156 f
.i
<?php
echo $i?
>subscriber_employer_postal_code
.value
=f
.form_em_postal_code
.value
;
157 if (f
.form_em_country
)
158 f
.form_i
<?php
echo $i?
>subscriber_employer_country
.value
=f
.form_em_country
.value
;
164 function upperFirst(string,text
) {
165 return replace(string,text
,text
.charAt(0).toUpperCase() + text
.substring(1,text
.length
));
168 // The ins_search.php window calls this to set the selected insurance.
169 function set_insurance(ins_id
, ins_name
) {
170 var thesel
= document
.forms
[0]['i' + insurance_index +
'provider'];
171 var theopts
= thesel
.options
; // the array of Option objects
173 for (; i
< theopts
.length
; ++i
) {
174 if (theopts
[i
].value
== ins_id
) {
175 theopts
[i
].selected
= true;
179 // no matching option was found so create one, append it to the
180 // end of the list, and select it.
181 theopts
[i
] = new Option(ins_name
, ins_id
, false, true);
184 // Indicates which insurance slot is being updated.
185 var insurance_index
= 0;
187 // The OnClick handler for searching/adding the insurance company.
188 function ins_search(ins
) {
189 insurance_index
= ins
;
193 function checkNum () {
194 var re
= new RegExp();
196 str
=document
.forms
[0].monthly_income
.value
;
200 alert("<?php echo xls("Please enter a dollar amount using only numbers
and a decimal point
."); ?>");
204 // This capitalizes the first letter of each word in the passed input
205 // element. It also strips out extraneous spaces.
206 function capitalizeMe(elem
) {
207 var a
= elem
.value
.split(' ');
209 for(var i
= 0; i
< a
.length
; ++i
) {
210 if (a
[i
].length
> 0) {
211 if (s
.length
> 0) s +
= ' ';
212 s +
= a
[i
].charAt(0).toUpperCase() + a
[i
].substring(1);
218 // Onkeyup handler for policy number. Allows only A-Z and 0-9.
219 function policykeyup(e
) {
220 var v
= e
.value
.toUpperCase();
221 var filteredString
="";
222 for (var i
= 0; i
< v
.length
; ++i
) {
224 if ((c
>= '0' && c
<= '9') ||
225 (c
>= 'A' && c
<= 'Z') ||
236 e
.value
= filteredString
;
240 function divclick(cb
, divid
) {
241 var divstyle
= document
.getElementById(divid
).style
;
243 divstyle
.display
= 'block';
245 divstyle
.display
= 'none';
250 // Compute the length of a string without leading and trailing spaces.
251 function trimlen(s
) {
253 var j
= s
.length
- 1;
254 for (; i
<= j
&& s
.charAt(i
) == ' '; ++i
);
255 for (; i
<= j
&& s
.charAt(j
) == ' '; --j
);
260 function validate(f
) {
261 var errMsgs
= new Array();
262 <?php
generate_layout_validation('DEM'); ?
>
263 <?php
if ($GLOBALS['erx_enable']) { ?
>
265 for(i
=0;i
<f
.length
;i++
){
266 if(f
[i
].type
=='text' && f
[i
].value
)
268 if(f
[i
].name
== 'form_fname' || f
[i
].name
== 'form_mname' || f
[i
].name
== 'form_lname')
270 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
271 alertMsg +
= checkUsername(f
[i
].name
,f
[i
].value
);
273 else if(f
[i
].name
== 'form_street' || f
[i
].name
== 'form_city')
275 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
276 alertMsg +
= checkAlphaNumericExtended(f
[i
].name
,f
[i
].value
);
278 else if(f
[i
].name
== 'form_phone_home')
280 alertMsg +
= checkPhone(f
[i
].name
,f
[i
].value
);
291 msg +
= "<?php echo xla('The following fields are required'); ?>:\n\n";
292 for ( var i
= 0; i
< errMsgs
.length
; i++
) {
293 msg +
= errMsgs
[i
] +
"\n";
295 msg +
= "\n<?php echo xla('Please fill them in before continuing.'); ?>";
298 //Misc Deceased Date Validation for Future Date
299 var dateVal
= document
.getElementById("form_deceased_date").value
;
302 month
= '' +
(d
.getMonth() +
1),
303 day
= '' + d
.getDate(),
304 year
= d
.getFullYear();
305 if (month
.length
< 2) month
= '0' + month
;
306 if (day
.length
< 2) day
= '0' + day
;
307 currentDate
= year+
'-'+month+
'-'+day
;
308 if(errMsgs
.length
> 0 || dateVal
> currentDate
)
310 if(errMsgs
.length
> 0)
312 if(dateVal
> currentDate
)
313 alert ('<?php echo xls("Deceased Date should not be greater than Today"); ?>');
319 function toggleSearch(elem
) {
320 var f
= document
.forms
[0];
321 <?php
if ($WITH_SEARCH) { ?
>
322 // Toggle background color.
323 if (elem
.style
.backgroundColor
== '')
324 elem
.style
.backgroundColor
= '<?php echo $searchcolor; ?>';
326 elem
.style
.backgroundColor
= '';
329 force_submit
= false;
330 f
.create
.value
= '<?php echo xla('Create
New Patient
'); ?>';
335 // If a <select> list is dropped down, this is its name.
336 var open_sel_name
= '';
338 function selClick(elem
) {
339 if (open_sel_name
== elem
.name
) {
343 open_sel_name
= elem
.name
;
349 function selBlur(elem
) {
350 if (open_sel_name
== elem
.name
) {
356 // This invokes the patient search dialog.
357 function searchme() {
358 var f
= document
.forms
[0];
359 var url
= '../main/finder/patient_select.php?popup=1';
362 $lres = getLayoutRes();
364 while ($lrow = sqlFetchArray($lres)) {
365 $field_id = $lrow['field_id'];
366 if (strpos($field_id, 'em_') === 0) {
370 $data_type = $lrow['data_type'];
371 $fldname = "form_$field_id";
372 switch (getSearchClass($data_type)) {
375 " if (f.$fldname.style.backgroundColor != '' && trimlen(f.$fldname.value) > 0) {\n" .
376 " url += '&$field_id=' + encodeURIComponent(f.$fldname.value);\n" .
381 " if (f.$fldname.style.backgroundColor != '' && f.$fldname.selectedIndex > 0) {\n" .
382 " url += '&$field_id=' + encodeURIComponent(f.$fldname.options[f.$fldname.selectedIndex].value);\n" .
389 dlgopen(url
, '_blank', 700, 500);
391 function srchDone(pid
){
392 top
.restoreSession();
393 document
.location
.href
= "./../../patient_file/summary/demographics.php?set_pid=" + pid
;
400 <body
class="body_top">
403 /*Get the constraint from the DB-> LBF forms accordinf the form_id*/
404 $constraints = LBF_Validation
::generate_validate_constraints("DEM");
406 <script
> var constraints
= <?php
echo $constraints;?
>; </script
>
408 <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)'>
410 <div
class="container-fluid">
412 <div
class="col-xs-12">
413 <div
class="page-header">
414 <h2
><?php
echo xlt('Search or Add Patient');?
></h2
>
417 <div
class="col-xs-12">
418 <div
class="btn-group">
419 <?php
if ($WITH_SEARCH) { ?
>
420 <button type
="button" class="btn btn-default btn-search" id
="search" value
="<?php echo xla('Search'); ?>">
421 <?php
echo xlt('Search'); ?
>
424 <button type
="button" class="btn btn-default btn-save" name
='create' id
="create" value
="<?php echo xla('Create New Patient'); ?>">
425 <?php
echo xlt('Create New Patient'); ?
>
433 <table width
='100%' cellpadding
='0' cellspacing
='8'>
435 <td align
='left' valign
='top'>
436 <?php
if ($SHORT_FORM) {
443 global $item_count, $cell_count;
444 if ($item_count > 0) {
452 global $cell_count, $CPR;
454 if ($cell_count > 0) {
455 for (; $cell_count < $CPR;
467 global $last_group, $SHORT_FORM;
468 if (strlen($last_group) > 0) {
480 $display_style = 'block';
481 $group_seq = 0; // this gives the DIV blocks unique IDs
485 while ($frow = sqlFetchArray($fres)) {
486 $this_group = $frow['group_id'];
487 $titlecols = $frow['titlecols'];
488 $datacols = $frow['datacols'];
489 $data_type = $frow['data_type'];
490 $field_id = $frow['field_id'];
491 $list_id = $frow['list_id'];
494 // Accumulate action conditions into a JSON expression for the browser side.
495 accumActionConditions($field_id, $condition_str, $frow['conditions']);
497 if (strpos($field_id, 'em_') === 0) {
498 $tmp = substr($field_id, 3);
499 if (isset($result2[$tmp])) {
500 $currvalue = $result2[$tmp];
503 if (isset($result[$field_id])) {
504 $currvalue = $result[$field_id];
508 // Handle a data category (group) change.
509 if (strcmp($this_group, $last_group) != 0) {
512 $group_seq++
; // ID for DIV tags
513 $group_name = $grparr[$this_group]['grp_title'];
515 if (strlen($last_group) > 0) {
519 echo "<span class='bold'><input type='checkbox' name='form_cb_$group_seq' id='form_cb_$group_seq' value='1' " .
520 "onclick='return divclick(this,\"div_$group_seq\");'";
521 if ($display_style == 'block') {
525 // Modified 6-09 by BM - Translate if applicable
526 echo " /><b>" . xl_layout_label($group_name) . "</b></span>\n";
528 echo "<div id='div_$group_seq' class='section' style='display:$display_style;'>\n";
529 echo " <table border='0' cellpadding='0'>\n";
530 $display_style = 'none';
531 } else if (strlen($last_group) == 0) {
532 echo " <table border='0' cellpadding='0'>\n";
535 $last_group = $this_group;
538 // Handle starting of a new row.
539 if (($titlecols > 0 && $cell_count >= $CPR) ||
$cell_count == 0) {
544 if ($item_count == 0 && $titlecols == 0) {
548 $field_id_label='label_'.$frow['field_id'];
549 // Handle starting of a new label cell.
550 if ($titlecols > 0) {
552 echo "<td colspan='$titlecols' id='$field_id_label'";
553 echo ($frow['uor'] == 2) ?
" class='required'" : " class='bold'";
554 if ($cell_count == 2) {
555 echo " style='padding-left:10pt'";
559 $cell_count +
= $titlecols;
566 // Modified 6-09 by BM - Translate if applicable
567 if ($frow['title']) {
568 echo (xl_layout_label($frow['title']).":");
575 // Handle starting of a new data cell.
577 $id_field_text = "text_".$frow['field_id'];
579 echo "<td colspan='$datacols' class='text data'";
580 if ($cell_count > 0) {
581 echo " style='padding-left:5pt'". " id='".$id_field_text."'";
585 $cell_count +
= $datacols;
589 generate_form_field($frow, $currvalue);
596 if (! $GLOBALS['simplified_demographics']) {
597 $insurancei = getInsuranceProviders();
599 $insurance_headings = array(xl("Primary Insurance Provider"), xl("Secondary Insurance Provider"), xl("Tertiary Insurance provider"));
600 $insurance_info = array();
601 $insurance_info[1] = getInsuranceData($pid, "primary");
602 $insurance_info[2] = getInsuranceData($pid, "secondary");
603 $insurance_info[3] = getInsuranceData($pid, "tertiary");
605 echo "<br /><span class='bold'><input type='checkbox' name='form_cb_ins' value='1' " .
606 "onclick='return divclick(this,\"div_ins\");'";
607 if ($display_style == 'block') {
611 echo " /><b>" . xlt('Insurance') . "</b></span>\n";
612 echo "<div id='div_ins' class='section' style='display:$display_style;'>\n";
614 for ($i=1; $i<=3; $i++
) {
615 $result3 = $insurance_info[$i];
619 <td valign
='top' colspan
='2'>
620 <span
class='required'><?php
echo text($insurance_headings[$i -1]).":"?
></span
>
621 <select name
="i<?php echo $i?>provider" class="form-control">
622 <option value
=""><?php
echo xlt('Unassigned'); ?
></option
>
624 foreach ($insurancei as $iid => $iname) {
625 echo "<option value='" . attr($iid) . "'";
626 if (strtolower($iid) == strtolower($result3{"provider"})) {
630 echo ">" . text($iname) . "</option>\n";
633 </select
> 
;<a
class='medium_modal' href
='../practice/ins_search.php' onclick
='ins_search(<?php echo $i?>)'>
634 <span
> <?php
echo xlt('Search/Add Insurer'); ?
></span
></a
>
643 <span
class='required'><?php
echo xlt('Plan Name'); ?
>: </span
>
646 <input type
='entry' class='form-control' size
='20' name
='i<?php echo $i?>plan_name' value
="<?php echo attr($result3{"plan_name
"}); ?>"
647 onchange
="capitalizeMe(this);" /> 
; 
;
653 <span
class='required'><?php
echo xlt('Effective Date'); ?
>: </span
>
656 <input type
='entry' size
='11' class='datepicker form-control' name
='i<?php echo $i ?>effective_date'
657 id
='i<?php echo $i ?>effective_date'
658 value
='<?php echo attr($result3['date
']); ?>'
659 title
='yyyy-mm-dd' />
664 <td
><span
class=required
><?php
echo xlt('Policy Number'); ?
>: </span
></td
>
665 <td
><input type
='entry' class='form-control' size
='16' name
='i<?php echo $i?>policy_number' value
="<?php echo attr($result3{"policy_number
"}); ?>"
666 onkeyup
='policykeyup(this)'></td
>
670 <td
><span
class=required
><?php
echo xlt('Group Number'); ?
>: </span
></td
>
671 <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
>
674 <tr
<?php
echo ($GLOBALS['omit_employers']) ?
" style='display:none'" : ""; ?
>>
675 <td
class='required'><?php
echo xlt('Subscriber Employer (SE)'); ?
><br
><span style
='font-weight:normal'>
676 (<?php
echo xlt('if unemployed enter Student'); ?
>,<br
><?php
echo xlt('PT Student, or leave blank'); ?
>): </span
></td
>
677 <td
><input type
=entry
class='form-control' size
=25 name
=i
<?php
echo $i?
>subscriber_employer
678 value
="<?php echo attr($result3{"subscriber_employer
"}); ?>"
679 onchange
="capitalizeMe(this);" /></td
>
682 <tr
<?php
echo ($GLOBALS['omit_employers']) ?
" style='display:none'" : ""; ?
>>
683 <td
><span
class=required
><?php
echo xlt('SE Address'); ?
>: </span
></td
>
684 <td
><input type
=entry
class='form-control' size
=25 name
=i
<?php
echo $i?
>subscriber_employer_street
685 value
="<?php echo attr($result3{"subscriber_employer_street
"}); ?>"
686 onchange
="capitalizeMe(this);" /></td
>
689 <tr
<?php
echo ($GLOBALS['omit_employers']) ?
" style='display:none'" : ""; ?
>>
693 <td
><span
class=required
><?php
echo xlt('SE City'); ?
>: </span
></td
>
694 <td
><input type
=entry
class='form-control' size
=15 name
=i
<?php
echo $i?
>subscriber_employer_city
695 value
="<?php echo attr($result3{"subscriber_employer_city
"}); ?>"
696 onchange
="capitalizeMe(this);" /></td
>
697 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('SE State') : xlt('SE Locality') ?
>: </span
></td
>
700 // Modified 7/2009 by BM to incorporate data types
701 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']);
706 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('SE Zip Code') : xlt('SE Postal Code') ?
>: </span
></td
>
707 <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
>
708 <td
><span
class=required
><?php
xl('SE Country', 'e'); ?
>: </span
></td
>
711 // Modified 7/2009 by BM to incorporate data types
712 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']);
724 <span
class=required
><?php
echo xlt('Subscriber'); ?
>: </span
>
725 <input type
=entry
class='form-control' size
=10 name
=i
<?php
echo $i?
>subscriber_fname
726 value
="<?php echo attr($result3{"subscriber_fname
"}); ?>"
727 onchange
="capitalizeMe(this);" />
728 <input type
=entry
class='form-control' size
=3 name
=i
<?php
echo $i?
>subscriber_mname
729 value
="<?php echo attr($result3{"subscriber_mname
"}); ?>"
730 onchange
="capitalizeMe(this);" />
731 <input type
=entry
class='form-control' size
=10 name
=i
<?php
echo $i?
>subscriber_lname
732 value
="<?php echo attr($result3{"subscriber_lname
"}); ?>"
733 onchange
="capitalizeMe(this);" />
735 <span
class=required
><?php
echo xlt('Relationship'); ?
>: </span
>
737 // Modified 6/2009 by BM to use list_options and function
738 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_relationship'),'list_id'=>'sub_relation','empty_title'=>' '), $result3['subscriber_relationship']);
740 <a href
="javascript:popUp('../../interface/patient_file/summary/browse.php?browsenum=<?php echo $i?>')" class=text
>(<?php
echo xla('Browse'); ?
>)</a
><br
/>
742 <span
class=bold
><?php
echo xlt('D.O.B.'); ?
>: </span
>
743 <input type
='entry' size
='11' class='datepicker form-control' name
='i<?php echo $i?>subscriber_DOB'
744 id
='i<?php echo $i?>subscriber_DOB'
745 value
='<?php echo attr($result3['subscriber_DOB
']); ?>'
746 title
='yyyy-mm-dd' />
748 <span
class=bold
><?php
echo xlt('S.S.'); ?
>: </span
>
749 <input type
=entry
class='form-control' size
=11 name
=i
<?php
echo $i?
>subscriber_ss value
="<?php echo attr($result3{"subscriber_ss
"}); ?>"> 
;
750 <span
class=bold
><?php
echo xlt('Sex'); ?
>: </span
>
752 // Modified 6/2009 by BM to use list_options and function
753 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_sex'),'list_id'=>'sex'), $result3['subscriber_sex']);
756 <span
class=required
><?php
echo xlt('Subscriber Address'); ?
>: </span
>
757 <input type
=entry
class='form-control' size
=25 name
=i
<?php
echo $i?
>subscriber_street
758 value
="<?php echo attr($result3{"subscriber_street
"}); ?>"
759 onchange
="capitalizeMe(this);" /><br
>
760 <span
class=required
><?php
echo xlt('City'); ?
>: </span
>
761 <input type
=entry
class='form-control' size
=15 name
=i
<?php
echo $i?
>subscriber_city
762 value
="<?php echo attr($result3{"subscriber_city
"}); ?>"
763 onchange
="capitalizeMe(this);" />
764 <span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('State') : xlt('Locality') ?
>: </span
>
766 // Modified 7/2009 by BM to incorporate data types
767 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']);
770 <span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('Zip Code') : xlt('Postal Code') ?
>: </span
>
771 <input type
=entry
class='form-control' size
=10 name
=i
<?php
echo $i?
>subscriber_postal_code value
="<?php echo attr($result3{"subscriber_postal_code
"}); ?>">
772 <span
class='required'<?php
echo ($GLOBALS['omit_employers']) ?
" style='display:none'" : ""; ?
>>
773 <?php
echo xlt('Country'); ?
>: </span
>
775 // Modified 7/2009 by BM to incorporate data types
776 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']);
779 <span
class=bold
><?php
echo xlt('Subscriber Phone'); ?
>:
780 <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)' />
782 <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
"}); ?>">
784 <span
class='required'><?php
echo xlt('Accept Assignment'); ?
>: </span
>
785 <select
class='form-control' name
=i
<?php
echo $i?
>accept_assignment
>
786 <option value
="TRUE" <?php
echo (strtoupper($result3{"accept_assignment"}) == "TRUE") ?
"selected" : ""; ?
>><?php
echo xlt('YES'); ?
></option
>
787 <option value
="FALSE" <?php
echo (strtoupper($result3{"accept_assignment"}) == "FALSE") ?
"selected" : ""; ?
>><?php
echo xlt('NO'); ?
></option
>
798 } // end of "if not simplified_demographics"
801 <?php
if ($SHORT_FORM) {
806 <td align
='right' valign
='top' width
='1%' nowrap
>
807 <!-- Image upload stuff was here but got moved
. -->
814 <!-- include support
for the
list-add selectbox feature
-->
815 <?php
include($GLOBALS['fileroot']."/library/options_listadd.inc"); ?
>
819 <script language
="JavaScript">
821 // hard code validation for old validation, in the new validation possible to add match rules
822 <?php
if ($GLOBALS['new_validate'] == 0) { ?
>
824 // fix inconsistently formatted phone numbers from the database
825 var f
= document
.forms
[0];
826 if (f
.form_phone_contact
) phonekeyup(f
.form_phone_contact
,mypcc
);
827 if (f
.form_phone_home
) phonekeyup(f
.form_phone_home
,mypcc
);
828 if (f
.form_phone_biz
) phonekeyup(f
.form_phone_biz
,mypcc
);
829 if (f
.form_phone_cell
) phonekeyup(f
.form_phone_cell
,mypcc
);
833 <?php
echo $date_init; ?
>
835 // -=- jQuery makes life easier -=-
837 // var matches = 0; // number of patients that match the demographic information being entered
838 // var override = false; // flag that overrides the duplication warning
840 $
(document
).ready(function() {
841 $
(".medium_modal").on('click', function(e
) {
842 e
.preventDefault();e
.stopPropagation();
843 dlgopen('', '', 650, 460, '', '', {
845 {text
: '<?php echo xla('Close
'); ?>', close
: true, style
: 'default btn-sm'}
847 //onClosed: 'refreshme',
852 url
: $
(this
).attr('href')
855 // added to integrate insurance stuff
856 <?php
for ($i=1; $i<=3; $i++
) { ?
>
857 $
("#form_i<?php echo $i?>subscriber_relationship").change(function() { auto_populate_employer_address
<?php
echo $i?
>(); });
860 $
('#search').click(function() { searchme(); });
861 $
('#create').click(function() { check()});
863 var check
= function(e
) {
864 <?php
if ($GLOBALS['new_validate']) {?
>
865 var valid
= submitme(<?php
echo $GLOBALS['new_validate'] ?
1 : 0;?
>,e
,"DEM",constraints
);
867 top
.restoreSession();
868 var f
= document
.forms
[0];
869 var valid
= validate(f
);
873 // In this case dups were shown already and Save should just save.
874 top
.restoreSession();
880 // D in edit_options indicates the field is used in duplication checking.
881 // This constructs a list of the names of those fields.
883 $mfres = sqlStatement("SELECT * FROM layout_options " .
884 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' AND " .
885 "(edit_options LIKE '%D%' OR edit_options LIKE '%W%' )" .
886 "ORDER BY group_id, seq");
887 while ($mfrow = sqlFetchArray($mfres)) {
888 $field_id = $mfrow['field_id'];
889 if (strpos($field_id, 'em_') === 0) {
893 if (!empty($mflist)) {
897 $mflist .= "'" . htmlentities($field_id) . "'";
900 <?php
if (($GLOBALS['full_new_patient_form'] == '4') && (checkIfPatientValidationHookIsActive())) :?
>
901 // Use zend module patient validation hook to open the controller and send the dup-checker fields.
902 var url
='<?php echo $GLOBALS['web_root
']."/interface/modules/zend_modules/public/patientvalidation";?>';
904 // Build and invoke the URL to create the dup-checker dialog.
905 var url
= 'new_search_popup.php';
908 var flds
= new Array(<?php
echo $mflist; ?
>);
910 for (var i
= 0; i
< flds
.length
; ++i
) {
911 var fval
= $
('#form_' + flds
[i
]).val();
912 if (fval
&& fval
!= '') {
915 url +
= 'mf_' + flds
[i
] +
'=' +
encodeURIComponent(fval
);
919 dlgopen(url
, '_blank', 700, 500);
923 // Set onclick/onfocus handlers for toggling background color.
925 $lres = getLayoutRes();
926 while ($lrow = sqlFetchArray($lres)) {
927 $field_id = $lrow['field_id'];
928 if (strpos($field_id, 'em_') === 0) {
932 switch (getSearchClass($lrow['data_type'])) {
934 echo " \$('#form_$field_id').click(function() { toggleSearch(this); });\n";
937 echo " \$('#form_$field_id').click(function() { selClick(this); });\n";
938 echo " \$('#form_$field_id').blur(function() { selBlur(this); });\n";
944 $
('.datepicker').datetimepicker({
945 <?php
$datetimepicker_timepicker = false; ?
>
946 <?php
$datetimepicker_showseconds = false; ?
>
947 <?php
$datetimepicker_formatInput = true; ?
>
948 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
949 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
951 $
('.datetimepicker').datetimepicker({
952 <?php
$datetimepicker_timepicker = true; ?
>
953 <?php
$datetimepicker_showseconds = false; ?
>
954 <?php
$datetimepicker_formatInput = true; ?
>
955 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
956 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
959 }); // end document.ready
961 // callback for new patient save confirm from new_search_popup.php
962 // note that dlgclose() callbacks mostly need to init outside dom.
963 function srcConfirmSave() {
964 document
.forms
[0].submit();
968 <?php
/*Include the validation script and rules for this form*/
973 //LBF forms use the new validation depending on the global value
974 $use_validate_js=$GLOBALS['new_validate'];
975 include_once("$srcdir/validation/validation_script.js.php");?
>
976 <script language
='JavaScript'>
977 // Array of skip conditions for the checkSkipConditions() function.
979 <?php
echo $condition_str; ?
>
981 checkSkipConditions();
982 $
("input").change(function() {
983 checkSkipConditions();
985 $
("select").change(function() {
986 checkSkipConditions();