6 * @link http://www.open-emr.org
7 * @author Brady Miller <brady.g.miller@gmail.com>
8 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
9 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
12 require_once("../../globals.php");
13 require_once("$srcdir/acl.inc");
14 require_once("$srcdir/options.inc.php");
15 require_once("$srcdir/erx_javascript.inc.php");
16 require_once("$srcdir/validation/LBF_Validation.php");
17 require_once("$srcdir/patientvalidation.inc.php");
19 use OpenEMR\Core\Header
;
21 // Session pid must be right or bad things can happen when demographics are saved!
23 include_once("$srcdir/pid.inc");
24 $set_pid = $_GET["set_pid"] ?
$_GET["set_pid"] : $_GET["pid"];
25 if ($set_pid && $set_pid != $_SESSION["pid"]) {
29 include_once("$srcdir/patient.inc");
31 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
32 $result2 = getEmployerData($pid);
34 // Check authorization.
36 if (!acl_check('patients', 'demo', '', 'write')) {
37 die(xlt('Updating demographics is not authorized.'));
40 if ($result['squad'] && ! acl_check('squads', $result['squad'])) {
41 die(xlt('You are not authorized to access this squad.'));
44 if (!acl_check('patients', 'demo', '', array('write','addonly'))) {
45 die(xlt('Adding demographics is not authorized.'));
49 $CPR = 4; // cells per row
51 // $statii = array('married','single','divorced','widowed','separated','domestic partner');
52 // $langi = getLanguages();
53 // $ethnoraciali = getEthnoRacials();
54 // $provideri = getProviderInfo();
55 if ($GLOBALS['insurance_information'] != '0') {
56 $insurancei = getInsuranceProvidersExtra();
58 $insurancei = getInsuranceProviders();
61 $fres = sqlStatement("SELECT * FROM layout_options " .
62 "WHERE form_id = 'DEM' AND uor > 0 " .
63 "ORDER BY group_id, seq");
68 <title
><?php
echo xlt('Edit Current Patient'); ?
></title
>
70 <?php Header
::setupHeader(['datetime-picker','common','select2']); ?
>
80 <?php
include_once("{$GLOBALS['srcdir']}/options.js.php"); ?
>
82 <script type
="text/javascript">
84 // Support for beforeunload handler.
85 var somethingChanged
= false;
87 $
(document
).ready(function(){
90 $
(".medium_modal").on('click', function(e
) {
91 e
.preventDefault();e
.stopPropagation();
92 let title
= '<?php echo xla('Insurance Search
/Select
/Add
'); ?>';
93 dlgopen('', '', 700, 460, '', title
, {
95 {text
: '<?php echo xla('Close
'); ?>', close
: true, style
: 'default btn-sm'}
101 url
: $
(this
).attr('href')
105 $
('.datepicker').datetimepicker({
106 <?php
$datetimepicker_timepicker = false; ?
>
107 <?php
$datetimepicker_showseconds = false; ?
>
108 <?php
$datetimepicker_formatInput = true; ?
>
109 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
110 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
112 $
('.datetimepicker').datetimepicker({
113 <?php
$datetimepicker_timepicker = true; ?
>
114 <?php
$datetimepicker_showseconds = false; ?
>
115 <?php
$datetimepicker_formatInput = true; ?
>
116 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
117 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
120 // Support for beforeunload handler.
121 $
('.tab input, .tab select, .tab textarea').change(function() {
122 somethingChanged
= true;
124 window
.addEventListener("beforeunload", function (e
) {
125 if (somethingChanged
&& !top
.timed_out
) {
126 var msg
= "<?php echo xls('You have unsaved changes.'); ?>";
127 e
.returnValue
= msg
; // Gecko, Trident, Chrome 34+
128 return msg
; // Gecko, WebKit, Chrome <34
132 if (window
.checkSkipConditions
) {
133 checkSkipConditions();
137 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
139 //code used from http://tech.irt.org/articles/js037/
140 function replace(string,text
,by
) {
141 // Replaces text with by in string
142 var strLength
= string.length
, txtLength
= text
.length
;
143 if ((strLength
== 0) ||
(txtLength
== 0)) return string;
145 var i
= string.indexOf(text
);
146 if ((!i
) && (text
!= string.substring(0,txtLength
))) return string;
147 if (i
== -1) return string;
149 var newstr
= string.substring(0,i
) + by
;
151 if (i+txtLength
< strLength
)
152 newstr +
= replace(string.substring(i+txtLength
,strLength
),text
,by
);
157 function upperFirst(string,text
) {
158 return replace(string,text
,text
.charAt(0).toUpperCase() + text
.substring(1,text
.length
));
161 <?php
for ($i=1; $i<=3; $i++
) { ?
>
162 function auto_populate_employer_address
<?php
echo $i ?
>(){
163 var f
= document
.demographics_form
;
164 if (f
.form_i
<?php
echo $i?
>subscriber_relationship
.options
[f
.form_i
<?php
echo $i?
>subscriber_relationship
.selectedIndex
].value
== "self")
166 f
.i
<?php
echo $i?
>subscriber_fname
.value
=f
.form_fname
.value
;
167 f
.i
<?php
echo $i?
>subscriber_mname
.value
=f
.form_mname
.value
;
168 f
.i
<?php
echo $i?
>subscriber_lname
.value
=f
.form_lname
.value
;
169 f
.i
<?php
echo $i?
>subscriber_street
.value
=f
.form_street
.value
;
170 f
.i
<?php
echo $i?
>subscriber_city
.value
=f
.form_city
.value
;
171 f
.form_i
<?php
echo $i?
>subscriber_state
.value
=f
.form_state
.value
;
172 f
.i
<?php
echo $i?
>subscriber_postal_code
.value
=f
.form_postal_code
.value
;
173 if (f
.form_country_code
)
174 f
.form_i
<?php
echo $i?
>subscriber_country
.value
=f
.form_country_code
.value
;
175 f
.i
<?php
echo $i?
>subscriber_phone
.value
=f
.form_phone_home
.value
;
176 f
.i
<?php
echo $i?
>subscriber_DOB
.value
=f
.form_DOB
.value
;
177 if(typeof f
.form_ss
!="undefined")
179 f
.i
<?php
echo $i?
>subscriber_ss
.value
=f
.form_ss
.value
;
181 f
.form_i
<?php
echo $i?
>subscriber_sex
.value
= f
.form_sex
.value
;
182 f
.i
<?php
echo $i?
>subscriber_employer
.value
=f
.form_em_name
.value
;
183 f
.i
<?php
echo $i?
>subscriber_employer_street
.value
=f
.form_em_street
.value
;
184 f
.i
<?php
echo $i?
>subscriber_employer_city
.value
=f
.form_em_city
.value
;
185 f
.form_i
<?php
echo $i?
>subscriber_employer_state
.value
=f
.form_em_state
.value
;
186 f
.i
<?php
echo $i?
>subscriber_employer_postal_code
.value
=f
.form_em_postal_code
.value
;
187 if (f
.form_em_country
)
188 f
.form_i
<?php
echo $i?
>subscriber_employer_country
.value
=f
.form_em_country
.value
;
194 function popUp(URL
) {
197 top
.restoreSession();
198 eval("page" + id +
" = window.open(URL, '" + id +
"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=300,left = 440,top = 362');");
201 function checkNum () {
202 var re
= new RegExp();
204 str
=document
.demographics_form
.monthly_income
.value
;
208 alert("<?php echo xls('Please enter a monetary amount using only numbers and a decimal point.'); ?>");
212 // Indicates which insurance slot is being updated.
213 var insurance_index
= 0;
215 // The OnClick handler for searching/adding the insurance company.
216 function ins_search(ins
) {
217 insurance_index
= ins
;
220 function InsSaveClose() {
221 top
.restoreSession();
222 document
.location
.reload();
224 // The ins_search.php window calls this to set the selected insurance.
225 function set_insurance(ins_id
, ins_name
) {
226 var thesel
= document
.forms
[0]['i' + insurance_index +
'provider'];
227 var theopts
= thesel
.options
; // the array of Option objects
229 for (; i
< theopts
.length
; ++i
) {
230 if (theopts
[i
].value
== ins_id
) {
231 theopts
[i
].selected
= true;
235 // no matching option was found so create one, append it to the
236 // end of the list, and select it.
237 theopts
[i
] = new Option(ins_name
, ins_id
, false, true);
240 // This capitalizes the first letter of each word in the passed input
241 // element. It also strips out extraneous spaces.
242 function capitalizeMe(elem
) {
243 var a
= elem
.value
.split(' ');
245 for(var i
= 0; i
< a
.length
; ++i
) {
246 if (a
[i
].length
> 0) {
247 if (s
.length
> 0) s +
= ' ';
248 s +
= a
[i
].charAt(0).toUpperCase() + a
[i
].substring(1);
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
) {
276 var errMsgs
= new Array();
277 <?php
generate_layout_validation('DEM'); ?
>
280 msg +
= "<?php echo xla('The following fields are required'); ?>:\n\n";
281 for ( var i
= 0; i
< errMsgs
.length
; i++
) {
282 msg +
= errMsgs
[i
] +
"\n";
284 msg +
= "\n<?php echo xla('Please fill them in before continuing.'); ?>";
286 if ( errMsgs
.length
> 0 ) {
290 //Misc Deceased Date Validation for Future Date
291 var dateVal
= document
.getElementById("form_deceased_date").value
;
294 month
= '' +
(d
.getMonth() +
1),
295 day
= '' + d
.getDate(),
296 year
= d
.getFullYear();
297 if (month
.length
< 2) month
= '0' + month
;
298 if (day
.length
< 2) day
= '0' + day
;
299 currentDate
= year+
'-'+month+
'-'+day
;
300 if(dateVal
> currentDate
)
302 alert ('<?php echo xls("Deceased Date should not be greater than Today"); ?>');
306 //Patient Data validations
307 <?php
if ($GLOBALS['erx_enable']) { ?
>
309 for(i
=0;i
<f
.length
;i++
){
310 if(f
[i
].type
=='text' && f
[i
].value
)
312 if(f
[i
].name
== 'form_fname' || f
[i
].name
== 'form_mname' || f
[i
].name
== 'form_lname')
314 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
315 alertMsg +
= checkUsername(f
[i
].name
,f
[i
].value
);
317 else if(f
[i
].name
== 'form_street' || f
[i
].name
== 'form_city')
319 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
320 alertMsg +
= checkAlphaNumericExtended(f
[i
].name
,f
[i
].value
);
322 else if(f
[i
].name
== 'form_phone_home')
324 alertMsg +
= checkPhone(f
[i
].name
,f
[i
].value
);
336 // Some insurance validation.
337 for (var i
= 1; i
<= 3; ++i
) {
338 subprov
= 'i' + i +
'provider';
339 if (!f
[subprov
] || f
[subprov
].selectedIndex
<= 0) continue;
340 var subpfx
= 'i' + i +
'subscriber_';
341 var subrelat
= f
['form_' + subpfx +
'relationship'];
343 f
[subpfx +
'fname'].value
== f
.form_fname
.value
&&
344 f
[subpfx +
'mname'].value
== f
.form_mname
.value
&&
345 f
[subpfx +
'lname'].value
== f
.form_lname
.value
;
346 var ss_regexp
=/[0-9][0-9][0-9]-?
[0-9][0-9]-?
[0-9][0-9][0-9][0-9]/;
349 if(typeof f
.form_ss
!="undefined")
351 samess
= f
[subpfx +
'ss'].value
== f
.form_ss
.value
;
352 ss_valid
=ss_regexp
.test(f
[subpfx +
'ss'].value
) && ss_regexp
.test(f
.form_ss
.value
);
354 if (subrelat
.options
[subrelat
.selectedIndex
].value
== "self") {
356 if (!confirm("<?php echo xls('Subscriber relationship is self but name is different! Is this really OK?'); ?>"))
359 if (!samess
&& ss_valid
) {
360 if(!confirm("<?php echo xls('Subscriber relationship is self but SS number is different!')." ". xls("Is this really OK?
"); ?>"))
366 if (!confirm("<?php echo xls('Subscriber relationship is not self but name is the same! Is this really OK?'); ?>"))
369 if (samess
&& ss_valid
) {
370 if(!confirm("<?php echo xls('Subscriber relationship is not self but SS number is the same!') ." ". xls("Is this really OK?
"); ?>"))
376 return errMsgs
.length
< 1;
381 // Onkeyup handler for policy number. Allows only A-Z and 0-9.
382 function policykeyup(e
) {
383 var v
= e
.value
.toUpperCase();
384 var filteredString
="";
385 for (var i
= 0; i
< v
.length
; ++i
) {
387 if ((c
>= '0' && c
<= '9') ||
388 (c
>= 'A' && c
<= 'Z') ||
399 e
.value
= filteredString
;
403 // Added 06/2009 by BM to make compatible with list_options table and functions - using jquery
404 $
(document
).ready(function() {
406 <?php
for ($i=1; $i<=3; $i++
) { ?
>
407 $
("#form_i<?php echo $i?>subscriber_relationship").change(function() { auto_populate_employer_address
<?php
echo $i?
>(); });
416 /*Get the constraint from the DB-> LBF forms accordinf the form_id*/
417 $constraints = LBF_Validation
::generate_validate_constraints("DEM");
419 <script
> var constraints
= <?php
echo $constraints;?
>; </script
>
421 <body
class="body_top">
423 <form action
='demographics_save.php' name
='demographics_form' id
="DEM" method
='post' onsubmit
="submitme(<?php echo $GLOBALS['new_validate'] ? 1 : 0;?>,event,'DEM',constraints)">
424 <input type
='hidden' name
='mode' value
='save' />
425 <input type
='hidden' name
='db_id' value
="<?php echo attr($result['id']); ?>" />
427 <div
class="container-fluid">
429 <div
class="col-xs-12">
430 <div
class="page-header">
431 <h2
><?php
echo xlt('Edit Current Patient');?
></h2
>
434 <div
class="col-xs-12">
435 <div
class="btn-group">
436 <button type
="submit" class="btn btn-default btn-save" id
="submit_btn" disabled
="disabled" value
="<?php echo xla('Save'); ?>">
437 <?php
echo xlt('Save'); ?
>
439 <a
class="btn btn-link btn-cancel" href
="demographics.php" onclick
="top.restoreSession()">
440 <?php
echo xlt('Cancel'); ?
>
451 global $item_count, $cell_count;
452 if ($item_count > 0) {
460 global $cell_count, $CPR;
462 if ($cell_count > 0) {
463 for (; $cell_count < $CPR;
476 if (strlen($last_group) > 0) {
486 $display_style = 'block';
488 $group_seq=0; // this gives the DIV blocks unique IDs
493 <div
class="section-header">
494 <span
class="text"><b
> <?php
echo xlt("Demographics")?
></b
></span
>
500 <?php
display_layout_tabs('DEM', $result, $result2); ?
>
503 <div
class="tabContainer">
504 <?php
display_layout_tabs_data_editable('DEM', $result, $result2); ?
>
513 if (! $GLOBALS['simplified_demographics']) {
514 $insurance_headings = array(xl("Primary Insurance Provider"), xl("Secondary Insurance Provider"), xl("Tertiary Insurance provider"));
515 $insurance_info = array();
516 $insurance_info[1] = getInsuranceData($pid, "primary");
517 $insurance_info[2] = getInsuranceData($pid, "secondary");
518 $insurance_info[3] = getInsuranceData($pid, "tertiary");
521 <div
class="section-header">
522 <span
class="text"><b
><?php
echo xlt("Insurance")?
></b
></span
>
524 <div id
="INSURANCE" >
527 foreach (array('primary','secondary','tertiary') as $instype) {
528 ?
><li
<?php
echo $instype == 'primary' ?
'class="current"' : '' ?
>><a href
="#"><?php
$CapInstype=ucfirst($instype);
529 echo xlt($CapInstype); ?
></a
></li
><?php
534 <div
class="tabContainer">
537 for ($i=1; $i<=3; $i++
) {
538 $result3 = $insurance_info[$i];
541 <div
class="tab <?php echo $i == 1 ? 'current': '' ?>" style
='height:auto;width:auto'> <!---display icky
, fix to auto
-->
544 <div
class="col-md-6">
549 <label
class='required'><?php
echo text($insurance_headings[$i -1])." "?
></label
>
551 <td
class='required'>:</td
>
553 <a href
="../../practice/ins_search.php" class="medium_modal css_button" onclick
="ins_search(<?php echo $i?>)">
554 <span
><?php
echo xlt('Search/Add') ?
></span
>
556 <select name
="i<?php echo $i?>provider" class="form-control sel2" style
="width: 300;">
557 <option value
=""><?php
echo xlt('Unassigned'); ?
></option
>
559 foreach ($insurancei as $iid => $iname) {
560 echo "<option value='" . attr($iid) . "'";
561 if (strtolower($iid) == strtolower($result3{"provider"})) {
565 echo ">" . text($iname) . "</option>\n";
575 <label
class='required'><?php
echo xlt('Plan Name'); ?
> </label
>
577 <td
class='required'>:</td
>
579 <input type
='entry' class='form-control' size
='20' name
='i<?php echo $i?>plan_name' value
="<?php echo attr($result3{"plan_name
"}); ?>"
580 onchange
="capitalizeMe(this);" /> 
; 
;
586 <label
class='required'><?php
echo xlt('Effective Date'); ?
></label
>
588 <td
class='required'>:</td
>
590 <input type
='entry' size
='16' class='datepicker form-control' id
='i<?php echo $i ?>effective_date' name
='i<?php echo $i ?>effective_date'
591 value
='<?php echo attr(oeFormatShortDate($result3['date
'])); ?>'
597 <td
><label
class=required
><?php
echo xlt('Policy Number'); ?
></label
></td
>
598 <td
class='required'>:</td
>
599 <td
><input type
='entry' class='form-control' size
='16' name
='i<?php echo $i?>policy_number' value
="<?php echo attr($result3{"policy_number
"}); ?>"
600 onkeyup
='policykeyup(this)'></td
>
604 <td
><label
class=required
><?php
echo xlt('Group Number'); ?
></label
></td
>
605 <td
class='required'>:</td
>
606 <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
>
609 <tr
<?php
if ($GLOBALS['omit_employers']) {
610 echo " style='display:none'";
612 <td
class='required'><?php
echo xlt('Subscriber Employer (SE)'); ?
><br
><label style
='font-weight:normal'>
613 (<?php
echo xlt('if unemployed enter Student'); ?
>,<br
><?php
echo xlt('PT Student, or leave blank'); ?
>) </label
></td
>
614 <td
class='required'>:</td
>
615 <td
><input type
=entry
class='form-control' size
=25 name
=i
<?php
echo $i?
>subscriber_employer
616 value
="<?php echo attr($result3{"subscriber_employer
"}); ?>"
617 onchange
="capitalizeMe(this);" /></td
>
620 <tr
<?php
if ($GLOBALS['omit_employers']) {
621 echo " style='display:none'";
623 <td
><label
class=required
><?php
echo xlt('SE Address'); ?
></label
></td
>
624 <td
class='required'>:</td
>
625 <td
><input type
=entry
class='form-control' size
=25 name
=i
<?php
echo $i?
>subscriber_employer_street
626 value
="<?php echo attr($result3{"subscriber_employer_street
"}); ?>"
627 onchange
="capitalizeMe(this);" /></td
>
630 <tr
<?php
if ($GLOBALS['omit_employers']) {
631 echo " style='display:none'";
636 <td
><label
class=required
><?php
echo xlt('SE City'); ?
>: </label
></td
>
637 <td
><input type
=entry
class='form-control' size
=15 name
=i
<?php
echo $i?
>subscriber_employer_city
638 value
="<?php echo attr($result3{"subscriber_employer_city
"}); ?>"
639 onchange
="capitalizeMe(this);" /></td
>
640 <td
><label
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('SE State') : xlt('SE Locality') ?
>: </label
></td
>
643 // Modified 7/2009 by BM to incorporate data types
644 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']);
649 <td
><label
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('SE Zip Code') : xlt('SE Postal Code') ?
>: </label
></td
>
650 <td
><input type
=entry
class='form-control' size
=15 name
=i
<?php
echo $i?
>subscriber_employer_postal_code value
="<?php echo text($result3{"subscriber_employer_postal_code
"}); ?>"></td
>
651 <td
><label
class=required
><?php
echo xlt('SE Country'); ?
>: </label
></td
>
654 // Modified 7/2009 by BM to incorporate data types
655 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']);
666 <div
class="col-md-6">
669 <td
><label
class=required
><?php
echo xlt('Relationship'); ?
></label
></td
>
670 <td
class=required
>:</td
>
672 // Modified 6/2009 by BM to use list_options and function
673 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_relationship'),'list_id'=>'sub_relation','empty_title'=>' '), $result3['subscriber_relationship']);
676 <a href
="javascript:popUp('browse.php?browsenum=<?php echo $i?>')" class=text
>(<?php
echo xlt('Browse'); ?
>)</a
></td
>
677 <td
></td
><td
></td
><td
></td
><td
></td
>
680 <td width
=120><label
class=required
><?php
echo xlt('Subscriber'); ?
> </label
></td
>
681 <td
class=required
>:</td
>
682 <td colspan
=3><input type
=entry
class='form-control'size
=10 name
=i
<?php
echo $i?
>subscriber_fname value
="<?php echo attr($result3{"subscriber_fname
"}); ?>" onchange
="capitalizeMe(this);" />
683 <input type
=entry
class='form-control' size
=3 name
=i
<?php
echo $i?
>subscriber_mname value
="<?php echo attr($result3{"subscriber_mname
"}); ?>" onchange
="capitalizeMe(this);" />
684 <input type
=entry
class='form-control' size
=10 name
=i
<?php
echo $i?
>subscriber_lname value
="<?php echo attr($result3{"subscriber_lname
"}); ?>" onchange
="capitalizeMe(this);" /></td
>
685 <td
></td
><td
></td
><td
></td
><td
></td
>
688 <td
><label
class=bold
><?php
echo xlt('D.O.B.'); ?
> </label
></td
>
689 <td
class=required
>:</td
>
690 <td
><input type
='entry' size
='11' class='datepicker form-control' id
='i<?php echo $i?>subscriber_DOB' name
='i<?php echo $i?>subscriber_DOB' value
='<?php echo attr(oeFormatShortDate($result3['subscriber_DOB
'])); ?>' />
692 <td
><label
class=bold
><?php
echo xlt('Sex'); ?
>: </label
></td
>
694 // Modified 6/2009 by BM to use list_options and function
695 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_sex'),'list_id'=>'sex'), $result3['subscriber_sex']);
698 <td
></td
><td
></td
> <td
></td
><td
></td
>
701 <td
class=leftborder
><label
class=bold
><?php
echo xlt('S.S.'); ?
> </label
></td
>
702 <td
class=required
>:</td
>
703 <td
><input type
=entry
class='form-control' size
=11 name
=i
<?php
echo $i?
>subscriber_ss value
="<?php echo attr(trim($result3{"subscriber_ss
"})); ?>"></td
>
707 <td
><label
class=required
><?php
echo xlt('Subscriber Address'); ?
> </label
></td
>
708 <td
class=required
>:</td
>
709 <td
><input type
=entry
class='form-control' size
=20 name
=i
<?php
echo $i?
>subscriber_street value
="<?php echo attr($result3{"subscriber_street
"}); ?>" onchange
="capitalizeMe(this);" /></td
>
711 <td
><label
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('State') : xlt('Locality') ?
>: </label
></td
>
714 // Modified 7/2009 by BM to incorporate data types
715 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']);
720 <td
class=leftborder
><label
class=required
><?php
echo xlt('City'); ?
></label
></td
>
721 <td
class=required
>:</td
>
722 <td
><input type
=entry
class='form-control' size
=11 name
=i
<?php
echo $i?
>subscriber_city value
="<?php echo attr($result3{"subscriber_city
"}); ?>" onchange
="capitalizeMe(this);" /></td
><td
class=leftborder
><label
class='required'<?php
if ($GLOBALS['omit_employers']) {
723 echo " style='display:none'";
724 } ?
>><?php
echo xlt('Country'); ?
>: </label
></td
><td
>
726 // Modified 7/2009 by BM to incorporate data types
727 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']);
732 <td
><label
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xlt('Zip Code') : xlt('Postal Code') ?
> </label
></td
>
733 <td
class=required
>:</td
><td
><input type
=entry
class='form-control' size
=10 name
=i
<?php
echo $i?
>subscriber_postal_code value
="<?php echo attr($result3{"subscriber_postal_code
"}); ?>"></td
>
739 <td
><label
class=bold
><?php
echo xlt('Subscriber Phone'); ?
></label
></td
>
740 <td
class=required
>:</td
>
741 <td
><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)' /></td
>
742 <td colspan
=2><label
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
"}); ?>"></label
></td
>
744 </td
><td
></td
><td
></td
>
747 <td colspan
=0><label
class='required'><?php
echo xlt('Accept Assignment'); ?
></label
></td
>
748 <td
class=required
>:</td
>
750 <select
class='form-control' name
=i
<?php
echo $i?
>accept_assignment
>
751 <option value
="TRUE" <?php
if (strtoupper($result3{"accept_assignment"}) == "TRUE") {
753 }?
>><?php
echo xlt('YES'); ?
></option
>
754 <option value
="FALSE" <?php
if (strtoupper($result3{"accept_assignment"}) == "FALSE") {
756 }?
>><?php
echo xlt('NO'); ?
></option
>
764 <td
><label
class='bold'><?php
echo xlt('Secondary Medicare Type'); ?
></label
></td
>
765 <td
class='bold'>:</td
>
767 <select
class='form-control sel2' name
=i
<?php
echo $i?
>policy_type
>
769 foreach ($policy_types as $key => $value) {
770 echo " <option value ='" . attr($key) . "'";
771 if ($key == $result3['policy_type']) {
775 echo ">" . text($value) . "</option>\n";
789 } //end insurer for loop ?>
794 <?php
} // end of "if not simplified_demographics" ?>
801 <script language
="JavaScript">
803 // Array of skip conditions for the checkSkipConditions() function.
805 <?php
echo $condition_str; ?
>
808 // hard code validation for old validation, in the new validation possible to add match rules
809 <?php
if ($GLOBALS['new_validate'] == 0) { ?
>
810 // fix inconsistently formatted phone numbers from the database
811 var f
= document
.forms
[0];
812 if (f
.form_phone_contact
) phonekeyup(f
.form_phone_contact
,mypcc
);
813 if (f
.form_phone_home
) phonekeyup(f
.form_phone_home
,mypcc
);
814 if (f
.form_phone_biz
) phonekeyup(f
.form_phone_biz
,mypcc
);
815 if (f
.form_phone_cell
) phonekeyup(f
.form_phone_cell
,mypcc
);
817 <?php
if (! $GLOBALS['simplified_demographics']) { ?
>
818 phonekeyup(f
.i1subscriber_phone
,mypcc
);
819 phonekeyup(f
.i2subscriber_phone
,mypcc
);
820 phonekeyup(f
.i3subscriber_phone
,mypcc
);
825 <?php
if ($set_pid) { ?
>
826 parent
.left_nav
.setPatient(<?php
echo "'" . addslashes($result['fname']) . " " . addslashes($result['lname']) . "'," . addslashes($pid) . ",'" . addslashes($result['pubpid']) . "','', ' " . xls('DOB') . ": " . addslashes(oeFormatShortDate($result['DOB_YMD'])) . " " . xls('Age') . ": " . addslashes(getPatientAgeDisplay($result['DOB_YMD'])) . "'"; ?
>);
829 <?php
echo $date_init; ?
>
832 <!-- include support
for the
list-add selectbox feature
-->
833 <?php
include $GLOBALS['fileroot']."/library/options_listadd.inc"; ?
>
835 <?php
/*Include the validation script and rules for this form*/
837 //LBF forms use the new validation depending on the global value
838 $use_validate_js=$GLOBALS['new_validate'];
841 <?php
include_once("$srcdir/validation/validation_script.js.php");?
>
845 <script language
='JavaScript'>
846 var duplicateFieldsArray
=[];
848 //This code deals with demographics before save action -
849 <?php
if (($GLOBALS['gbl_edit_patient_form'] == '1') && (checkIfPatientValidationHookIsActive())) :?
>
851 //Use the Zend patient validation hook.
852 //TODO - get the edit part of patient validation hook to work smoothly and then
853 // remove the closeBeforeOpening=1 in the url below.
857 // Use hook to open the controller and get the new patient validation .
858 // when no params are sent this window will be closed from the zend controller.
859 var url
='<?php echo $GLOBALS['web_root
']."/interface/modules/zend_modules/public/patientvalidation";?>';
860 $
("#submit_btn").attr("name","btnSubmit");
861 $
("#submit_btn").attr("id","btnSubmit");
862 $
("#btnSubmit").click(function( event
) {
864 top
.restoreSession();
866 if(!submitme(<?php
echo $GLOBALS['new_validate'] ?
1 : 0;?
>,event
,'DEM',constraints
)){
867 event
.preventDefault();
870 somethingChanged
= false;
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 field_id FROM layout_options " .
876 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' AND " .
877 "(edit_options LIKE '%D%' OR edit_options LIKE '%E%') " .
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 .= "'" . text($field_id) . "'";
892 var flds
= new Array(<?php
echo $mflist; ?
>);
894 var valueIsChanged
=false;
895 for (var i
= 0; i
< flds
.length
; ++i
) {
896 var fval
= $
('#form_' + flds
[i
]).val();
897 if(duplicateFieldsArray
['#form_' + flds
[i
]]!=fval
) {
898 valueIsChanged
= true;
902 if (fval
&& fval
!= '') {
905 url +
= 'mf_' + flds
[i
] +
'=' +
encodeURIComponent(fval
);
910 //Only if check for duplicates values are changed open the popup hook screen
912 event
.preventDefault();
913 //("value has changed for duplicate check inputs");
914 url +
= '&page=edit&closeBeforeOpening=1&mf_id='+$
("[name='db_id']").val();
915 dlgopen(url
, '_blank', 700, 500);
917 else {//other wise submit me is a success just submit the form
924 $
(document
).ready(function(){
925 //When document is ready collect all the values Marked with D (check duplicate) stored in the db into array duplicateFieldsArray.
926 var flds
= new Array(<?php
echo $mflist; ?
>);
927 for (var i
= 0; i
< flds
.length
; ++i
) {
928 var fval
= $
('#form_' + flds
[i
]).val();
929 duplicateFieldsArray
['#form_' + flds
[i
]] = fval
;
932 <?php
require($GLOBALS['srcdir'] . '/js/xl/select2.js.php'); ?
>