4 * New patient or search patient.
7 * @link http://www.open-emr.org
8 * @author Rod Roark <rod@sunsetsystems.com>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @author Tyler Wrenn <tyler@tylerwrenn.com>
11 * @copyright Copyright (c) 2009-2021 Rod Roark <rod@sunsetsystems.com>
12 * @copyright Copyright (c) 2017-2019 Brady Miller <brady.g.miller@gmail.com>
13 * @copyright Copyright (c) 2020 Tyler Wrenn <tyler@tylerwrenn.com>
14 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
17 require_once("../globals.php");
18 require_once("$srcdir/options.inc.php");
19 require_once("$srcdir/patient.inc.php");
20 require_once("$srcdir/validation/LBF_Validation.php");
21 require_once("$srcdir/patientvalidation.inc.php");
23 use OpenEMR\Common\Acl\AclMain
;
24 use OpenEMR\Common\Csrf\CsrfUtils
;
25 use OpenEMR\Common\Twig\TwigContainer
;
26 use OpenEMR\Core\Header
;
28 // Check authorization.
29 if (!AclMain
::aclCheckCore('patients', 'demo', '', array('write','addonly'))) {
30 echo (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('core/unauthorized.html.twig', ['pageTitle' => xl("Search or Add Patient")]);
34 $CPR = 4; // cells per row
36 $searchcolor = empty($GLOBALS['layout_search_color']) ?
37 'var(--yellow)' : $GLOBALS['layout_search_color'];
39 $WITH_SEARCH = ($GLOBALS['full_new_patient_form'] == '1' ||
$GLOBALS['full_new_patient_form'] == '2' );
40 $SHORT_FORM = ($GLOBALS['full_new_patient_form'] == '2' ||
$GLOBALS['full_new_patient_form'] == '3' ||
$GLOBALS['full_new_patient_form'] == '4');
43 getLayoutProperties('DEM', $grparr, '*');
45 $TOPCPR = empty($grparr['']['grp_columns']) ?
4 : $grparr['']['grp_columns'];
47 function getLayoutRes()
50 return sqlStatement("SELECT * FROM layout_options " .
51 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' " .
52 ($SHORT_FORM ?
"AND ( uor > 1 OR edit_options LIKE '%N%' ) " : "") .
53 "ORDER BY group_id, seq");
56 // Determine layout field search treatment from its data type:
61 function getSearchClass($data_type)
64 case 1: // single-selection list
65 case 10: // local provider list
66 case 11: // provider list
67 case 12: // pharmacy list
69 case 14: // address book list
70 case 26: // single-selection list with add
71 case 35: // facilities
82 $fres = getLayoutRes();
87 <?php Header
::setupHeader(['common','datetime-picker','select2', 'erx']); ?
>
88 <title
><?php
echo xlt("Search or Add Patient"); ?
></title
>
91 margin
-bottom
: 0.25rem
;
95 <?php
include_once("{$GLOBALS['srcdir']}/options.js.php"); ?
>
98 //Visolve - sync the radio buttons - Start
99 if((top
.window
.parent
) && (parent
.window
)){
100 var wname
= top
.window
.parent
.left_nav
;
101 fname
= (parent
.window
.name
)?parent
.window
.name
:window
.name
;
103 }//Visolve - sync the radio buttons - End
105 var mypcc
= <?php
echo js_escape($GLOBALS['phone_country_code']); ?
>;
107 // This may be changed to true by the AJAX search script.
108 var force_submit
= false;
110 //code used from http://tech.irt.org/articles/js037/
111 function replace(string,text
,by
) {
112 // Replaces text with by in string
113 var strLength
= string.length
, txtLength
= text
.length
;
114 if ((strLength
== 0) ||
(txtLength
== 0)) return string;
116 var i
= string.indexOf(text
);
117 if ((!i
) && (text
!= string.substring(0,txtLength
))) return string;
118 if (i
== -1) return string;
120 var newstr
= string.substring(0,i
) + by
;
122 if (i+txtLength
< strLength
)
123 newstr +
= replace(string.substring(i+txtLength
,strLength
),text
,by
);
128 <?php
for ($i = 1; $i <= 3; $i++
) { ?
>
129 function auto_populate_employer_address
<?php
echo $i ?
>(){
130 var f
= document
.demographics_form
;
131 if (f
.form_i
<?php
echo $i?
>subscriber_relationship
.options
[f
.form_i
<?php
echo $i?
>subscriber_relationship
.selectedIndex
].value
== "self") {
132 f
.i
<?php
echo $i?
>subscriber_fname
.value
=f
.form_fname
.value
;
133 f
.i
<?php
echo $i?
>subscriber_mname
.value
=f
.form_mname
.value
;
134 f
.i
<?php
echo $i?
>subscriber_lname
.value
=f
.form_lname
.value
;
135 f
.i
<?php
echo $i?
>subscriber_street
.value
=f
.form_street
.value
;
136 f
.i
<?php
echo $i?
>subscriber_street_line_2
.value
=f
.form_street_line_2
.value
;
137 f
.i
<?php
echo $i?
>subscriber_city
.value
=f
.form_city
.value
;
138 f
.form_i
<?php
echo $i?
>subscriber_state
.value
=f
.form_state
.value
;
139 f
.i
<?php
echo $i?
>subscriber_postal_code
.value
=f
.form_postal_code
.value
;
140 if (f
.form_country_code
)
141 f
.form_i
<?php
echo $i?
>subscriber_country
.value
=f
.form_country_code
.value
;
142 f
.i
<?php
echo $i?
>subscriber_phone
.value
=f
.form_phone_home
.value
;
143 f
.i
<?php
echo $i?
>subscriber_DOB
.value
=f
.form_DOB
.value
;
144 f
.i
<?php
echo $i?
>subscriber_ss
.value
=f
.form_ss
.value
;
145 f
.form_i
<?php
echo $i?
>subscriber_sex
.value
= f
.form_sex
.value
;
146 f
.i
<?php
echo $i?
>subscriber_employer
.value
=f
.form_em_name
.value
;
147 f
.i
<?php
echo $i?
>subscriber_employer_street
.value
=f
.form_em_street
.value
;
148 f
.i
<?php
echo $i?
>subscriber_employer_city
.value
=f
.form_em_city
.value
;
149 f
.form_i
<?php
echo $i?
>subscriber_employer_state
.value
=f
.form_em_state
.value
;
150 f
.i
<?php
echo $i?
>subscriber_employer_postal_code
.value
=f
.form_em_postal_code
.value
;
151 if (f
.form_em_country
)
152 f
.form_i
<?php
echo $i?
>subscriber_employer_country
.value
=f
.form_em_country
.value
;
158 function upperFirst(string,text
) {
159 return replace(string,text
,text
.charAt(0).toUpperCase() + text
.substring(1,text
.length
));
162 // The ins_search.php window calls this to set the selected insurance.
163 function set_insurance(ins_id
, ins_name
) {
164 var thesel
= document
.forms
[0]['i' + insurance_index +
'provider'];
165 var theopts
= thesel
.options
; // the array of Option objects
167 for (; i
< theopts
.length
; ++i
) {
168 if (theopts
[i
].value
== ins_id
) {
169 theopts
[i
].selected
= true;
173 // no matching option was found so create one, append it to the
174 // end of the list, and select it.
175 theopts
[i
] = new Option(ins_name
, ins_id
, false, true);
178 // Indicates which insurance slot is being updated.
179 var insurance_index
= 0;
181 // The OnClick handler for searching/adding the insurance company.
182 function ins_search(ins
) {
183 insurance_index
= ins
;
187 function checkNum () {
188 var re
= new RegExp();
190 str
=document
.forms
[0].monthly_income
.value
;
194 alert(<?php
echo xlj("Please enter a dollar amount using only numbers and a decimal point."); ?
>);
198 // This capitalizes the first letter of each word in the passed input
199 // element. It also strips out extraneous spaces.
200 function capitalizeMe(elem
) {
201 var a
= elem
.value
.split(' ');
203 for(var i
= 0; i
< a
.length
; ++i
) {
204 if (a
[i
].length
> 0) {
205 if (s
.length
> 0) s +
= ' ';
206 s +
= a
[i
].charAt(0).toUpperCase() + a
[i
].substring(1);
212 function divclick(cb
, divid
) {
213 var divstyle
= document
.getElementById(divid
).style
;
215 divstyle
.display
= 'block';
217 divstyle
.display
= 'none';
222 // Compute the length of a string without leading and trailing spaces.
223 function trimlen(s
) {
225 var j
= s
.length
- 1;
226 for (; i
<= j
&& s
.charAt(i
) == ' '; ++i
);
227 for (; i
<= j
&& s
.charAt(j
) == ' '; --j
);
232 function validate(f
) {
233 var errMsgs
= new Array();
234 <?php
generate_layout_validation('DEM'); ?
>
235 <?php
if ($GLOBALS['erx_enable']) { ?
>
237 for(i
=0;i
<f
.length
;i++
){
238 if(f
[i
].type
=='text' && f
[i
].value
)
240 if(f
[i
].name
== 'form_fname' || f
[i
].name
== 'form_mname' || f
[i
].name
== 'form_lname')
242 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
243 alertMsg +
= checkUsername(f
[i
].name
,f
[i
].value
);
245 else if(f
[i
].name
== 'form_street' || f
[i
].name
== 'form_city')
247 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
248 alertMsg +
= checkAlphaNumericExtended(f
[i
].name
,f
[i
].value
);
250 else if(f
[i
].name
== 'form_phone_home')
252 alertMsg +
= checkPhone(f
[i
].name
,f
[i
].value
);
263 msg +
= <?php
echo xlj('The following fields are required'); ?
> +
":\n\n";
264 for ( var i
= 0; i
< errMsgs
.length
; i++
) {
265 msg +
= errMsgs
[i
] +
"\n";
267 msg +
= "\n" +
<?php
echo xlj('Please fill them in before continuing.'); ?
>;
270 //Misc Deceased Date Validation for Future Date
271 var dateVal
= document
.getElementById("form_deceased_date").value
;
274 month
= '' +
(d
.getMonth() +
1),
275 day
= '' + d
.getDate(),
276 year
= d
.getFullYear();
277 if (month
.length
< 2) month
= '0' + month
;
278 if (day
.length
< 2) day
= '0' + day
;
279 currentDate
= year+
'-'+month+
'-'+day
;
280 if(errMsgs
.length
> 0 || dateVal
> currentDate
) {
281 if(errMsgs
.length
> 0) {
284 if(dateVal
> currentDate
) {
285 alert(<?php
echo xlj("Deceased Date should not be greater than Today"); ?
>);
292 function toggleSearch(elem
) {
293 var f
= document
.forms
[0];
294 <?php
if ($WITH_SEARCH) { ?
>
295 // Toggle background color.
296 if (elem
.style
.backgroundColor
== '')
297 elem
.style
.backgroundColor
= <?php
echo js_escape($searchcolor); ?
>;
299 elem
.style
.backgroundColor
= '';
301 if (!elem
.classList
.contains("is-invalid") && $
.trim($
(elem
).val()) == '') {
302 elem
.classList
.add("is-invalid");
304 if($
.trim($
(elem
).val()) != '') {
305 elem
.classList
.remove("is-invalid");
306 elem
.classList
.remove("is-valid");
311 force_submit
= false;
312 f
.create
.value
= <?php
echo xlj('Create New Patient'); ?
>;
317 // If a <select> list is dropped down, this is its name.
318 var open_sel_name
= '';
320 function selClick(elem
) {
321 if (open_sel_name
== elem
.name
) {
325 open_sel_name
= elem
.name
;
331 function selBlur(elem
) {
332 if (open_sel_name
== elem
.name
) {
338 // This invokes the patient search dialog.
339 function searchme() {
340 var f
= document
.forms
[0];
341 var url
= '../main/finder/patient_select.php?popup=1&csrf_token_form=<?php echo attr_url(CsrfUtils::collectCsrfToken()); ?>';
344 $lres = getLayoutRes();
346 while ($lrow = sqlFetchArray($lres)) {
347 $field_id = $lrow['field_id'];
348 if (strpos($field_id, 'em_') === 0) {
352 $data_type = $lrow['data_type'];
353 $fldname = "form_$field_id";
354 switch (getSearchClass($data_type)) {
357 " if (f." . attr($fldname) . ".style.backgroundColor != '' && trimlen(f." . attr($fldname) . ".value) > 0) {\n" .
358 " url += '&" . attr($field_id) . "=' + encodeURIComponent(f." . attr($fldname) . ".value);\n" .
363 " if (f." . attr($fldname) . ".style.backgroundColor != '' && f." . attr($fldname) . ".selectedIndex > 0) {\n" .
364 " url += '&" . attr($field_id) . "=' + encodeURIComponent(f." . attr($fldname) . ".options[f." . attr($fldname) . ".selectedIndex].value);\n" .
371 dlgopen(url
, '_blank', 700, 500);
373 function srchDone(pid
){
374 top
.restoreSession();
375 document
.location
.href
= "./../../patient_file/summary/demographics.php?set_pid=" +
encodeURIComponent(pid
);
382 <body
class="body_top">
385 /*Get the constraint from the DB-> LBF forms accordinf the form_id*/
386 $constraints = LBF_Validation
::generate_validate_constraints("DEM");
388 <script
> var constraints
= <?php
echo $constraints; ?
>; </script
>
389 <div
class="container-xl">
391 <div
class="col-md-12">
392 <h2
><?php
echo xlt('Search or Add Patient');?
></h2
>
396 <div
class="<?php echo $BS_COL_CLASS; ?>-12">
397 <div
class="accordion" id
="dem_according">
398 <form action
='new_comprehensive_save.php' name
='demographics_form' id
='DEM'
400 onsubmit
='return submitme(<?php echo $GLOBALS['new_validate
'] ? 1 : 0;?>,event,"DEM",constraints)'>
401 <!-- Was
: class='form-inline' -->
402 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
404 <table
class='table table-sm w-100' cellspacing
='8'>
406 <td
class="text-left align-top">
409 echo "<div class='mx-auto'>";
416 if ($item_count > 0) {
417 echo "</div>"; // end BS column
424 global $cell_count, $CPR, $BS_COL_CLASS;
426 if ($cell_count > 0 && $cell_count < $CPR) {
427 // Create a cell occupying the remaining bootstrap columns.
428 // BS columns will be less than 12 if $CPR is not 2, 3, 4, 6 or 12.
429 $bs_cols_remaining = ($CPR - $cell_count) * intval(12 / $CPR);
430 echo "<div class='$BS_COL_CLASS-$bs_cols_remaining'></div>";
432 if ($cell_count > 0) {
433 echo "</div><!-- End BS row -->\n";
440 global $last_group, $SHORT_FORM;
441 if (strlen($last_group) > 0) {
443 echo "</div>\n"; // end BS container
454 $display_style = 'block';
455 $group_seq = 0; // this gives the DIV blocks unique IDs
458 while ($frow = sqlFetchArray($fres)) {
459 $this_group = $frow['group_id'];
460 $titlecols = $frow['titlecols'];
461 $datacols = $frow['datacols'];
462 $data_type = $frow['data_type'];
463 $field_id = $frow['field_id'];
464 $list_id = $frow['list_id'];
467 // Accumulate action conditions into a JSON expression for the browser side.
468 accumActionConditions($frow, $condition_str);
470 if (strpos($field_id, 'em_') === 0) {
471 $tmp = substr($field_id, 3);
472 if (isset($result2[$tmp])) {
473 $currvalue = $result2[$tmp];
476 if (isset($result[$field_id])) {
477 $currvalue = $result[$field_id];
481 // Handle a data category (group) change.
482 if (strcmp($this_group, $last_group) != 0) {
485 $group_seq++
; // ID for DIV tags
486 $group_name = $grparr[$this_group]['grp_title'];
488 $group_seq_attr = attr($group_seq);
489 $checked = ($display_style == 'block') ?
"show" : "";
490 $group_name_xl = text(xl_layout_label($group_name));
491 $onclick = attr_js("div_" . $group_seq);
492 $init_open = $grparr[$this_group]['grp_init_open'];
493 if ($checked != "show") {
494 $checked = ($init_open == 1) ?
$checked . " show" : $checked;
498 <div class="card-header p-0 bg-secondary" id="header_{$group_seq_attr}">
500 <button class="btn btn-link btn-block text-light text-left" type="button" data-toggle="collapse" data-target="#div_{$group_seq_attr}" aria-expanded="true" aria-controls="{$group_seq_attr}">$group_name_xl</button>
503 <div id="div_{$group_seq_attr}" class="bg-light collapse {$checked}" aria-labelledby="header_{$group_seq_attr}" >
504 <div class="container-xl card-body">
506 $display_style = 'none';
507 } elseif (strlen($last_group) == 0) {
508 echo " <div class='container-xl'>\n";
510 $CPR = empty($grparr[$this_group]['grp_columns']) ?
$TOPCPR : $grparr[$this_group]['grp_columns'];
511 $last_group = $this_group;
514 // Handle starting of a new row.
515 if (($titlecols > 0 && $cell_count >= $CPR) ||
$cell_count == 0) {
517 echo "<div class='form-group row'>";
520 if ($item_count == 0 && $titlecols == 0) {
524 $field_id_label = 'label_' . $frow['field_id'];
526 // Handle starting of a new label cell.
527 if ($titlecols > 0) {
529 $bs_cols = $titlecols * intval(12 / $CPR);
530 echo "<div class='$BS_COL_CLASS-$bs_cols ";
531 echo ($frow['uor'] == 2) ?
"required" : "";
532 echo "' id='" . attr($field_id_label) . "'";
534 $cell_count +
= $titlecols;
537 // $item_count is the number of title and data items in the current cell.
540 if ($datacols == 0) {
541 // Data will be in the same cell, so prevent wrapping between title and data.
542 echo "<span class='text-nowrap mr-2'>"; // mb-2 doesn't work here
546 // Modified 6-09 by BM - Translate if applicable
547 if ($frow['title']) {
548 echo (text(xl_layout_label($frow['title'])) . ":");
551 // Handle starting of a new data cell.
553 $id_field_text = "text_" . $frow['field_id'];
555 $bs_cols = $datacols * intval(12 / $CPR);
556 echo "<div class='$BS_COL_CLASS-$bs_cols'";
557 echo " id='" . attr($id_field_text) . "'";
559 $cell_count +
= $datacols;
564 if ($item_count > 1) {
568 // 'smallform' can be used to add arbitrary CSS classes. Note the leading space.
569 $frow['smallform'] = ' form-control-sm mw-100' . ($datacols ?
'' : ' mb-1');
571 // set flag so we don't bring in session pid data for a new pt form
572 $frow['blank_form'] = false;
574 $frow['data_type'] == "52"
575 ||
$frow['data_type'] == "53"
576 ||
$frow['data_type'] == "54"
578 $frow['blank_form'] = true;
580 generate_form_field($frow, $currvalue);
582 if ($datacols == 0) {
584 echo "</span> "; // space to allow wrap between spans
592 if (!$GLOBALS['simplified_demographics']) {
593 $insurancei = getInsuranceProviders();
595 if ($GLOBALS['insurance_only_one']) {
596 $insurance_headings = array(xl("Primary Insurance Provider"));
597 $insurance_info = array();
598 $insurance_info[1] = getInsuranceData($pid, "primary");
600 $insurance_headings = array(xl("Primary Insurance Provider"), xl("Secondary Insurance Provider"), xl("Tertiary Insurance provider"));
601 $insurance_info = array();
602 $insurance_info[1] = getInsuranceData($pid, "primary");
603 $insurance_info[2] = getInsuranceData($pid, "secondary");
604 $insurance_info[3] = getInsuranceData($pid, "tertiary");
606 $insuranceTitle = xlt("Insurance");
609 <div class="card-header p-0 bg-secondary" id="header_ins">
611 <button class="btn btn-link btn-block text-light text-left" type="button" data-toggle="collapse" data-target="#div_ins" aria-expanded="true" aria-controls="ins">$insuranceTitle</button>
614 <div id="div_ins" class="bg-light collapse" aria-labelledby="header_ins" >
615 <div class="container-xl card-body">
618 for ($i = 1; $i <= sizeof($insurance_info); $i++
) {
619 $result3 = $insurance_info[$i];
621 <div
class="row p-3">
622 <div
class="col-md-12 mb-2">
623 <div
class="input-group">
624 <label
class='col-form-label mr-2 required'><?php
echo text($insurance_headings[$i - 1]) . ":"?
></label
>
625 <select name
="i<?php echo attr($i); ?>provider" class="form-control">
626 <option value
=""><?php
echo xlt('Unassigned'); ?
></option
>
628 foreach ($insurancei as $iid => $iname) {
629 echo "<option value='" . attr($iid) . "'";
630 if (!empty($result3["provider"]) && (strtolower($iid) == strtolower($result3["provider"]))) {
633 echo ">" . text($iname) . "</option>\n";
637 <div
class="input-group-append">
638 <a
class='btn btn-primary text-white medium_modal' href
='../practice/ins_search.php' onclick
='ins_search(<?php echo attr_js($i); ?>)'><?php
echo xlt('Search/Add Insurer'); ?
></a
>
642 <label
class='col-form-label col-md-1 mb-2 required'><?php
echo xlt('Plan Name'); ?
>:</label
>
643 <div
class="col-md-5 mb-2">
644 <input type
='entry' class='form-control' size
='20' name
='i<?php echo attr($i); ?>plan_name' value
="<?php echo attr($result3["plan_name
"] ?? ''); ?>" onchange
="capitalizeMe(this);" />
646 <label
class='col-form-label col-md-1 mb-2 required'><?php
echo xlt('Subscriber'); ?
>:</label
>
647 <div
class="col-md-5 mb-2 form-inline">
648 <input type
='entry' class='form-control' size
='10' name
='i<?php echo attr($i); ?>subscriber_fname' value
="<?php echo attr($result3["subscriber_fname
"] ?? ''); ?>" onchange
="capitalizeMe(this);" />
649 <input type
='entry' class='form-control' size
='3' name
='i<?php echo attr($i); ?>subscriber_mname' value
="<?php echo attr($result3["subscriber_mname
"] ?? ''); ?>" onchange
="capitalizeMe(this);" />
650 <input type
='entry' class='form-control' size
='10' name
='i<?php echo attr($i); ?>subscriber_lname' value
="<?php echo attr($result3["subscriber_lname
"] ?? ''); ?>" onchange
="capitalizeMe(this);" />
652 <label
class='col-form-label col-md-1 mb-2 required'><?php
echo xlt('Effective Date'); ?
>: </label
>
653 <div
class="col-md-5 mb-2">
654 <input type
='entry' size
='11' class='datepicker form-control' name
='i<?php echo attr($i); ?>effective_date' id
='i<?php echo attr($i); ?>effective_date' value
='<?php echo attr($result3['date
'] ?? ''); ?>' />
656 <label
class='col-form-label col-md-1 mb-2 required'><?php
echo xlt('Relationship'); ?
>:</label
>
657 <div
class="col-md-5 mb-2">
659 generate_form_field(array('data_type' => 1,'field_id' => ('i' . $i . 'subscriber_relationship'),'list_id' => 'sub_relation','empty_title' => ' ', 'smallform' => 'true'), ($result3['subscriber_relationship'] ??
''));
661 <a href
="javascript:popUp('../../interface/patient_file/summary/browse.php?browsenum=<?php echo attr_url($i); ?>')" class='text'>(<?php
echo xlt('Browse'); ?
>)</a
>
663 <label
class='col-form-label col-md-1 mb-2 required'><?php
echo xlt('Policy Number'); ?
>:</label
>
664 <div
class="col-md-5 mb-2">
665 <input type
='entry' class='form-control' size
='16' name
='i<?php echo attr($i); ?>policy_number' value
="<?php echo attr($result3["policy_number
"] ?? ''); ?>" onkeyup
='policykeyup(this)' />
667 <label
class='col-form-label col-md-1 mb-2'><?php
echo xlt('D.O.B.'); ?
>:</label
>
668 <div
class="col-md-5 mb-2">
669 <input type
='entry' size
='11' class='datepicker-past form-control' name
='i<?php echo attr($i); ?>subscriber_DOB' id
='i<?php echo attr($i); ?>subscriber_DOB' value
='<?php echo attr($result3['subscriber_DOB
'] ?? ''); ?>' />
671 <label
class='col-form-label col-md-1 required'><?php
echo xlt('Group Number'); ?
>:</label
>
672 <div
class="col-md-5 mb-2">
673 <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)' />
675 <label
class='col-form-label col-md-1 mb-2'><?php
echo xlt('S.S.'); ?
>:</label
>
676 <div
class="col-md-5 mb-2">
677 <input type
='entry' class='form-control' size
='11' name
='i<?php echo attr($i); ?>subscriber_ss' value
="<?php echo attr($result3["subscriber_ss
"] ?? ''); ?>" />
679 <?php
echo ($GLOBALS['omit_employers']) ?
"<div class='d-none'>" : ""; ?
>
680 <label
class="col-form-label col-md-1 mb-2 required"><?php
echo xlt('Subscriber Employer (SE)'); ?
>:</label
>
681 <div
class="col-md-5 mb-2">
682 <input type
='entry' class='form-control' aria
-describedby
="seHelpBlock" size
='25' name
='i<?php echo attr($i); ?>subscriber_employer' value
="<?php echo attr($result3["subscriber_employer
"] ?? ''); ?>" onchange
="capitalizeMe(this);" />
683 <small id
="seHelpBlock" class="form-text text-muted">
684 <?php
echo xlt('if unemployed enter Student'); ?
>, <?php
echo xlt('PT Student, or leave blank'); ?
>.
687 <?php
echo ($GLOBALS['omit_employers']) ?
"</div>" : ""; ?
>
688 <label
class='col-form-label col-md-1 mb-2'><?php
echo xlt('Sex'); ?
>:</label
>
689 <div
class="col-md-5 mb-2">
691 generate_form_field(array('data_type' => 1,'field_id' => ('i' . $i . 'subscriber_sex'),'list_id' => 'sex', 'smallform' => 'true'), $result3['subscriber_sex'] ??
'');
694 <?php
echo ($GLOBALS['omit_employers']) ?
"<div class='d-none'>" : ""; ?
>
695 <label
class='col-form-label col-md-1 mb-2 required'><?php
echo xlt('SE Address'); ?
>:</label
>
696 <div
class="col-md-5 mb-2">
697 <input type
='entry' class='form-control' size
='25' name
='i<?php echo attr($i); ?>subscriber_employer_street' value
="<?php echo attr($result3["subscriber_employer_street
"] ?? ''); ?>" onchange
="capitalizeMe(this);" />
699 <?php
echo ($GLOBALS['omit_employers']) ?
"</div>" : ""; ?
>
700 <label
class='col-form-label col-md-1 mb-2 required'><?php
echo xlt('Subscriber Address Line 1'); ?
>:</label
>
701 <div
class="col-md-5 mb-2">
702 <input type
='entry' class='form-control' size
='25' name
='i<?php echo attr($i); ?>subscriber_street' value
="<?php echo attr($result3["subscriber_street
"] ?? ''); ?>" onchange
="capitalizeMe(this);" />
704 <label
class='col-form-label col-md-1 mb-2 required'><?php
echo xlt('Subscriber Address Line 2'); ?
>:</label
>
705 <div
class="col-md-5 mb-2">
706 <input type
='entry' class='form-control' size
='25' name
='i<?php echo attr($i); ?>subscriber_street_line_2' value
="<?php echo attr($result3["subscriber_street_line_2
"] ?? ''); ?>" onchange
="capitalizeMe(this);" />
708 <?php
echo ($GLOBALS['omit_employers']) ?
"<div class='d-none'>" : ""; ?
>
709 <label
class='col-form-label col-md-1 mb-2 required'><?php
echo xlt('SE City'); ?
>:</label
>
710 <div
class="col-md-5 mb-2">
711 <input type
='entry' class='form-control' size
='15' name
='i<?php echo attr($i); ?>subscriber_employer_city' value
="<?php echo attr($result3["subscriber_employer_city
"] ?? ''); ?>" onchange
="capitalizeMe(this);" />
713 <?php
echo ($GLOBALS['omit_employers']) ?
"</div>" : ""; ?
>
714 <label
class='col-form-label col-md-1 mb-2 required'><?php
echo xlt('City'); ?
>:</label
>
715 <div
class="col-md-5 mb-2">
716 <input type
='entry' class='form-control' size
='15' name
='i<?php echo attr($i); ?>subscriber_city' value
="<?php echo attr($result3["subscriber_city
"] ?? ''); ?>" onchange
="capitalizeMe(this);" />
718 <?php
echo ($GLOBALS['omit_employers']) ?
"<div class='d-none'>" : ""; ?
>
719 <label
class='col-form-label col-md-1 mb-2 required'><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('SE State') : xlt('SE Locality') ?
>:</label
>
720 <div
class="col-md-5 mb-2">
722 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', 'smallform' => 'true'), ($result3['subscriber_employer_state'] ??
''));
725 <?php
echo ($GLOBALS['omit_employers']) ?
"</div>" : ""; ?
>
726 <label
class='col-form-label col-md-1 mb-2 required'><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('State') : xlt('Locality') ?
>:</label
>
727 <div
class="col-md-5 mb-2">
729 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', 'smallform' => 'true'), ($result3['subscriber_state'] ??
''));
732 <?php
echo ($GLOBALS['omit_employers']) ?
"<div class='d-none'>" : ""; ?
>
733 <label
class='col-form-label col-md-1 mb-2 required'><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('SE Zip Code') : xlt('SE Postal Code') ?
>: </label
>
734 <div
class="col-md-5 mb-2">
735 <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
"] ?? ''); ?>" />
737 <?php
echo ($GLOBALS['omit_employers']) ?
"</div>" : ""; ?
>
738 <label
class='col-form-label col-md-1 mb-2 required'><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('Zip Code') : xlt('Postal Code') ?
>: </label
>
739 <div
class="col-md-5 mb-2">
740 <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
"] ?? ''); ?>" />
742 <?php
echo ($GLOBALS['omit_employers']) ?
"<div class='d-none'>" : ""; ?
>
743 <label
class='col-form-label col-md-1 mb-2 required'><?php
echo xlt('SE Country'); ?
>:</label
>
744 <div
class="col-md-5 mb-2">
746 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', 'smallform' => 'true'), ($result3['subscriber_employer_country'] ??
''));
749 <label
class='col-form-label col-md-1 mb-2 required'><?php
echo xlt('Country'); ?
>:</label
>
750 <div
class="col-md-5 mb-2">
752 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', 'smallform' => 'true'), ($result3['subscriber_country'] ??
''));
755 <?php
echo ($GLOBALS['omit_employers']) ?
"</div>" : ""; ?
>
756 <label
class='col-form-label col-md-1 mb-2'><?php
echo xlt('Subscriber Phone'); ?
>:</label
>
757 <div
class="col-md-5 mb-2">
758 <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)' />
760 <label
class='col-form-label col-md-1 mb-2'><?php
echo xlt('Co-Pay'); ?
>:</label
>
761 <div
class="col-md-5 mb-2">
762 <input type
='text' class='form-control' size
="6" name
='i<?php echo attr($i); ?>copay' value
="<?php echo attr($result3["copay
"] ?? ''); ?>" />
764 <label
class='col-form-label col-md-1 mb-2 required'><?php
echo xlt('Accept Assignment'); ?
>:</label
>
765 <div
class="col-md-5 mb-2">
766 <select
class='form-control' name
='i<?php echo attr($i); ?>accept_assignment'>
767 <option value
="TRUE" <?php
echo (strtoupper($result3["accept_assignment"] ??
'') == "TRUE") ?
"selected" : ""; ?
>><?php
echo xlt('YES'); ?
></option
>
768 <option value
="FALSE" <?php
echo (strtoupper($result3["accept_assignment"] ??
'') == "FALSE") ?
"selected" : ""; ?
>><?php
echo xlt('NO'); ?
></option
>
777 } // end of "if not simplified_demographics"
786 <td
class="text-right align-top text-nowrap" width
='1%'>
787 <!-- Image upload stuff was here but got moved
. -->
796 <div
class="col-md-12">
797 <div
class="btn-group">
798 <?php
if ($WITH_SEARCH) { ?
>
799 <button type
="button" class="btn btn-secondary btn-search" id
="search" value
="<?php echo xla('Search'); ?>">
800 <?php
echo xlt('Search'); ?
>
803 <button type
="button" class="btn btn-primary btn-save" name
='create' id
="create" value
="<?php echo xla('Create New Patient'); ?>">
804 <?php
echo xlt('Create New Patient'); ?
>
809 </div
> <!--end of container div
-->
810 <!-- include support
for the
list-add selectbox feature
-->
811 <?php
require($GLOBALS['fileroot'] . "/library/options_listadd.inc.php"); ?
>
814 // hard code validation for old validation, in the new validation possible to add match rules
815 <?php
if ($GLOBALS['new_validate'] == 0) { ?
>
816 // fix inconsistently formatted phone numbers from the database
817 var f
= document
.forms
[0];
818 if (f
.form_phone_contact
) phonekeyup(f
.form_phone_contact
,mypcc
);
819 if (f
.form_phone_home
) phonekeyup(f
.form_phone_home
,mypcc
);
820 if (f
.form_phone_biz
) phonekeyup(f
.form_phone_biz
,mypcc
);
821 if (f
.form_phone_cell
) phonekeyup(f
.form_phone_cell
,mypcc
);
825 <?php
echo $date_init; ?
>
827 // -=- jQuery makes life easier -=-
829 // var matches = 0; // number of patients that match the demographic information being entered
830 // var override = false; // flag that overrides the duplication warning
833 $
(".medium_modal").on('click', function(e
) {
834 e
.preventDefault();e
.stopPropagation();
835 dlgopen('', '', 650, 460, '', '', {
837 {text
: <?php
echo xlj('Close'); ?
>, close
: true, style
: 'default btn-sm'}
839 //onClosed: 'refreshme',
844 url
: $
(this
).attr('href')
847 // added to integrate insurance stuff
848 <?php
for ($i = 1; $i <= 3; $i++
) { ?
>
849 $
("#form_i<?php echo $i?>subscriber_relationship").change(function() { auto_populate_employer_address
<?php
echo $i?
>(); });
852 $
('#search').click(function() { searchme(); });
853 $
('#create').click(function() { check()});
855 var check
= function(e
) {
856 var f
= document
.forms
[0];
857 <?php
if ($GLOBALS['new_validate']) {?
>
858 var valid
= submitme(<?php
echo $GLOBALS['new_validate'] ?
1 : 0;?
>, e
, "DEM", constraints
);
860 top
.restoreSession();
861 var valid
= validate(f
);
865 // In this case dups were shown already and Save should just save.
866 top
.restoreSession();
872 // D in edit_options indicates the field is used in duplication checking.
873 // This constructs a list of the names of those fields.
875 $mfres = sqlStatement("SELECT * FROM layout_options " .
876 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' AND " .
877 "(edit_options LIKE '%D%' OR edit_options LIKE '%W%' )" .
878 "ORDER BY group_id, seq");
879 while ($mfrow = sqlFetchArray($mfres)) {
880 $field_id = $mfrow['field_id'];
881 if (strpos($field_id, 'em_') === 0) {
885 if (!empty($mflist)) {
889 $mflist .= js_escape($field_id);
892 <?php
if (($GLOBALS['full_new_patient_form'] == '4') && (checkIfPatientValidationHookIsActive())) :?
>
893 // Use zend module patient validation hook to open the controller and send the dup-checker fields.
894 var url
='<?php echo $GLOBALS['web_root
'] . "/interface/modules/zend_modules/public/patientvalidation"; ?>';
896 // Build and invoke the URL to create the dup-checker dialog.
897 var url
= 'new_search_popup.php';
900 var flds
= new Array(<?php
echo $mflist; ?
>);
902 for (var i
= 0; i
< flds
.length
; ++i
) {
903 var fval
= $
('#form_' + flds
[i
]).val();
904 if (fval
&& fval
!= '') {
907 url +
= 'mf_' + flds
[i
] +
'=' +
encodeURIComponent(fval
);
915 dlgopen(url
, '_blank', 875, 500);
919 // Set onclick/onfocus handlers for toggling background color.
921 $lres = getLayoutRes();
922 while ($lrow = sqlFetchArray($lres)) {
923 $field_id = $lrow['field_id'];
924 if (strpos($field_id, 'em_') === 0) {
928 switch (getSearchClass($lrow['data_type'])) {
930 echo " \$(" . js_escape("#form_" . $field_id) . ").click(function() { toggleSearch(this); });\n";
933 echo " \$(" . js_escape("#form_" . $field_id) . ").click(function() { selClick(this); });\n";
934 echo " \$(" . js_escape("#form_" . $field_id) . ").blur(function() { selBlur(this); });\n";
940 $
(".select-dropdown").select2({
942 dropdownAutoWidth
: true,
944 <?php
require($GLOBALS['srcdir'] . '/js/xl/select2.js.php'); ?
>
946 if (typeof error
!== 'undefined') {
952 $
('.datepicker').datetimepicker({
953 <?php
$datetimepicker_timepicker = false; ?
>
954 <?php
$datetimepicker_showseconds = false; ?
>
955 <?php
$datetimepicker_formatInput = true; ?
>
956 <?php
$datetimepicker_minDate = false; ?
>
957 <?php
$datetimepicker_maxDate = false; ?
>
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 ?>
961 $
('.datetimepicker').datetimepicker({
962 <?php
$datetimepicker_timepicker = true; ?
>
963 <?php
$datetimepicker_showseconds = false; ?
>
964 <?php
$datetimepicker_formatInput = true; ?
>
965 <?php
$datetimepicker_minDate = false; ?
>
966 <?php
$datetimepicker_maxDate = false; ?
>
967 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
968 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
970 $
('.datepicker-past').datetimepicker({
971 <?php
$datetimepicker_timepicker = false; ?
>
972 <?php
$datetimepicker_showseconds = false; ?
>
973 <?php
$datetimepicker_formatInput = true; ?
>
974 <?php
$datetimepicker_minDate = false; ?
>
975 <?php
$datetimepicker_maxDate = '+1970/01/01'; ?
>
976 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
977 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
979 $
('.datetimepicker-past').datetimepicker({
980 <?php
$datetimepicker_timepicker = true; ?
>
981 <?php
$datetimepicker_showseconds = false; ?
>
982 <?php
$datetimepicker_formatInput = true; ?
>
983 <?php
$datetimepicker_minDate = false; ?
>
984 <?php
$datetimepicker_maxDate = '+1970/01/01'; ?
>
985 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
986 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
988 $
('.datepicker-future').datetimepicker({
989 <?php
$datetimepicker_timepicker = false; ?
>
990 <?php
$datetimepicker_showseconds = false; ?
>
991 <?php
$datetimepicker_formatInput = true; ?
>
992 <?php
$datetimepicker_minDate = '-1970/01/01'; ?
>
993 <?php
$datetimepicker_maxDate = false; ?
>
994 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
995 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
997 $
('.datetimepicker-future').datetimepicker({
998 <?php
$datetimepicker_timepicker = true; ?
>
999 <?php
$datetimepicker_showseconds = false; ?
>
1000 <?php
$datetimepicker_formatInput = true; ?
>
1001 <?php
$datetimepicker_minDate = '-1970/01/01'; ?
>
1002 <?php
$datetimepicker_maxDate = false; ?
>
1003 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
1004 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
1008 }); // end document.ready
1010 // callback for new patient save confirm from new_search_popup.php
1011 // note that dlgclose() callbacks mostly need to init outside dom.
1012 function srcConfirmSave() {
1013 document
.forms
[0].submit();
1017 <?php
/*Include the validation script and rules for this form*/
1022 //LBF forms use the new validation depending on the global value
1023 $use_validate_js = $GLOBALS['new_validate'];
1024 include_once("$srcdir/validation/validation_script.js.php");?
>
1026 // Array of skip conditions for the checkSkipConditions() function.
1028 <?php
echo $condition_str; ?
>
1030 checkSkipConditions();
1031 $
("input").change(function() {
1032 checkSkipConditions();
1034 $
("select").change(function() {
1035 checkSkipConditions();