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");
16 // Check authorization.
17 if (!acl_check('patients','demo','',array('write','addonly') ))
18 die("Adding demographics is not authorized.");
20 $CPR = 4; // cells per row
22 $searchcolor = empty($GLOBALS['layout_search_color']) ?
23 '#ffff55' : $GLOBALS['layout_search_color'];
25 $WITH_SEARCH = ($GLOBALS['full_new_patient_form'] == '1' ||
$GLOBALS['full_new_patient_form'] == '2');
26 $SHORT_FORM = ($GLOBALS['full_new_patient_form'] == '2' ||
$GLOBALS['full_new_patient_form'] == '3');
28 function getLayoutRes() {
30 return sqlStatement("SELECT * FROM layout_options " .
31 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' " .
32 ($SHORT_FORM ?
"AND ( uor > 1 OR edit_options LIKE '%N%' ) " : "") .
33 "ORDER BY group_name, seq");
36 // Determine layout field search treatment from its data type:
41 function getSearchClass($data_type) {
43 case 1: // single-selection list
44 case 10: // local provider list
45 case 11: // provider list
46 case 12: // pharmacy list
48 case 14: // address book list
49 case 26: // single-selection list with add
50 case 35: // facilities
60 $fres = getLayoutRes();
64 <?php
html_header_show(); ?
>
66 <link rel
="stylesheet" href
="<?php echo $css_header; ?>" type
="text/css">
69 body
, td
, input
, select
, textarea
{
70 font
-family
: Arial
, Helvetica
, sans
-serif
;
75 padding
: 5pt
5pt
5pt
5pt
;
81 border
-color
: #0000ff;
88 <style type
="text/css">@import
url(../../library
/dynarch_calendar
.css
);</style
>
90 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
91 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
92 <script type
="text/javascript" src
="../../library/dynarch_calendar.js"></script
>
93 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
94 <script type
="text/javascript" src
="../../library/dynarch_calendar_setup.js"></script
>
95 <script type
="text/javascript" src
="../../library/js/jquery-1.9.1.min.js"></script
>
96 <script type
="text/javascript" src
="../../library/js/common.js"></script
>
97 <script type
="text/javascript" src
="../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script
>
98 <?php
include_once("{$GLOBALS['srcdir']}/options.js.php"); ?
>
99 <link rel
="stylesheet" type
="text/css" href
="../../library/js/fancybox/jquery.fancybox-1.2.6.css" media
="screen" />
101 <SCRIPT LANGUAGE
="JavaScript"><!--
102 //Visolve - sync the radio buttons - Start
103 if((top
.window
.parent
) && (parent
.window
)){
104 var wname
= top
.window
.parent
.left_nav
;
105 fname
= (parent
.window
.name
)?parent
.window
.name
:window
.name
;
107 wname
.setRadio(fname
, "new");
108 }//Visolve - sync the radio buttons - End
110 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
112 // This may be changed to true by the AJAX search script.
113 var force_submit
= false;
115 //code used from http://tech.irt.org/articles/js037/
116 function replace(string,text
,by
) {
117 // Replaces text with by in string
118 var strLength
= string.length
, txtLength
= text
.length
;
119 if ((strLength
== 0) ||
(txtLength
== 0)) return string;
121 var i
= string.indexOf(text
);
122 if ((!i
) && (text
!= string.substring(0,txtLength
))) return string;
123 if (i
== -1) return string;
125 var newstr
= string.substring(0,i
) + by
;
127 if (i+txtLength
< strLength
)
128 newstr +
= replace(string.substring(i+txtLength
,strLength
),text
,by
);
133 <?php
for ($i=1;$i<=3;$i++
) { ?
>
134 function auto_populate_employer_address
<?php
echo $i ?
>(){
135 var f
= document
.demographics_form
;
136 if (f
.form_i
<?php
echo $i?
>subscriber_relationship
.options
[f
.form_i
<?php
echo $i?
>subscriber_relationship
.selectedIndex
].value
== "self") {
137 f
.i
<?php
echo $i?
>subscriber_fname
.value
=f
.form_fname
.value
;
138 f
.i
<?php
echo $i?
>subscriber_mname
.value
=f
.form_mname
.value
;
139 f
.i
<?php
echo $i?
>subscriber_lname
.value
=f
.form_lname
.value
;
140 f
.i
<?php
echo $i?
>subscriber_street
.value
=f
.form_street
.value
;
141 f
.i
<?php
echo $i?
>subscriber_city
.value
=f
.form_city
.value
;
142 f
.form_i
<?php
echo $i?
>subscriber_state
.value
=f
.form_state
.value
;
143 f
.i
<?php
echo $i?
>subscriber_postal_code
.value
=f
.form_postal_code
.value
;
144 if (f
.form_country_code
)
145 f
.form_i
<?php
echo $i?
>subscriber_country
.value
=f
.form_country_code
.value
;
146 f
.i
<?php
echo $i?
>subscriber_phone
.value
=f
.form_phone_home
.value
;
147 f
.i
<?php
echo $i?
>subscriber_DOB
.value
=f
.form_DOB
.value
;
148 f
.i
<?php
echo $i?
>subscriber_ss
.value
=f
.form_ss
.value
;
149 f
.form_i
<?php
echo $i?
>subscriber_sex
.value
= f
.form_sex
.value
;
150 f
.i
<?php
echo $i?
>subscriber_employer
.value
=f
.form_em_name
.value
;
151 f
.i
<?php
echo $i?
>subscriber_employer_street
.value
=f
.form_em_street
.value
;
152 f
.i
<?php
echo $i?
>subscriber_employer_city
.value
=f
.form_em_city
.value
;
153 f
.form_i
<?php
echo $i?
>subscriber_employer_state
.value
=f
.form_em_state
.value
;
154 f
.i
<?php
echo $i?
>subscriber_employer_postal_code
.value
=f
.form_em_postal_code
.value
;
155 if (f
.form_em_country
)
156 f
.form_i
<?php
echo $i?
>subscriber_employer_country
.value
=f
.form_em_country
.value
;
162 function upperFirst(string,text
) {
163 return replace(string,text
,text
.charAt(0).toUpperCase() + text
.substring(1,text
.length
));
166 // The ins_search.php window calls this to set the selected insurance.
167 function set_insurance(ins_id
, ins_name
) {
168 var thesel
= document
.forms
[0]['i' + insurance_index +
'provider'];
169 var theopts
= thesel
.options
; // the array of Option objects
171 for (; i
< theopts
.length
; ++i
) {
172 if (theopts
[i
].value
== ins_id
) {
173 theopts
[i
].selected
= true;
177 // no matching option was found so create one, append it to the
178 // end of the list, and select it.
179 theopts
[i
] = new Option(ins_name
, ins_id
, false, true);
182 // Indicates which insurance slot is being updated.
183 var insurance_index
= 0;
185 // The OnClick handler for searching/adding the insurance company.
186 function ins_search(ins
) {
187 insurance_index
= ins
;
191 function checkNum () {
192 var re
= new RegExp();
194 str
=document
.forms
[0].monthly_income
.value
;
198 alert("Please enter a dollar amount using only numbers and a decimal point.");
202 // This capitalizes the first letter of each word in the passed input
203 // element. It also strips out extraneous spaces.
204 function capitalizeMe(elem
) {
205 var a
= elem
.value
.split(' ');
207 for(var i
= 0; i
< a
.length
; ++i
) {
208 if (a
[i
].length
> 0) {
209 if (s
.length
> 0) s +
= ' ';
210 s +
= a
[i
].charAt(0).toUpperCase() + a
[i
].substring(1);
216 // Onkeyup handler for policy number. Allows only A-Z and 0-9.
217 function policykeyup(e
) {
218 var v
= e
.value
.toUpperCase();
219 var filteredString
="";
220 for (var i
= 0; i
< v
.length
; ++i
) {
222 if ((c
>= '0' && c
<= '9') ||
223 (c
>= 'A' && c
<= 'Z') ||
234 e
.value
= filteredString
;
238 function divclick(cb
, divid
) {
239 var divstyle
= document
.getElementById(divid
).style
;
241 divstyle
.display
= 'block';
243 divstyle
.display
= 'none';
248 // Compute the length of a string without leading and trailing spaces.
249 function trimlen(s
) {
251 var j
= s
.length
- 1;
252 for (; i
<= j
&& s
.charAt(i
) == ' '; ++i
);
253 for (; i
<= j
&& s
.charAt(j
) == ' '; --j
);
258 function validate(f
) {
259 var errMsgs
= new Array();
260 <?php
generate_layout_validation('DEM'); ?
>
261 <?php
if($GLOBALS['erx_enable']){ ?
>
263 for(i
=0;i
<f
.length
;i++
){
264 if(f
[i
].type
=='text' && f
[i
].value
)
266 if(f
[i
].name
== 'form_fname' || f
[i
].name
== 'form_mname' || f
[i
].name
== 'form_lname')
268 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
269 alertMsg +
= checkUsername(f
[i
].name
,f
[i
].value
);
271 else if(f
[i
].name
== 'form_street' || f
[i
].name
== 'form_city')
273 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
274 alertMsg +
= checkAlphaNumericExtended(f
[i
].name
,f
[i
].value
);
276 else if(f
[i
].name
== 'form_phone_home')
278 alertMsg +
= checkPhone(f
[i
].name
,f
[i
].value
);
289 msg +
= "<?php echo htmlspecialchars(xl('The following fields are required'),ENT_QUOTES); ?>:\n\n";
290 for ( var i
= 0; i
< errMsgs
.length
; i++
) {
291 msg +
= errMsgs
[i
] +
"\n";
293 msg +
= "\n<?php echo htmlspecialchars(xl('Please fill them in before continuing.'),ENT_QUOTES); ?>";
296 //Misc Deceased Date Validation for Future Date
297 var dateVal
= document
.getElementById("form_deceased_date").value
;
300 month
= '' +
(d
.getMonth() +
1),
301 day
= '' + d
.getDate(),
302 year
= d
.getFullYear();
303 if (month
.length
< 2) month
= '0' + month
;
304 if (day
.length
< 2) day
= '0' + day
;
305 currentDate
= year+
'-'+month+
'-'+day
;
306 if(errMsgs
.length
> 0 || dateVal
> currentDate
)
308 if(errMsgs
.length
> 0)
310 if(dateVal
> currentDate
)
311 alert ('<?php echo xls("Deceased Date should not be greater than Today"); ?>');
317 function toggleSearch(elem
) {
318 var f
= document
.forms
[0];
319 <?php
if ($WITH_SEARCH) { ?
>
320 // Toggle background color.
321 if (elem
.style
.backgroundColor
== '')
322 elem
.style
.backgroundColor
= '<?php echo $searchcolor; ?>';
324 elem
.style
.backgroundColor
= '';
327 force_submit
= false;
328 f
.create
.value
= '<?php xl('Create
New Patient
','e
'); ?>';
333 // If a <select> list is dropped down, this is its name.
334 var open_sel_name
= '';
336 function selClick(elem
) {
337 if (open_sel_name
== elem
.name
) {
341 open_sel_name
= elem
.name
;
347 function selBlur(elem
) {
348 if (open_sel_name
== elem
.name
) {
354 // This invokes the patient search dialog.
355 function searchme() {
356 var f
= document
.forms
[0];
357 var url
= '../main/finder/patient_select.php?popup=1';
360 $lres = getLayoutRes();
362 while ($lrow = sqlFetchArray($lres)) {
363 $field_id = $lrow['field_id'];
364 if (strpos($field_id, 'em_') === 0) continue;
365 $data_type = $lrow['data_type'];
366 $fldname = "form_$field_id";
367 switch(getSearchClass($data_type)) {
370 " if (f.$fldname.style.backgroundColor != '' && trimlen(f.$fldname.value) > 0) {\n" .
371 " url += '&$field_id=' + encodeURIComponent(f.$fldname.value);\n" .
376 " if (f.$fldname.style.backgroundColor != '' && f.$fldname.selectedIndex > 0) {\n" .
377 " url += '&$field_id=' + encodeURIComponent(f.$fldname.options[f.$fldname.selectedIndex].value);\n" .
384 dlgopen(url
, '_blank', 700, 500);
392 <body
class="body_top">
394 <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")'>
396 <span
class='title'><?php
xl('Search or Add Patient','e'); ?
></span
>
398 <table width
='100%' cellpadding
='0' cellspacing
='8'>
400 <td align
='left' valign
='top'>
401 <?php
if ($SHORT_FORM) echo " <center>\n"; ?
>
404 function end_cell() {
405 global $item_count, $cell_count;
406 if ($item_count > 0) {
413 global $cell_count, $CPR;
415 if ($cell_count > 0) {
416 for (; $cell_count < $CPR; ++
$cell_count) echo "<td></td>";
422 function end_group() {
423 global $last_group, $SHORT_FORM;
424 if (strlen($last_group) > 0) {
427 if (!$SHORT_FORM) echo "</div>\n";
434 $display_style = 'block';
435 $group_seq = 0; // this gives the DIV blocks unique IDs
437 while ($frow = sqlFetchArray($fres)) {
438 $this_group = $frow['group_name'];
439 $titlecols = $frow['titlecols'];
440 $datacols = $frow['datacols'];
441 $data_type = $frow['data_type'];
442 $field_id = $frow['field_id'];
443 $list_id = $frow['list_id'];
445 $condition_str = get_conditions_str($condition_str,$group_fields);
447 if (strpos($field_id, 'em_') === 0) {
448 $tmp = substr($field_id, 3);
449 if (isset($result2[$tmp])) $currvalue = $result2[$tmp];
452 if (isset($result[$field_id])) $currvalue = $result[$field_id];
455 // Handle a data category (group) change.
456 if (strcmp($this_group, $last_group) != 0) {
459 $group_seq++
; // ID for DIV tags
460 $group_name = substr($this_group, 1);
461 if (strlen($last_group) > 0) echo "<br />";
462 echo "<span class='bold'><input type='checkbox' name='form_cb_$group_seq' id='form_cb_$group_seq' value='1' " .
463 "onclick='return divclick(this,\"div_$group_seq\");'";
464 if ($display_style == 'block') echo " checked";
466 // Modified 6-09 by BM - Translate if applicable
467 echo " /><b>" . xl_layout_label($group_name) . "</b></span>\n";
469 echo "<div id='div_$group_seq' class='section' style='display:$display_style;'>\n";
470 echo " <table border='0' cellpadding='0'>\n";
471 $display_style = 'none';
473 else if (strlen($last_group) == 0) {
474 echo " <table border='0' cellpadding='0'>\n";
476 $last_group = $this_group;
479 // Handle starting of a new row.
480 if (($titlecols > 0 && $cell_count >= $CPR) ||
$cell_count == 0) {
485 if ($item_count == 0 && $titlecols == 0) $titlecols = 1;
486 $field_id_label='label_'.$frow['field_id'];
487 // Handle starting of a new label cell.
488 if ($titlecols > 0) {
490 echo "<td colspan='$titlecols' id='$field_id_label'";
491 echo ($frow['uor'] == 2) ?
" class='required'" : " class='bold'";
492 if ($cell_count == 2) echo " style='padding-left:10pt'";
494 $cell_count +
= $titlecols;
500 // Modified 6-09 by BM - Translate if applicable
501 if ($frow['title']) echo (xl_layout_label($frow['title']).":"); else echo " ";
505 // Handle starting of a new data cell.
507 $id_field_text = "text_".$frow['field_id'];
509 echo "<td colspan='$datacols' class='text data'";
510 if ($cell_count > 0) echo " style='padding-left:5pt'". " id='".$id_field_text."'";
512 $cell_count +
= $datacols;
516 generate_form_field($frow, $currvalue);
523 if (! $GLOBALS['simplified_demographics']) {
524 $insurancei = getInsuranceProviders();
526 $insurance_headings = array(xl("Primary Insurance Provider"), xl("Secondary Insurance Provider"), xl("Tertiary Insurance provider"));
527 $insurance_info = array();
528 $insurance_info[1] = getInsuranceData($pid,"primary");
529 $insurance_info[2] = getInsuranceData($pid,"secondary");
530 $insurance_info[3] = getInsuranceData($pid,"tertiary");
532 echo "<br /><span class='bold'><input type='checkbox' name='form_cb_ins' value='1' " .
533 "onclick='return divclick(this,\"div_ins\");'";
534 if ($display_style == 'block') echo " checked";
535 echo " /><b>" . xl('Insurance') . "</b></span>\n";
536 echo "<div id='div_ins' class='section' style='display:$display_style;'>\n";
538 for($i=1;$i<=3;$i++
) {
539 $result3 = $insurance_info[$i];
543 <td valign
='top' colspan
='2'>
544 <span
class='required'><?php
echo $insurance_headings[$i -1].":"?
></span
>
545 <select name
="i<?php echo $i?>provider">
546 <option value
=""><?php
xl('Unassigned','e'); ?
></option
>
548 foreach ($insurancei as $iid => $iname) {
549 echo "<option value='" . $iid . "'";
550 if (strtolower($iid) == strtolower($result3{"provider"}))
552 echo ">" . $iname . "</option>\n";
555 </select
> 
;<a
class='iframe medium_modal' href
='../practice/ins_search.php' onclick
='ins_search(<?php echo $i?>)'>
556 <span
> <?php
xl('Search/Add Insurer','e'); ?
></span
></a
>
565 <span
class='required'><?php
xl('Plan Name','e'); ?
>: </span
>
568 <input type
='entry' size
='20' name
='i<?php echo $i?>plan_name' value
="<?php echo $result3{"plan_name
"} ?>"
569 onchange
="capitalizeMe(this);" /> 
; 
;
575 <span
class='required'><?php
xl('Effective Date','e'); ?
>: </span
>
578 <input type
='entry' size
='11' name
='i<?php echo $i ?>effective_date'
579 id
='i<?php echo $i ?>effective_date'
580 value
='<?php echo $result3['date
'] ?>'
581 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
582 title
='yyyy-mm-dd' />
584 <img src
='../../interface/pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
585 id
='img_i<?php echo $i ?>effective_date' border
='0' alt
='[?]' style
='cursor:pointer'
586 title
='<?php xl('Click here to choose a date
','e
'); ?>'>
588 <script LANGUAGE
="JavaScript">
589 Calendar
.setup({inputField
:"i<?php echo $i ?>effective_date", ifFormat
:"%Y-%m-%d", button
:"img_i<?php echo $i; ?>effective_date"});
597 <td
><span
class=required
><?php
xl('Policy Number','e'); ?
>: </span
></td
>
598 <td
><input type
='entry' size
='16' name
='i<?php echo $i?>policy_number' value
="<?php echo $result3{"policy_number
"}?>"
599 onkeyup
='policykeyup(this)'></td
>
603 <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
>
606 <tr
<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
607 <td
class='required'><?php
xl('Subscriber Employer (SE)','e'); ?
><br
><span style
='font-weight:normal'>
608 (<?php
xl('if unemployed enter Student','e'); ?
>,<br
><?php
xl('PT Student, or leave blank','e'); ?
>): </span
></td
>
609 <td
><input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_employer
610 value
="<?php echo $result3{"subscriber_employer
"}?>"
611 onchange
="capitalizeMe(this);" /></td
>
614 <tr
<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
615 <td
><span
class=required
><?php
xl('SE Address','e'); ?
>: </span
></td
>
616 <td
><input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_employer_street
617 value
="<?php echo $result3{"subscriber_employer_street
"}?>"
618 onchange
="capitalizeMe(this);" /></td
>
621 <tr
<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
625 <td
><span
class=required
><?php
xl('SE City','e'); ?
>: </span
></td
>
626 <td
><input type
=entry size
=15 name
=i
<?php
echo $i?
>subscriber_employer_city
627 value
="<?php echo $result3{"subscriber_employer_city
"}?>"
628 onchange
="capitalizeMe(this);" /></td
>
629 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('SE State','e') : xl('SE Locality','e') ?
>: </span
></td
>
632 // Modified 7/2009 by BM to incorporate data types
633 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']);
638 <td
><span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('SE Zip Code','e') : xl('SE Postal Code','e') ?
>: </span
></td
>
639 <td
><input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_employer_postal_code value
="<?php echo $result3{"subscriber_employer_postal_code
"}?>"></td
>
640 <td
><span
class=required
><?php
xl('SE Country','e'); ?
>: </span
></td
>
643 // Modified 7/2009 by BM to incorporate data types
644 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']);
656 <span
class=required
><?php
xl('Subscriber','e'); ?
>: </span
>
657 <input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_fname
658 value
="<?php echo $result3{"subscriber_fname
"}?>"
659 onchange
="capitalizeMe(this);" />
660 <input type
=entry size
=3 name
=i
<?php
echo $i?
>subscriber_mname
661 value
="<?php echo $result3{"subscriber_mname
"}?>"
662 onchange
="capitalizeMe(this);" />
663 <input type
=entry size
=10 name
=i
<?php
echo $i?
>subscriber_lname
664 value
="<?php echo $result3{"subscriber_lname
"}?>"
665 onchange
="capitalizeMe(this);" />
667 <span
class=required
><?php
xl('Relationship','e'); ?
>: </span
>
669 // Modified 6/2009 by BM to use list_options and function
670 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_relationship'),'list_id'=>'sub_relation','empty_title'=>' '), $result3['subscriber_relationship']);
672 <a href
="javascript:popUp('../../interface/patient_file/summary/browse.php?browsenum=<?php echo $i?>')" class=text
>(<?php
xl('Browse','e'); ?
>)</a
><br
/>
674 <span
class=bold
><?php
xl('D.O.B.','e'); ?
>: </span
>
675 <input type
='entry' size
='11' name
='i<?php echo $i?>subscriber_DOB'
676 id
='i<?php echo $i?>subscriber_DOB'
677 value
='<?php echo $result3['subscriber_DOB
'] ?>'
678 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
679 title
='yyyy-mm-dd' />
681 <img src
='../../interface/pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
682 id
='img_i<?php echo $i; ?>dob_date' border
='0' alt
='[?]' style
='cursor:pointer'
683 title
='<?php xl('Click here to choose a date
','e
'); ?>'>
685 <script LANGUAGE
="JavaScript">
686 Calendar
.setup({inputField
:"i<?php echo $i?>subscriber_DOB", ifFormat
:"%Y-%m-%d", button
:"img_i<?php echo $i; ?>dob_date"});
690 <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
"}?>"> 
;
691 <span
class=bold
><?php
xl('Sex','e'); ?
>: </span
>
693 // Modified 6/2009 by BM to use list_options and function
694 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_sex'),'list_id'=>'sex'), $result3['subscriber_sex']);
697 <span
class=required
><?php
xl('Subscriber Address','e'); ?
>: </span
>
698 <input type
=entry size
=25 name
=i
<?php
echo $i?
>subscriber_street
699 value
="<?php echo $result3{"subscriber_street
"}?>"
700 onchange
="capitalizeMe(this);" /><br
>
701 <span
class=required
><?php
xl('City','e'); ?
>: </span
>
702 <input type
=entry size
=15 name
=i
<?php
echo $i?
>subscriber_city
703 value
="<?php echo $result3{"subscriber_city
"}?>"
704 onchange
="capitalizeMe(this);" />
705 <span
class=required
><?php
echo ($GLOBALS['phone_country_code'] == '1') ?
xl('State','e') : xl('Locality','e') ?
>: </span
>
707 // Modified 7/2009 by BM to incorporate data types
708 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']);
711 <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
"}?>">
712 <span
class='required'<?php
if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?
>>
713 <?php
xl('Country','e'); ?
>: </span
>
715 // Modified 7/2009 by BM to incorporate data types
716 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']);
719 <span
class=bold
><?php
xl('Subscriber Phone','e'); ?
>:
720 <input type
='text' size
='20' name
='i<?php echo $i?>subscriber_phone' value
='<?php echo $result3["subscriber_phone"] ?>' onkeyup
='phonekeyup(this,mypcc)' />
722 <span
class=bold
><?php
xl('CoPay','e'); ?
>: <input type
=text size
="6" name
=i
<?php
echo $i?
>copay value
="<?php echo $result3{"copay
"}?>">
724 <span
class='required'><?php
xl('Accept Assignment','e'); ?
>: </span
>
725 <select name
=i
<?php
echo $i?
>accept_assignment
>
726 <option value
="TRUE" <?php
if (strtoupper($result3{"accept_assignment"}) == "TRUE") echo "selected"?
>><?php
xl('YES','e'); ?
></option
>
727 <option value
="FALSE" <?php
if (strtoupper($result3{"accept_assignment"}) == "FALSE") echo "selected"?
>><?php
xl('NO','e'); ?
></option
>
737 } // end of "if not simplified_demographics"
740 <?php
if (!$SHORT_FORM) echo " <center>\n"; ?
>
742 <?php
if ($WITH_SEARCH) { ?
>
743 <input type
="button" id
="search" value
=<?php
xl('Search','e','\'','\''); ?
>
744 style
='background-color:<?php echo $searchcolor; ?>' />
747 <input type
="button" name
='create' id
="create" value
=<?php
xl('Create New Patient','e','\'','\''); ?
> />
752 <td align
='right' valign
='top' width
='1%' nowrap
>
753 <!-- Image upload stuff was here but got moved
. -->
760 <!-- include support
for the
list-add selectbox feature
-->
761 <?php
include($GLOBALS['fileroot']."/library/options_listadd.inc"); ?
>
765 <script language
="JavaScript">
767 // hard code validation for old validation, in the new validation possible to add match rules
768 <?php
if($GLOBALS['new_validate'] == 0) { ?
>
770 // fix inconsistently formatted phone numbers from the database
771 var f
= document
.forms
[0];
772 if (f
.form_phone_contact
) phonekeyup(f
.form_phone_contact
,mypcc
);
773 if (f
.form_phone_home
) phonekeyup(f
.form_phone_home
,mypcc
);
774 if (f
.form_phone_biz
) phonekeyup(f
.form_phone_biz
,mypcc
);
775 if (f
.form_phone_cell
) phonekeyup(f
.form_phone_cell
,mypcc
);
779 <?php
echo $date_init; ?
>
781 // -=- jQuery makes life easier -=-
783 // var matches = 0; // number of patients that match the demographic information being entered
784 // var override = false; // flag that overrides the duplication warning
786 $
(document
).ready(function() {
788 $
(".medium_modal").fancybox( {
789 'overlayOpacity' : 0.0,
790 'showCloseButton' : true,
794 // added to integrate insurance stuff
795 <?php
for ($i=1;$i<=3;$i++
) { ?
>
796 $
("#form_i<?php echo $i?>subscriber_relationship").change(function() { auto_populate_employer_address
<?php
echo $i?
>(); });
799 $
('#search').click(function() { searchme(); });
800 $
('#create').click(function() { check()});
802 var check
= function(e
) {
803 <?php
if($GLOBALS['new_validate']){?
>
804 var valid
= submitme(<?php
echo $GLOBALS['new_validate'] ?
1 : 0;?
>,e
,"DEM");
806 top
.restoreSession();
807 var f
= document
.forms
[0];
808 var valid
= validate(f
);
812 // In this case dups were shown already and Save should just save.
818 // D in edit_options indicates the field is used in duplication checking.
819 // This constructs a list of the names of those fields.
821 $mfres = sqlStatement("SELECT * FROM layout_options " .
822 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' AND " .
823 "edit_options LIKE '%D%' " .
824 "ORDER BY group_name, seq");
825 while ($mfrow = sqlFetchArray($mfres)) {
826 $field_id = $mfrow['field_id'];
827 if (strpos($field_id, 'em_') === 0) continue;
828 if (!empty($mflist)) $mflist .= ",";
829 $mflist .= "'" . htmlentities($field_id) . "'";
832 // Build and invoke the URL to create the dup-checker dialog.
833 var url
= 'new_search_popup.php';
834 var flds
= new Array(<?php
echo $mflist; ?
>);
836 for (var i
= 0; i
< flds
.length
; ++i
) {
837 var fval
= $
('#form_' + flds
[i
]).val();
838 if (fval
&& fval
!= '') {
841 url +
= 'mf_' + flds
[i
] +
'=' +
encodeURIComponent(fval
);
844 dlgopen(url
, '_blank', 700, 500);
849 // Set onclick/onfocus handlers for toggling background color.
851 $lres = getLayoutRes();
852 while ($lrow = sqlFetchArray($lres)) {
853 $field_id = $lrow['field_id'];
854 if (strpos($field_id, 'em_') === 0) continue;
855 switch(getSearchClass($lrow['data_type'])) {
857 echo " \$('#form_$field_id').click(function() { toggleSearch(this); });\n";
860 echo " \$('#form_$field_id').click(function() { selClick(this); });\n";
861 echo " \$('#form_$field_id').blur(function() { selBlur(this); });\n";
867 }); // end document.ready
870 <?php
/*Include the validation script and rules for this form*/
874 <?php
include_once("$srcdir/validation/validation_script.js.php");?
>
875 <script language
='JavaScript'>
876 // Array of skip conditions for the checkSkipConditions() function.
878 <?php
echo $condition_str; ?
>
880 checkSkipConditions();
881 $
("input").change(function() {
882 checkSkipConditions();
884 $
("select").change(function() {
885 checkSkipConditions();