4 * Copyright (C) 2009-2010 Rod Roark <rod@sunsetsystems.com>
5 * Copyright (C) 2017 Brady Miller <brady.g.miller@gmail.com>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>.
19 * @author Rod Roark <rod@sunsetsystems.com>
20 * @author Brady Miller <brady.g.miller@gmail.com>
21 * @link http://www.open-emr.org
25 require_once("../globals.php");
26 require_once("$srcdir/acl.inc");
27 require_once("$srcdir/options.inc.php");
28 require_once("$srcdir/patient.inc");
29 require_once("$srcdir/erx_javascript.inc.php");
30 require_once("$srcdir/validation/LBF_Validation.php");
31 require_once("$srcdir/patientvalidation.inc.php");
33 // Check authorization.
34 if (!acl_check('patients', 'demo', '', array('write','addonly'))) {
35 die("Adding demographics is not authorized.");
38 $CPR = 4; // cells per row
40 $searchcolor = empty($GLOBALS['layout_search_color']) ?
41 '#ffff55' : $GLOBALS['layout_search_color'];
43 $WITH_SEARCH = ($GLOBALS['full_new_patient_form'] == '1' ||
$GLOBALS['full_new_patient_form'] == '2' );
44 $SHORT_FORM = ($GLOBALS['full_new_patient_form'] == '2' ||
$GLOBALS['full_new_patient_form'] == '3' ||
$GLOBALS['full_new_patient_form'] == '4');
46 function getLayoutRes()
49 return sqlStatement("SELECT * FROM layout_options " .
50 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' " .
51 ($SHORT_FORM ?
"AND ( uor > 1 OR edit_options LIKE '%N%' ) " : "") .
52 "ORDER BY group_name, seq");
55 // Determine layout field search treatment from its data type:
60 function getSearchClass($data_type)
63 case 1: // single-selection list
64 case 10: // local provider list
65 case 11: // provider list
66 case 12: // pharmacy list
68 case 14: // address book list
69 case 26: // single-selection list with add
70 case 35: // facilities
81 $fres = getLayoutRes();
85 <?php
html_header_show(); ?
>
87 <link rel
="stylesheet" href
="<?php echo $css_header; ?>" type
="text/css">
88 <link rel
="stylesheet" href
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.min.css">
89 <link rel
="stylesheet" type
="text/css" href
="../../library/js/fancybox/jquery.fancybox-1.2.6.css" media
="screen" />
92 body
, td
, input
, select
, textarea
{
93 font
-family
: Arial
, Helvetica
, sans
-serif
;
98 padding
: 5pt
5pt
5pt
5pt
;
104 border
-color
: #0000ff;
111 <script type
="text/javascript" src
="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
112 <script type
="text/javascript" src
="../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script
>
113 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-9-1/index.js"></script
>
114 <script type
="text/javascript" src
="../../library/js/common.js?v=<?php echo $v_js_includes; ?>"></script
>
115 <script type
="text/javascript" src
="../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script
>
116 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.full.min.js"></script
>
118 <?php
include_once("{$GLOBALS['srcdir']}/options.js.php"); ?
>
120 <SCRIPT LANGUAGE
="JavaScript"><!--
121 //Visolve - sync the radio buttons - Start
122 if((top
.window
.parent
) && (parent
.window
)){
123 var wname
= top
.window
.parent
.left_nav
;
124 fname
= (parent
.window
.name
)?parent
.window
.name
:window
.name
;
126 }//Visolve - sync the radio buttons - End
128 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
130 // This may be changed to true by the AJAX search script.
131 var force_submit
= false;
133 //code used from http://tech.irt.org/articles/js037/
134 function replace(string,text
,by
) {
135 // Replaces text with by in string
136 var strLength
= string.length
, txtLength
= text
.length
;
137 if ((strLength
== 0) ||
(txtLength
== 0)) return string;
139 var i
= string.indexOf(text
);
140 if ((!i
) && (text
!= string.substring(0,txtLength
))) return string;
141 if (i
== -1) return string;
143 var newstr
= string.substring(0,i
) + by
;
145 if (i+txtLength
< strLength
)
146 newstr +
= replace(string.substring(i+txtLength
,strLength
),text
,by
);
151 <?php
for ($i=1; $i<=3; $i++
) { ?
>
152 function auto_populate_employer_address
<?php
echo $i ?
>(){
153 var f
= document
.demographics_form
;
154 if (f
.form_i
<?php
echo $i?
>subscriber_relationship
.options
[f
.form_i
<?php
echo $i?
>subscriber_relationship
.selectedIndex
].value
== "self") {
155 f
.i
<?php
echo $i?
>subscriber_fname
.value
=f
.form_fname
.value
;
156 f
.i
<?php
echo $i?
>subscriber_mname
.value
=f
.form_mname
.value
;
157 f
.i
<?php
echo $i?
>subscriber_lname
.value
=f
.form_lname
.value
;
158 f
.i
<?php
echo $i?
>subscriber_street
.value
=f
.form_street
.value
;
159 f
.i
<?php
echo $i?
>subscriber_city
.value
=f
.form_city
.value
;
160 f
.form_i
<?php
echo $i?
>subscriber_state
.value
=f
.form_state
.value
;
161 f
.i
<?php
echo $i?
>subscriber_postal_code
.value
=f
.form_postal_code
.value
;
162 if (f
.form_country_code
)
163 f
.form_i
<?php
echo $i?
>subscriber_country
.value
=f
.form_country_code
.value
;
164 f
.i
<?php
echo $i?
>subscriber_phone
.value
=f
.form_phone_home
.value
;
165 f
.i
<?php
echo $i?
>subscriber_DOB
.value
=f
.form_DOB
.value
;
166 f
.i
<?php
echo $i?
>subscriber_ss
.value
=f
.form_ss
.value
;
167 f
.form_i
<?php
echo $i?
>subscriber_sex
.value
= f
.form_sex
.value
;
168 f
.i
<?php
echo $i?
>subscriber_employer
.value
=f
.form_em_name
.value
;
169 f
.i
<?php
echo $i?
>subscriber_employer_street
.value
=f
.form_em_street
.value
;
170 f
.i
<?php
echo $i?
>subscriber_employer_city
.value
=f
.form_em_city
.value
;
171 f
.form_i
<?php
echo $i?
>subscriber_employer_state
.value
=f
.form_em_state
.value
;
172 f
.i
<?php
echo $i?
>subscriber_employer_postal_code
.value
=f
.form_em_postal_code
.value
;
173 if (f
.form_em_country
)
174 f
.form_i
<?php
echo $i?
>subscriber_employer_country
.value
=f
.form_em_country
.value
;
180 function upperFirst(string,text
) {
181 return replace(string,text
,text
.charAt(0).toUpperCase() + text
.substring(1,text
.length
));
184 // The ins_search.php window calls this to set the selected insurance.
185 function set_insurance(ins_id
, ins_name
) {
186 var thesel
= document
.forms
[0]['i' + insurance_index +
'provider'];
187 var theopts
= thesel
.options
; // the array of Option objects
189 for (; i
< theopts
.length
; ++i
) {
190 if (theopts
[i
].value
== ins_id
) {
191 theopts
[i
].selected
= true;
195 // no matching option was found so create one, append it to the
196 // end of the list, and select it.
197 theopts
[i
] = new Option(ins_name
, ins_id
, false, true);
200 // Indicates which insurance slot is being updated.
201 var insurance_index
= 0;
203 // The OnClick handler for searching/adding the insurance company.
204 function ins_search(ins
) {
205 insurance_index
= ins
;
209 function checkNum () {
210 var re
= new RegExp();
212 str
=document
.forms
[0].monthly_income
.value
;
216 alert("Please enter a dollar amount using only numbers and a decimal point.");
220 // This capitalizes the first letter of each word in the passed input
221 // element. It also strips out extraneous spaces.
222 function capitalizeMe(elem
) {
223 var a
= elem
.value
.split(' ');
225 for(var i
= 0; i
< a
.length
; ++i
) {
226 if (a
[i
].length
> 0) {
227 if (s
.length
> 0) s +
= ' ';
228 s +
= a
[i
].charAt(0).toUpperCase() + a
[i
].substring(1);
234 // Onkeyup handler for policy number. Allows only A-Z and 0-9.
235 function policykeyup(e
) {
236 var v
= e
.value
.toUpperCase();
237 var filteredString
="";
238 for (var i
= 0; i
< v
.length
; ++i
) {
240 if ((c
>= '0' && c
<= '9') ||
241 (c
>= 'A' && c
<= 'Z') ||
252 e
.value
= filteredString
;
256 function divclick(cb
, divid
) {
257 var divstyle
= document
.getElementById(divid
).style
;
259 divstyle
.display
= 'block';
261 divstyle
.display
= 'none';
266 // Compute the length of a string without leading and trailing spaces.
267 function trimlen(s
) {
269 var j
= s
.length
- 1;
270 for (; i
<= j
&& s
.charAt(i
) == ' '; ++i
);
271 for (; i
<= j
&& s
.charAt(j
) == ' '; --j
);
276 function validate(f
) {
277 var errMsgs
= new Array();
278 <?php
generate_layout_validation('DEM'); ?
>
279 <?php
if ($GLOBALS['erx_enable']) { ?
>
281 for(i
=0;i
<f
.length
;i++
){
282 if(f
[i
].type
=='text' && f
[i
].value
)
284 if(f
[i
].name
== 'form_fname' || f
[i
].name
== 'form_mname' || f
[i
].name
== 'form_lname')
286 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
287 alertMsg +
= checkUsername(f
[i
].name
,f
[i
].value
);
289 else if(f
[i
].name
== 'form_street' || f
[i
].name
== 'form_city')
291 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
292 alertMsg +
= checkAlphaNumericExtended(f
[i
].name
,f
[i
].value
);
294 else if(f
[i
].name
== 'form_phone_home')
296 alertMsg +
= checkPhone(f
[i
].name
,f
[i
].value
);
307 msg +
= "<?php echo htmlspecialchars(xl('The following fields are required'), ENT_QUOTES); ?>:\n\n";
308 for ( var i
= 0; i
< errMsgs
.length
; i++
) {
309 msg +
= errMsgs
[i
] +
"\n";
311 msg +
= "\n<?php echo htmlspecialchars(xl('Please fill them in before continuing.'), ENT_QUOTES); ?>";
314 //Misc Deceased Date Validation for Future Date
315 var dateVal
= document
.getElementById("form_deceased_date").value
;
318 month
= '' +
(d
.getMonth() +
1),
319 day
= '' + d
.getDate(),
320 year
= d
.getFullYear();
321 if (month
.length
< 2) month
= '0' + month
;
322 if (day
.length
< 2) day
= '0' + day
;
323 currentDate
= year+
'-'+month+
'-'+day
;
324 if(errMsgs
.length
> 0 || dateVal
> currentDate
)
326 if(errMsgs
.length
> 0)
328 if(dateVal
> currentDate
)
329 alert ('<?php echo xls("Deceased Date should not be greater than Today"); ?>');
335 function toggleSearch(elem
) {
336 var f
= document
.forms
[0];
337 <?php
if ($WITH_SEARCH) { ?
>
338 // Toggle background color.
339 if (elem
.style
.backgroundColor
== '')
340 elem
.style
.backgroundColor
= '<?php echo $searchcolor; ?>';
342 elem
.style
.backgroundColor
= '';
345 force_submit
= false;
346 f
.create
.value
= '<?php xl('Create
New Patient
', 'e
'); ?>';
351 // If a <select> list is dropped down, this is its name.
352 var open_sel_name
= '';
354 function selClick(elem
) {
355 if (open_sel_name
== elem
.name
) {
359 open_sel_name
= elem
.name
;
365 function selBlur(elem
) {
366 if (open_sel_name
== elem
.name
) {
372 // This invokes the patient search dialog.
373 function searchme() {
374 var f
= document
.forms
[0];
375 var url
= '../main/finder/patient_select.php?popup=1';
378 $lres = getLayoutRes();
380 while ($lrow = sqlFetchArray($lres)) {
381 $field_id = $lrow['field_id'];
382 if (strpos($field_id, 'em_') === 0) {
386 $data_type = $lrow['data_type'];
387 $fldname = "form_$field_id";
388 switch (getSearchClass($data_type)) {
391 " if (f.$fldname.style.backgroundColor != '' && trimlen(f.$fldname.value) > 0) {\n" .
392 " url += '&$field_id=' + encodeURIComponent(f.$fldname.value);\n" .
397 " if (f.$fldname.style.backgroundColor != '' && f.$fldname.selectedIndex > 0) {\n" .
398 " url += '&$field_id=' + encodeURIComponent(f.$fldname.options[f.$fldname.selectedIndex].value);\n" .
405 dlgopen(url
, '_blank', 700, 500);
413 <body
class="body_top">
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 <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)'>
423 <span
class='title'><?php
xl('Search or Add Patient', 'e'); ?
></span
>
425 <table width
='100%' cellpadding
='0' cellspacing
='8'>
427 <td align
='left' valign
='top'>
428 <?php
if ($SHORT_FORM) {
435 global $item_count, $cell_count;
436 if ($item_count > 0) {
444 global $cell_count, $CPR;
446 if ($cell_count > 0) {
447 for (; $cell_count < $CPR;
459 global $last_group, $SHORT_FORM;
460 if (strlen($last_group) > 0) {
472 $display_style = 'block';
473 $group_seq = 0; // this gives the DIV blocks unique IDs
475 while ($frow = sqlFetchArray($fres)) {
476 $this_group = $frow['group_name'];
477 $titlecols = $frow['titlecols'];
478 $datacols = $frow['datacols'];
479 $data_type = $frow['data_type'];
480 $field_id = $frow['field_id'];
481 $list_id = $frow['list_id'];
483 $condition_str = get_conditions_str($condition_str, $group_fields);
485 if (strpos($field_id, 'em_') === 0) {
486 $tmp = substr($field_id, 3);
487 if (isset($result2[$tmp])) {
488 $currvalue = $result2[$tmp];
491 if (isset($result[$field_id])) {
492 $currvalue = $result[$field_id];
496 // Handle a data category (group) change.
497 if (strcmp($this_group, $last_group) != 0) {
500 $group_seq++
; // ID for DIV tags
501 $group_name = substr($this_group, 1);
502 if (strlen($last_group) > 0) {
506 echo "<span class='bold'><input type='checkbox' name='form_cb_$group_seq' id='form_cb_$group_seq' value='1' " .
507 "onclick='return divclick(this,\"div_$group_seq\");'";
508 if ($display_style == 'block') {
512 // Modified 6-09 by BM - Translate if applicable
513 echo " /><b>" . xl_layout_label($group_name) . "</b></span>\n";
515 echo "<div id='div_$group_seq' class='section' style='display:$display_style;'>\n";
516 echo " <table border='0' cellpadding='0'>\n";
517 $display_style = 'none';
518 } else if (strlen($last_group) == 0) {
519 echo " <table border='0' cellpadding='0'>\n";
522 $last_group = $this_group;
525 // Handle starting of a new row.
526 if (($titlecols > 0 && $cell_count >= $CPR) ||
$cell_count == 0) {
531 if ($item_count == 0 && $titlecols == 0) {
535 $field_id_label='label_'.$frow['field_id'];
536 // Handle starting of a new label cell.
537 if ($titlecols > 0) {
539 echo "<td colspan='$titlecols' id='$field_id_label'";
540 echo ($frow['uor'] == 2) ?
" class='required'" : " class='bold'";
541 if ($cell_count == 2) {
542 echo " style='padding-left:10pt'";
546 $cell_count +
= $titlecols;
553 // Modified 6-09 by BM - Translate if applicable
554 if ($frow['title']) {
555 echo (xl_layout_label($frow['title']).":");
562 // Handle starting of a new data cell.
564 $id_field_text = "text_".$frow['field_id'];
566 echo "<td colspan='$datacols' class='text data'";
567 if ($cell_count > 0) {
568 echo " style='padding-left:5pt'". " id='".$id_field_text."'";
572 $cell_count +
= $datacols;
576 generate_form_field($frow, $currvalue);
583 if (! $GLOBALS['simplified_demographics']) {
584 $insurancei = getInsuranceProviders();
586 $insurance_headings = array(xl("Primary Insurance Provider"), xl("Secondary Insurance Provider"), xl("Tertiary Insurance provider"));
587 $insurance_info = array();
588 $insurance_info[1] = getInsuranceData($pid, "primary");
589 $insurance_info[2] = getInsuranceData($pid, "secondary");
590 $insurance_info[3] = getInsuranceData($pid, "tertiary");
592 echo "<br /><span class='bold'><input type='checkbox' name='form_cb_ins' value='1' " .
593 "onclick='return divclick(this,\"div_ins\");'";
594 if ($display_style == 'block') {
598 echo " /><b>" . xl('Insurance') . "</b></span>\n";
599 echo "<div id='div_ins' class='section' style='display:$display_style;'>\n";
601 for ($i=1; $i<=3; $i++
) {
602 $result3 = $insurance_info[$i];
606 <td valign
='top' colspan
='2'>
607 <span
class='required'><?php
echo $insurance_headings[$i -1].":"?
></span
>
608 <select name
="i<?php echo $i?>provider">
609 <option value
=""><?php
xl('Unassigned', 'e'); ?
></option
>
611 foreach ($insurancei as $iid => $iname) {
612 echo "<option value='" . $iid . "'";
613 if (strtolower($iid) == strtolower($result3{"provider"})) {
617 echo ">" . $iname . "</option>\n";
620 </select
> 
;<a
class='iframe medium_modal' href
='../practice/ins_search.php' onclick
='ins_search(<?php echo $i?>)'>
621 <span
> <?php
xl('Search/Add Insurer', 'e'); ?
></span
></a
>
630 <span
class='required'><?php
xl('Plan Name', 'e'); ?
>: </span
>
633 <input type
='entry' size
='20' name
='i<?php echo $i?>plan_name' value
="<?php echo $result3{"plan_name
"} ?>"
634 onchange
="capitalizeMe(this);" /> 
; 
;
640 <span
class='required'><?php
xl('Effective Date', 'e'); ?
>: </span
>
643 <input type
='entry' size
='11' class='datepicker' name
='i<?php echo $i ?>effective_date'
644 id
='i<?php echo $i ?>effective_date'
645 value
='<?php echo $result3['date
'] ?>'
646 title
='yyyy-mm-dd' />
651 <td
><span
class=required
><?php
xl('Policy Number', 'e'); ?
>: </span
></td
>
652 <td
><input type
='entry' size
='16' name
='i<?php echo $i?>policy_number' value
="<?php echo $result3{"policy_number
"}?>"
653 onkeyup
='policykeyup(this)'></td
>
657 <td
><span
class=required
><?php
xl('Group Number', 'e'); ?
>: </span
></td
><td
><input type
=entry size
=16 name
=i
<?php
echo $i?
>group_number value
="<?php echo $result3{"group_number
"}?>" onkeyup
='policykeyup(this)'></td
>
660 <tr
<?php
if ($GLOBALS['omit_employers']) {
661 echo " style='display:none'";
663 <td
class='required'><?php
xl('Subscriber Employer (SE)', 'e'); ?
><br
><span style
='font-weight:normal'>
664 (<?php
xl('if unemployed enter Student', 'e'); ?
>,<br
><?php
xl('PT Student, or leave blank', 'e'); ?
>): </span
></td
>
665 <td
><input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_employer
666 value
="<?php echo $result3{"subscriber_employer
"}?>"
667 onchange
="capitalizeMe(this);" /></td
>
670 <tr
<?php
if ($GLOBALS['omit_employers']) {
671 echo " style='display:none'";
673 <td
><span
class=required
><?php
xl('SE Address', 'e'); ?
>: </span
></td
>
674 <td
><input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_employer_street
675 value
="<?php echo $result3{"subscriber_employer_street
"}?>"
676 onchange
="capitalizeMe(this);" /></td
>
679 <tr
<?php
if ($GLOBALS['omit_employers']) {
680 echo " style='display:none'";
685 <td
><span
class=required
><?php
xl('SE City', 'e'); ?
>: </span
></td
>
686 <td
><input type
=entry size
=15 name
=i
<?php
echo $i?
>subscriber_employer_city
687 value
="<?php echo $result3{"subscriber_employer_city
"}?>"
688 onchange
="capitalizeMe(this);" /></td
>
689 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('SE State', 'e') : xl('SE Locality', 'e') ?
>: </span
></td
>
692 // Modified 7/2009 by BM to incorporate data types
693 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']);
698 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('SE Zip Code', 'e') : xl('SE Postal Code', 'e') ?
>: </span
></td
>
699 <td
><input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_employer_postal_code value
="<?php echo $result3{"subscriber_employer_postal_code
"}?>"></td
>
700 <td
><span
class=required
><?php
xl('SE Country', 'e'); ?
>: </span
></td
>
703 // Modified 7/2009 by BM to incorporate data types
704 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']);
716 <span
class=required
><?php
xl('Subscriber', 'e'); ?
>: </span
>
717 <input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_fname
718 value
="<?php echo $result3{"subscriber_fname
"}?>"
719 onchange
="capitalizeMe(this);" />
720 <input type
=entry size
=3 name
=i
<?php
echo $i?
>subscriber_mname
721 value
="<?php echo $result3{"subscriber_mname
"}?>"
722 onchange
="capitalizeMe(this);" />
723 <input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_lname
724 value
="<?php echo $result3{"subscriber_lname
"}?>"
725 onchange
="capitalizeMe(this);" />
727 <span
class=required
><?php
xl('Relationship', 'e'); ?
>: </span
>
729 // Modified 6/2009 by BM to use list_options and function
730 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_relationship'),'list_id'=>'sub_relation','empty_title'=>' '), $result3['subscriber_relationship']);
732 <a href
="javascript:popUp('../../interface/patient_file/summary/browse.php?browsenum=<?php echo $i?>')" class=text
>(<?php
xl('Browse', 'e'); ?
>)</a
><br
/>
734 <span
class=bold
><?php
xl('D.O.B.', 'e'); ?
>: </span
>
735 <input type
='entry' size
='11' class='datepicker' name
='i<?php echo $i?>subscriber_DOB'
736 id
='i<?php echo $i?>subscriber_DOB'
737 value
='<?php echo $result3['subscriber_DOB
'] ?>'
738 title
='yyyy-mm-dd' />
740 <span
class=bold
><?php
xl('S.S.', 'e'); ?
>: </span
><input type
=entry size
=11 name
=i
<?php
echo $i?
>subscriber_ss value
="<?php echo $result3{"subscriber_ss
"}?>"> 
;
741 <span
class=bold
><?php
xl('Sex', 'e'); ?
>: </span
>
743 // Modified 6/2009 by BM to use list_options and function
744 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_sex'),'list_id'=>'sex'), $result3['subscriber_sex']);
747 <span
class=required
><?php
xl('Subscriber Address', 'e'); ?
>: </span
>
748 <input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_street
749 value
="<?php echo $result3{"subscriber_street
"}?>"
750 onchange
="capitalizeMe(this);" /><br
>
751 <span
class=required
><?php
xl('City', 'e'); ?
>: </span
>
752 <input type
=entry size
=15 name
=i
<?php
echo $i?
>subscriber_city
753 value
="<?php echo $result3{"subscriber_city
"}?>"
754 onchange
="capitalizeMe(this);" />
755 <span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('State', 'e') : xl('Locality', 'e') ?
>: </span
>
757 // Modified 7/2009 by BM to incorporate data types
758 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']);
761 <span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('Zip Code', 'e') : xl('Postal Code', 'e') ?
>: </span
><input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_postal_code value
="<?php echo $result3{"subscriber_postal_code
"}?>">
762 <span
class='required'<?php
if ($GLOBALS['omit_employers']) {
763 echo " style='display:none'";
765 <?php
xl('Country', 'e'); ?
>: </span
>
767 // Modified 7/2009 by BM to incorporate data types
768 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']);
771 <span
class=bold
><?php
xl('Subscriber Phone', 'e'); ?
>:
772 <input type
='text' size
='20' name
='i<?php echo $i?>subscriber_phone' value
='<?php echo $result3["subscriber_phone"] ?>' onkeyup
='phonekeyup(this,mypcc)' />
774 <span
class=bold
><?php
xl('CoPay', 'e'); ?
>: <input type
=text size
="6" name
=i
<?php
echo $i?
>copay value
="<?php echo $result3{"copay
"}?>">
776 <span
class='required'><?php
xl('Accept Assignment', 'e'); ?
>: </span
>
777 <select name
=i
<?php
echo $i?
>accept_assignment
>
778 <option value
="TRUE" <?php
if (strtoupper($result3{"accept_assignment"}) == "TRUE") {
780 }?
>><?php
xl('YES', 'e'); ?
></option
>
781 <option value
="FALSE" <?php
if (strtoupper($result3{"accept_assignment"}) == "FALSE") {
783 }?
>><?php
xl('NO', 'e'); ?
></option
>
794 } // end of "if not simplified_demographics"
797 <?php
if (!$SHORT_FORM) {
801 <?php
if ($WITH_SEARCH) { ?
>
802 <input type
="button" id
="search" value
=<?php
xl('Search', 'e', '\'', '\''); ?
>
803 style
='background-color:<?php echo $searchcolor; ?>' />
806 <input type
="button" name
='create' id
="create" value
=<?php
xl('Create New Patient', 'e', '\'', '\''); ?
> />
811 <td align
='right' valign
='top' width
='1%' nowrap
>
812 <!-- Image upload stuff was here but got moved
. -->
819 <!-- include support
for the
list-add selectbox feature
-->
820 <?php
include($GLOBALS['fileroot']."/library/options_listadd.inc"); ?
>
824 <script language
="JavaScript">
826 // hard code validation for old validation, in the new validation possible to add match rules
827 <?php
if ($GLOBALS['new_validate'] == 0) { ?
>
829 // fix inconsistently formatted phone numbers from the database
830 var f
= document
.forms
[0];
831 if (f
.form_phone_contact
) phonekeyup(f
.form_phone_contact
,mypcc
);
832 if (f
.form_phone_home
) phonekeyup(f
.form_phone_home
,mypcc
);
833 if (f
.form_phone_biz
) phonekeyup(f
.form_phone_biz
,mypcc
);
834 if (f
.form_phone_cell
) phonekeyup(f
.form_phone_cell
,mypcc
);
838 <?php
echo $date_init; ?
>
840 // -=- jQuery makes life easier -=-
842 // var matches = 0; // number of patients that match the demographic information being entered
843 // var override = false; // flag that overrides the duplication warning
845 $
(document
).ready(function() {
847 $
(".medium_modal").fancybox( {
848 'overlayOpacity' : 0.0,
849 'showCloseButton' : true,
853 // added to integrate insurance stuff
854 <?php
for ($i=1; $i<=3; $i++
) { ?
>
855 $
("#form_i<?php echo $i?>subscriber_relationship").change(function() { auto_populate_employer_address
<?php
echo $i?
>(); });
858 $
('#search').click(function() { searchme(); });
859 $
('#create').click(function() { check()});
861 var check
= function(e
) {
862 <?php
if ($GLOBALS['new_validate']) {?
>
863 var valid
= submitme(<?php
echo $GLOBALS['new_validate'] ?
1 : 0;?
>,e
,"DEM",constraints
);
865 top
.restoreSession();
866 var f
= document
.forms
[0];
867 var valid
= validate(f
);
871 // In this case dups were shown already and Save should just save.
872 top
.restoreSession();
878 // D in edit_options indicates the field is used in duplication checking.
879 // This constructs a list of the names of those fields.
881 $mfres = sqlStatement("SELECT * FROM layout_options " .
882 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' AND " .
883 "(edit_options LIKE '%D%' OR edit_options LIKE '%W%' )" .
884 "ORDER BY group_name, seq");
885 while ($mfrow = sqlFetchArray($mfres)) {
886 $field_id = $mfrow['field_id'];
887 if (strpos($field_id, 'em_') === 0) {
891 if (!empty($mflist)) {
895 $mflist .= "'" . htmlentities($field_id) . "'";
898 <?php
if (($GLOBALS['full_new_patient_form'] == '4') && (checkIfPatientValidationHookIsActive())) :?
>
899 // Use zend module patient validation hook to open the controller and send the dup-checker fields.
900 var url
='<?php echo $GLOBALS['web_root
']."/interface/modules/zend_modules/public/patientvalidation";?>';
902 // Build and invoke the URL to create the dup-checker dialog.
903 var url
= 'new_search_popup.php';
906 var flds
= new Array(<?php
echo $mflist; ?
>);
908 for (var i
= 0; i
< flds
.length
; ++i
) {
909 var fval
= $
('#form_' + flds
[i
]).val();
910 if (fval
&& fval
!= '') {
913 url +
= 'mf_' + flds
[i
] +
'=' +
encodeURIComponent(fval
);
917 dlgopen(url
, '_blank', 700, 500);
922 // Set onclick/onfocus handlers for toggling background color.
924 $lres = getLayoutRes();
925 while ($lrow = sqlFetchArray($lres)) {
926 $field_id = $lrow['field_id'];
927 if (strpos($field_id, 'em_') === 0) {
931 switch (getSearchClass($lrow['data_type'])) {
933 echo " \$('#form_$field_id').click(function() { toggleSearch(this); });\n";
936 echo " \$('#form_$field_id').click(function() { selClick(this); });\n";
937 echo " \$('#form_$field_id').blur(function() { selBlur(this); });\n";
943 $
('.datepicker').datetimepicker({
944 <?php
$datetimepicker_timepicker = false; ?
>
945 <?php
$datetimepicker_showseconds = false; ?
>
946 <?php
$datetimepicker_formatInput = false; ?
>
947 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
948 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
950 $
('.datetimepicker').datetimepicker({
951 <?php
$datetimepicker_timepicker = true; ?
>
952 <?php
$datetimepicker_showseconds = false; ?
>
953 <?php
$datetimepicker_formatInput = false; ?
>
954 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
955 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
958 }); // end document.ready
961 <?php
/*Include the validation script and rules for this form*/
966 //LBF forms use the new validation depending on the global value
967 $use_validate_js=$GLOBALS['new_validate'];
968 include_once("$srcdir/validation/validation_script.js.php");?
>
969 <script language
='JavaScript'>
970 // Array of skip conditions for the checkSkipConditions() function.
972 <?php
echo $condition_str; ?
>
974 checkSkipConditions();
975 $
("input").change(function() {
976 checkSkipConditions();
978 $
("select").change(function() {
979 checkSkipConditions();