query('SELECT coll_type_name, COUNT(item_id) AS total_items FROM `item` AS i INNER JOIN mst_coll_type AS ct ON i.coll_type_id = ct.coll_type_id GROUP BY i.coll_type_id HAVING total_items >0 ORDER BY COUNT(item_id) DESC'); // set plot data and colors while ($data = $stat_query->fetch_row()) { if($sysconf['chart']['mode'] == 'plot') { $plot_data[] = array($data[0], $data[1]); $data_colors[] = '#'.generateRandomColors(); } else { $plot_data .= '{ value: '.$data[1].', color: "#'.generateRandomColors().'", highlight: "#'.generateRandomColors().'", label: "'.$data[0].'" },'; } } break; case 'total_member_by_type': $chart_title = __('Total Members By Membership Type'); // total number of active member by membership type $report_q = $dbs->query('SELECT member_type_name, COUNT(member_id) FROM mst_member_type AS mt LEFT JOIN member AS m ON mt.member_type_id=m.member_type_id WHERE TO_DAYS(expire_date)>TO_DAYS(\''.date('Y-m-d').'\') GROUP BY m.member_type_id ORDER BY COUNT(member_id) DESC'); while ($data = $report_q->fetch_row()) { if($sysconf['chart']['mode'] == 'plot') { $plot_data[] = array($data[0], $data[1]); $data_colors[] = '#'.generateRandomColors(); } else { $plot_data .= '{ value: '.$data[1].', color: "#'.generateRandomColors().'", highlight: "#'.generateRandomColors().'", label: "'.$data[0].'" },'; } } break; case 'total_loan_gmd': $chart_title = __('Total Loan By GMD/Medium'); $report_q = $dbs->query('SELECT gmd_name, COUNT(loan_id) FROM loan AS l INNER JOIN item AS i ON l.item_code=i.item_code INNER JOIN biblio AS b ON i.biblio_id=b.biblio_id INNER JOIN mst_gmd AS gmd ON b.gmd_id=gmd.gmd_id GROUP BY b.gmd_id ORDER BY COUNT(loan_id) DESC'); $report_d = ''; while ($data = $report_q->fetch_row()) { if($sysconf['chart']['mode'] == 'plot') { $plot_data[] = array($data[0], $data[1]); $data_colors[] = '#'.generateRandomColors(); } else { $plot_data .= '{ value: '.$data[1].', color: "#'.generateRandomColors().'", highlight: "#'.generateRandomColors().'", label: "'.$data[0].'" },'; } } break; case 'total_loan_colltype': $chart_title = __('Total Loan By Collection Type'); $report_q = $dbs->query('SELECT coll_type_name, COUNT(loan_id) FROM loan AS l INNER JOIN item AS i ON l.item_code=i.item_code INNER JOIN mst_coll_type AS ct ON i.coll_type_id=ct.coll_type_id GROUP BY i.coll_type_id ORDER BY COUNT(loan_id) DESC'); while ($data = $report_q->fetch_row()) { if($sysconf['chart']['mode'] == 'plot') { $plot_data[] = array($data[0], $data[1]); $data_colors[] = '#'.generateRandomColors(); } else { $plot_data .= '{ value: '.$data[1].', color: "#'.generateRandomColors().'", highlight: "#'.generateRandomColors().'", label: "'.$data[0].'" },'; } } break; default: $stat_query = $dbs->query('SELECT gmd_name, COUNT(biblio_id) AS total_titles FROM `biblio` AS b INNER JOIN mst_gmd AS gmd ON b.gmd_id = gmd.gmd_id GROUP BY b.gmd_id HAVING total_titles>0 ORDER BY COUNT(biblio_id) DESC'); // set plot data and colors while ($data = $stat_query->fetch_row()) { if($sysconf['chart']['mode'] == 'plot') { $plot_data[] = array($data[0], $data[1]); $data_colors[] = '#'.generateRandomColors(); } else { $plot_data .= '{ value: '.$data[1].', color: "#'.generateRandomColors().'", highlight: "#'.generateRandomColors().'", label: "'.$data[0].'" },'; } } break; } /** * Charts data definition end */ // Create plot if($sysconf['chart']['mode'] == 'plot') { if ($plot_data && $chart) { // set plot titles $plot->SetTitle($chart_title); // set data $plot->SetDataValues($plot_data); // set plot colors $plot->SetDataColors($data_colors); // set plot shading $plot->SetShading(20); // set plot type to pie $plot->SetPlotType('pie'); $plot->SetDataType('text-data-single'); // set legend foreach ($plot_data as $row) { $plot->SetLegend(implode(': ', $row)); } //Draw it $plot->DrawGraph(); } } else { echo '
'; } exit();