'.__('You don\'t have enough privileges to access this area!').'');
}
// show only current user stock take item flag
if (isset($_GET['listShow']) && $_GET['listShow'] == '1') {
$show_only_current = 1;
}
// check if there is any active stock take proccess
$stk_query = $dbs->query('SELECT * FROM stock_take WHERE is_active=1');
if ($stk_query->num_rows < 1) {
echo '
'.__('NO stock taking proccess initialized yet!').'
';
} else {
// check view mode
$view = 'e';
if (isset($_GET['view']) AND $_GET['view']) {
$view = trim($_GET['view']);
}
?>
setSQLColumn('item_code AS \''.__('Item Code').'\'',
'title AS \''.__('Title').'\'',
'call_number AS \''.__('Call Number').'\'',
'coll_type_name AS \''.__('Collection Type').'\'',
'classification AS \''.__('Classification').'\'',
'IF(sti.status=\'e\', \''.__('Exists').'\', IF(sti.status=\'l\', \''.__('On Loan').'\', \''.__('Missing').'\')) AS \'Status\'');
$datagrid->setSQLorder("last_update DESC");
$criteria = 'item_id <> 0 ';
// is there any search
if (isset($_GET['keywords']) AND $_GET['keywords']) {
$keyword = $dbs->escape_string(trim($_GET['keywords']));
$words = explode(' ', $keyword);
if (count($words) > 1) {
$concat_sql = ' (';
foreach ($words as $word) {
$concat_sql .= " (title LIKE '%$word%' OR item_code LIKE '%$word%') AND";
}
// remove the last AND
$concat_sql = substr_replace($concat_sql, '', -3);
$concat_sql .= ') ';
$criteria .= ' AND '.$concat_sql." AND status='".$view."'";
} else {
$criteria .= " AND (title LIKE '%$keyword%' OR item_code LIKE '%$keyword%') AND status='".$view."'";
}
} else {
$criteria .= " AND status='".$view."'";
}
if (isset($show_only_current)) {
$criteria .= ' AND checked_by=\''.$_SESSION['realname'].'\'';
}
// set criteria
$datagrid->setSQLCriteria($criteria);
// set table and table header attributes
$datagrid->table_attr = 'align="center" id="dataList" cellpadding="5" cellspacing="0"';
$datagrid->table_header_attr = 'class="dataListHeader" style="font-weight: bold;"';
// set delete proccess URL
$datagrid->delete_URL = $_SERVER['PHP_SELF'];
$datagrid->column_width = array('10%', '60%', '10%', '10%', '10%');
$datagrid->disableSort('Current Status');
// put the result into variables
$datagrid_result = $datagrid->createDataGrid($dbs, $table_spec, 20, false);
if (isset($_GET['keywords']) AND $_GET['keywords']) {
$msg = str_replace('{result->num_rows}', $datagrid->num_rows, __('Found {result->num_rows} from your keywords')); //mfc
echo ''.$msg.' : "'.$_GET['keywords'].'"
';
}
echo $datagrid_result;
/* main content end */
}