* @author Brady Miller * @author Tyler Wrenn * @copyright Copyright (c) 2009-2021 Rod Roark * @copyright Copyright (c) 2017-2019 Brady Miller * @copyright Copyright (c) 2020 Tyler Wrenn * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 */ require_once("../globals.php"); require_once("$srcdir/options.inc.php"); require_once("$srcdir/patient.inc"); require_once("$srcdir/validation/LBF_Validation.php"); require_once("$srcdir/patientvalidation.inc.php"); use OpenEMR\Common\Acl\AclMain; use OpenEMR\Common\Csrf\CsrfUtils; use OpenEMR\Common\Twig\TwigContainer; use OpenEMR\Core\Header; // Check authorization. if (!AclMain::aclCheckCore('patients', 'demo', '', array('write','addonly'))) { echo (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('core/unauthorized.html.twig', ['pageTitle' => xl("Search or Add Patient")]); exit; } $CPR = 4; // cells per row $searchcolor = empty($GLOBALS['layout_search_color']) ? 'var(--yellow)' : $GLOBALS['layout_search_color']; $WITH_SEARCH = ($GLOBALS['full_new_patient_form'] == '1' || $GLOBALS['full_new_patient_form'] == '2' ); $SHORT_FORM = ($GLOBALS['full_new_patient_form'] == '2' || $GLOBALS['full_new_patient_form'] == '3' || $GLOBALS['full_new_patient_form'] == '4'); $grparr = array(); getLayoutProperties('DEM', $grparr, '*'); $TOPCPR = empty($grparr['']['grp_columns']) ? 4 : $grparr['']['grp_columns']; function getLayoutRes() { global $SHORT_FORM; return sqlStatement("SELECT * FROM layout_options " . "WHERE form_id = 'DEM' AND uor > 0 AND field_id != '' " . ($SHORT_FORM ? "AND ( uor > 1 OR edit_options LIKE '%N%' ) " : "") . "ORDER BY group_id, seq"); } // Determine layout field search treatment from its data type: // 1 = text field // 2 = select list // 0 = not searchable // function getSearchClass($data_type) { switch ($data_type) { case 1: // single-selection list case 10: // local provider list case 11: // provider list case 12: // pharmacy list case 13: // squads case 14: // address book list case 26: // single-selection list with add case 35: // facilities return 2; case 2: // text field case 3: // textarea case 4: // date return 1; } return 0; } $fres = getLayoutRes(); ?> <?php echo xlt("Search or Add Patient"); ?> LBF forms accordinf the form_id*/ $constraints = LBF_Validation::generate_validate_constraints("DEM"); ?>

,event,"DEM",constraints)'>
\n"; } ?> 0) { echo ""; // end BS column $item_count = 0; } } function end_row() { global $cell_count, $CPR, $BS_COL_CLASS; end_cell(); if ($cell_count > 0 && $cell_count < $CPR) { // Create a cell occupying the remaining bootstrap columns. // BS columns will be less than 12 if $CPR is not 2, 3, 4, 6 or 12. $bs_cols_remaining = ($CPR - $cell_count) * intval(12 / $CPR); echo "
"; } if ($cell_count > 0) { echo "\n"; } $cell_count = 0; } function end_group() { global $last_group, $SHORT_FORM; if (strlen($last_group) > 0) { end_row(); echo "\n"; // end BS container if (!$SHORT_FORM) { echo "\n"; } } echo ""; } $last_group = ''; $cell_count = 0; $item_count = 0; $display_style = 'block'; $group_seq = 0; // this gives the DIV blocks unique IDs $condition_str = ''; while ($frow = sqlFetchArray($fres)) { $this_group = $frow['group_id']; $titlecols = $frow['titlecols']; $datacols = $frow['datacols']; $data_type = $frow['data_type']; $field_id = $frow['field_id']; $list_id = $frow['list_id']; $currvalue = ''; // Accumulate action conditions into a JSON expression for the browser side. accumActionConditions($frow, $condition_str); if (strpos($field_id, 'em_') === 0) { $tmp = substr($field_id, 3); if (isset($result2[$tmp])) { $currvalue = $result2[$tmp]; } } else { if (isset($result[$field_id])) { $currvalue = $result[$field_id]; } } // Handle a data category (group) change. if (strcmp($this_group, $last_group) != 0) { if (!$SHORT_FORM) { end_group(); $group_seq++; // ID for DIV tags $group_name = $grparr[$this_group]['grp_title']; $group_seq_attr = attr($group_seq); $checked = ($display_style == 'block') ? "show" : ""; $group_name_xl = text(xl_layout_label($group_name)); $onclick = attr_js("div_" . $group_seq); $init_open = $grparr[$this_group]['grp_init_open']; if ($checked != "show") { $checked = ($init_open == 1) ? $checked . " show" : $checked; } echo <<

HTML; $display_style = 'none'; } elseif (strlen($last_group) == 0) { echo "
\n"; } $CPR = empty($grparr[$this_group]['grp_columns']) ? $TOPCPR : $grparr[$this_group]['grp_columns']; $last_group = $this_group; } // Handle starting of a new row. if (($titlecols > 0 && $cell_count >= $CPR) || $cell_count == 0) { end_row(); echo "
"; } if ($item_count == 0 && $titlecols == 0) { $titlecols = 1; } $field_id_label = 'label_' . $frow['field_id']; // Handle starting of a new label cell. if ($titlecols > 0) { end_cell(); $bs_cols = $titlecols * intval(12 / $CPR); echo "
"; $cell_count += $titlecols; } // $item_count is the number of title and data items in the current cell. ++$item_count; if ($datacols == 0) { // Data will be in the same cell, so prevent wrapping between title and data. echo ""; // mb-2 doesn't work here } // Modified 6-09 by BM - Translate if applicable if ($frow['title']) { echo (text(xl_layout_label($frow['title'])) . ":"); } else { echo " "; } // Handle starting of a new data cell. if ($datacols > 0) { $id_field_text = "text_" . $frow['field_id']; end_cell(); $bs_cols = $datacols * intval(12 / $CPR); echo "
"; $cell_count += $datacols; } ++$item_count; if ($item_count > 1) { echo " "; } // 'smallform' can be used to add arbitrary CSS classes. Note the leading space. $frow['smallform'] = ' form-control-sm mw-100' . ($datacols ? '' : ' mb-1'); // set flag so we don't bring in session pid data for a new pt form $frow['blank_form'] = false; if ( $frow['data_type'] == "52" || $frow['data_type'] == "53" || $frow['data_type'] == "54" ) { $frow['blank_form'] = true; } generate_form_field($frow, $currvalue); if ($datacols == 0) { // End nowrap echo " "; // space to allow wrap between spans } } end_group(); ?>

HTML; for ($i = 1; $i <= sizeof($insurance_info); $i++) { $result3 = $insurance_info[$i]; ?>
" onchange="capitalizeMe(this);" />
" onchange="capitalizeMe(this);" /> " onchange="capitalizeMe(this);" /> " onchange="capitalizeMe(this);" />
' />
1,'field_id' => ('i' . $i . 'subscriber_relationship'),'list_id' => 'sub_relation','empty_title' => ' ', 'smallform' => 'true'), ($result3['subscriber_relationship'] ?? '')); ?> ()
" onkeyup='policykeyup(this)' />
' />
" onkeyup='policykeyup(this)' />
" />
" : ""; ?>
" onchange="capitalizeMe(this);" /> , .
" : ""; ?>
1,'field_id' => ('i' . $i . 'subscriber_sex'),'list_id' => 'sex', 'smallform' => 'true'), $result3['subscriber_sex'] ?? ''); ?>
" : ""; ?>
" onchange="capitalizeMe(this);" />
" : ""; ?>
" onchange="capitalizeMe(this);" />
" onchange="capitalizeMe(this);" />
" : ""; ?>
" onchange="capitalizeMe(this);" />
" : ""; ?>
" onchange="capitalizeMe(this);" />
" : ""; ?>
$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', 'smallform' => 'true'), ($result3['subscriber_employer_state'] ?? '')); ?>
" : ""; ?>
$GLOBALS['state_data_type'], 'field_id' => ('i' . $i . 'subscriber_state'),'list_id' => $GLOBALS['state_list'],'fld_length' => '15','max_length' => '63','edit_options' => 'C', 'smallform' => 'true'), ($result3['subscriber_state'] ?? '')); ?>
" : ""; ?>
" />
" : ""; ?>
" />
" : ""; ?>
$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', 'smallform' => 'true'), ($result3['subscriber_employer_country'] ?? '')); ?>
$GLOBALS['country_data_type'],'field_id' => ('i' . $i . 'subscriber_country'),'list_id' => $GLOBALS['country_list'],'fld_length' => '10','max_length' => '63','edit_options' => 'C', 'smallform' => 'true'), ($result3['subscriber_country'] ?? '')); ?>
" : ""; ?>
' onkeyup='phonekeyup(this,mypcc)' />
" />

\n"; } // end of "if not simplified_demographics" ?> \n"; } ?>