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 // 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');
36 getLayoutProperties('DEM', $grparr);
38 function getLayoutRes()
41 return sqlStatement("SELECT * FROM layout_options " .
42 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' " .
43 ($SHORT_FORM ?
"AND ( uor > 1 OR edit_options LIKE '%N%' ) " : "") .
44 "ORDER BY group_id, seq");
47 // Determine layout field search treatment from its data type:
52 function getSearchClass($data_type)
55 case 1: // single-selection list
56 case 10: // local provider list
57 case 11: // provider list
58 case 12: // pharmacy list
60 case 14: // address book list
61 case 26: // single-selection list with add
62 case 35: // facilities
73 $fres = getLayoutRes();
77 <?php
html_header_show(); ?
>
79 <title
><?php
echo xlt("Search or Add Patient"); ?
></title
>
81 <link rel
="stylesheet" href
="<?php echo $GLOBALS['assets_static_relative'] ?>/bootstrap-3-3-4/dist/css/bootstrap.min.css">
82 <?php
if ($_SESSION['language_direction'] == 'rtl') { ?
>
83 <link rel
="stylesheet" href
="<?php echo $GLOBALS['assets_static_relative'] ?>/bootstrap-rtl-3-3-4/dist/css/bootstrap-rtl.min.css">
85 <link rel
="stylesheet" href
="<?php echo $css_header; ?>" type
="text/css">
86 <link rel
="stylesheet" href
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.min.css">
87 <link rel
="stylesheet" type
="text/css" href
="../../library/js/fancybox/jquery.fancybox-1.2.6.css" media
="screen" />
91 padding
: 5pt
5pt
5pt
5pt
;
97 border
-color
: #0000ff;
109 <script type
="text/javascript" src
="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
110 <script type
="text/javascript" src
="../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script
>
111 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-7-2/index.js"></script
>
112 <script type
="text/javascript" src
="../../library/js/common.js?v=<?php echo $v_js_includes; ?>"></script
>
113 <script type
="text/javascript" src
="../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script
>
114 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.full.min.js"></script
>
116 <?php
include_once("{$GLOBALS['srcdir']}/options.js.php"); ?
>
118 <SCRIPT LANGUAGE
="JavaScript"><!--
119 //Visolve - sync the radio buttons - Start
120 if((top
.window
.parent
) && (parent
.window
)){
121 var wname
= top
.window
.parent
.left_nav
;
122 fname
= (parent
.window
.name
)?parent
.window
.name
:window
.name
;
124 }//Visolve - sync the radio buttons - End
126 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
128 // This may be changed to true by the AJAX search script.
129 var force_submit
= false;
131 //code used from http://tech.irt.org/articles/js037/
132 function replace(string,text
,by
) {
133 // Replaces text with by in string
134 var strLength
= string.length
, txtLength
= text
.length
;
135 if ((strLength
== 0) ||
(txtLength
== 0)) return string;
137 var i
= string.indexOf(text
);
138 if ((!i
) && (text
!= string.substring(0,txtLength
))) return string;
139 if (i
== -1) return string;
141 var newstr
= string.substring(0,i
) + by
;
143 if (i+txtLength
< strLength
)
144 newstr +
= replace(string.substring(i+txtLength
,strLength
),text
,by
);
149 <?php
for ($i=1; $i<=3; $i++
) { ?
>
150 function auto_populate_employer_address
<?php
echo $i ?
>(){
151 var f
= document
.demographics_form
;
152 if (f
.form_i
<?php
echo $i?
>subscriber_relationship
.options
[f
.form_i
<?php
echo $i?
>subscriber_relationship
.selectedIndex
].value
== "self") {
153 f
.i
<?php
echo $i?
>subscriber_fname
.value
=f
.form_fname
.value
;
154 f
.i
<?php
echo $i?
>subscriber_mname
.value
=f
.form_mname
.value
;
155 f
.i
<?php
echo $i?
>subscriber_lname
.value
=f
.form_lname
.value
;
156 f
.i
<?php
echo $i?
>subscriber_street
.value
=f
.form_street
.value
;
157 f
.i
<?php
echo $i?
>subscriber_city
.value
=f
.form_city
.value
;
158 f
.form_i
<?php
echo $i?
>subscriber_state
.value
=f
.form_state
.value
;
159 f
.i
<?php
echo $i?
>subscriber_postal_code
.value
=f
.form_postal_code
.value
;
160 if (f
.form_country_code
)
161 f
.form_i
<?php
echo $i?
>subscriber_country
.value
=f
.form_country_code
.value
;
162 f
.i
<?php
echo $i?
>subscriber_phone
.value
=f
.form_phone_home
.value
;
163 f
.i
<?php
echo $i?
>subscriber_DOB
.value
=f
.form_DOB
.value
;
164 f
.i
<?php
echo $i?
>subscriber_ss
.value
=f
.form_ss
.value
;
165 f
.form_i
<?php
echo $i?
>subscriber_sex
.value
= f
.form_sex
.value
;
166 f
.i
<?php
echo $i?
>subscriber_employer
.value
=f
.form_em_name
.value
;
167 f
.i
<?php
echo $i?
>subscriber_employer_street
.value
=f
.form_em_street
.value
;
168 f
.i
<?php
echo $i?
>subscriber_employer_city
.value
=f
.form_em_city
.value
;
169 f
.form_i
<?php
echo $i?
>subscriber_employer_state
.value
=f
.form_em_state
.value
;
170 f
.i
<?php
echo $i?
>subscriber_employer_postal_code
.value
=f
.form_em_postal_code
.value
;
171 if (f
.form_em_country
)
172 f
.form_i
<?php
echo $i?
>subscriber_employer_country
.value
=f
.form_em_country
.value
;
178 function upperFirst(string,text
) {
179 return replace(string,text
,text
.charAt(0).toUpperCase() + text
.substring(1,text
.length
));
182 // The ins_search.php window calls this to set the selected insurance.
183 function set_insurance(ins_id
, ins_name
) {
184 var thesel
= document
.forms
[0]['i' + insurance_index +
'provider'];
185 var theopts
= thesel
.options
; // the array of Option objects
187 for (; i
< theopts
.length
; ++i
) {
188 if (theopts
[i
].value
== ins_id
) {
189 theopts
[i
].selected
= true;
193 // no matching option was found so create one, append it to the
194 // end of the list, and select it.
195 theopts
[i
] = new Option(ins_name
, ins_id
, false, true);
198 // Indicates which insurance slot is being updated.
199 var insurance_index
= 0;
201 // The OnClick handler for searching/adding the insurance company.
202 function ins_search(ins
) {
203 insurance_index
= ins
;
207 function checkNum () {
208 var re
= new RegExp();
210 str
=document
.forms
[0].monthly_income
.value
;
214 alert("<?php echo xls("Please enter a dollar amount using only numbers
and a decimal point
."); ?>");
218 // This capitalizes the first letter of each word in the passed input
219 // element. It also strips out extraneous spaces.
220 function capitalizeMe(elem
) {
221 var a
= elem
.value
.split(' ');
223 for(var i
= 0; i
< a
.length
; ++i
) {
224 if (a
[i
].length
> 0) {
225 if (s
.length
> 0) s +
= ' ';
226 s +
= a
[i
].charAt(0).toUpperCase() + a
[i
].substring(1);
232 // Onkeyup handler for policy number. Allows only A-Z and 0-9.
233 function policykeyup(e
) {
234 var v
= e
.value
.toUpperCase();
235 var filteredString
="";
236 for (var i
= 0; i
< v
.length
; ++i
) {
238 if ((c
>= '0' && c
<= '9') ||
239 (c
>= 'A' && c
<= 'Z') ||
250 e
.value
= filteredString
;
254 function divclick(cb
, divid
) {
255 var divstyle
= document
.getElementById(divid
).style
;
257 divstyle
.display
= 'block';
259 divstyle
.display
= 'none';
264 // Compute the length of a string without leading and trailing spaces.
265 function trimlen(s
) {
267 var j
= s
.length
- 1;
268 for (; i
<= j
&& s
.charAt(i
) == ' '; ++i
);
269 for (; i
<= j
&& s
.charAt(j
) == ' '; --j
);
274 function validate(f
) {
275 var errMsgs
= new Array();
276 <?php
generate_layout_validation('DEM'); ?
>
277 <?php
if ($GLOBALS['erx_enable']) { ?
>
279 for(i
=0;i
<f
.length
;i++
){
280 if(f
[i
].type
=='text' && f
[i
].value
)
282 if(f
[i
].name
== 'form_fname' || f
[i
].name
== 'form_mname' || f
[i
].name
== 'form_lname')
284 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
285 alertMsg +
= checkUsername(f
[i
].name
,f
[i
].value
);
287 else if(f
[i
].name
== 'form_street' || f
[i
].name
== 'form_city')
289 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
290 alertMsg +
= checkAlphaNumericExtended(f
[i
].name
,f
[i
].value
);
292 else if(f
[i
].name
== 'form_phone_home')
294 alertMsg +
= checkPhone(f
[i
].name
,f
[i
].value
);
305 msg +
= "<?php echo xla('The following fields are required'); ?>:\n\n";
306 for ( var i
= 0; i
< errMsgs
.length
; i++
) {
307 msg +
= errMsgs
[i
] +
"\n";
309 msg +
= "\n<?php echo xla('Please fill them in before continuing.'); ?>";
312 //Misc Deceased Date Validation for Future Date
313 var dateVal
= document
.getElementById("form_deceased_date").value
;
316 month
= '' +
(d
.getMonth() +
1),
317 day
= '' + d
.getDate(),
318 year
= d
.getFullYear();
319 if (month
.length
< 2) month
= '0' + month
;
320 if (day
.length
< 2) day
= '0' + day
;
321 currentDate
= year+
'-'+month+
'-'+day
;
322 if(errMsgs
.length
> 0 || dateVal
> currentDate
)
324 if(errMsgs
.length
> 0)
326 if(dateVal
> currentDate
)
327 alert ('<?php echo xls("Deceased Date should not be greater than Today"); ?>');
333 function toggleSearch(elem
) {
334 var f
= document
.forms
[0];
335 <?php
if ($WITH_SEARCH) { ?
>
336 // Toggle background color.
337 if (elem
.style
.backgroundColor
== '')
338 elem
.style
.backgroundColor
= '<?php echo $searchcolor; ?>';
340 elem
.style
.backgroundColor
= '';
343 force_submit
= false;
344 f
.create
.value
= '<?php echo xla('Create
New Patient
'); ?>';
349 // If a <select> list is dropped down, this is its name.
350 var open_sel_name
= '';
352 function selClick(elem
) {
353 if (open_sel_name
== elem
.name
) {
357 open_sel_name
= elem
.name
;
363 function selBlur(elem
) {
364 if (open_sel_name
== elem
.name
) {
370 // This invokes the patient search dialog.
371 function searchme() {
372 var f
= document
.forms
[0];
373 var url
= '../main/finder/patient_select.php?popup=1';
376 $lres = getLayoutRes();
378 while ($lrow = sqlFetchArray($lres)) {
379 $field_id = $lrow['field_id'];
380 if (strpos($field_id, 'em_') === 0) {
384 $data_type = $lrow['data_type'];
385 $fldname = "form_$field_id";
386 switch (getSearchClass($data_type)) {
389 " if (f.$fldname.style.backgroundColor != '' && trimlen(f.$fldname.value) > 0) {\n" .
390 " url += '&$field_id=' + encodeURIComponent(f.$fldname.value);\n" .
395 " if (f.$fldname.style.backgroundColor != '' && f.$fldname.selectedIndex > 0) {\n" .
396 " url += '&$field_id=' + encodeURIComponent(f.$fldname.options[f.$fldname.selectedIndex].value);\n" .
403 dlgopen(url
, '_blank', 700, 500);
411 <body
class="body_top">
414 /*Get the constraint from the DB-> LBF forms accordinf the form_id*/
415 $constraints = LBF_Validation
::generate_validate_constraints("DEM");
417 <script
> var constraints
= <?php
echo $constraints;?
>; </script
>
419 <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)'>
421 <div
class="container-fluid">
423 <div
class="col-xs-12">
424 <div
class="page-header">
425 <h2
><?php
echo xlt('Search or Add Patient');?
></h2
>
428 <div
class="col-xs-12">
429 <div
class="btn-group">
430 <?php
if ($WITH_SEARCH) { ?
>
431 <button type
="button" class="btn btn-default btn-search" id
="search" value
="<?php echo xla('Search'); ?>">
432 <?php
echo xlt('Search'); ?
>
435 <button type
="button" class="btn btn-default btn-save" name
='create' id
="create" value
="<?php echo xla('Create New Patient'); ?>">
436 <?php
echo xlt('Create New Patient'); ?
>
444 <table width
='100%' cellpadding
='0' cellspacing
='8'>
446 <td align
='left' valign
='top'>
447 <?php
if ($SHORT_FORM) {
454 global $item_count, $cell_count;
455 if ($item_count > 0) {
463 global $cell_count, $CPR;
465 if ($cell_count > 0) {
466 for (; $cell_count < $CPR;
478 global $last_group, $SHORT_FORM;
479 if (strlen($last_group) > 0) {
491 $display_style = 'block';
492 $group_seq = 0; // this gives the DIV blocks unique IDs
496 while ($frow = sqlFetchArray($fres)) {
497 $this_group = $frow['group_id'];
498 $titlecols = $frow['titlecols'];
499 $datacols = $frow['datacols'];
500 $data_type = $frow['data_type'];
501 $field_id = $frow['field_id'];
502 $list_id = $frow['list_id'];
505 // Accumulate action conditions into a JSON expression for the browser side.
506 accumActionConditions($field_id, $condition_str, $frow['conditions']);
508 if (strpos($field_id, 'em_') === 0) {
509 $tmp = substr($field_id, 3);
510 if (isset($result2[$tmp])) {
511 $currvalue = $result2[$tmp];
514 if (isset($result[$field_id])) {
515 $currvalue = $result[$field_id];
519 // Handle a data category (group) change.
520 if (strcmp($this_group, $last_group) != 0) {
523 $group_seq++
; // ID for DIV tags
524 $group_name = $grparr[$this_group]['grp_title'];
526 if (strlen($last_group) > 0) {
530 echo "<span class='bold'><input type='checkbox' name='form_cb_$group_seq' id='form_cb_$group_seq' value='1' " .
531 "onclick='return divclick(this,\"div_$group_seq\");'";
532 if ($display_style == 'block') {
536 // Modified 6-09 by BM - Translate if applicable
537 echo " /><b>" . xl_layout_label($group_name) . "</b></span>\n";
539 echo "<div id='div_$group_seq' class='section' style='display:$display_style;'>\n";
540 echo " <table border='0' cellpadding='0'>\n";
541 $display_style = 'none';
542 } else if (strlen($last_group) == 0) {
543 echo " <table border='0' cellpadding='0'>\n";
546 $last_group = $this_group;
549 // Handle starting of a new row.
550 if (($titlecols > 0 && $cell_count >= $CPR) ||
$cell_count == 0) {
555 if ($item_count == 0 && $titlecols == 0) {
559 $field_id_label='label_'.$frow['field_id'];
560 // Handle starting of a new label cell.
561 if ($titlecols > 0) {
563 echo "<td colspan='$titlecols' id='$field_id_label'";
564 echo ($frow['uor'] == 2) ?
" class='required'" : " class='bold'";
565 if ($cell_count == 2) {
566 echo " style='padding-left:10pt'";
570 $cell_count +
= $titlecols;
577 // Modified 6-09 by BM - Translate if applicable
578 if ($frow['title']) {
579 echo (xl_layout_label($frow['title']).":");
586 // Handle starting of a new data cell.
588 $id_field_text = "text_".$frow['field_id'];
590 echo "<td colspan='$datacols' class='text data'";
591 if ($cell_count > 0) {
592 echo " style='padding-left:5pt'". " id='".$id_field_text."'";
596 $cell_count +
= $datacols;
600 generate_form_field($frow, $currvalue);
607 if (! $GLOBALS['simplified_demographics']) {
608 $insurancei = getInsuranceProviders();
610 $insurance_headings = array(xl("Primary Insurance Provider"), xl("Secondary Insurance Provider"), xl("Tertiary Insurance provider"));
611 $insurance_info = array();
612 $insurance_info[1] = getInsuranceData($pid, "primary");
613 $insurance_info[2] = getInsuranceData($pid, "secondary");
614 $insurance_info[3] = getInsuranceData($pid, "tertiary");
616 echo "<br /><span class='bold'><input type='checkbox' name='form_cb_ins' value='1' " .
617 "onclick='return divclick(this,\"div_ins\");'";
618 if ($display_style == 'block') {
622 echo " /><b>" . xlt('Insurance') . "</b></span>\n";
623 echo "<div id='div_ins' class='section' style='display:$display_style;'>\n";
625 for ($i=1; $i<=3; $i++
) {
626 $result3 = $insurance_info[$i];
630 <td valign
='top' colspan
='2'>
631 <span
class='required'><?php
echo text($insurance_headings[$i -1]).":"?
></span
>
632 <select name
="i<?php echo $i?>provider" class="form-control">
633 <option value
=""><?php
echo xlt('Unassigned'); ?
></option
>
635 foreach ($insurancei as $iid => $iname) {
636 echo "<option value='" . attr($iid) . "'";
637 if (strtolower($iid) == strtolower($result3{"provider"})) {
641 echo ">" . text($iname) . "</option>\n";
644 </select
> 
;<a
class='iframe medium_modal' href
='../practice/ins_search.php' onclick
='ins_search(<?php echo $i?>)'>
645 <span
> <?php
echo xlt('Search/Add Insurer'); ?
></span
></a
>
654 <span
class='required'><?php
echo xlt('Plan Name'); ?
>: </span
>
657 <input type
='entry' class='form-control' size
='20' name
='i<?php echo $i?>plan_name' value
="<?php echo attr($result3{"plan_name
"}); ?>"
658 onchange
="capitalizeMe(this);" /> 
; 
;
664 <span
class='required'><?php
echo xlt('Effective Date'); ?
>: </span
>
667 <input type
='entry' size
='11' class='datepicker form-control' name
='i<?php echo $i ?>effective_date'
668 id
='i<?php echo $i ?>effective_date'
669 value
='<?php echo attr($result3['date
']); ?>'
670 title
='yyyy-mm-dd' />
675 <td
><span
class=required
><?php
echo xlt('Policy Number'); ?
>: </span
></td
>
676 <td
><input type
='entry' class='form-control' size
='16' name
='i<?php echo $i?>policy_number' value
="<?php echo attr($result3{"policy_number
"}); ?>"
677 onkeyup
='policykeyup(this)'></td
>
681 <td
><span
class=required
><?php
echo xlt('Group Number'); ?
>: </span
></td
>
682 <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
>
685 <tr
<?php
echo ($GLOBALS['omit_employers']) ?
" style='display:none'" : ""; ?
>>
686 <td
class='required'><?php
echo xlt('Subscriber Employer (SE)'); ?
><br
><span style
='font-weight:normal'>
687 (<?php
echo xlt('if unemployed enter Student'); ?
>,<br
><?php
echo xlt('PT Student, or leave blank'); ?
>): </span
></td
>
688 <td
><input type
=entry
class='form-control' size
=25 name
=i
<?php
echo $i?
>subscriber_employer
689 value
="<?php echo attr($result3{"subscriber_employer
"}); ?>"
690 onchange
="capitalizeMe(this);" /></td
>
693 <tr
<?php
echo ($GLOBALS['omit_employers']) ?
" style='display:none'" : ""; ?
>>
694 <td
><span
class=required
><?php
echo xlt('SE Address'); ?
>: </span
></td
>
695 <td
><input type
=entry
class='form-control' size
=25 name
=i
<?php
echo $i?
>subscriber_employer_street
696 value
="<?php echo attr($result3{"subscriber_employer_street
"}); ?>"
697 onchange
="capitalizeMe(this);" /></td
>
700 <tr
<?php
echo ($GLOBALS['omit_employers']) ?
" style='display:none'" : ""; ?
>>
704 <td
><span
class=required
><?php
echo xlt('SE City'); ?
>: </span
></td
>
705 <td
><input type
=entry
class='form-control' size
=15 name
=i
<?php
echo $i?
>subscriber_employer_city
706 value
="<?php echo attr($result3{"subscriber_employer_city
"}); ?>"
707 onchange
="capitalizeMe(this);" /></td
>
708 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('SE State') : xlt('SE Locality') ?
>: </span
></td
>
711 // Modified 7/2009 by BM to incorporate data types
712 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']);
717 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('SE Zip Code') : xlt('SE Postal Code') ?
>: </span
></td
>
718 <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
>
719 <td
><span
class=required
><?php
xl('SE Country', 'e'); ?
>: </span
></td
>
722 // Modified 7/2009 by BM to incorporate data types
723 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']);
735 <span
class=required
><?php
echo xlt('Subscriber'); ?
>: </span
>
736 <input type
=entry
class='form-control' size
=10 name
=i
<?php
echo $i?
>subscriber_fname
737 value
="<?php echo attr($result3{"subscriber_fname
"}); ?>"
738 onchange
="capitalizeMe(this);" />
739 <input type
=entry
class='form-control' size
=3 name
=i
<?php
echo $i?
>subscriber_mname
740 value
="<?php echo attr($result3{"subscriber_mname
"}); ?>"
741 onchange
="capitalizeMe(this);" />
742 <input type
=entry
class='form-control' size
=10 name
=i
<?php
echo $i?
>subscriber_lname
743 value
="<?php echo attr($result3{"subscriber_lname
"}); ?>"
744 onchange
="capitalizeMe(this);" />
746 <span
class=required
><?php
echo xlt('Relationship'); ?
>: </span
>
748 // Modified 6/2009 by BM to use list_options and function
749 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_relationship'),'list_id'=>'sub_relation','empty_title'=>' '), $result3['subscriber_relationship']);
751 <a href
="javascript:popUp('../../interface/patient_file/summary/browse.php?browsenum=<?php echo $i?>')" class=text
>(<?php
echo xla('Browse'); ?
>)</a
><br
/>
753 <span
class=bold
><?php
echo xlt('D.O.B.'); ?
>: </span
>
754 <input type
='entry' size
='11' class='datepicker form-control' name
='i<?php echo $i?>subscriber_DOB'
755 id
='i<?php echo $i?>subscriber_DOB'
756 value
='<?php echo attr($result3['subscriber_DOB
']); ?>'
757 title
='yyyy-mm-dd' />
759 <span
class=bold
><?php
echo xlt('S.S.'); ?
>: </span
>
760 <input type
=entry
class='form-control' size
=11 name
=i
<?php
echo $i?
>subscriber_ss value
="<?php echo attr($result3{"subscriber_ss
"}); ?>"> 
;
761 <span
class=bold
><?php
echo xlt('Sex'); ?
>: </span
>
763 // Modified 6/2009 by BM to use list_options and function
764 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_sex'),'list_id'=>'sex'), $result3['subscriber_sex']);
767 <span
class=required
><?php
echo xlt('Subscriber Address'); ?
>: </span
>
768 <input type
=entry
class='form-control' size
=25 name
=i
<?php
echo $i?
>subscriber_street
769 value
="<?php echo attr($result3{"subscriber_street
"}); ?>"
770 onchange
="capitalizeMe(this);" /><br
>
771 <span
class=required
><?php
echo xlt('City'); ?
>: </span
>
772 <input type
=entry
class='form-control' size
=15 name
=i
<?php
echo $i?
>subscriber_city
773 value
="<?php echo attr($result3{"subscriber_city
"}); ?>"
774 onchange
="capitalizeMe(this);" />
775 <span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('State') : xlt('Locality') ?
>: </span
>
777 // Modified 7/2009 by BM to incorporate data types
778 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']);
781 <span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('Zip Code') : xlt('Postal Code') ?
>: </span
>
782 <input type
=entry
class='form-control' size
=10 name
=i
<?php
echo $i?
>subscriber_postal_code value
="<?php echo attr($result3{"subscriber_postal_code
"}); ?>">
783 <span
class='required'<?php
echo ($GLOBALS['omit_employers']) ?
" style='display:none'" : ""; ?
>>
784 <?php
echo xlt('Country'); ?
>: </span
>
786 // Modified 7/2009 by BM to incorporate data types
787 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']);
790 <span
class=bold
><?php
echo xlt('Subscriber Phone'); ?
>:
791 <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)' />
793 <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
"}); ?>">
795 <span
class='required'><?php
echo xlt('Accept Assignment'); ?
>: </span
>
796 <select
class='form-control' name
=i
<?php
echo $i?
>accept_assignment
>
797 <option value
="TRUE" <?php
echo (strtoupper($result3{"accept_assignment"}) == "TRUE") ?
"selected" : ""; ?
>><?php
echo xlt('YES'); ?
></option
>
798 <option value
="FALSE" <?php
echo (strtoupper($result3{"accept_assignment"}) == "FALSE") ?
"selected" : ""; ?
>><?php
echo xlt('NO'); ?
></option
>
809 } // end of "if not simplified_demographics"
812 <?php
if ($SHORT_FORM) {
817 <td align
='right' valign
='top' width
='1%' nowrap
>
818 <!-- Image upload stuff was here but got moved
. -->
825 <!-- include support
for the
list-add selectbox feature
-->
826 <?php
include($GLOBALS['fileroot']."/library/options_listadd.inc"); ?
>
830 <script language
="JavaScript">
832 // hard code validation for old validation, in the new validation possible to add match rules
833 <?php
if ($GLOBALS['new_validate'] == 0) { ?
>
835 // fix inconsistently formatted phone numbers from the database
836 var f
= document
.forms
[0];
837 if (f
.form_phone_contact
) phonekeyup(f
.form_phone_contact
,mypcc
);
838 if (f
.form_phone_home
) phonekeyup(f
.form_phone_home
,mypcc
);
839 if (f
.form_phone_biz
) phonekeyup(f
.form_phone_biz
,mypcc
);
840 if (f
.form_phone_cell
) phonekeyup(f
.form_phone_cell
,mypcc
);
844 <?php
echo $date_init; ?
>
846 // -=- jQuery makes life easier -=-
848 // var matches = 0; // number of patients that match the demographic information being entered
849 // var override = false; // flag that overrides the duplication warning
851 $
(document
).ready(function() {
853 $
(".medium_modal").fancybox( {
854 'overlayOpacity' : 0.0,
855 'showCloseButton' : true,
859 // added to integrate insurance stuff
860 <?php
for ($i=1; $i<=3; $i++
) { ?
>
861 $
("#form_i<?php echo $i?>subscriber_relationship").change(function() { auto_populate_employer_address
<?php
echo $i?
>(); });
864 $
('#search').click(function() { searchme(); });
865 $
('#create').click(function() { check()});
867 var check
= function(e
) {
868 <?php
if ($GLOBALS['new_validate']) {?
>
869 var valid
= submitme(<?php
echo $GLOBALS['new_validate'] ?
1 : 0;?
>,e
,"DEM",constraints
);
871 top
.restoreSession();
872 var f
= document
.forms
[0];
873 var valid
= validate(f
);
877 // In this case dups were shown already and Save should just save.
878 top
.restoreSession();
884 // D in edit_options indicates the field is used in duplication checking.
885 // This constructs a list of the names of those fields.
887 $mfres = sqlStatement("SELECT * FROM layout_options " .
888 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' AND " .
889 "(edit_options LIKE '%D%' OR edit_options LIKE '%W%' )" .
890 "ORDER BY group_id, seq");
891 while ($mfrow = sqlFetchArray($mfres)) {
892 $field_id = $mfrow['field_id'];
893 if (strpos($field_id, 'em_') === 0) {
897 if (!empty($mflist)) {
901 $mflist .= "'" . htmlentities($field_id) . "'";
904 <?php
if (($GLOBALS['full_new_patient_form'] == '4') && (checkIfPatientValidationHookIsActive())) :?
>
905 // Use zend module patient validation hook to open the controller and send the dup-checker fields.
906 var url
='<?php echo $GLOBALS['web_root
']."/interface/modules/zend_modules/public/patientvalidation";?>';
908 // Build and invoke the URL to create the dup-checker dialog.
909 var url
= 'new_search_popup.php';
912 var flds
= new Array(<?php
echo $mflist; ?
>);
914 for (var i
= 0; i
< flds
.length
; ++i
) {
915 var fval
= $
('#form_' + flds
[i
]).val();
916 if (fval
&& fval
!= '') {
919 url +
= 'mf_' + flds
[i
] +
'=' +
encodeURIComponent(fval
);
923 dlgopen(url
, '_blank', 700, 500);
928 // Set onclick/onfocus handlers for toggling background color.
930 $lres = getLayoutRes();
931 while ($lrow = sqlFetchArray($lres)) {
932 $field_id = $lrow['field_id'];
933 if (strpos($field_id, 'em_') === 0) {
937 switch (getSearchClass($lrow['data_type'])) {
939 echo " \$('#form_$field_id').click(function() { toggleSearch(this); });\n";
942 echo " \$('#form_$field_id').click(function() { selClick(this); });\n";
943 echo " \$('#form_$field_id').blur(function() { selBlur(this); });\n";
949 $
('.datepicker').datetimepicker({
950 <?php
$datetimepicker_timepicker = false; ?
>
951 <?php
$datetimepicker_showseconds = false; ?
>
952 <?php
$datetimepicker_formatInput = false; ?
>
953 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
954 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
956 $
('.datetimepicker').datetimepicker({
957 <?php
$datetimepicker_timepicker = true; ?
>
958 <?php
$datetimepicker_showseconds = false; ?
>
959 <?php
$datetimepicker_formatInput = false; ?
>
960 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
961 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
964 }); // end document.ready
967 <?php
/*Include the validation script and rules for this form*/
972 //LBF forms use the new validation depending on the global value
973 $use_validate_js=$GLOBALS['new_validate'];
974 include_once("$srcdir/validation/validation_script.js.php");?
>
975 <script language
='JavaScript'>
976 // Array of skip conditions for the checkSkipConditions() function.
978 <?php
echo $condition_str; ?
>
980 checkSkipConditions();
981 $
("input").change(function() {
982 checkSkipConditions();
984 $
("select").change(function() {
985 checkSkipConditions();