'.__('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 = 'Item Usage 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-1); ?>
setSQLColumn('i.item_code AS \''.__('Item Code').'\'', 'b.title AS \''.__('Title').'\'', '\'01\' AS \''.__('Jan').'\'', '\'02\' AS \''.__('Feb').'\'', '\'03\' AS \''.__('Mar').'\'', '\'04\' AS \''.__('Apr').'\'', '\'05\' AS \''.__('May').'\'', '\'06\' AS \''.__('Jun').'\'', '\'07\' AS \''.__('Jul').'\'', '\'08\' AS \''.__('Aug').'\'', '\'09\' AS \''.__('Sep').'\'', '\'10\' AS \''.__('Oct').'\'', '\'11\' AS \''.__('Nov').'\'', '\'12\' AS \''.__('Dec').'\'' ); $reportgrid->setSQLorder('b.title ASC'); // is there any search $criteria = 'b.biblio_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%' OR b.isbn_issn 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.'%\' OR b.isbn_issn 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['year']) AND !empty($_GET['year'])) { $selected_year = (integer)$_GET['year']; } else { $selected_year = date('Y')-1; } $reportgrid->setSQLCriteria($criteria); // callback function to show overdued list function showUsage($obj_db, $array_data, $int_current_field_num) { global $selected_year; $_usage_q = $obj_db->query('SELECT COUNT(*) FROM loan AS l WHERE l.item_code=\''.$array_data[0].'\' AND l.loan_date LIKE \''.$selected_year.'-'.$array_data[$int_current_field_num].'%\''); $_usage_d = $_usage_q->fetch_row(); return ($_usage_d[0]=='0')?'0':''.$_usage_d[0].''; } // modify column value $reportgrid->modifyColumnContent(2, 'callback{showUsage}'); $reportgrid->modifyColumnContent(3, 'callback{showUsage}'); $reportgrid->modifyColumnContent(4, 'callback{showUsage}'); $reportgrid->modifyColumnContent(5, 'callback{showUsage}'); $reportgrid->modifyColumnContent(6, 'callback{showUsage}'); $reportgrid->modifyColumnContent(7, 'callback{showUsage}'); $reportgrid->modifyColumnContent(8, 'callback{showUsage}'); $reportgrid->modifyColumnContent(9, 'callback{showUsage}'); $reportgrid->modifyColumnContent(10, 'callback{showUsage}'); $reportgrid->modifyColumnContent(11, 'callback{showUsage}'); $reportgrid->modifyColumnContent(12, 'callback{showUsage}'); $reportgrid->modifyColumnContent(13, 'callback{showUsage}'); // no sort column $reportgrid->disableSort(__('Jan'), __('Feb'), __('Mar'), __('Apr'), __('May'), __('Jun'), __('Jul'), __('Aug'), __('Sep'), __('Oct'), __('Nov'), __('Dec')); // 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'; }