'.__('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 = 'Recap Report'; $reportView = false; if (isset($_GET['reportView'])) { $reportView = true; } if (!$reportView) { ?>

:
'; // header $output .= ''.$recapby.' '.__('Title').' '.__('Items').''; $xlsrows = array($xls_rc => array($recapby,__('Title'),__('Items'))); $xls_rc++; if (isset($_GET['recapBy']) AND trim($_GET['recapBy']) != '') { switch ($_GET['recapBy']) { case 'gmd' : $recapby = __('GMD'); /* GMD */ $gmd_q = $dbs->query("SELECT DISTINCT gmd_id, gmd_name FROM mst_gmd"); while ($gmd_d = $gmd_q->fetch_row()) { $row_class = ($row_class == 'alterCellPrinted')?'alterCellPrinted2':'alterCellPrinted'; $output .= ''.$gmd_d[1].''; // count by title $bytitle_q = $dbs->query("SELECT COUNT(biblio_id) FROM biblio WHERE gmd_id=".$gmd_d[0]); $bytitle_d = $bytitle_q->fetch_row(); $output .= ''.$bytitle_d[0].''; // count by item $byitem_q = $dbs->query("SELECT COUNT(item_id) FROM item AS i INNER JOIN biblio AS b ON i.biblio_id=b.biblio_id WHERE b.gmd_id=".$gmd_d[0]); $byitem_d = $byitem_q->fetch_row(); $output .= ''.$byitem_d[0].''; $xlsrows[$xls_rc] = array($gmd_d[1],$bytitle_d[0],$byitem_d[0]); $xls_rc++; $output .= ''; } /* GMD END */ break; case 'language' : $recapby = __('Language'); /* LANGUAGE */ $lang_q = $dbs->query("SELECT DISTINCT language_id, language_name FROM mst_language"); while ($lang_d = $lang_q->fetch_row()) { $row_class = ($row_class == 'alterCellPrinted')?'alterCellPrinted2':'alterCellPrinted'; $output .= ''.$lang_d[1].''; // count by title $bytitle_q = $dbs->query("SELECT COUNT(biblio_id) FROM biblio WHERE language_id='".$lang_d[0]."'"); $bytitle_d = $bytitle_q->fetch_row(); $output .= ''.$bytitle_d[0].''; // count by item $byitem_q = $dbs->query("SELECT COUNT(item_id) FROM item AS i INNER JOIN biblio AS b ON i.biblio_id=b.biblio_id WHERE b.language_id='".$lang_d[0]."'"); $byitem_d = $byitem_q->fetch_row(); $output .= ''.$byitem_d[0].''; $xlsrows[$xls_rc] = array($lang_d[1],$bytitle_d[0],$byitem_d[0]); $xls_rc++; $output .= ''; } /* LANGUAGE END */ break; case 'collType' : $recapby = __('Collection Type'); /* COLLECTION TYPE */ $ctype_q = $dbs->query("SELECT DISTINCT coll_type_id, coll_type_name FROM mst_coll_type"); while ($ctype_d = $ctype_q->fetch_row()) { $row_class = ($row_class == 'alterCellPrinted')?'alterCellPrinted2':'alterCellPrinted'; $output .= ''.$ctype_d[1].''; // count by title $bytitle_q = $dbs->query("SELECT DISTINCT biblio_id FROM item AS i WHERE i.coll_type_id=".$ctype_d[0].""); $bytitle_d[0] = $bytitle_q->num_rows; $output .= ''.$bytitle_q->num_rows.''; // count by item $byitem_q = $dbs->query("SELECT COUNT(item_id) FROM item AS i WHERE i.coll_type_id=".$ctype_d[0]); $byitem_d = $byitem_q->fetch_row(); $output .= ''.$byitem_d[0].''; $xlsrows[$xls_rc] = array($ctype_d[1],$bytitle_d[0],$byitem_d[0]); $xls_rc++; $output .= ''; } /* COLLECTION TYPE END */ break; } } else { // recap by classification /* DECIMAL CLASSES */ $class_num = 0; while ($class_num < 10) { $class_num2 = 0; $row_class = ($class_num%2 == 0)?'alterCellPrinted':'alterCellPrinted2'; $output .= ''.$class_num.'00'; // count by title $bytitle_q = $dbs->query("SELECT COUNT(biblio_id) FROM biblio WHERE TRIM(classification) LIKE '$class_num%'"); $bytitle_d = $bytitle_q->fetch_row(); $output .= ''.$bytitle_d[0].''; // count by item $byitem_q = $dbs->query("SELECT COUNT(item_id) FROM item AS i LEFT JOIN biblio AS b ON i.biblio_id=b.biblio_id WHERE TRIM(b.classification) LIKE '$class_num%'"); $byitem_d = $byitem_q->fetch_row(); $output .= ''.$byitem_d[0].''; $xlsrows[$xls_rc] = array($class_num.'00',$bytitle_d[0],$byitem_d[0]); $xls_rc++; $output .= ''; // 2nd subclasses while ($class_num2 < 10) { $row_class = ($row_class == 'alterCellPrinted')?'alterCellPrinted2':'alterCellPrinted'; $output .= '   '.$class_num.$class_num2.'0'; // count by title $bytitle_q = $dbs->query("SELECT COUNT(biblio_id) FROM biblio WHERE TRIM(classification) LIKE '".$class_num.$class_num2."%'"); $bytitle_d = $bytitle_q->fetch_row(); $output .= ''.$bytitle_d[0].''; // count by item $byitem_q = $dbs->query("SELECT COUNT(item_id) FROM item AS i LEFT JOIN biblio AS b ON i.biblio_id=b.biblio_id WHERE TRIM(b.classification) LIKE '".$class_num.$class_num2."%'"); $byitem_d = $byitem_q->fetch_row(); $output .= ''.$byitem_d[0].''; $xlsrows[$xls_rc] = array(' '.$class_num.$class_num2.'0',$bytitle_d[0],$byitem_d[0]); $xls_rc++; $output .= ''; $class_num2++; } $class_num++; } /* 2X NUMBER CLASSES */ $row_class = ($row_class == 'alterCellPrinted')?'alterCellPrinted2':'alterCellPrinted'; $output .= '2X classes'; // count by title $bytitle_q = $dbs->query("SELECT COUNT(biblio_id) FROM biblio WHERE TRIM(classification) LIKE '2X%'"); $bytitle_d = $bytitle_q->fetch_row(); $output .= ''.$bytitle_d[0].''; // count by item $byitem_q = $dbs->query("SELECT COUNT(item_id) FROM item AS i INNER JOIN biblio AS b ON i.biblio_id=b.biblio_id WHERE TRIM(b.classification) LIKE '2X%'"); $byitem_d = $byitem_q->fetch_row(); $output .= ''.$byitem_d[0].''; $xlsrows[$xls_rc] = array('2X',$bytitle_d[0],$byitem_d[0]); $xls_rc++; $output .= ''; /* 2X NUMBER CLASSES END */ /* NON-DECIMAL NUMBER CLASSES */ // get non-decimal class $_non_decimal_q = $dbs->query("SELECT DISTINCT classification FROM biblio WHERE classification REGEXP '^[^0-9]'"); if ($_non_decimal_q->num_rows > 0) { while ($_non_decimal = $_non_decimal_q->fetch_row()) { $row_class = ($row_class == 'alterCellPrinted')?'alterCellPrinted2':'alterCellPrinted'; $output .= ''.$_non_decimal[0].' classes'; // count by title $bytitle_q = $dbs->query("SELECT COUNT(biblio_id) FROM biblio WHERE classification LIKE '".$_non_decimal[0]."'"); $bytitle_d = $bytitle_q->fetch_row(); $output .= ''.$bytitle_d[0].''; // count by item $byitem_q = $dbs->query("SELECT COUNT(item_id) FROM item AS i INNER JOIN biblio AS b ON i.biblio_id=b.biblio_id WHERE classification LIKE '".$_non_decimal[0]."'"); $byitem_d = $byitem_q->fetch_row(); $output .= ''.$byitem_d[0].''; $xlsrows[$xls_rc] = array($_non_decimal[0],$bytitle_d[0],$byitem_d[0]); $xls_rc++; $output .= ''; } } /* NON-DECIMAL NUMBER CLASSES END */ } $output .= ''; // print out echo '
'.__('Title and Collection Recap by').' '.$recapby.' '.__('Print Current Page').''.__('Export to spreadsheet format').'
'."\n"; echo $output; unset($_SESSION['xlsquery']); $_SESSION['xlsdata'] = $xlsrows; $_SESSION['tblout'] = "recap_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'; }