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

:
query('SELECT coll_type_id, coll_type_name FROM mst_coll_type'); $coll_type_options = array(); $coll_type_options[] = array('0', __('ALL')); while ($coll_type_d = $coll_type_q->fetch_row()) { $coll_type_options[] = array($coll_type_d[0], $coll_type_d[1]); } echo simbio_form_element::selectList('collType', $coll_type_options); ?>
1999; $y--) { $year_options[] = array($y, $y); } echo simbio_form_element::selectList('year', $year_options, $current_year-1); ?>
'; // header $output .= ''; $output .= ''.__('Classification').''; $xlsrows = array($xls_rc => array(__('Classification'),__('Jan'),__('Feb'),__('Mar'),__('Apr'),__('May'),__('Jun'),__('Jul'),__('Aug'),__('Sep'),__('Oct'),__('Nov'),__('Dec'))); $xls_rc++; foreach ($months as $month) { $output .= ''.$month.''; } $output .= ''; // class $class_num = isset($_GET['class'])?trim($_GET['class']):'0'; // year $selected_year = date('Y')-1; if (isset($_GET['year']) AND !empty($_GET['year'])) { $selected_year = (integer)$_GET['year']; } // collection type $coll_type = null; if (isset($_GET['collType'])) { $coll_type = (integer)$_GET['collType']; $coll_type_q = $dbs->query('SELECT coll_type_name FROM mst_coll_type WHERE coll_type_id='.$coll_type); $coll_type_d = $coll_type_q->fetch_row(); $coll_type_name = $coll_type_d[0]; } $row_class = ($class_num%2 == 0)?'alterCellPrinted':'alterCellPrinted2'; if ($class_num == 'NONDECIMAL') { $output .= 'NON DECIMAL Classification'; $xlsrows[$xls_rc][$xls_cc] = 'NON DECIMAL Classification'; $xls_cc++; // count loan each month foreach ($months as $month_num => $month) { $loan_q = $dbs->query("SELECT COUNT(*) FROM biblio AS b LEFT JOIN item AS i ON b.biblio_id=i.biblio_id LEFT JOIN loan AS l ON l.item_code=i.item_code WHERE classification REGEXP '^[^0-9]' AND l.loan_date LIKE '$selected_year-$month_num-%'".( !empty($coll_type)?" AND i.coll_type_id=$coll_type":'' )); $loan_d = $loan_q->fetch_row(); if ($loan_d[0] > 0) { $output .= ''.$loan_d[0].''; } else { $output .= ''.$loan_d[0].''; } $xlsrows[$xls_rc][$xls_cc] = $loan_d[0]; $xls_cc++; } $xls_rc++; $xls_cc =0; $output .= ''; } else { $output .= ''.$class_num.'00'; $xlsrows[$xls_rc][$xls_cc] = $class_num; $xls_cc++; // count loan each month foreach ($months as $month_num => $month) { $loan_q = $dbs->query("SELECT COUNT(*) FROM biblio AS b LEFT JOIN item AS i ON b.biblio_id=i.biblio_id LEFT JOIN loan AS l ON l.item_code=i.item_code WHERE TRIM(classification) LIKE '$class_num%' AND l.loan_date LIKE '$selected_year-$month_num-%'".( !empty($coll_type)?" AND i.coll_type_id=$coll_type":'' )); $loan_d = $loan_q->fetch_row(); if ($loan_d[0] > 0) { $output .= ''.$loan_d[0].''; } else { $output .= ''.$loan_d[0].''; } $xlsrows[$xls_rc][$xls_cc] = $loan_d[0]; $xls_cc++; } $xls_rc++; $xls_cc =0; $output .= ''; $class_num2 = 0; // 2nd subclasses while ($class_num2 < 10) { $row_class = ($row_class == 'alterCellPrinted')?'alterCellPrinted2':'alterCellPrinted'; $output .= '   '.$class_num.$class_num2.'0'; $xlsrows[$xls_rc][$xls_cc] = ' '.$class_num; $xls_cc++; // count loan each month foreach ($months as $month_num => $month) { $loan_q = $dbs->query("SELECT COUNT(*) FROM biblio AS b LEFT JOIN item AS i ON b.biblio_id=i.biblio_id LEFT JOIN loan AS l ON l.item_code=i.item_code WHERE TRIM(classification) LIKE '$class_num"."$class_num2%' AND l.loan_date LIKE '$selected_year-$month_num-%'".( !empty($coll_type)?" AND i.coll_type_id=$coll_type":'' )); $loan_d = $loan_q->fetch_row(); if ($loan_d[0] > 0) { $output .= ''.$loan_d[0].''; } else { $output .= ''.$loan_d[0].''; } $xlsrows[$xls_rc][$xls_cc] = $loan_d[0]; $xls_cc++; } $xls_rc++; $xls_cc =0; $output .= ''; $class_num2++; } } $output .= ''; // print out echo '
Loan Recap By Class '.$class_num.' for year '.$selected_year.''.( isset($coll_type_name)?'
'.$coll_type_name.'
':'' ).' '.__('Print Current Page').''; echo ''.__('Export to spreadsheet format').'
'."\n"; echo $output; unset($_SESSION['xlsquery']); $_SESSION['xlsdata'] = $xlsrows; $_SESSION['tblout'] = "loan_by_class_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'; }