Fix for editing current event in a recurring appointment
[openemr.git] / interface / new / new_comprehensive.php
blob8d239cf8e211a01be50decb5a08be644711bf94f
1 <?php
2 // Copyright (C) 2009-2010 Rod Roark <rod@sunsetsystems.com>
3 //
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");
15 // Check authorization.
16 $thisauth = acl_check('patients', 'demo');
17 if ($thisauth != 'write' && $thisauth != '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() {
29 global $SHORT_FORM;
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:
37 // 1 = text field
38 // 2 = select list
39 // 0 = not searchable
41 function getSearchClass($data_type) {
42 switch($data_type) {
43 case 1: // single-selection list
44 case 10: // local provider list
45 case 11: // provider list
46 case 12: // pharmacy list
47 case 13: // squads
48 case 14: // address book list
49 case 26: // single-selection list with add
50 case 35: // facilities
51 return 2;
52 case 2: // text field
53 case 3: // textarea
54 case 4: // date
55 return 1;
57 return 0;
60 $fres = getLayoutRes();
62 <html>
63 <head>
64 <?php html_header_show(); ?>
66 <link rel="stylesheet" href="<?php echo $css_header; ?>" type="text/css">
68 <style>
69 body, td, input, select, textarea {
70 font-family: Arial, Helvetica, sans-serif;
71 font-size: 10pt;
74 body {
75 padding: 5pt 5pt 5pt 5pt;
78 div.section {
79 border: solid;
80 border-width: 1px;
81 border-color: #0000ff;
82 margin: 0 0 0 10pt;
83 padding: 5pt;
86 </style>
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="<?php echo $GLOBALS['webroot']; ?>/library/js/jquery.js"></script>
97 <SCRIPT LANGUAGE="JavaScript"><!--
98 //Visolve - sync the radio buttons - Start
99 if((top.window.parent) && (parent.window)){
100 var wname = top.window.parent.left_nav;
101 fname = (parent.window.name)?parent.window.name:window.name;
102 wname.syncRadios();
103 wname.setRadio(fname, "new");
104 }//Visolve - sync the radio buttons - End
106 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
108 // This may be changed to true by the AJAX search script.
109 var force_submit = false;
111 //code used from http://tech.irt.org/articles/js037/
112 function replace(string,text,by) {
113 // Replaces text with by in string
114 var strLength = string.length, txtLength = text.length;
115 if ((strLength == 0) || (txtLength == 0)) return string;
117 var i = string.indexOf(text);
118 if ((!i) && (text != string.substring(0,txtLength))) return string;
119 if (i == -1) return string;
121 var newstr = string.substring(0,i) + by;
123 if (i+txtLength < strLength)
124 newstr += replace(string.substring(i+txtLength,strLength),text,by);
126 return newstr;
129 <?php for ($i=1;$i<=3;$i++) { ?>
130 function auto_populate_employer_address<?php echo $i ?>(){
131 var f = document.demographics_form;
132 if (f.form_i<?php echo $i?>subscriber_relationship.options[f.form_i<?php echo $i?>subscriber_relationship.selectedIndex].value == "self") {
133 f.i<?php echo $i?>subscriber_fname.value=f.form_fname.value;
134 f.i<?php echo $i?>subscriber_mname.value=f.form_mname.value;
135 f.i<?php echo $i?>subscriber_lname.value=f.form_lname.value;
136 f.i<?php echo $i?>subscriber_street.value=f.form_street.value;
137 f.i<?php echo $i?>subscriber_city.value=f.form_city.value;
138 f.form_i<?php echo $i?>subscriber_state.value=f.form_state.value;
139 f.i<?php echo $i?>subscriber_postal_code.value=f.form_postal_code.value;
140 if (f.form_country_code)
141 f.form_i<?php echo $i?>subscriber_country.value=f.form_country_code.value;
142 f.i<?php echo $i?>subscriber_phone.value=f.form_phone_home.value;
143 f.i<?php echo $i?>subscriber_DOB.value=f.form_DOB.value;
144 f.i<?php echo $i?>subscriber_ss.value=f.form_ss.value;
145 f.form_i<?php echo $i?>subscriber_sex.value = f.form_sex.value;
146 f.i<?php echo $i?>subscriber_employer.value=f.form_em_name.value;
147 f.i<?php echo $i?>subscriber_employer_street.value=f.form_em_street.value;
148 f.i<?php echo $i?>subscriber_employer_city.value=f.form_em_city.value;
149 f.form_i<?php echo $i?>subscriber_employer_state.value=f.form_em_state.value;
150 f.i<?php echo $i?>subscriber_employer_postal_code.value=f.form_em_postal_code.value;
151 if (f.form_em_country)
152 f.form_i<?php echo $i?>subscriber_employer_country.value=f.form_em_country.value;
156 <?php } ?>
158 function upperFirst(string,text) {
159 return replace(string,text,text.charAt(0).toUpperCase() + text.substring(1,text.length));
162 // The ins_search.php window calls this to set the selected insurance.
163 function set_insurance(ins_id, ins_name) {
164 var thesel = document.forms[0]['i' + insurance_index + 'provider'];
165 var theopts = thesel.options; // the array of Option objects
166 var i = 0;
167 for (; i < theopts.length; ++i) {
168 if (theopts[i].value == ins_id) {
169 theopts[i].selected = true;
170 return;
173 // no matching option was found so create one, append it to the
174 // end of the list, and select it.
175 theopts[i] = new Option(ins_name, ins_id, false, true);
178 // Indicates which insurance slot is being updated.
179 var insurance_index = 0;
181 // The OnClick handler for searching/adding the insurance company.
182 function ins_search(ins) {
183 insurance_index = ins;
184 dlgopen('../../interface/practice/ins_search.php', '_blank', 550, 400);
185 return false;
188 function checkNum () {
189 var re= new RegExp();
190 re = /^\d*\.?\d*$/;
191 str=document.forms[0].monthly_income.value;
192 if(re.exec(str))
194 }else{
195 alert("Please enter a dollar amount using only numbers and a decimal point.");
199 // This capitalizes the first letter of each word in the passed input
200 // element. It also strips out extraneous spaces.
201 function capitalizeMe(elem) {
202 var a = elem.value.split(' ');
203 var s = '';
204 for(var i = 0; i < a.length; ++i) {
205 if (a[i].length > 0) {
206 if (s.length > 0) s += ' ';
207 s += a[i].charAt(0).toUpperCase() + a[i].substring(1);
210 elem.value = s;
213 // Onkeyup handler for policy number. Allows only A-Z and 0-9.
214 function policykeyup(e) {
215 var v = e.value.toUpperCase();
216 for (var i = 0; i < v.length; ++i) {
217 var c = v.charAt(i);
218 if (c >= '0' && c <= '9') continue;
219 if (c >= 'A' && c <= 'Z') continue;
220 if (c == '*') continue;
221 if (c == '-') continue;
222 if (c == '_') continue;
223 if (c == '(') continue;
224 if (c == ')') continue;
225 if (c == '#') continue;
226 v = v.substring(0, i) + v.substring(i + i);
227 --i;
229 e.value = v;
230 return;
233 function divclick(cb, divid) {
234 var divstyle = document.getElementById(divid).style;
235 if (cb.checked) {
236 divstyle.display = 'block';
237 } else {
238 divstyle.display = 'none';
240 return true;
243 // Compute the length of a string without leading and trailing spaces.
244 function trimlen(s) {
245 var i = 0;
246 var j = s.length - 1;
247 for (; i <= j && s.charAt(i) == ' '; ++i);
248 for (; i <= j && s.charAt(j) == ' '; --j);
249 if (i > j) return 0;
250 return j + 1 - i;
253 function validate(f) {
254 <?php generate_layout_validation('DEM'); ?>
255 <?php if($GLOBALS['erx_enable']){ ?>
256 alertMsg='';
257 for(i=0;i<f.length;i++){
258 if(f[i].type=='text' && f[i].value)
260 if(f[i].name == 'form_fname' || f[i].name == 'form_mname' || f[i].name == 'form_lname')
262 alertMsg += checkLength(f[i].name,f[i].value,35);
263 alertMsg += checkUsername(f[i].name,f[i].value);
265 else if(f[i].name == 'form_street' || f[i].name == 'form_city')
267 alertMsg += checkLength(f[i].name,f[i].value,35);
268 alertMsg += checkAlphaNumericExtended(f[i].name,f[i].value);
270 else if(f[i].name == 'form_phone_home')
272 alertMsg += checkPhone(f[i].name,f[i].value);
276 if(alertMsg)
278 alert(alertMsg);
279 return false;
281 <?php } ?>
282 return true;
285 function toggleSearch(elem) {
286 var f = document.forms[0];
287 <?php if ($WITH_SEARCH) { ?>
288 // Toggle background color.
289 if (elem.style.backgroundColor == '')
290 elem.style.backgroundColor = '<?php echo $searchcolor; ?>';
291 else
292 elem.style.backgroundColor = '';
293 <?php } ?>
294 if (force_submit) {
295 force_submit = false;
296 f.create.value = '<?php xl('Create New Patient','e'); ?>';
298 return true;
301 // If a <select> list is dropped down, this is its name.
302 var open_sel_name = '';
304 function selClick(elem) {
305 if (open_sel_name == elem.name) {
306 open_sel_name = '';
308 else {
309 open_sel_name = elem.name;
310 toggleSearch(elem);
312 return true;
315 function selBlur(elem) {
316 if (open_sel_name == elem.name) {
317 open_sel_name = '';
319 return true;
322 // This invokes the patient search dialog.
323 function searchme() {
324 var f = document.forms[0];
325 var url = '../main/finder/patient_select.php?popup=1';
327 <?php
328 $lres = getLayoutRes();
330 while ($lrow = sqlFetchArray($lres)) {
331 $field_id = $lrow['field_id'];
332 if (strpos($field_id, 'em_') === 0) continue;
333 $data_type = $lrow['data_type'];
334 $fldname = "form_$field_id";
335 switch(getSearchClass($data_type)) {
336 case 1:
337 echo
338 " if (f.$fldname.style.backgroundColor != '' && trimlen(f.$fldname.value) > 0) {\n" .
339 " url += '&$field_id=' + encodeURIComponent(f.$fldname.value);\n" .
340 " }\n";
341 break;
342 case 2:
343 echo
344 " if (f.$fldname.style.backgroundColor != '' && f.$fldname.selectedIndex > 0) {\n" .
345 " url += '&$field_id=' + encodeURIComponent(f.$fldname.options[f.$fldname.selectedIndex].value);\n" .
346 " }\n";
347 break;
352 dlgopen(url, '_blank', 700, 500);
355 //-->
357 </script>
358 </head>
360 <body class="body_top">
362 <form action='new_comprehensive_save.php' name='demographics_form' method='post' onsubmit='return validate(this)'>
364 <span class='title'><?php xl('Search or Add Patient','e'); ?></span>
366 <table width='100%' cellpadding='0' cellspacing='8'>
367 <tr>
368 <td align='left' valign='top'>
369 <?php if ($SHORT_FORM) echo " <center>\n"; ?>
370 <?php
372 function end_cell() {
373 global $item_count, $cell_count;
374 if ($item_count > 0) {
375 echo "</td>";
376 $item_count = 0;
380 function end_row() {
381 global $cell_count, $CPR;
382 end_cell();
383 if ($cell_count > 0) {
384 for (; $cell_count < $CPR; ++$cell_count) echo "<td></td>";
385 echo "</tr>\n";
386 $cell_count = 0;
390 function end_group() {
391 global $last_group, $SHORT_FORM;
392 if (strlen($last_group) > 0) {
393 end_row();
394 echo " </table>\n";
395 if (!$SHORT_FORM) echo "</div>\n";
399 $last_group = '';
400 $cell_count = 0;
401 $item_count = 0;
402 $display_style = 'block';
403 $group_seq = 0; // this gives the DIV blocks unique IDs
405 while ($frow = sqlFetchArray($fres)) {
406 $this_group = $frow['group_name'];
407 $titlecols = $frow['titlecols'];
408 $datacols = $frow['datacols'];
409 $data_type = $frow['data_type'];
410 $field_id = $frow['field_id'];
411 $list_id = $frow['list_id'];
412 $currvalue = '';
414 if (strpos($field_id, 'em_') === 0) {
415 $tmp = substr($field_id, 3);
416 if (isset($result2[$tmp])) $currvalue = $result2[$tmp];
418 else {
419 if (isset($result[$field_id])) $currvalue = $result[$field_id];
422 // Handle a data category (group) change.
423 if (strcmp($this_group, $last_group) != 0) {
424 if (!$SHORT_FORM) {
425 end_group();
426 $group_seq++; // ID for DIV tags
427 $group_name = substr($this_group, 1);
428 if (strlen($last_group) > 0) echo "<br />";
429 echo "<span class='bold'><input type='checkbox' name='form_cb_$group_seq' id='form_cb_$group_seq' value='1' " .
430 "onclick='return divclick(this,\"div_$group_seq\");'";
431 if ($display_style == 'block') echo " checked";
433 // Modified 6-09 by BM - Translate if applicable
434 echo " /><b>" . xl_layout_label($group_name) . "</b></span>\n";
436 echo "<div id='div_$group_seq' class='section' style='display:$display_style;'>\n";
437 echo " <table border='0' cellpadding='0'>\n";
438 $display_style = 'none';
440 else if (strlen($last_group) == 0) {
441 echo " <table border='0' cellpadding='0'>\n";
443 $last_group = $this_group;
446 // Handle starting of a new row.
447 if (($titlecols > 0 && $cell_count >= $CPR) || $cell_count == 0) {
448 end_row();
449 echo " <tr>";
452 if ($item_count == 0 && $titlecols == 0) $titlecols = 1;
454 // Handle starting of a new label cell.
455 if ($titlecols > 0) {
456 end_cell();
457 echo "<td colspan='$titlecols'";
458 echo ($frow['uor'] == 2) ? " class='required'" : " class='bold'";
459 if ($cell_count == 2) echo " style='padding-left:10pt'";
460 echo ">";
461 $cell_count += $titlecols;
463 ++$item_count;
465 echo "<b>";
467 // Modified 6-09 by BM - Translate if applicable
468 if ($frow['title']) echo (xl_layout_label($frow['title']).":"); else echo "&nbsp;";
470 echo "</b>";
472 // Handle starting of a new data cell.
473 if ($datacols > 0) {
474 end_cell();
475 echo "<td colspan='$datacols' class='text'";
476 if ($cell_count > 0) echo " style='padding-left:5pt'";
477 echo ">";
478 $cell_count += $datacols;
481 ++$item_count;
482 generate_form_field($frow, $currvalue);
485 end_group();
488 <?php
489 if (! $GLOBALS['simplified_demographics']) {
490 $insurancei = getInsuranceProviders();
491 $pid = 0;
492 $insurance_headings = array(xl("Primary Insurance Provider"), xl("Secondary Insurance Provider"), xl("Tertiary Insurance provider"));
493 $insurance_info = array();
494 $insurance_info[1] = getInsuranceData($pid,"primary");
495 $insurance_info[2] = getInsuranceData($pid,"secondary");
496 $insurance_info[3] = getInsuranceData($pid,"tertiary");
498 echo "<br /><span class='bold'><input type='checkbox' name='form_cb_ins' value='1' " .
499 "onclick='return divclick(this,\"div_ins\");'";
500 if ($display_style == 'block') echo " checked";
501 echo " /><b>" . xl('Insurance') . "</b></span>\n";
502 echo "<div id='div_ins' class='section' style='display:$display_style;'>\n";
504 for($i=1;$i<=3;$i++) {
505 $result3 = $insurance_info[$i];
507 <table border="0">
508 <tr>
509 <td valign='top' colspan='2'>
510 <span class='required'><?php echo $insurance_headings[$i -1].":"?></span>
511 <select name="i<?php echo $i?>provider">
512 <option value=""><?php xl('Unassigned','e'); ?></option>
513 <?php
514 foreach ($insurancei as $iid => $iname) {
515 echo "<option value='" . $iid . "'";
516 if (strtolower($iid) == strtolower($result3{"provider"}))
517 echo " selected";
518 echo ">" . $iname . "</option>\n";
521 </select>&nbsp;<a href='' onclick='return ins_search(<?php echo $i?>)'>
522 <?php xl('Search/Add Insurer','e'); ?></a>
523 </td>
524 </tr>
525 <tr>
526 <td valign=top>
527 <table border="0">
529 <tr>
530 <td>
531 <span class='required'><?php xl('Plan Name','e'); ?>: </span>
532 </td>
533 <td>
534 <input type='entry' size='20' name='i<?php echo $i?>plan_name' value="<?php echo $result3{"plan_name"} ?>"
535 onchange="capitalizeMe(this);" />&nbsp;&nbsp;
536 </td>
537 </tr>
539 <tr>
540 <td>
541 <span class='required'><?php xl('Effective Date','e'); ?>: </span>
542 </td>
543 <td>
544 <input type='entry' size='11' name='i<?php echo $i ?>effective_date'
545 id='i<?php echo $i ?>effective_date'
546 value='<?php echo $result3['date'] ?>'
547 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
548 title='yyyy-mm-dd' />
550 <img src='../../interface/pic/show_calendar.gif' align='absbottom' width='24' height='22'
551 id='img_i<?php echo $i ?>effective_date' border='0' alt='[?]' style='cursor:pointer'
552 title='<?php xl('Click here to choose a date','e'); ?>'>
554 <script LANGUAGE="JavaScript">
555 Calendar.setup({inputField:"i<?php echo $i ?>effective_date", ifFormat:"%Y-%m-%d", button:"img_i<?php echo $i; ?>effective_date"});
556 </script>
559 </td>
560 </tr>
562 <tr>
563 <td><span class=required><?php xl('Policy Number','e'); ?>: </span></td>
564 <td><input type='entry' size='16' name='i<?php echo $i?>policy_number' value="<?php echo $result3{"policy_number"}?>"
565 onkeyup='policykeyup(this)'></td>
566 </tr>
568 <tr>
569 <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>
570 </tr>
572 <tr<?php if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?>>
573 <td class='required'><?php xl('Subscriber Employer (SE)','e'); ?><br><span style='font-weight:normal'>
574 (<?php xl('if unemployed enter Student','e'); ?>,<br><?php xl('PT Student, or leave blank','e'); ?>): </span></td>
575 <td><input type=entry size=25 name=i<?php echo $i?>subscriber_employer
576 value="<?php echo $result3{"subscriber_employer"}?>"
577 onchange="capitalizeMe(this);" /></td>
578 </tr>
580 <tr<?php if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?>>
581 <td><span class=required><?php xl('SE Address','e'); ?>: </span></td>
582 <td><input type=entry size=25 name=i<?php echo $i?>subscriber_employer_street
583 value="<?php echo $result3{"subscriber_employer_street"}?>"
584 onchange="capitalizeMe(this);" /></td>
585 </tr>
587 <tr<?php if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?>>
588 <td colspan="2">
589 <table>
590 <tr>
591 <td><span class=required><?php xl('SE City','e'); ?>: </span></td>
592 <td><input type=entry size=15 name=i<?php echo $i?>subscriber_employer_city
593 value="<?php echo $result3{"subscriber_employer_city"}?>"
594 onchange="capitalizeMe(this);" /></td>
595 <td><span class=required><?php echo ($GLOBALS['phone_country_code'] == '1') ? xl('SE State','e') : xl('SE Locality','e') ?>: </span></td>
596 <td>
597 <?php
598 // Modified 7/2009 by BM to incorporate data types
599 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']);
601 </td>
602 </tr>
603 <tr>
604 <td><span class=required><?php echo ($GLOBALS['phone_country_code'] == '1') ? xl('SE Zip Code','e') : xl('SE Postal Code','e') ?>: </span></td>
605 <td><input type=entry size=10 name=i<?php echo $i?>subscriber_employer_postal_code value="<?php echo $result3{"subscriber_employer_postal_code"}?>"></td>
606 <td><span class=required><?php xl('SE Country','e'); ?>: </span></td>
607 <td>
608 <?php
609 // Modified 7/2009 by BM to incorporate data types
610 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']);
612 </td>
613 </tr>
614 </table>
615 </td>
616 </tr>
618 </table>
619 </td>
621 <td valign=top>
622 <span class=required><?php xl('Subscriber','e'); ?>: </span>
623 <input type=entry size=10 name=i<?php echo $i?>subscriber_fname
624 value="<?php echo $result3{"subscriber_fname"}?>"
625 onchange="capitalizeMe(this);" />
626 <input type=entry size=3 name=i<?php echo $i?>subscriber_mname
627 value="<?php echo $result3{"subscriber_mname"}?>"
628 onchange="capitalizeMe(this);" />
629 <input type=entry size=10 name=i<?php echo $i?>subscriber_lname
630 value="<?php echo $result3{"subscriber_lname"}?>"
631 onchange="capitalizeMe(this);" />
632 <br>
633 <span class=required><?php xl('Relationship','e'); ?>: </span>
634 <?php
635 // Modified 6/2009 by BM to use list_options and function
636 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_relationship'),'list_id'=>'sub_relation','empty_title'=>' '), $result3['subscriber_relationship']);
638 <a href="javascript:popUp('../../interface/patient_file/summary/browse.php?browsenum=<?php echo $i?>')" class=text>(<?php xl('Browse','e'); ?>)</a><br />
640 <span class=bold><?php xl('D.O.B.','e'); ?>: </span>
641 <input type='entry' size='11' name='i<?php echo $i?>subscriber_DOB'
642 id='i<?php echo $i?>subscriber_DOB'
643 value='<?php echo $result3['subscriber_DOB'] ?>'
644 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
645 title='yyyy-mm-dd' />
647 <img src='../../interface/pic/show_calendar.gif' align='absbottom' width='24' height='22'
648 id='img_i<?php echo $i; ?>dob_date' border='0' alt='[?]' style='cursor:pointer'
649 title='<?php xl('Click here to choose a date','e'); ?>'>
651 <script LANGUAGE="JavaScript">
652 Calendar.setup({inputField:"i<?php echo $i?>subscriber_DOB", ifFormat:"%Y-%m-%d", button:"img_i<?php echo $i; ?>dob_date"});
653 </script>
656 <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"}?>">&nbsp;
657 <span class=bold><?php xl('Sex','e'); ?>: </span>
658 <?php
659 // Modified 6/2009 by BM to use list_options and function
660 generate_form_field(array('data_type'=>1,'field_id'=>('i'.$i.'subscriber_sex'),'list_id'=>'sex'), $result3['subscriber_sex']);
662 <br>
663 <span class=required><?php xl('Subscriber Address','e'); ?>: </span>
664 <input type=entry size=25 name=i<?php echo $i?>subscriber_street
665 value="<?php echo $result3{"subscriber_street"}?>"
666 onchange="capitalizeMe(this);" /><br>
667 <span class=required><?php xl('City','e'); ?>: </span>
668 <input type=entry size=15 name=i<?php echo $i?>subscriber_city
669 value="<?php echo $result3{"subscriber_city"}?>"
670 onchange="capitalizeMe(this);" />
671 <span class=required><?php echo ($GLOBALS['phone_country_code'] == '1') ? xl('State','e') : xl('Locality','e') ?>: </span>
672 <?php
673 // Modified 7/2009 by BM to incorporate data types
674 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']);
676 <br />
677 <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"}?>">
678 <span class='required'<?php if ($GLOBALS['omit_employers']) echo " style='display:none'"; ?>>
679 <?php xl('Country','e'); ?>: </span>
680 <?php
681 // Modified 7/2009 by BM to incorporate data types
682 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']);
684 <br />
685 <span class=bold><?php xl('Subscriber Phone','e'); ?>:
686 <input type='text' size='20' name='i<?php echo $i?>subscriber_phone' value='<?php echo $result3["subscriber_phone"] ?>' onkeyup='phonekeyup(this,mypcc)' />
687 </span><br />
688 <span class=bold><?php xl('CoPay','e'); ?>: <input type=text size="6" name=i<?php echo $i?>copay value="<?php echo $result3{"copay"}?>">
689 </span><br />
690 <span class='required'><?php xl('Accept Assignment','e'); ?>: </span>
691 <select name=i<?php echo $i?>accept_assignment>
692 <option value="TRUE" <?php if (strtoupper($result3{"accept_assignment"}) == "TRUE") echo "selected"?>><?php xl('YES','e'); ?></option>
693 <option value="FALSE" <?php if (strtoupper($result3{"accept_assignment"}) == "FALSE") echo "selected"?>><?php xl('NO','e'); ?></option>
694 </select>
695 </td>
696 </tr>
698 </table>
699 <hr />
700 <?php
702 echo "</div>\n";
703 } // end of "if not simplified_demographics"
706 <?php if (!$SHORT_FORM) echo " <center>\n"; ?>
707 <br />
708 <?php if ($WITH_SEARCH) { ?>
709 <input type="button" id="search" value=<?php xl('Search','e','\'','\''); ?>
710 style='background-color:<?php echo $searchcolor; ?>' />
711 &nbsp;&nbsp;
712 <?php } ?>
713 <input type="button" name='create' id="create" value=<?php xl('Create New Patient','e','\'','\''); ?> />
715 </center>
717 </td>
718 <td align='right' valign='top' width='1%' nowrap>
719 <!-- Image upload stuff was here but got moved. -->
720 </td>
721 </tr>
722 </table>
724 </form>
726 <!-- include support for the list-add selectbox feature -->
727 <?php include($GLOBALS['fileroot']."/library/options_listadd.inc"); ?>
729 </body>
731 <script language="JavaScript">
733 // fix inconsistently formatted phone numbers from the database
734 var f = document.forms[0];
735 if (f.form_phone_contact) phonekeyup(f.form_phone_contact,mypcc);
736 if (f.form_phone_home ) phonekeyup(f.form_phone_home ,mypcc);
737 if (f.form_phone_biz ) phonekeyup(f.form_phone_biz ,mypcc);
738 if (f.form_phone_cell ) phonekeyup(f.form_phone_cell ,mypcc);
740 <?php echo $date_init; ?>
742 // -=- jQuery makes life easier -=-
744 // var matches = 0; // number of patients that match the demographic information being entered
745 // var override = false; // flag that overrides the duplication warning
747 $(document).ready(function() {
749 // added to integrate insurance stuff
750 <?php for ($i=1;$i<=3;$i++) { ?>
751 $("#form_i<?php echo $i?>subscriber_relationship").change(function() { auto_populate_employer_address<?php echo $i?>(); });
752 <?php } ?>
754 $('#search').click(function() { searchme(); });
755 $('#create').click(function() { submitme(); });
757 var submitme = function() {
758 top.restoreSession();
759 var f = document.forms[0];
761 if (validate(f)) {
762 if (force_submit) {
763 // In this case dups were shown already and Save should just save.
764 f.submit();
765 return;
767 <?php
768 // D in edit_options indicates the field is used in duplication checking.
769 // This constructs a list of the names of those fields.
770 $mflist = "";
771 $mfres = sqlStatement("SELECT * FROM layout_options " .
772 "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' AND " .
773 "edit_options LIKE '%D%' " .
774 "ORDER BY group_name, seq");
775 while ($mfrow = sqlFetchArray($mfres)) {
776 $field_id = $mfrow['field_id'];
777 if (strpos($field_id, 'em_') === 0) continue;
778 if (!empty($mflist)) $mflist .= ",";
779 $mflist .= "'" . htmlentities($field_id) . "'";
782 // Build and invoke the URL to create the dup-checker dialog.
783 var url = 'new_search_popup.php';
784 var flds = new Array(<?php echo $mflist; ?>);
785 var separator = '?';
786 for (var i = 0; i < flds.length; ++i) {
787 var fval = $('#form_' + flds[i]).val();
788 if (fval && fval != '') {
789 url += separator;
790 separator = '&';
791 url += 'mf_' + flds[i] + '=' + encodeURIComponent(fval);
794 dlgopen(url, '_blank', 700, 500);
796 } // end if validate
797 } // end function
799 // Set onclick/onfocus handlers for toggling background color.
800 <?php
801 $lres = getLayoutRes();
802 while ($lrow = sqlFetchArray($lres)) {
803 $field_id = $lrow['field_id'];
804 if (strpos($field_id, 'em_') === 0) continue;
805 switch(getSearchClass($lrow['data_type'])) {
806 case 1:
807 echo " \$('#form_$field_id').click(function() { toggleSearch(this); });\n";
808 break;
809 case 2:
810 echo " \$('#form_$field_id').click(function() { selClick(this); });\n";
811 echo " \$('#form_$field_id').blur(function() { selBlur(this); });\n";
812 break;
817 }); // end document.ready
819 </script>
821 </html>