2 // Copyright (C) 2009-2010 Rod Roark <rod@sunsetsystems.com>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 require_once("../globals.php");
10 require_once("$srcdir/acl.inc");
11 require_once("$srcdir/options.inc.php");
12 require_once("$srcdir/patient.inc");
13 require_once("$srcdir/erx_javascript.inc.php");
14 require_once("$srcdir/validation/LBF_Validation.php");
15 require_once ("$srcdir/patientvalidation.inc.php");
17 // Check authorization.
18 if (!acl_check('patients','demo','',array('write','addonly') ))
19 die("Adding demographics is not authorized.");
21 $CPR = 4; // cells per row
23 $searchcolor = empty($GLOBALS['layout_search_color']) ?
24 '#ffff55' : $GLOBALS['layout_search_color'];
26 $WITH_SEARCH = ($GLOBALS['full_new_patient_form'] == '1' ||
$GLOBALS['full_new_patient_form'] == '2' ||
$GLOBALS['full_new_patient_form'] == '4');
27 $SHORT_FORM = ($GLOBALS['full_new_patient_form'] == '2' ||
$GLOBALS['full_new_patient_form'] == '3' );
29 function getLayoutRes() {
31 return sqlStatement("SELECT * FROM layout_options " .
32 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' " .
33 ($SHORT_FORM ?
"AND ( uor > 1 OR edit_options LIKE '%N%' ) " : "") .
34 "ORDER BY group_name, seq");
37 // Determine layout field search treatment from its data type:
42 function getSearchClass($data_type) {
44 case 1: // single-selection list
45 case 10: // local provider list
46 case 11: // provider list
47 case 12: // pharmacy list
49 case 14: // address book list
50 case 26: // single-selection list with add
51 case 35: // facilities
61 $fres = getLayoutRes();
65 <?php
html_header_show(); ?
>
67 <link rel
="stylesheet" href
="<?php echo $css_header; ?>" type
="text/css">
70 body
, td
, input
, select
, textarea
{
71 font
-family
: Arial
, Helvetica
, sans
-serif
;
76 padding
: 5pt
5pt
5pt
5pt
;
82 border
-color
: #0000ff;
89 <style type
="text/css">@import
url(../../library
/dynarch_calendar
.css
);</style
>
91 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
92 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
93 <script type
="text/javascript" src
="../../library/dynarch_calendar.js"></script
>
94 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
95 <script type
="text/javascript" src
="../../library/dynarch_calendar_setup.js"></script
>
96 <script type
="text/javascript" src
="../../library/js/jquery-1.9.1.min.js"></script
>
97 <script type
="text/javascript" src
="../../library/js/common.js"></script
>
98 <script type
="text/javascript" src
="../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script
>
99 <?php
include_once("{$GLOBALS['srcdir']}/options.js.php"); ?
>
100 <link rel
="stylesheet" type
="text/css" href
="../../library/js/fancybox/jquery.fancybox-1.2.6.css" media
="screen" />
102 <SCRIPT LANGUAGE
="JavaScript"><!--
103 //Visolve - sync the radio buttons - Start
104 if((top
.window
.parent
) && (parent
.window
)){
105 var wname
= top
.window
.parent
.left_nav
;
106 fname
= (parent
.window
.name
)?parent
.window
.name
:window
.name
;
108 wname
.setRadio(fname
, "new");
109 }//Visolve - sync the radio buttons - End
111 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
113 // This may be changed to true by the AJAX search script.
114 var force_submit
= false;
116 //code used from http://tech.irt.org/articles/js037/
117 function replace(string,text
,by
) {
118 // Replaces text with by in string
119 var strLength
= string.length
, txtLength
= text
.length
;
120 if ((strLength
== 0) ||
(txtLength
== 0)) return string;
122 var i
= string.indexOf(text
);
123 if ((!i
) && (text
!= string.substring(0,txtLength
))) return string;
124 if (i
== -1) return string;
126 var newstr
= string.substring(0,i
) + by
;
128 if (i+txtLength
< strLength
)
129 newstr +
= replace(string.substring(i+txtLength
,strLength
),text
,by
);
134 <?php
for ($i=1;$i<=3;$i++
) { ?
>
135 function auto_populate_employer_address
<?php
echo $i ?
>(){
136 var f
= document
.demographics_form
;
137 if (f
.form_i
<?php
echo $i?
>subscriber_relationship
.options
[f
.form_i
<?php
echo $i?
>subscriber_relationship
.selectedIndex
].value
== "self") {
138 f
.i
<?php
echo $i?
>subscriber_fname
.value
=f
.form_fname
.value
;
139 f
.i
<?php
echo $i?
>subscriber_mname
.value
=f
.form_mname
.value
;
140 f
.i
<?php
echo $i?
>subscriber_lname
.value
=f
.form_lname
.value
;
141 f
.i
<?php
echo $i?
>subscriber_street
.value
=f
.form_street
.value
;
142 f
.i
<?php
echo $i?
>subscriber_city
.value
=f
.form_city
.value
;
143 f
.form_i
<?php
echo $i?
>subscriber_state
.value
=f
.form_state
.value
;
144 f
.i
<?php
echo $i?
>subscriber_postal_code
.value
=f
.form_postal_code
.value
;
145 if (f
.form_country_code
)
146 f
.form_i
<?php
echo $i?
>subscriber_country
.value
=f
.form_country_code
.value
;
147 f
.i
<?php
echo $i?
>subscriber_phone
.value
=f
.form_phone_home
.value
;
148 f
.i
<?php
echo $i?
>subscriber_DOB
.value
=f
.form_DOB
.value
;
149 f
.i
<?php
echo $i?
>subscriber_ss
.value
=f
.form_ss
.value
;
150 f
.form_i
<?php
echo $i?
>subscriber_sex
.value
= f
.form_sex
.value
;
151 f
.i
<?php
echo $i?
>subscriber_employer
.value
=f
.form_em_name
.value
;
152 f
.i
<?php
echo $i?
>subscriber_employer_street
.value
=f
.form_em_street
.value
;
153 f
.i
<?php
echo $i?
>subscriber_employer_city
.value
=f
.form_em_city
.value
;
154 f
.form_i
<?php
echo $i?
>subscriber_employer_state
.value
=f
.form_em_state
.value
;
155 f
.i
<?php
echo $i?
>subscriber_employer_postal_code
.value
=f
.form_em_postal_code
.value
;
156 if (f
.form_em_country
)
157 f
.form_i
<?php
echo $i?
>subscriber_employer_country
.value
=f
.form_em_country
.value
;
163 function upperFirst(string,text
) {
164 return replace(string,text
,text
.charAt(0).toUpperCase() + text
.substring(1,text
.length
));
167 // The ins_search.php window calls this to set the selected insurance.
168 function set_insurance(ins_id
, ins_name
) {
169 var thesel
= document
.forms
[0]['i' + insurance_index +
'provider'];
170 var theopts
= thesel
.options
; // the array of Option objects
172 for (; i
< theopts
.length
; ++i
) {
173 if (theopts
[i
].value
== ins_id
) {
174 theopts
[i
].selected
= true;
178 // no matching option was found so create one, append it to the
179 // end of the list, and select it.
180 theopts
[i
] = new Option(ins_name
, ins_id
, false, true);
183 // Indicates which insurance slot is being updated.
184 var insurance_index
= 0;
186 // The OnClick handler for searching/adding the insurance company.
187 function ins_search(ins
) {
188 insurance_index
= ins
;
192 function checkNum () {
193 var re
= new RegExp();
195 str
=document
.forms
[0].monthly_income
.value
;
199 alert("Please enter a dollar amount using only numbers and a decimal point.");
203 // This capitalizes the first letter of each word in the passed input
204 // element. It also strips out extraneous spaces.
205 function capitalizeMe(elem
) {
206 var a
= elem
.value
.split(' ');
208 for(var i
= 0; i
< a
.length
; ++i
) {
209 if (a
[i
].length
> 0) {
210 if (s
.length
> 0) s +
= ' ';
211 s +
= a
[i
].charAt(0).toUpperCase() + a
[i
].substring(1);
217 // Onkeyup handler for policy number. Allows only A-Z and 0-9.
218 function policykeyup(e
) {
219 var v
= e
.value
.toUpperCase();
220 var filteredString
="";
221 for (var i
= 0; i
< v
.length
; ++i
) {
223 if ((c
>= '0' && c
<= '9') ||
224 (c
>= 'A' && c
<= 'Z') ||
235 e
.value
= filteredString
;
239 function divclick(cb
, divid
) {
240 var divstyle
= document
.getElementById(divid
).style
;
242 divstyle
.display
= 'block';
244 divstyle
.display
= 'none';
249 // Compute the length of a string without leading and trailing spaces.
250 function trimlen(s
) {
252 var j
= s
.length
- 1;
253 for (; i
<= j
&& s
.charAt(i
) == ' '; ++i
);
254 for (; i
<= j
&& s
.charAt(j
) == ' '; --j
);
259 function validate(f
) {
260 var errMsgs
= new Array();
261 <?php
generate_layout_validation('DEM'); ?
>
262 <?php
if($GLOBALS['erx_enable']){ ?
>
264 for(i
=0;i
<f
.length
;i++
){
265 if(f
[i
].type
=='text' && f
[i
].value
)
267 if(f
[i
].name
== 'form_fname' || f
[i
].name
== 'form_mname' || f
[i
].name
== 'form_lname')
269 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
270 alertMsg +
= checkUsername(f
[i
].name
,f
[i
].value
);
272 else if(f
[i
].name
== 'form_street' || f
[i
].name
== 'form_city')
274 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
275 alertMsg +
= checkAlphaNumericExtended(f
[i
].name
,f
[i
].value
);
277 else if(f
[i
].name
== 'form_phone_home')
279 alertMsg +
= checkPhone(f
[i
].name
,f
[i
].value
);
290 msg +
= "<?php echo htmlspecialchars(xl('The following fields are required'),ENT_QUOTES); ?>:\n\n";
291 for ( var i
= 0; i
< errMsgs
.length
; i++
) {
292 msg +
= errMsgs
[i
] +
"\n";
294 msg +
= "\n<?php echo htmlspecialchars(xl('Please fill them in before continuing.'),ENT_QUOTES); ?>";
297 //Misc Deceased Date Validation for Future Date
298 var dateVal
= document
.getElementById("form_deceased_date").value
;
301 month
= '' +
(d
.getMonth() +
1),
302 day
= '' + d
.getDate(),
303 year
= d
.getFullYear();
304 if (month
.length
< 2) month
= '0' + month
;
305 if (day
.length
< 2) day
= '0' + day
;
306 currentDate
= year+
'-'+month+
'-'+day
;
307 if(errMsgs
.length
> 0 || dateVal
> currentDate
)
309 if(errMsgs
.length
> 0)
311 if(dateVal
> currentDate
)
312 alert ('<?php echo xls("Deceased Date should not be greater than Today"); ?>');
318 function toggleSearch(elem
) {
319 var f
= document
.forms
[0];
320 <?php
if ($WITH_SEARCH) { ?
>
321 // Toggle background color.
322 if (elem
.style
.backgroundColor
== '')
323 elem
.style
.backgroundColor
= '<?php echo $searchcolor; ?>';
325 elem
.style
.backgroundColor
= '';
328 force_submit
= false;
329 f
.create
.value
= '<?php xl('Create
New Patient
','e
'); ?>';
334 // If a <select> list is dropped down, this is its name.
335 var open_sel_name
= '';
337 function selClick(elem
) {
338 if (open_sel_name
== elem
.name
) {
342 open_sel_name
= elem
.name
;
348 function selBlur(elem
) {
349 if (open_sel_name
== elem
.name
) {
355 // This invokes the patient search dialog.
356 function searchme() {
357 var f
= document
.forms
[0];
358 var url
= '../main/finder/patient_select.php?popup=1';
361 $lres = getLayoutRes();
363 while ($lrow = sqlFetchArray($lres)) {
364 $field_id = $lrow['field_id'];
365 if (strpos($field_id, 'em_') === 0) continue;
366 $data_type = $lrow['data_type'];
367 $fldname = "form_$field_id";
368 switch(getSearchClass($data_type)) {
371 " if (f.$fldname.style.backgroundColor != '' && trimlen(f.$fldname.value) > 0) {\n" .
372 " url += '&$field_id=' + encodeURIComponent(f.$fldname.value);\n" .
377 " if (f.$fldname.style.backgroundColor != '' && f.$fldname.selectedIndex > 0) {\n" .
378 " url += '&$field_id=' + encodeURIComponent(f.$fldname.options[f.$fldname.selectedIndex].value);\n" .
385 dlgopen(url
, '_blank', 700, 500);
393 <body
class="body_top">
396 /*Get the constraint from the DB-> LBF forms accordinf the form_id*/
397 $constraints = LBF_Validation
::generate_validate_constraints("DEM");
399 <script
> var constraints
= <?php
echo $constraints;?
>; </script
>
401 <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)'>
403 <span
class='title'><?php
xl('Search or Add Patient','e'); ?
></span
>
405 <table width
='100%' cellpadding
='0' cellspacing
='8'>
407 <td align
='left' valign
='top'>
408 <?php
if ($SHORT_FORM) echo " <center>\n"; ?
>
411 function end_cell() {
412 global $item_count, $cell_count;
413 if ($item_count > 0) {
420 global $cell_count, $CPR;
422 if ($cell_count > 0) {
423 for (; $cell_count < $CPR; ++
$cell_count) echo "<td></td>";
429 function end_group() {
430 global $last_group, $SHORT_FORM;
431 if (strlen($last_group) > 0) {
434 if (!$SHORT_FORM) echo "</div>\n";
441 $display_style = 'block';
442 $group_seq = 0; // this gives the DIV blocks unique IDs
444 while ($frow = sqlFetchArray($fres)) {
445 $this_group = $frow['group_name'];
446 $titlecols = $frow['titlecols'];
447 $datacols = $frow['datacols'];
448 $data_type = $frow['data_type'];
449 $field_id = $frow['field_id'];
450 $list_id = $frow['list_id'];
452 $condition_str = get_conditions_str($condition_str,$group_fields);
454 if (strpos($field_id, 'em_') === 0) {
455 $tmp = substr($field_id, 3);
456 if (isset($result2[$tmp])) $currvalue = $result2[$tmp];
459 if (isset($result[$field_id])) $currvalue = $result[$field_id];
462 // Handle a data category (group) change.
463 if (strcmp($this_group, $last_group) != 0) {
466 $group_seq++
; // ID for DIV tags
467 $group_name = substr($this_group, 1);
468 if (strlen($last_group) > 0) echo "<br />";
469 echo "<span class='bold'><input type='checkbox' name='form_cb_$group_seq' id='form_cb_$group_seq' value='1' " .
470 "onclick='return divclick(this,\"div_$group_seq\");'";
471 if ($display_style == 'block') echo " checked";
473 // Modified 6-09 by BM - Translate if applicable
474 echo " /><b>" . xl_layout_label($group_name) . "</b></span>\n";
476 echo "<div id='div_$group_seq' class='section' style='display:$display_style;'>\n";
477 echo " <table border='0' cellpadding='0'>\n";
478 $display_style = 'none';
480 else if (strlen($last_group) == 0) {
481 echo " <table border='0' cellpadding='0'>\n";
483 $last_group = $this_group;
486 // Handle starting of a new row.
487 if (($titlecols > 0 && $cell_count >= $CPR) ||
$cell_count == 0) {
492 if ($item_count == 0 && $titlecols == 0) $titlecols = 1;
493 $field_id_label='label_'.$frow['field_id'];
494 // Handle starting of a new label cell.
495 if ($titlecols > 0) {
497 echo "<td colspan='$titlecols' id='$field_id_label'";
498 echo ($frow['uor'] == 2) ?
" class='required'" : " class='bold'";
499 if ($cell_count == 2) echo " style='padding-left:10pt'";
501 $cell_count +
= $titlecols;
507 // Modified 6-09 by BM - Translate if applicable
508 if ($frow['title']) echo (xl_layout_label($frow['title']).":"); else echo " ";
512 // Handle starting of a new data cell.
514 $id_field_text = "text_".$frow['field_id'];
516 echo "<td colspan='$datacols' class='text data'";
517 if ($cell_count > 0) echo " style='padding-left:5pt'". " id='".$id_field_text."'";
519 $cell_count +
= $datacols;
523 generate_form_field($frow, $currvalue);
530 if (! $GLOBALS['simplified_demographics']) {
531 $insurancei = getInsuranceProviders();
533 $insurance_headings = array(xl("Primary Insurance Provider"), xl("Secondary Insurance Provider"), xl("Tertiary Insurance provider"));
534 $insurance_info = array();
535 $insurance_info[1] = getInsuranceData($pid,"primary");
536 $insurance_info[2] = getInsuranceData($pid,"secondary");
537 $insurance_info[3] = getInsuranceData($pid,"tertiary");
539 echo "<br /><span class='bold'><input type='checkbox' name='form_cb_ins' value='1' " .
540 "onclick='return divclick(this,\"div_ins\");'";
541 if ($display_style == 'block') echo " checked";
542 echo " /><b>" . xl('Insurance') . "</b></span>\n";
543 echo "<div id='div_ins' class='section' style='display:$display_style;'>\n";
545 for($i=1;$i<=3;$i++
) {
546 $result3 = $insurance_info[$i];
550 <td valign
='top' colspan
='2'>
551 <span
class='required'><?php
echo $insurance_headings[$i -1].":"?
></span
>
552 <select name
="i<?php echo $i?>provider">
553 <option value
=""><?php
xl('Unassigned','e'); ?
></option
>
555 foreach ($insurancei as $iid => $iname) {
556 echo "<option value='" . $iid . "'";
557 if (strtolower($iid) == strtolower($result3{"provider"}))
559 echo ">" . $iname . "</option>\n";
562 </select
> 
;<a
class='iframe medium_modal' href
='../practice/ins_search.php' onclick
='ins_search(<?php echo $i?>)'>
563 <span
> <?php
xl('Search/Add Insurer','e'); ?
></span
></a
>
572 <span
class='required'><?php
xl('Plan Name','e'); ?
>: </span
>
575 <input type
='entry' size
='20' name
='i<?php echo $i?>plan_name' value
="<?php echo $result3{"plan_name
"} ?>"
576 onchange
="capitalizeMe(this);" /> 
; 
;
582 <span
class='required'><?php
xl('Effective Date','e'); ?
>: </span
>
585 <input type
='entry' size
='11' name
='i<?php echo $i ?>effective_date'
586 id
='i<?php echo $i ?>effective_date'
587 value
='<?php echo $result3['date
'] ?>'
588 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
589 title
='yyyy-mm-dd' />
591 <img src
='../../interface/pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
592 id
='img_i<?php echo $i ?>effective_date' border
='0' alt
='[?]' style
='cursor:pointer'
593 title
='<?php xl('Click here to choose a date
','e
'); ?>'>
595 <script LANGUAGE
="JavaScript">
596 Calendar
.setup({inputField
:"i<?php echo $i ?>effective_date", ifFormat
:"%Y-%m-%d", button
:"img_i<?php echo $i; ?>effective_date"});
604 <td
><span
class=required
><?php
xl('Policy Number','e'); ?
>: </span
></td
>
605 <td
><input type
='entry' size
='16' name
='i<?php echo $i?>policy_number' value
="<?php echo $result3{"policy_number
"}?>"
606 onkeyup
='policykeyup(this)'></td
>
610 <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
>
613 <tr
<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
614 <td
class='required'><?php
xl('Subscriber Employer (SE)','e'); ?
><br
><span style
='font-weight:normal'>
615 (<?php
xl('if unemployed enter Student','e'); ?
>,<br
><?php
xl('PT Student, or leave blank','e'); ?
>): </span
></td
>
616 <td
><input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_employer
617 value
="<?php echo $result3{"subscriber_employer
"}?>"
618 onchange
="capitalizeMe(this);" /></td
>
621 <tr
<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
622 <td
><span
class=required
><?php
xl('SE Address','e'); ?
>: </span
></td
>
623 <td
><input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_employer_street
624 value
="<?php echo $result3{"subscriber_employer_street
"}?>"
625 onchange
="capitalizeMe(this);" /></td
>
628 <tr
<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
632 <td
><span
class=required
><?php
xl('SE City','e'); ?
>: </span
></td
>
633 <td
><input type
=entry size
=15 name
=i
<?php
echo $i?
>subscriber_employer_city
634 value
="<?php echo $result3{"subscriber_employer_city
"}?>"
635 onchange
="capitalizeMe(this);" /></td
>
636 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('SE State','e') : xl('SE Locality','e') ?
>: </span
></td
>
639 // Modified 7/2009 by BM to incorporate data types
640 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']);
645 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('SE Zip Code','e') : xl('SE Postal Code','e') ?
>: </span
></td
>
646 <td
><input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_employer_postal_code value
="<?php echo $result3{"subscriber_employer_postal_code
"}?>"></td
>
647 <td
><span
class=required
><?php
xl('SE Country','e'); ?
>: </span
></td
>
650 // Modified 7/2009 by BM to incorporate data types
651 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']);
663 <span
class=required
><?php
xl('Subscriber','e'); ?
>: </span
>
664 <input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_fname
665 value
="<?php echo $result3{"subscriber_fname
"}?>"
666 onchange
="capitalizeMe(this);" />
667 <input type
=entry size
=3 name
=i
<?php
echo $i?
>subscriber_mname
668 value
="<?php echo $result3{"subscriber_mname
"}?>"
669 onchange
="capitalizeMe(this);" />
670 <input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_lname
671 value
="<?php echo $result3{"subscriber_lname
"}?>"
672 onchange
="capitalizeMe(this);" />
674 <span
class=required
><?php
xl('Relationship','e'); ?
>: </span
>
676 // Modified 6/2009 by BM to use list_options and function
677 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_relationship'),'list_id'=>'sub_relation','empty_title'=>' '), $result3['subscriber_relationship']);
679 <a href
="javascript:popUp('../../interface/patient_file/summary/browse.php?browsenum=<?php echo $i?>')" class=text
>(<?php
xl('Browse','e'); ?
>)</a
><br
/>
681 <span
class=bold
><?php
xl('D.O.B.','e'); ?
>: </span
>
682 <input type
='entry' size
='11' name
='i<?php echo $i?>subscriber_DOB'
683 id
='i<?php echo $i?>subscriber_DOB'
684 value
='<?php echo $result3['subscriber_DOB
'] ?>'
685 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
686 title
='yyyy-mm-dd' />
688 <img src
='../../interface/pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
689 id
='img_i<?php echo $i; ?>dob_date' border
='0' alt
='[?]' style
='cursor:pointer'
690 title
='<?php xl('Click here to choose a date
','e
'); ?>'>
692 <script LANGUAGE
="JavaScript">
693 Calendar
.setup({inputField
:"i<?php echo $i?>subscriber_DOB", ifFormat
:"%Y-%m-%d", button
:"img_i<?php echo $i; ?>dob_date"});
697 <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
"}?>"> 
;
698 <span
class=bold
><?php
xl('Sex','e'); ?
>: </span
>
700 // Modified 6/2009 by BM to use list_options and function
701 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_sex'),'list_id'=>'sex'), $result3['subscriber_sex']);
704 <span
class=required
><?php
xl('Subscriber Address','e'); ?
>: </span
>
705 <input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_street
706 value
="<?php echo $result3{"subscriber_street
"}?>"
707 onchange
="capitalizeMe(this);" /><br
>
708 <span
class=required
><?php
xl('City','e'); ?
>: </span
>
709 <input type
=entry size
=15 name
=i
<?php
echo $i?
>subscriber_city
710 value
="<?php echo $result3{"subscriber_city
"}?>"
711 onchange
="capitalizeMe(this);" />
712 <span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('State','e') : xl('Locality','e') ?
>: </span
>
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']);
718 <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
"}?>">
719 <span
class='required'<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
720 <?php
xl('Country','e'); ?
>: </span
>
722 // Modified 7/2009 by BM to incorporate data types
723 generate_form_field(array('data_type'=>$GLOBALS['country_data_type'],'field_id'=>('i'.$i.'subscriber_country'),'list_id'=>$GLOBALS['country_list'],'fld_length'=>'10','max_length'=>'63','edit_options'=>'C'), $result3['subscriber_country']);
726 <span
class=bold
><?php
xl('Subscriber Phone','e'); ?
>:
727 <input type
='text' size
='20' name
='i<?php echo $i?>subscriber_phone' value
='<?php echo $result3["subscriber_phone"] ?>' onkeyup
='phonekeyup(this,mypcc)' />
729 <span
class=bold
><?php
xl('CoPay','e'); ?
>: <input type
=text size
="6" name
=i
<?php
echo $i?
>copay value
="<?php echo $result3{"copay
"}?>">
731 <span
class='required'><?php
xl('Accept Assignment','e'); ?
>: </span
>
732 <select name
=i
<?php
echo $i?
>accept_assignment
>
733 <option value
="TRUE" <?php
if (strtoupper($result3{"accept_assignment"}) == "TRUE") echo "selected"?
>><?php
xl('YES','e'); ?
></option
>
734 <option value
="FALSE" <?php
if (strtoupper($result3{"accept_assignment"}) == "FALSE") echo "selected"?
>><?php
xl('NO','e'); ?
></option
>
744 } // end of "if not simplified_demographics"
747 <?php
if (!$SHORT_FORM) echo " <center>\n"; ?
>
749 <?php
if ($WITH_SEARCH) { ?
>
750 <input type
="button" id
="search" value
=<?php
xl('Search','e','\'','\''); ?
>
751 style
='background-color:<?php echo $searchcolor; ?>' />
754 <input type
="button" name
='create' id
="create" value
=<?php
xl('Create New Patient','e','\'','\''); ?
> />
759 <td align
='right' valign
='top' width
='1%' nowrap
>
760 <!-- Image upload stuff was here but got moved
. -->
767 <!-- include support
for the
list-add selectbox feature
-->
768 <?php
include($GLOBALS['fileroot']."/library/options_listadd.inc"); ?
>
772 <script language
="JavaScript">
774 // hard code validation for old validation, in the new validation possible to add match rules
775 <?php
if($GLOBALS['new_validate'] == 0) { ?
>
777 // fix inconsistently formatted phone numbers from the database
778 var f
= document
.forms
[0];
779 if (f
.form_phone_contact
) phonekeyup(f
.form_phone_contact
,mypcc
);
780 if (f
.form_phone_home
) phonekeyup(f
.form_phone_home
,mypcc
);
781 if (f
.form_phone_biz
) phonekeyup(f
.form_phone_biz
,mypcc
);
782 if (f
.form_phone_cell
) phonekeyup(f
.form_phone_cell
,mypcc
);
786 <?php
echo $date_init; ?
>
788 // -=- jQuery makes life easier -=-
790 // var matches = 0; // number of patients that match the demographic information being entered
791 // var override = false; // flag that overrides the duplication warning
793 $
(document
).ready(function() {
795 $
(".medium_modal").fancybox( {
796 'overlayOpacity' : 0.0,
797 'showCloseButton' : true,
801 // added to integrate insurance stuff
802 <?php
for ($i=1;$i<=3;$i++
) { ?
>
803 $
("#form_i<?php echo $i?>subscriber_relationship").change(function() { auto_populate_employer_address
<?php
echo $i?
>(); });
806 $
('#search').click(function() { searchme(); });
807 $
('#create').click(function() { check()});
809 var check
= function(e
) {
810 <?php
if($GLOBALS['new_validate']){?
>
811 var valid
= submitme(<?php
echo $GLOBALS['new_validate'] ?
1 : 0;?
>,e
,"DEM",constraints
);
813 top
.restoreSession();
814 var f
= document
.forms
[0];
815 var valid
= validate(f
);
819 // In this case dups were shown already and Save should just save.
825 // D in edit_options indicates the field is used in duplication checking.
826 // This constructs a list of the names of those fields.
828 $mfres = sqlStatement("SELECT * FROM layout_options " .
829 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' AND " .
830 "edit_options LIKE '%D%' " .
831 "ORDER BY group_name, seq");
832 while ($mfrow = sqlFetchArray($mfres)) {
833 $field_id = $mfrow['field_id'];
834 if (strpos($field_id, 'em_') === 0) continue;
835 if (!empty($mflist)) $mflist .= ",";
836 $mflist .= "'" . htmlentities($field_id) . "'";
839 <?php
if ( ($GLOBALS['full_new_patient_form'] == '4') && (checkIfPatientValidationHookIsActive()) ):?
>
840 // Use zend module patient validation hook to open the controller and send the dup-checker fields.
841 var url
='<?php echo $GLOBALS['web_root
']."/interface/modules/zend_modules/public/patientvalidation?close";?>';
843 // Build and invoke the URL to create the dup-checker dialog.
844 var url
= 'new_search_popup.php';
847 var flds
= new Array(<?php
echo $mflist; ?
>);
849 for (var i
= 0; i
< flds
.length
; ++i
) {
850 var fval
= $
('#form_' + flds
[i
]).val();
851 if (fval
&& fval
!= '') {
854 url +
= 'mf_' + flds
[i
] +
'=' +
encodeURIComponent(fval
);
858 dlgopen(url
, '_blank', 700, 500);
863 // Set onclick/onfocus handlers for toggling background color.
865 $lres = getLayoutRes();
866 while ($lrow = sqlFetchArray($lres)) {
867 $field_id = $lrow['field_id'];
868 if (strpos($field_id, 'em_') === 0) continue;
869 switch(getSearchClass($lrow['data_type'])) {
871 echo " \$('#form_$field_id').click(function() { toggleSearch(this); });\n";
874 echo " \$('#form_$field_id').click(function() { selClick(this); });\n";
875 echo " \$('#form_$field_id').blur(function() { selBlur(this); });\n";
881 }); // end document.ready
884 <?php
/*Include the validation script and rules for this form*/
888 <?php
include_once("$srcdir/validation/validation_script.js.php");?
>
889 <script language
='JavaScript'>
890 // Array of skip conditions for the checkSkipConditions() function.
892 <?php
echo $condition_str; ?
>
894 checkSkipConditions();
895 $
("input").change(function() {
896 checkSkipConditions();
898 $
("select").change(function() {
899 checkSkipConditions();