'.__('You don\'t have enough privileges to access this area!').'');
}
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 = 'Reservation List Report';
$reportView = false;
if (isset($_GET['reportView'])) {
$reportView = true;
}
if (!$reportView) {
?>
setSQLColumn('r.item_code AS \''.__('Item Code').'\'',
'b.title AS \''.__('Title').'\'',
'm.member_name AS \''.__('Member Name').'\'',
'r.reserve_date AS \''.__('Reserve Date').'\'');
$reportgrid->setSQLorder('r.reserve_date DESC');
// is there any search
$criteria = 'r.reserve_id IS NOT NULL ';
if (isset($_GET['title']) AND !empty($_GET['title'])) {
$keyword = $dbs->escape_string(trim($_GET['title']));
$words = explode(' ', $keyword);
if (count($words) > 1) {
$concat_sql = ' AND (';
foreach ($words as $word) {
$concat_sql .= " (b.title LIKE '%$word%') AND";
}
// remove the last AND
$concat_sql = substr_replace($concat_sql, '', -3);
$concat_sql .= ') ';
$criteria .= $concat_sql;
} else {
$criteria .= ' AND (b.title LIKE \'%'.$keyword.'%\')';
}
}
if (isset($_GET['itemCode']) AND !empty($_GET['itemCode'])) {
$item_code = $dbs->escape_string(trim($_GET['itemCode']));
$criteria .= ' AND i.item_code LIKE \'%'.$item_code.'%\'';
}
if (isset($_GET['member']) AND !empty($_GET['member'])) {
$member = $dbs->escape_string($_GET['member']);
$criteria .= ' AND (m.member_name LIKE \'%'.$member.'%\' OR m.member_id LIKE \'%'.$member.'%\')';
}
if (isset($_GET['startDate']) AND isset($_GET['untilDate'])) {
$criteria .= ' AND (TO_DAYS(r.reserve_date) BETWEEN TO_DAYS(\''.$_GET['startDate'].'\') AND
TO_DAYS(\''.$_GET['untilDate'].'\'))';
}
$reportgrid->setSQLCriteria($criteria);
// put the result into variables
echo $reportgrid->createDataGrid($dbs, $table_spec, 20);
echo '';
$content = ob_get_clean();
// include the page template
require SB.'/admin/'.$sysconf['admin_template']['dir'].'/printed_page_tpl.php';
}