'.__('You don\'t have enough privileges to access this area!').''); } require SIMBIO.'simbio_GUI/template_parser/simbio_template_parser.inc.php'; require SIMBIO.'simbio_GUI/table/simbio_table.inc.php'; require SIMBIO.'simbio_GUI/paging/simbio_paging.inc.php'; require SIMBIO.'simbio_GUI/form_maker/simbio_form_element.inc.php'; require SIMBIO.'simbio_DB/datagrid/simbio_dbgrid.inc.php'; require MDLBS.'reporting/report_dbgrid.inc.php'; $page_title = 'Visitors Report'; $reportView = false; $num_recs_show = 20; if (isset($_GET['reportView'])) { $reportView = true; } if (!$reportView) { ?>

query('SELECT member_type_id, member_type_name FROM mst_member_type'); $mtype_options = array(); $mtype_options[] = array('0', __('ALL')); $mtype_options[] = array('-1', __('NON-Member visitor')); while ($mtype_d = $mtype_q->fetch_row()) { $mtype_options[] = array($mtype_d[0], $mtype_d[1]); } echo simbio_form_element::selectList('member_type', $mtype_options); ?>
setSQLColumn('IF(vc.member_id IS NOT NULL, vc.member_id, \'NON-MEMBER\') AS \''.__('Member ID').'\'', 'vc.member_name AS \''.__('Visitor Name').'\'', 'IF(mt.member_type_name IS NOT NULL, mt.member_type_name, \'NON-MEMBER\') AS \''.__('Membership Type').'\'', 'vc.institution AS \''.__('Institution').'\'', 'vc.checkin_date AS \''.__('Visit Date').'\''); $reportgrid->setSQLorder('vc.member_id ASC'); // is there any search $criteria = 'vc.visitor_id IS NOT NULL '; if (isset($_GET['member_type']) AND !empty($_GET['member_type'])) { $mtype = $_GET['member_type']; if (intval($mtype) < 0) { $criteria .= ' AND (vc.member_id IS NULL OR vc.member_id=\'\')'; } else if (intval($mtype) > 0) { $criteria .= ' AND mt.member_type_id='.$mtype; } } if (isset($_GET['id_name']) AND !empty($_GET['id_name'])) { $id_name = $dbs->escape_string($_GET['id_name']); $criteria .= ' AND (vc.member_id LIKE \'%'.$id_name.'%\' OR vc.member_name LIKE \'%'.$id_name.'%\')'; } if (isset($_GET['institution']) AND !empty($_GET['institution'])) { $institution = $dbs->escape_string(trim($_GET['institution'])); $criteria .= ' AND vc.institution LIKE \'%'.$institution.'%\''; } // register date if (isset($_GET['startDate']) AND isset($_GET['untilDate'])) { $criteria .= ' AND (TO_DAYS(vc.checkin_date) BETWEEN TO_DAYS(\''.$_GET['startDate'].'\') AND TO_DAYS(\''.$_GET['untilDate'].'\'))'; } if (isset($_GET['recsEachPage'])) { $recsEachPage = (integer)$_GET['recsEachPage']; $num_recs_show = ($recsEachPage >= 20 && $recsEachPage <= 200)?$recsEachPage:$num_recs_show; } $reportgrid->setSQLCriteria($criteria); // put the result into variables echo $reportgrid->createDataGrid($dbs, $table_spec, $num_recs_show); echo ''; $xlsquery = 'SELECT IF(vc.member_id IS NOT NULL, vc.member_id, \'NON-MEMBER\') AS \''.__('Member ID').'\''. ', vc.member_name AS \''.__('Visitor Name').'\''. ', IF(mt.member_type_name IS NOT NULL, mt.member_type_name, \'NON-MEMBER\') AS \''.__('Membership Type').'\''. ', vc.institution AS \''.__('Institution').'\''. ', vc.checkin_date AS \''.__('Visit Date').'\''. ' FROM '.$table_spec.' WHERE '.$criteria. ' ORDER BY vc.member_id ASC'; unset($_SESSION['xlsdata']); $_SESSION['xlsquery'] = $xlsquery; $_SESSION['tblout'] = "visitor_list"; echo '

'.__('Export to spreadsheet format').'

'; $content = ob_get_clean(); // include the page template require SB.'/admin/'.$sysconf['admin_template']['dir'].'/printed_page_tpl.php'; }