// // 2004-05/19 AddContent(SNF_TITLE_SEPARATOR . 'Search', 'HEAD_TITLE', 'BOTTOM'); $tpl = new HTML_Template_IT(); $tpl->loadTemplatefile(EP_TEMPLATE_DIR . 'search.tpl'); if ($_SESSION['bad_email']) $tpl->touchBlock('BAD_EMAIL'); $tpl->setCurrentBlock('SEARCH'); if ($_SESSION['account_type'] == SNF_ACCT_INDIVIDUAL) { // get number of reports this user owns $rpts_owned = GetDbField(DbQuery('SELECT count(*) AS reports FROM ' . EP_DB_COM_NAME . '.tbl_report_purchase WHERE userid = ' . intval(USER_ID) . ' AND UNIX_TIMESTAMP(NOW()) <= expiration_ts'), 'reports'); $rpt_price = GetDbField(DbQuery('SELECT at.price FROM ' . EP_DB_COM_NAME . '.tbl_account_type at WHERE id = ' . SNF_ACCT_INDIVIDUAL), 'price'); $sub_price = GetDbField(DbQuery('SELECT at.price FROM ' . EP_DB_COM_NAME . '.tbl_account_type at WHERE id = ' . SNF_ACCT_LEVEL2), 'price'); $tax = '0'; // show UPGRADE offer $upg_price = sprintf("%01.2f", ($sub_price - ($rpts_owned * $rpt_price)) * (1 + $tax)); echo '
You can upgrade to a full subscription for only $' . $upg_price . '!' . $tax_msg . '
'; } if ($_REQUEST['clear']) $_SESSION['search'] = array('listing' => true); $tpl->loadTemplatefile(EP_TEMPLATE_DIR . 'search.tpl'); $tpl->setCurrentBlock('SEARCH'); // when counting search criteria, exclude list_query_string, mprovid_hidden, and listing // they don't count if (is_array($_SESSION['search']) && count(array_diff_key($_SESSION['search'], array('list_query_string' => '', 'mprovid_hidden' => '', 'listing' => '')))) $tpl->touchBlock('PREVIOUSCRITERIA'); if (isset($_REQUEST['no_search_criteria'])) $tpl->touchBlock('NO_SEARCH_CRITERIA'); // build msa list $msa_rst = DbQuery('SELECT m.msacode AS value, m.msaname AS label FROM tbl_cms_msa m ORDER BY m.msaname'); $msas['-- All Facilities --'] = ''; $msas['Urban (Within any MSA)'] = 'A'; $msas['Rural (Not in an MSA)'] = 'B'; while ($msa_row = GetDbRow($msa_rst)) $msas[$msa_row['label']] = $msa_row['value']; // fipscounty setting... if ($_REQUEST['fipsaction'] == 'changeFIPSState') { $_SESSION['fipsstate'] = $_REQUEST['fipsstate']; // reset the county selection $_SESSION['fipscounty'] = array(); } if ($_SESSION['search']['fipsstate']) { $fips_rst = DbQuery('SELECT fips_code AS value, fips_county AS label from tbl_fips WHERE county_code != \'000\' AND state = \''. DbEscapeQuotes($_SESSION['search']['fipsstate']) . '\' ORDER BY fips_county'); $fipscounties['-- Choose County within State --'] = ''; while ($fips_row = GetDbRow($fips_rst)) $fipscounties[$fips_row['label']] = $fips_row['value']; } else $fipscounties = array('-- Choose State First --' => ''); $free_subscriber = !snf_show_data(); $search_form = array( 'SNF_JS_AUTOSUGGEST' => SNF_JS_AUTOSUGGEST, 'NAME_QS' => ep_gettext('name_qs', array('autofocus' => true, 'type' => 'search', 'cols' => 30, 'attributes' => array('style' => 'width: 100%;', 'accesskey' => 's'))), 'MPROVID' => ep_gettext('mprovid', array('type' => 'search', 'value' => $_SESSION['search']['mprovid'], 'cols' => 12, 'disabled' => $free_subscriber, 'inputmode' => 'numeric', 'pattern' => '[A-Za-z0-9]{6}|[rR][0-9]*', 'title' => 'Numbers and letters')), 'MNAME' => ep_gettext('mname', array('type' => 'search', 'value' => $_SESSION['search']['mname'], 'cols' => 30)), 'LISTING' => ep_getcheck('listing', 'Active SNFs Only', array('selected' => $_SESSION['search']['listing'])), 'MCITY' => ep_gettext('mcity', array('value' => $_SESSION['search']['mcity'], 'cols' => 20)), 'MSTATE' => ep_getdbselect('mstate[]', DbQuery('SELECT d.code AS value, CONCAT(d.code, \' (\', d.name, \')\') AS label FROM tbl_demographic d WHERE d.type IN (' . DEMOGRAPHIC_TYPE_STATE . ', ' . DEMOGRAPHIC_TYPE_STATE_EXTENDED . ') ORDER BY code'), array('value' => $_SESSION['search']['mstate'], 'rows' => 3, 'multi' => true, 'header' => '-- Any State --')), 'MZIP' => ep_gettext('mzip', array('inputmode' => 'numeric', 'value' => $_SESSION['search']['mzip'], 'cols' => 10, 'pattern' => '[0-9]{3,5}', 'title' => 'Numbers only, 3 to 5 characters')), 'FACILITY_TYPE' => ep_getdbselect('facility_type', DbQuery('SELECT description AS value, description AS label FROM tbl_facility_type ORDER BY description'), array('value' => $_SESSION['search']['facility_type'], 'header' => '-- All Types --', 'disabled' => $free_subscriber)), 'CNTRL' => ep_getdbselect('cntrl', DbQuery('SELECT id AS value, description AS label FROM tbl_cntrl_msa c ORDER BY description'), array('value' => $_SESSION['search']['cntrl'], 'header' => '-- All Types --', 'disabled' => $free_subscriber)), 'BEDMIN' => ep_gettext('bed_min', array('value' => $_SESSION['search']['bed_min'], 'cols' => 5, 'disabled' => $free_subscriber, 'inputmode' => 'numeric', 'pattern' => '[0-9]{1,6}', 'title' => 'Numbers only')), 'BEDMAX' => ep_gettext('bed_max', array('value' => $_SESSION['search']['bed_max'], 'cols' => 5, 'disabled' => $free_subscriber, 'inputmode' => 'numeric', 'pattern' => '[0-9]{1,6}', 'title' => 'Numbers only')), 'PATIENTDAYSMIN' => ep_gettext('patientdays_min', array('value' => $_SESSION['search']['patientdays_min'], 'cols' => 5, 'disabled' => $free_subscriber, 'inputmode' => 'numeric', 'pattern' => '[0-9]{1,6}', 'title' => 'Numbers only')), 'PATIENTDAYSMAX' => ep_gettext('patientdays_max', array('value' => $_SESSION['search']['patientdays_max'], 'cols' => 5, 'disabled' => $free_subscriber, 'inputmode' => 'numeric', 'pattern' => '[0-9]{1,6}', 'title' => 'Numbers only')), 'REVMIN' => ep_gettext('rev_min', array('value' => $_SESSION['search']['rev_min'], 'cols' => 10, 'disabled' => $free_subscriber, 'inputmode' => 'numeric', 'pattern' => '[0-9]{1,14}', 'title' => 'Numbers only')), 'REVMAX' => ep_gettext('rev_max', array('value' => $_SESSION['search']['rev_max'], 'cols' => 10, 'disabled' => $free_subscriber, 'inputmode' => 'numeric', 'pattern' => '[0-9]{1,14}', 'title' => 'Numbers only')), 'MSA' => ep_getselect('msa', $msas, array('value' => $_SESSION['search']['msa'], 'disabled' => $free_subscriber)), 'FIPS' => ep_getdbselect('fipsstate', DbQuery('SELECT stateabbr AS value, concat(stateabbr, \' - \', statename) AS label FROM tbl_fips_state ORDER BY stateabbr'), array('value' => $_SESSION['search']['fipsstate'], 'attributes' => array('onChange' => 'getCountyList(this,\'fipscounty[]\')'), 'header' => '-- Choose State --', 'disabled' => $free_subscriber)) . GetHidden('fipsaction', ''), 'FIPS_COUNTY_SELECTOR' => '' . ep_getselect('fipscounty[]', $fipscounties, array('value' => $_SESSION['search']['fipscounty'], 'rows' => 3, 'multi' => true, 'disabled' => $free_subscriber)), 'RADIUS' => ep_gettext('radius', array('value' => $_SESSION['search']['radius'], 'cols' => 5, 'disabled' => $free_subscriber, 'inputmode' => 'numeric', 'pattern' => '[0-9]{1,5}', 'title' => 'Numbers only')), 'RADIUSZIP' => ep_gettext('radiuszip', array('value' => $_SESSION['search']['radiuszip'], 'cols' => 5, 'disabled' => $free_subscriber, 'inputmode' => 'numeric', 'pattern' => '[0-9]{3,5}', 'title' => 'Numbers only, 3 to 5 characters')) ); if ($free_subscriber) $tpl->touchBlock('SUBSCRIBE'); $tpl->setVariable($search_form); $tpl->parseCurrentBlock(); $tpl->show(); ?>