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-2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../globals.php");
16 require_once("$srcdir/acl.inc");
17 require_once("$srcdir/options.inc.php");
18 require_once("$srcdir/patient.inc");
19 require_once("$srcdir/erx_javascript.inc.php");
20 require_once("$srcdir/validation/LBF_Validation.php");
21 require_once("$srcdir/patientvalidation.inc.php");
23 use OpenEMR\Core\Header
;
25 // Check authorization.
26 if (!acl_check('patients', 'demo', '', array('write','addonly'))) {
27 die(xlt("Adding demographics is not authorized."));
30 $CPR = 4; // cells per row
32 $searchcolor = empty($GLOBALS['layout_search_color']) ?
33 '#ffff55' : $GLOBALS['layout_search_color'];
35 $WITH_SEARCH = ($GLOBALS['full_new_patient_form'] == '1' ||
$GLOBALS['full_new_patient_form'] == '2' );
36 $SHORT_FORM = ($GLOBALS['full_new_patient_form'] == '2' ||
$GLOBALS['full_new_patient_form'] == '3' ||
$GLOBALS['full_new_patient_form'] == '4');
39 getLayoutProperties('DEM', $grparr);
41 function getLayoutRes()
44 return sqlStatement("SELECT * FROM layout_options " .
45 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' " .
46 ($SHORT_FORM ?
"AND ( uor > 1 OR edit_options LIKE '%N%' ) " : "") .
47 "ORDER BY group_id, seq");
50 // Determine layout field search treatment from its data type:
55 function getSearchClass($data_type)
58 case 1: // single-selection list
59 case 10: // local provider list
60 case 11: // provider list
61 case 12: // pharmacy list
63 case 14: // address book list
64 case 26: // single-selection list with add
65 case 35: // facilities
76 $fres = getLayoutRes();
80 <?php Header
::setupHeader(['common','datetime-picker', 'jquery-ui']); ?
>
81 <title
><?php
echo xlt("Search or Add Patient"); ?
></title
>
85 padding
: 5pt
5pt
5pt
5pt
;
91 border
-color
: #0000ff;
103 <?php
include_once("{$GLOBALS['srcdir']}/options.js.php"); ?
>
105 <SCRIPT LANGUAGE
="JavaScript"><!--
106 //Visolve - sync the radio buttons - Start
107 if((top
.window
.parent
) && (parent
.window
)){
108 var wname
= top
.window
.parent
.left_nav
;
109 fname
= (parent
.window
.name
)?parent
.window
.name
:window
.name
;
111 }//Visolve - sync the radio buttons - End
113 var mypcc
= <?php
echo js_escape($GLOBALS['phone_country_code']); ?
>;
115 // This may be changed to true by the AJAX search script.
116 var force_submit
= false;
118 //code used from http://tech.irt.org/articles/js037/
119 function replace(string,text
,by
) {
120 // Replaces text with by in string
121 var strLength
= string.length
, txtLength
= text
.length
;
122 if ((strLength
== 0) ||
(txtLength
== 0)) return string;
124 var i
= string.indexOf(text
);
125 if ((!i
) && (text
!= string.substring(0,txtLength
))) return string;
126 if (i
== -1) return string;
128 var newstr
= string.substring(0,i
) + by
;
130 if (i+txtLength
< strLength
)
131 newstr +
= replace(string.substring(i+txtLength
,strLength
),text
,by
);
136 <?php
for ($i=1; $i<=3; $i++
) { ?
>
137 function auto_populate_employer_address
<?php
echo $i ?
>(){
138 var f
= document
.demographics_form
;
139 if (f
.form_i
<?php
echo $i?
>subscriber_relationship
.options
[f
.form_i
<?php
echo $i?
>subscriber_relationship
.selectedIndex
].value
== "self") {
140 f
.i
<?php
echo $i?
>subscriber_fname
.value
=f
.form_fname
.value
;
141 f
.i
<?php
echo $i?
>subscriber_mname
.value
=f
.form_mname
.value
;
142 f
.i
<?php
echo $i?
>subscriber_lname
.value
=f
.form_lname
.value
;
143 f
.i
<?php
echo $i?
>subscriber_street
.value
=f
.form_street
.value
;
144 f
.i
<?php
echo $i?
>subscriber_city
.value
=f
.form_city
.value
;
145 f
.form_i
<?php
echo $i?
>subscriber_state
.value
=f
.form_state
.value
;
146 f
.i
<?php
echo $i?
>subscriber_postal_code
.value
=f
.form_postal_code
.value
;
147 if (f
.form_country_code
)
148 f
.form_i
<?php
echo $i?
>subscriber_country
.value
=f
.form_country_code
.value
;
149 f
.i
<?php
echo $i?
>subscriber_phone
.value
=f
.form_phone_home
.value
;
150 f
.i
<?php
echo $i?
>subscriber_DOB
.value
=f
.form_DOB
.value
;
151 f
.i
<?php
echo $i?
>subscriber_ss
.value
=f
.form_ss
.value
;
152 f
.form_i
<?php
echo $i?
>subscriber_sex
.value
= f
.form_sex
.value
;
153 f
.i
<?php
echo $i?
>subscriber_employer
.value
=f
.form_em_name
.value
;
154 f
.i
<?php
echo $i?
>subscriber_employer_street
.value
=f
.form_em_street
.value
;
155 f
.i
<?php
echo $i?
>subscriber_employer_city
.value
=f
.form_em_city
.value
;
156 f
.form_i
<?php
echo $i?
>subscriber_employer_state
.value
=f
.form_em_state
.value
;
157 f
.i
<?php
echo $i?
>subscriber_employer_postal_code
.value
=f
.form_em_postal_code
.value
;
158 if (f
.form_em_country
)
159 f
.form_i
<?php
echo $i?
>subscriber_employer_country
.value
=f
.form_em_country
.value
;
165 function upperFirst(string,text
) {
166 return replace(string,text
,text
.charAt(0).toUpperCase() + text
.substring(1,text
.length
));
169 // The ins_search.php window calls this to set the selected insurance.
170 function set_insurance(ins_id
, ins_name
) {
171 var thesel
= document
.forms
[0]['i' + insurance_index +
'provider'];
172 var theopts
= thesel
.options
; // the array of Option objects
174 for (; i
< theopts
.length
; ++i
) {
175 if (theopts
[i
].value
== ins_id
) {
176 theopts
[i
].selected
= true;
180 // no matching option was found so create one, append it to the
181 // end of the list, and select it.
182 theopts
[i
] = new Option(ins_name
, ins_id
, false, true);
185 // Indicates which insurance slot is being updated.
186 var insurance_index
= 0;
188 // The OnClick handler for searching/adding the insurance company.
189 function ins_search(ins
) {
190 insurance_index
= ins
;
194 function checkNum () {
195 var re
= new RegExp();
197 str
=document
.forms
[0].monthly_income
.value
;
201 alert(<?php
echo xlj("Please enter a dollar amount using only numbers and a decimal point."); ?
>);
205 // This capitalizes the first letter of each word in the passed input
206 // element. It also strips out extraneous spaces.
207 function capitalizeMe(elem
) {
208 var a
= elem
.value
.split(' ');
210 for(var i
= 0; i
< a
.length
; ++i
) {
211 if (a
[i
].length
> 0) {
212 if (s
.length
> 0) s +
= ' ';
213 s +
= a
[i
].charAt(0).toUpperCase() + a
[i
].substring(1);
219 // Onkeyup handler for policy number. Allows only A-Z and 0-9.
220 function policykeyup(e
) {
221 var v
= e
.value
.toUpperCase();
222 var filteredString
="";
223 for (var i
= 0; i
< v
.length
; ++i
) {
225 if ((c
>= '0' && c
<= '9') ||
226 (c
>= 'A' && c
<= 'Z') ||
237 e
.value
= filteredString
;
241 function divclick(cb
, divid
) {
242 var divstyle
= document
.getElementById(divid
).style
;
244 divstyle
.display
= 'block';
246 divstyle
.display
= 'none';
251 // Compute the length of a string without leading and trailing spaces.
252 function trimlen(s
) {
254 var j
= s
.length
- 1;
255 for (; i
<= j
&& s
.charAt(i
) == ' '; ++i
);
256 for (; i
<= j
&& s
.charAt(j
) == ' '; --j
);
261 function validate(f
) {
262 var errMsgs
= new Array();
263 <?php
generate_layout_validation('DEM'); ?
>
264 <?php
if ($GLOBALS['erx_enable']) { ?
>
266 for(i
=0;i
<f
.length
;i++
){
267 if(f
[i
].type
=='text' && f
[i
].value
)
269 if(f
[i
].name
== 'form_fname' || f
[i
].name
== 'form_mname' || f
[i
].name
== 'form_lname')
271 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
272 alertMsg +
= checkUsername(f
[i
].name
,f
[i
].value
);
274 else if(f
[i
].name
== 'form_street' || f
[i
].name
== 'form_city')
276 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
277 alertMsg +
= checkAlphaNumericExtended(f
[i
].name
,f
[i
].value
);
279 else if(f
[i
].name
== 'form_phone_home')
281 alertMsg +
= checkPhone(f
[i
].name
,f
[i
].value
);
292 msg +
= <?php
echo xlj('The following fields are required'); ?
> +
":\n\n";
293 for ( var i
= 0; i
< errMsgs
.length
; i++
) {
294 msg +
= errMsgs
[i
] +
"\n";
296 msg +
= "\n" +
<?php
echo xlj('Please fill them in before continuing.'); ?
>;
299 //Misc Deceased Date Validation for Future Date
300 var dateVal
= document
.getElementById("form_deceased_date").value
;
303 month
= '' +
(d
.getMonth() +
1),
304 day
= '' + d
.getDate(),
305 year
= d
.getFullYear();
306 if (month
.length
< 2) month
= '0' + month
;
307 if (day
.length
< 2) day
= '0' + day
;
308 currentDate
= year+
'-'+month+
'-'+day
;
309 if(errMsgs
.length
> 0 || dateVal
> currentDate
)
311 if(errMsgs
.length
> 0)
313 if(dateVal
> currentDate
)
314 alert (<?php
echo xlj("Deceased Date should not be greater than Today"); ?
>);
320 function toggleSearch(elem
) {
321 var f
= document
.forms
[0];
322 <?php
if ($WITH_SEARCH) { ?
>
323 // Toggle background color.
324 if (elem
.style
.backgroundColor
== '')
325 elem
.style
.backgroundColor
= <?php
echo js_escape($searchcolor); ?
>;
327 elem
.style
.backgroundColor
= '';
330 force_submit
= false;
331 f
.create
.value
= <?php
echo xlj('Create New Patient'); ?
>;
336 // If a <select> list is dropped down, this is its name.
337 var open_sel_name
= '';
339 function selClick(elem
) {
340 if (open_sel_name
== elem
.name
) {
344 open_sel_name
= elem
.name
;
350 function selBlur(elem
) {
351 if (open_sel_name
== elem
.name
) {
357 // This invokes the patient search dialog.
358 function searchme() {
359 var f
= document
.forms
[0];
360 var url
= '../main/finder/patient_select.php?popup=1&csrf_token_form=<?php echo attr_url(collectCsrfToken()); ?>';
363 $lres = getLayoutRes();
365 while ($lrow = sqlFetchArray($lres)) {
366 $field_id = $lrow['field_id'];
367 if (strpos($field_id, 'em_') === 0) {
371 $data_type = $lrow['data_type'];
372 $fldname = "form_$field_id";
373 switch (getSearchClass($data_type)) {
376 " if (f." . attr($fldname) . ".style.backgroundColor != '' && trimlen(f." . attr($fldname) . ".value) > 0) {\n" .
377 " url += '&" . attr($field_id) . "=' + encodeURIComponent(f." . attr($fldname) . ".value);\n" .
382 " if (f." . attr($fldname) . ".style.backgroundColor != '' && f." . attr($fldname) . ".selectedIndex > 0) {\n" .
383 " url += '&" . attr($field_id) . "=' + encodeURIComponent(f." . attr($fldname) . ".options[f." . attr($fldname) . ".selectedIndex].value);\n" .
390 dlgopen(url
, '_blank', 700, 500);
392 function srchDone(pid
){
393 top
.restoreSession();
394 document
.location
.href
= "./../../patient_file/summary/demographics.php?set_pid=" +
encodeURIComponent(pid
);
401 <body
class="body_top">
404 /*Get the constraint from the DB-> LBF forms accordinf the form_id*/
405 $constraints = LBF_Validation
::generate_validate_constraints("DEM");
407 <script
> var constraints
= <?php
echo $constraints;?
>; </script
>
408 <div
class="container">
410 <div
class="col-xs-12">
411 <div
class="page-header">
412 <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'); ?
>
432 <div
class="col-sm-12">
433 <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)'>
434 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(collectCsrfToken()); ?>" />
435 <table width
='100%' cellpadding
='0' cellspacing
='8'>
437 <td align
='left' valign
='top'>
446 global $item_count, $cell_count;
447 if ($item_count > 0) {
455 global $cell_count, $CPR;
457 if ($cell_count > 0) {
458 for (; $cell_count < $CPR;
470 global $last_group, $SHORT_FORM;
471 if (strlen($last_group) > 0) {
483 $display_style = 'block';
484 $group_seq = 0; // this gives the DIV blocks unique IDs
488 while ($frow = sqlFetchArray($fres)) {
489 $this_group = $frow['group_id'];
490 $titlecols = $frow['titlecols'];
491 $datacols = $frow['datacols'];
492 $data_type = $frow['data_type'];
493 $field_id = $frow['field_id'];
494 $list_id = $frow['list_id'];
497 // Accumulate action conditions into a JSON expression for the browser side.
498 accumActionConditions($field_id, $condition_str, $frow['conditions']);
500 if (strpos($field_id, 'em_') === 0) {
501 $tmp = substr($field_id, 3);
502 if (isset($result2[$tmp])) {
503 $currvalue = $result2[$tmp];
506 if (isset($result[$field_id])) {
507 $currvalue = $result[$field_id];
511 // Handle a data category (group) change.
512 if (strcmp($this_group, $last_group) != 0) {
515 $group_seq++
; // ID for DIV tags
516 $group_name = $grparr[$this_group]['grp_title'];
518 if (strlen($last_group) > 0) {
522 echo "<span class='bold'><input type='checkbox' name='form_cb_" . attr($group_seq) . "' id='form_cb_" . attr($group_seq) . "' value='1' " .
523 "onclick='return divclick(this," . attr_js("div_" . $group_seq) . ");'";
524 if ($display_style == 'block') {
528 // Modified 6-09 by BM - Translate if applicable
529 echo " /><b>" . text(xl_layout_label($group_name)) . "</b></span>\n";
531 echo "<div id='div_" . attr($group_seq) . "' class='section' style='display:$display_style;'>\n";
532 echo " <table border='0' cellpadding='0'>\n";
533 $display_style = 'none';
534 } elseif (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='" . attr($titlecols) . "' id='" . attr($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 (text(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='" . attr($datacols) . "' class='text data'";
583 if ($cell_count > 0) {
584 echo " style='padding-left:5pt'". " id='" . attr($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 attr($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"})) {
632 echo ">" . text($iname) . "</option>\n";
635 </select
> 
;<a
class='medium_modal' href
='../practice/ins_search.php' onclick
='ins_search(<?php echo attr($i); ?>)'>
636 <span
> <?php
echo xlt('Search/Add Insurer'); ?
></span
></a
>
644 <span
class='required'><?php
echo xlt('Plan Name'); ?
>: </span
>
647 <input type
='entry' class='form-control' size
='20' name
='i<?php echo attr($i); ?>plan_name' value
="<?php echo attr($result3{"plan_name
"}); ?>"
648 onchange
="capitalizeMe(this);" /> 
; 
;
654 <span
class='required'><?php
echo xlt('Effective Date'); ?
>: </span
>
657 <input type
='entry' size
='11' class='datepicker form-control' name
='i<?php echo attr($i); ?>effective_date'
658 id
='i<?php echo attr($i); ?>effective_date'
659 value
='<?php echo attr($result3['date
']); ?>' />
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 attr($i); ?>policy_number' value
="<?php echo attr($result3{"policy_number
"}); ?>"
666 onkeyup
='policykeyup(this)'>
671 <td
><span
class=required
><?php
echo xlt('Group Number'); ?
>: </span
></td
>
672 <td
><input type
=entry
class='form-control' size
=16 name
='i<?php echo attr($i); ?>group_number' value
="<?php echo attr($result3{"group_number
"}); ?>" onkeyup
='policykeyup(this)'></td
>
675 <tr
<?php
echo ($GLOBALS['omit_employers']) ?
" style='display:none'" : ""; ?
>>
676 <td
class='required'><?php
echo xlt('Subscriber Employer (SE)'); ?
><br
><span style
='font-weight:normal'>
677 (<?php
echo xlt('if unemployed enter Student'); ?
>,<br
><?php
echo xlt('PT Student, or leave blank'); ?
>): </span
>
679 <td
><input type
=entry
class='form-control' size
=25 name
=i
<?php
echo attr($i); ?
>subscriber_employer
680 value
="<?php echo attr($result3{"subscriber_employer
"}); ?>"
681 onchange
="capitalizeMe(this);" />
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 attr($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 attr($i); ?
>subscriber_employer_city
698 value
="<?php echo attr($result3{"subscriber_employer_city
"}); ?>"
699 onchange
="capitalizeMe(this);" />
701 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('SE State') : xlt('SE Locality') ?
>: </span
></td
>
704 // Modified 7/2009 by BM to incorporate data types
705 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']);
710 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('SE Zip Code') : xlt('SE Postal Code') ?
>: </span
></td
>
711 <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
>
712 <td
><span
class=required
><?php
echo xlt('SE Country'); ?
>: </span
></td
>
715 // Modified 7/2009 by BM to incorporate data types
716 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 attr($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 attr($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 attr($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 attr_url($i); ?>')" class=text
>(<?php
echo xlt('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 attr($i); ?>subscriber_DOB'
747 id
='i<?php echo attr($i); ?>subscriber_DOB'
748 value
='<?php echo attr($result3['subscriber_DOB
']); ?>' />
750 <span
class=bold
><?php
echo xlt('S.S.'); ?
>: </span
>
751 <input type
=entry
class='form-control' size
=11 name
=i
<?php
echo attr($i); ?
>subscriber_ss value
="<?php echo attr($result3{"subscriber_ss
"}); ?>"> 
;
752 <span
class=bold
><?php
echo xlt('Sex'); ?
>: </span
>
754 // Modified 6/2009 by BM to use list_options and function
755 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_sex'),'list_id'=>'sex'), $result3['subscriber_sex']);
758 <span
class=required
><?php
echo xlt('Subscriber Address'); ?
>: </span
>
759 <input type
=entry
class='form-control' size
=25 name
=i
<?php
echo attr($i); ?
>subscriber_street
760 value
="<?php echo attr($result3{"subscriber_street
"}); ?>"
761 onchange
="capitalizeMe(this);" /><br
>
762 <span
class=required
><?php
echo xlt('City'); ?
>: </span
>
763 <input type
=entry
class='form-control' size
=15 name
=i
<?php
echo attr($i); ?
>subscriber_city
764 value
="<?php echo attr($result3{"subscriber_city
"}); ?>"
765 onchange
="capitalizeMe(this);" />
766 <span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('State') : xlt('Locality') ?
>: </span
>
768 // Modified 7/2009 by BM to incorporate data types
769 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']);
772 <span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('Zip Code') : xlt('Postal Code') ?
>: </span
>
773 <input type
=entry
class='form-control' size
=10 name
=i
<?php
echo attr($i); ?
>subscriber_postal_code value
="<?php echo attr($result3{"subscriber_postal_code
"}); ?>">
774 <span
class='required'<?php
echo ($GLOBALS['omit_employers']) ?
" style='display:none'" : ""; ?
>>
775 <?php
echo xlt('Country'); ?
>: </span
>
777 // Modified 7/2009 by BM to incorporate data types
778 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']);
781 <span
class=bold
><?php
echo xlt('Subscriber Phone'); ?
>:
782 <input type
='text' class='form-control' size
='20' name
='i<?php echo attr($i); ?>subscriber_phone' value
='<?php echo attr($result3["subscriber_phone"]); ?>' onkeyup
='phonekeyup(this,mypcc)' />
784 <span
class=bold
><?php
echo xlt('CoPay'); ?
>: <input type
=text
class='form-control' size
="6" name
=i
<?php
echo attr($i); ?
>copay value
="<?php echo attr($result3{"copay
"}); ?>">
786 <span
class='required'><?php
echo xlt('Accept Assignment'); ?
>: </span
>
787 <select
class='form-control' name
=i
<?php
echo attr($i); ?
>accept_assignment
>
788 <option value
="TRUE" <?php
echo (strtoupper($result3{"accept_assignment"}) == "TRUE") ?
"selected" : ""; ?
>><?php
echo xlt('YES'); ?
></option
>
789 <option value
="FALSE" <?php
echo (strtoupper($result3{"accept_assignment"}) == "FALSE") ?
"selected" : ""; ?
>><?php
echo xlt('NO'); ?
></option
>
799 } // end of "if not simplified_demographics"
808 <td align
='right' valign
='top' width
='1%' nowrap
>
809 <!-- Image upload stuff was here but got moved
. -->
816 </div
> <!--end of container div
-->
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
844 $
(".medium_modal").on('click', function(e
) {
845 e
.preventDefault();e
.stopPropagation();
846 dlgopen('', '', 650, 460, '', '', {
848 {text
: <?php
echo xlj('Close'); ?
>, close
: true, style
: 'default btn-sm'}
850 //onClosed: 'refreshme',
855 url
: $
(this
).attr('href')
858 // added to integrate insurance stuff
859 <?php
for ($i=1; $i<=3; $i++
) { ?
>
860 $
("#form_i<?php echo $i?>subscriber_relationship").change(function() { auto_populate_employer_address
<?php
echo $i?
>(); });
863 $
('#search').click(function() { searchme(); });
864 $
('#create').click(function() { check()});
866 var check
= function(e
) {
867 <?php
if ($GLOBALS['new_validate']) {?
>
868 var valid
= submitme(<?php
echo $GLOBALS['new_validate'] ?
1 : 0;?
>,e
,"DEM",constraints
);
870 top
.restoreSession();
871 var f
= document
.forms
[0];
872 var valid
= validate(f
);
876 // In this case dups were shown already and Save should just save.
877 top
.restoreSession();
883 // D in edit_options indicates the field is used in duplication checking.
884 // This constructs a list of the names of those fields.
886 $mfres = sqlStatement("SELECT * FROM layout_options " .
887 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' AND " .
888 "(edit_options LIKE '%D%' OR edit_options LIKE '%W%' )" .
889 "ORDER BY group_id, seq");
890 while ($mfrow = sqlFetchArray($mfres)) {
891 $field_id = $mfrow['field_id'];
892 if (strpos($field_id, 'em_') === 0) {
896 if (!empty($mflist)) {
900 $mflist .= js_escape($field_id);
903 <?php
if (($GLOBALS['full_new_patient_form'] == '4') && (checkIfPatientValidationHookIsActive())) :?
>
904 // Use zend module patient validation hook to open the controller and send the dup-checker fields.
905 var url
='<?php echo $GLOBALS['web_root
']."/interface/modules/zend_modules/public/patientvalidation"; ?>';
907 // Build and invoke the URL to create the dup-checker dialog.
908 var url
= 'new_search_popup.php';
911 var flds
= new Array(<?php
echo $mflist; ?
>);
913 for (var i
= 0; i
< flds
.length
; ++i
) {
914 var fval
= $
('#form_' + flds
[i
]).val();
915 if (fval
&& fval
!= '') {
918 url +
= 'mf_' + flds
[i
] +
'=' +
encodeURIComponent(fval
);
922 dlgopen(url
, '_blank', 700, 500);
926 // Set onclick/onfocus handlers for toggling background color.
928 $lres = getLayoutRes();
929 while ($lrow = sqlFetchArray($lres)) {
930 $field_id = $lrow['field_id'];
931 if (strpos($field_id, 'em_') === 0) {
935 switch (getSearchClass($lrow['data_type'])) {
937 echo " \$(" . js_escape("#form_".$field_id) . ").click(function() { toggleSearch(this); });\n";
940 echo " \$(" . js_escape("#form_".$field_id) . ").click(function() { selClick(this); });\n";
941 echo " \$(" . js_escape("#form_".$field_id) . ").blur(function() { selBlur(this); });\n";
947 $
('.datepicker').datetimepicker({
948 <?php
$datetimepicker_timepicker = false; ?
>
949 <?php
$datetimepicker_showseconds = false; ?
>
950 <?php
$datetimepicker_formatInput = true; ?
>
951 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
952 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
954 $
('.datetimepicker').datetimepicker({
955 <?php
$datetimepicker_timepicker = true; ?
>
956 <?php
$datetimepicker_showseconds = false; ?
>
957 <?php
$datetimepicker_formatInput = true; ?
>
958 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
959 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
962 }); // end document.ready
964 // callback for new patient save confirm from new_search_popup.php
965 // note that dlgclose() callbacks mostly need to init outside dom.
966 function srcConfirmSave() {
967 document
.forms
[0].submit();
971 <?php
/*Include the validation script and rules for this form*/
976 //LBF forms use the new validation depending on the global value
977 $use_validate_js=$GLOBALS['new_validate'];
978 include_once("$srcdir/validation/validation_script.js.php");?
>
979 <script language
='JavaScript'>
980 // Array of skip conditions for the checkSkipConditions() function.
982 <?php
echo $condition_str; ?
>
984 checkSkipConditions();
985 $
("input").change(function() {
986 checkSkipConditions();
988 $
("select").change(function() {
989 checkSkipConditions();