'.__('You don\'t have enough privileges to access this area!').''); } require SIMBIO.'simbio_GUI/form_maker/simbio_form_element.inc.php'; $page_title = 'Library Visitor Report'; $reportView = false; if (isset($_GET['reportView'])) { $reportView = true; } if (!$reportView) { ?>

1999; $y--) { $year_options[] = array($y, $y); } echo simbio_form_element::selectList('year', $year_options, $current_year); ?>
'; // header $output .= ''; $output .= ''.__('Member Type').''; foreach ($months as $month_num => $month) { $total_month[$month_num] = 0; $output .= ''.$month.''; } $output .= ''; // year $selected_year = date('Y'); if (isset($_GET['year']) AND !empty($_GET['year'])) { $selected_year = (integer)$_GET['year']; } // get member type data from databse $_q = $dbs->query("SELECT member_type_id, member_type_name FROM mst_member_type LIMIT 100"); while ($_d = $_q->fetch_row()) { $member_types[$_d[0]] = $_d[1]; } $r = 1; // count library member visitor each month foreach ($member_types as $id => $member_type) { $row_class = ($r%2 == 0)?'alterCellPrinted':'alterCellPrinted2'; $output .= ''; $output .= ''.$member_type.''."\n"; foreach ($months as $month_num => $month) { $sql_str = "SELECT COUNT(visitor_id) FROM visitor_count AS vc INNER JOIN (member AS m LEFT JOIN mst_member_type AS mt ON m.member_type_id=mt.member_type_id) ON m.member_id=vc.member_id WHERE m.member_type_id=$id AND vc.checkin_date LIKE '$selected_year-$month_num-%'"; $visitor_q = $dbs->query($sql_str); $visitor_d = $visitor_q->fetch_row(); if ($visitor_d[0] > 0) { $output .= ''.$visitor_d[0].''; } else { $output .= ''.$visitor_d[0].''; } $total_month[$month_num] += $visitor_d[0]; } $output .= ''; $r++; } // non member visitor count $row_class = ($r%2 == 0)?'alterCellPrinted':'alterCellPrinted2'; $output .= ''; $output .= ''.__('NON-Member Visitor').''."\n"; foreach ($months as $month_num => $month) { $sql_str = "SELECT COUNT(visitor_id) FROM visitor_count AS vc WHERE (vc.member_id IS NULL OR vc.member_id='') AND vc.checkin_date LIKE '$selected_year-$month_num-%'"; $visitor_q = $dbs->query($sql_str); $visitor_d = $visitor_q->fetch_row(); if ($visitor_d[0] > 0) { $output .= ''.$visitor_d[0].''; } else { $output .= ''.$visitor_d[0].''; } $total_month[$month_num] += $visitor_d[0]; } $output .= ''; // total for each month $output .= ''; $output .= ''.__('Total visit/month').''; foreach ($months as $month_num => $month) { $output .= ''.$total_month[$month_num].''; } $output .= ''; $output .= ''; // print out echo '
Visitor Count Report for year '.$selected_year.' '.__('Print Current Page').'
'."\n"; echo $output; $content = ob_get_clean(); // include the page template require SB.'/admin/'.$sysconf['admin_template']['dir'].'/printed_page_tpl.php'; }