本文整理汇总了PHP中graph类的典型用法代码示例。如果您正苦于以下问题:PHP graph类的具体用法?PHP graph怎么用?PHP graph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了graph类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_day_information
private function show_day_information($type, $date)
{
$filter = new filter($this->db, $this->output, $this->user);
$filter->to_output($this->model->table, $this->model->hostnames);
if (($stats = $this->model->get_day_statistics($type, $date, $filter->hostname, $filter->webserver)) === false) {
$this->output->add_tag("result", "Database error.");
return false;
}
$graph = new graph($this->output);
$graph->title = $this->graphs[$type] . " for " . date("l j F Y", strtotime($date));
$graph->width = 960;
$graph->height = GRAPH_HEIGHT;
foreach ($stats as $hour => $count) {
$graph->add_bar("Hour " . $hour, $count, "hour");
}
$graph->to_output();
if (($stats = $this->model->get_day_information($type, $date, $filter->hostname, $filter->webserver)) === false) {
$this->output->add_tag("result", "Database error.");
return false;
}
$this->output->open_tag("day", array("hostnames" => show_boolean($this->model->hostnames), "label" => $this->graphs[$type]));
foreach ($stats as $stat) {
if ($type == "requests" || $type == "bytes_sent") {
$stat["count"] = $this->model->readable_number($stat["count"]);
}
$this->output->record($stat, "stat");
}
$this->output->close_tag();
}
示例2: render
function render($id, $title)
{
global $path_to_root;
include_once $path_to_root . "/includes/ui.inc";
include_once $path_to_root . "/reporting/includes/class.graphic.inc";
if (!defined('FLOAT_COMP_DELTA')) {
define('FLOAT_COMP_DELTA', 0.004);
}
if (!isset($this->top)) {
$this->top = 10;
}
$begin = begin_fiscalyear();
$today = Today();
$begin1 = date2sql($begin);
$today1 = date2sql($today);
$sql = "SELECT SUM((trans.ov_amount + trans.ov_discount) * rate) AS total, s.supplier_id, s.supp_name FROM\n " . TB_PREF . "supp_trans AS trans, " . TB_PREF . "suppliers AS s WHERE trans.supplier_id=s.supplier_id\n AND (trans.type = " . ST_SUPPINVOICE . " OR trans.type = " . ST_SUPPCREDIT . ")\n AND tran_date >= '{$begin1}' AND tran_date <= '{$today1}' ";
if ($this->data_filter != '') {
$sql .= ' AND ' . $this->data_filter;
}
$sql .= "GROUP by s.supplier_id ORDER BY total DESC, s.supplier_id " . " LIMIT " . $this->top;
$result = db_query($sql);
if ($this->graph_type == 'Table') {
$th = array(_("Supplier"), _("Amount"));
start_table(TABLESTYLE, "width=98%");
table_header($th);
$k = 0;
//row colour counter
while ($myrow = db_fetch($result)) {
alt_table_row_color($k);
$name = $myrow["supplier_id"] . " " . $myrow["supp_name"];
label_cell($name);
amount_cell($myrow['total']);
end_row();
}
end_table(1);
} else {
$pg = new graph();
$i = 0;
while ($myrow = db_fetch($result)) {
$name = $myrow["supplier_id"] . " " . $myrow["supp_name"];
$pg->x[$i] = $name;
$pg->y[$i] = $myrow['total'];
$i++;
}
$pg->title = $title;
$pg->axis_x = _("Supplier");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $today;
$pg->type = 2;
$pg->skin = 1;
$pg->built_in = false;
$filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
$pg->display($filename, true);
echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
}
}
示例3: render
function render($id, $title)
{
global $path_to_root;
include_once $path_to_root . "/reporting/includes/class.graphic.inc";
if (!defined('FLOAT_COMP_DELTA')) {
define('FLOAT_COMP_DELTA', 0.004);
}
if (!isset($this->top)) {
$this->top = 10;
}
$begin = begin_fiscalyear();
$today = Today();
$begin1 = date2sql($begin);
$today1 = date2sql($today);
$sql = "SELECT SUM((ov_amount + ov_discount) * rate * IF(trans.type = " . ST_CUSTCREDIT . ", -1, 1)) AS total,d.debtor_no, d.name" . " FROM " . TB_PREF . "debtor_trans AS trans, " . TB_PREF . "debtors_master AS d" . " WHERE trans.debtor_no=d.debtor_no" . " AND (trans.type = " . ST_SALESINVOICE . " OR trans.type = " . ST_CUSTCREDIT . ")" . " AND tran_date >= '{$begin1}' AND tran_date <= '{$today1}'";
if ($this->data_filter != '') {
$sql .= ' AND ' . $this->data_filter;
}
$sql .= " GROUP by d.debtor_no ORDER BY total DESC, d.debtor_no " . " LIMIT " . $this->top;
$result = db_query($sql);
if ($this->graph_type == 'Table') {
$th = array(null, _("Customer"), _("Amount"));
start_table(TABLESTYLE, "width=98%");
table_header($th);
$k = 0;
//row colour counter
$i = 0;
while ($myrow = db_fetch($result)) {
alt_table_row_color($k);
label_cell(viewer_link($myrow["debtor_no"], 'sales/inquiry/customer_inquiry.php?customer_id=' . $myrow["debtor_no"]));
label_cell(viewer_link($myrow["name"], 'sales/inquiry/customer_inquiry.php?customer_id=' . $myrow["debtor_no"]));
amount_cell($myrow['total']);
end_row();
}
end_table(1);
} else {
$pg = new graph();
$i = 0;
while ($myrow = db_fetch($result)) {
$pg->x[$i] = $myrow["debtor_no"] . " " . $myrow["name"];
$pg->y[$i] = $myrow['total'];
$i++;
}
$pg->title = $title;
$pg->axis_x = _("Customer");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $today;
$pg->type = 2;
$pg->skin = 1;
$pg->built_in = false;
$filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
$pg->display($filename, true);
echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
}
}
示例4: render
function render($id, $title)
{
global $path_to_root;
include_once $path_to_root . "/reporting/includes/class.graphic.inc";
$begin = begin_fiscalyear();
$today = Today();
$begin1 = date2sql($begin);
$today1 = date2sql($today);
$sql = "SELECT SUM(amount) AS total, c.class_name, c.ctype FROM\n " . TB_PREF . "gl_trans," . TB_PREF . "chart_master AS a, " . TB_PREF . "chart_types AS t,\n " . TB_PREF . "chart_class AS c WHERE\n account = a.account_code AND a.account_type = t.id AND t.class_id = c.cid\n AND IF(c.ctype > 3, tran_date >= '{$begin1}', tran_date >= '0000-00-00')\n AND tran_date <= '{$today1}' ";
if ($this->data_filter != '') {
$sql .= ' AND ' . $this->data_filter;
}
$sql .= " GROUP BY c.cid ORDER BY c.cid";
$result = db_query($sql, "Transactions could not be calculated");
$calculated = _("Calculated Return");
if ($this->graph_type == 'Table') {
start_table(TABLESTYLE2, "width=98%");
$total = 0;
while ($myrow = db_fetch($result)) {
if ($myrow['ctype'] > 3) {
$total += $myrow['total'];
$myrow['total'] = -$myrow['total'];
}
label_row($myrow['class_name'], number_format2($myrow['total'], user_price_dec()), "class='label' style='font-weight:bold;'", "style='font-weight:bold;' align=right");
}
label_row(" ", "");
label_row($calculated, number_format2(-$total, user_price_dec()), "class='label' style='font-weight:bold;'", "style='font-weight:bold;' align=right");
end_table(1);
} else {
$pg = new graph();
$i = 0;
$total = 0;
while ($myrow = db_fetch($result)) {
if ($myrow['ctype'] > 3) {
$total += $myrow['total'];
$myrow['total'] = -$myrow['total'];
$pg->x[$i] = $myrow['class_name'];
$pg->y[$i] = abs($myrow['total']);
$i++;
}
}
$pg->x[$i] = $calculated;
$pg->y[$i] = -$total;
$pg->title = $title;
$pg->axis_x = _("Class");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $today;
$pg->type = 5;
$pg->skin = 1;
$pg->built_in = false;
$filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
$pg->display($filename, true);
echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
}
}
示例5: render
function render($id, $title)
{
global $path_to_root;
if (!isset($this->top)) {
$this->top = 10;
}
global $path_to_root;
$pg = new graph();
$begin = begin_fiscalyear();
$today = Today();
$begin1 = date2sql($begin);
$today1 = date2sql($today);
$sql = "SELECT SUM(-t.amount) AS total, d.reference, d.name FROM\n " . TB_PREF . "gl_trans AS t," . TB_PREF . "dimensions AS d WHERE\n (t.dimension_id = d.id OR t.dimension2_id = d.id) AND\n t.tran_date >= '{$begin1}' AND t.tran_date <= '{$today1}' ";
if ($this->data_filter != '') {
$sql .= ' AND ' . $this->data_filter;
}
$sql .= "GROUP BY d.id ORDER BY total DESC LIMIT " . $this->top;
$result = db_query($sql, "Transactions could not be calculated");
if ($this->graph_type == 'Table') {
$title = _("Top 10 Dimensions in fiscal year");
br(2);
display_heading($title);
br();
$th = array(_("Dimension"), _("Amount"));
start_table(TABLESTYLE, "width=98%");
table_header($th);
$k = 0;
//row colour counter
while ($myrow = db_fetch($result)) {
alt_table_row_color($k);
label_cell($myrow['reference'] . " " . $myrow["name"]);
amount_cell($myrow['total']);
end_row();
}
end_table(2);
} else {
$pg = new graph();
$i = 0;
while ($myrow = db_fetch($result)) {
$pg->x[$i] = $myrow['reference'] . " " . $myrow["name"];
$pg->y[$i] = abs($myrow['total']);
$i++;
}
$pg->title = $title;
$pg->axis_x = _("Dimension");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $today;
$pg->type = 5;
$pg->skin = 1;
$pg->built_in = false;
$filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
$pg->display($filename, true);
echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
}
}
示例6: execute
public function execute()
{
$graph = new graph($this->output);
$graph->title = "Demo graph";
$graph->width = 600;
$graph->height = 200;
$nr = 1;
for ($i = 0; $i < 6.3; $i += 0.1) {
$graph->add_bar("Bar number: " . $nr++, sprintf("%0.2f", sin($i) + 1.5));
}
$graph->to_output();
}
示例7: grafico
function grafico($titulo)
{
$this->load->library('Graph');
$mSQL_1 = "SELECT cod_cli,nombre, \r\n\t\t\tsum(totalg*IF(tipo_doc='D', -1, 1)) AS grantotal, \r\n\t\t\tsum(totalg*(referen IN ('E', 'M'))*IF(tipo_doc='D', -1, 1)) AS contado,\r\n\t\t\tsum(totalg*(referen NOT IN ('E', 'M'))*IF(tipo_doc='D', -1, 1)) AS credito \r\n\t\t\tFROM sfac\r\n\t\t\tWHERE tipo_doc<>'X' AND fecha>='20070101' AND fecha<='20071231' \r\n\t\t\tGROUP BY cod_cli ORDER BY grantotal DESC LIMIT 10";
// generate some random data
srand((double) microtime() * 1000000);
$bar_1 = new bar_fade(50, '#209B2C');
$bar_1->key('Contado', 10);
$bar_2 = new bar_fade(50, '#9933CC');
$bar_2->key('Credito', 10);
$bar_3 = new bar_fade(50, '#639F45');
$bar_3->key('Total', 10);
$maxval = 0;
$label = $tips = array();
$query = $this->db->query($mSQL_1);
foreach ($query->result() as $row) {
if ($row->grantotal > $maxval) {
$maxval = $row->grantotal;
}
$bar_1->data[] = $row->contado;
$bar_2->data[] = $row->credito;
$bar_3->data[] = $row->grantotal;
//$bar_1->tips = $data_tips_3;
$tips[] = $row->nombre;
$label[] = $row->cod_cli;
}
$g = new graph();
$g->title($titulo, '{font-size: 26px;}');
$g->data_sets[] = $bar_1;
$g->data_sets[] = $bar_2;
$g->data_sets[] = $bar_3;
$g->set_x_labels($label);
$g->set_x_label_style(10, '#9933CC', 2, 1);
$g->set_x_axis_steps(10);
$g->bg_colour = '#FFFFFF';
$g->set_tool_tip('#key#<br>Codigo de Clinte: #x_label# <br>Monto: #tip#');
$g->tips = $tips;
$g->set_y_max($maxval);
$g->y_label_steps(3);
$g->set_y_legend('Open Flash Chart', 12, '0x736AFF');
echo utf8_encode($g->render());
}
示例8: mkCacheData
function mkCacheData($date_from, $date_to, $product_id)
{
$conditions = array();
$info = $this->dbstuff->GetRow("SELECT * FROM " . $this->table_prefix . "products WHERE id='" . $product_id . "'");
if (!empty($info)) {
$_GET['pn'] = $info['name'];
}
$mdt = date("Ymd") . "_" . substr(md5($_GET['pn'] . $_GET['ds'] . $_GET['de']), 0, 6);
$file_item = $mdt;
$file_path = DATA_PATH . "tmp/" . $file_item . $this->cache_ext;
if (!file_exists($file_path)) {
// use the chart class to build the chart:
include_once LIB_PATH . 'ofc/chart.php';
$g = new graph();
$result = $this->dbstuff->GetArray("SELECT DATE_FORMAT(FROM_UNIXTIME(created),'%m') as mn,avg(max_price) AS avmax,avg(min_price) AS avmin FROM " . $this->table_prefix . "quotes WHERE product_id=" . $product_id . " AND created BETWEEN {$date_from} AND {$date_to} group by mn ORDER BY created ASC");
if (!empty($result)) {
foreach ($result as $val) {
$data[] = floor(($val['avmax'] + $val['avmin']) / 2);
}
$title = L("stat_charts", "tpl") . $_GET['ds'] . L("arrive_to", "tpl") . $_GET['de'];
} elseif ($info['name']) {
$title = $info['name'];
} else {
$title = L("data_not_exists") . df();
}
$g->title($title, '{font-size: 24px;color: #0000FF}');
$g->set_data($data);
$g->line_hollow(2, 4, '0x80a033', $_GET['pn'], 10);
// label each point with its value
//$g->set_x_labels( explode(",", L("months", "tpl")) );
$x_result = $this->dbstuff->GetArray("select CONCAT(FROM_UNIXTIME(created, '%Y'),'/',FROM_UNIXTIME(created, '%m')) as m from " . $this->table_prefix . "quotes WHERE created BETWEEN {$date_from} AND {$date_to} group by DATE_FORMAT(FROM_UNIXTIME(created),'%m') ORDER BY created ASC");
foreach ($x_result as $val) {
$x_tmp[] = $val['m'];
}
$g->set_x_labels($x_tmp);
$label_y = $this->dbstuff->GetRow("select max(max_price) as price_max,min(min_price) as price_min from " . $this->table_prefix . "quotes WHERE product_id=" . $product_id . " AND created BETWEEN {$date_from} AND {$date_to}");
$y_max = !empty($label_y['price_max']) ? $label_y['price_max'] : 100;
// set the Y max
$this->max_price = $label_y['price_max'];
$this->min_price = $label_y['price_min'];
$g->set_y_max($label_y['price_max']);
// label every 20 (0,20,40,60)
$g->y_label_steps(6);
// display the data
file_put_contents($file_path, $g->render());
}
$this->cache_datafile = $file_item . $this->cache_ext;
}
示例9: grafico
function grafico($anio = '')
{
$this->load->library('Graph');
if (empty($anio)) {
return;
}
$fechai = $anio . '0101';
$fechaf = $anio . '1231';
$mSQL = "SELECT a.vd, LEFT(b.nombre, 8)as nombre2, \n\t\t sum(a.totalg*IF(a.tipo_doc='D', -1, 1)) AS grantotal, \n\t\t sum(a.totalg*(a.referen IN ('E', 'M'))*IF(a.tipo_doc='D', -1, 1)) AS contado, \n\t\t sum(a.totalg*(a.referen NOT IN ('E', 'M'))*IF(a.tipo_doc='D', -1, 1)) AS credito \n\t\t FROM sfac AS a \n\t\t JOIN vend AS b ON a.vd=b.vendedor \n\t\t WHERE a.tipo_doc<>'X' AND a.fecha>='{$fechai}' AND a.fecha<='{$fechaf}' \n\t\t GROUP BY a.vd ORDER BY a.vd,grantotal DESC LIMIT 10";
$maxval = 0;
$query = $this->db->query($mSQL);
$data_1 = $data_2 = $data_3 = $vendedor = array();
foreach ($query->result() as $row) {
if ($row->grantotal > $maxval) {
$maxval = $row->grantotal;
}
$nombre[] = $row->nombre2;
$vendedor[] = $row->vd;
$data_1[] = $row->contado;
$data_2[] = $row->credito;
$data_3[] = $row->grantotal;
}
$om = 1;
while ($maxval / $om > 100) {
$om = $om * 10;
}
$bar_1 = new bar(75, '#0053A4');
$bar_2 = new bar(75, '#9933CC');
$bar_3 = new bar(75, '#639F45');
$bar_1->key('Contado', 10);
$bar_2->key('Credito', 10);
$bar_3->key('Total', 10);
for ($i = 0; $i < count($data_1); $i++) {
$bar_1->add_data_tip($data_1[$i] / $om, graph::esc(number_format($data_1[$i], 2, ',', '.')));
$bar_2->add_data_tip($data_2[$i] / $om, graph::esc(number_format($data_2[$i], 2, ',', '.')));
$bar_3->add_data_tip($data_3[$i] / $om, graph::esc(number_format($data_3[$i], 2, ',', '.')));
$bar_1->links[] = site_url("/ventas/vendedoresmensuales/index/{$anio}/" . $vendedor[$i]);
$bar_2->links[] = site_url("/ventas/vendedoresmensuales/index/{$anio}/" . $vendedor[$i]);
$bar_3->links[] = site_url("/ventas/vendedoresmensuales/index/{$anio}/" . $vendedor[$i]);
}
$g = new graph();
$g->title('Los 10 vendedores con los indice de ventas más altos en el año' . $anio, '{font-size: 22px; color:##00264A}');
$g->set_is_decimal_separator_comma(1);
$g->data_sets[] = $bar_1;
$g->data_sets[] = $bar_2;
$g->data_sets[] = $bar_3;
$g->set_x_labels($nombre);
$g->set_x_label_style(10, '#000000', 3, 1);
$g->set_x_axis_steps(10);
$g->set_x_legend('Vendedores', 14, '#004381');
$g->bg_colour = '#FFFFFF';
$g->set_tool_tip('#key#<br>Vendedor: #x_label# <br>Monto: #tip#');
$g->set_y_max(ceil($maxval / $om));
$g->y_label_steps(5);
$g->set_y_legend('Ventas x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381');
echo utf8_encode($g->render());
}
示例10: foreach
foreach ($questionorder as $i => $val) {
if ($count1[$i]) {
$stdev1[$i] = sqrt((double) $stdev1[$i] / (double) $count1[$i]);
}
if ($count2[$i]) {
$stdev2[$i] = sqrt((double) $stdev2[$i] / (double) $count2[$i]);
}
$buckets1[$i] = $buckets1[$i] - 1;
// Hack because there should not be ANY 0 values in the data.
$buckets2[$i] = $buckets2[$i] - 1;
$studbuckets1[$i] = $studbuckets1[$i] - 1;
$studbuckets2[$i] = $studbuckets2[$i] - 1;
}
$maxbuckets1 = max($buckets1);
$maxbuckets2 = max($buckets2);
$graph = new graph($SURVEY_GWIDTH, $SURVEY_GHEIGHT);
$graph->parameter['title'] = "{$question->text}";
$graph->x_data = $names;
$graph->y_data['answers1'] = $buckets1;
$graph->y_format['answers1'] = array('colour' => 'ltblue', 'line' => 'line', 'point' => 'square', 'shadow_offset' => 0.1, 'legend' => $stractualclass);
$graph->y_data['answers2'] = $buckets2;
$graph->y_format['answers2'] = array('colour' => 'ltorange', 'line' => 'line', 'point' => 'square', 'shadow_offset' => 0.1, 'legend' => $strpreferredclass);
$graph->y_data['studanswers1'] = $studbuckets1;
$graph->y_format['studanswers1'] = array('colour' => 'blue', 'line' => 'line', 'point' => 'square', 'shadow_offset' => 4, 'legend' => $stractualstudent);
$graph->y_data['studanswers2'] = $studbuckets2;
$graph->y_format['studanswers2'] = array('colour' => 'orange', 'line' => 'line', 'point' => 'square', 'shadow_offset' => 4, 'legend' => $strpreferredstudent);
$graph->y_data['stdev1'] = $stdev1;
$graph->y_format['stdev1'] = array('colour' => 'ltltblue', 'bar' => 'fill', 'shadow_offset' => 0.1, 'legend' => 'none', 'bar_size' => 0.3);
$graph->y_data['stdev2'] = $stdev2;
$graph->y_format['stdev2'] = array('colour' => 'ltltorange', 'bar' => 'fill', 'shadow_offset' => 0.1, 'legend' => 'none', 'bar_size' => 0.2);
$graph->offset_relation['stdev1'] = 'answers1';
示例11: print_error
$group = $groups[$groupid];
if (!($groupusers = get_users_by_capability($modcontext, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'), '', '', '', '', $group->id, '', false))) {
print_error('nostudentsingroup');
} else {
$groupusers = array_keys($groupusers);
}
} else {
print_error('errorinvalidgroup', 'group', null, $groupid);
}
} else {
$groups = false;
$group = false;
$groupusers = array();
}
require_capability('mod/quiz:viewreports', $modcontext);
$line = new graph(800, 600);
$line->parameter['title'] = '';
$line->parameter['y_label_left'] = get_string('participants');
$line->parameter['x_label'] = get_string('grade');
$line->parameter['y_label_angle'] = 90;
$line->parameter['x_label_angle'] = 0;
$line->parameter['x_axis_angle'] = 60;
//following two lines seem to silence notice warnings from graphlib.php
$line->y_tick_labels = null;
$line->offset_relation = null;
$line->parameter['bar_size'] = 1;
// will make size > 1 to get overlap effect when showing groups
$line->parameter['bar_spacing'] = 10;
// don't forget to increase spacing so that graph doesn't become one big block of colour
//pick a sensible number of bands depending on quiz maximum grade.
$bands = $quiz->grade;
示例12: array
$total = $_GET ['total'];
$_nomes = array ();
$_quantidade = array ();
for($i = 0; $i < $total; $i ++) {
if (( int ) $_GET ['quantidade' . $i] > 0) {
$_nomes [$i] = $_GET ['nome' . $i];
$_quantidade [$i] = ( int ) $_GET ['quantidade' . $i];
}
}
require 'library/open-flash-chart.php';
$g = new graph ( );
//
// PIE chart, 60% alpha
//
$g->pie ( 60, '#FFFFFF' );
$g->bg_colour = '#FFFFFF';
//
// pass in two arrays, one of data, the other data labels
//
$g->pie_values ( $_quantidade, $_nomes );
//
// Colours for each slice, in this case some of the colours
// will be re-used (3 colurs for 5 slices means the last two
// slices will have colours colour[0] and colour[1]):
//
示例13: _epi_report
function _epi_report()
{
//
// main API to reports
//
if (func_num_args() > 0) {
$arg_list = func_get_args();
$menu_id = $arg_list[0];
$post_vars = $arg_list[1];
$get_vars = $arg_list[2];
$validuser = $arg_list[3];
$isadmin = $arg_list[4];
//print_r($arg_list);
}
// always check dependencies
if ($exitinfo = $this->missing_dependencies('vaccine')) {
return print $exitinfo;
}
print "<span class='patient'>" . FTITLE_EPI_REPORTS . "</span><br/><br/>";
$n = new epi_report();
$g = new graph();
$n->report_menu($menu_id, $post_vars, $get_vars);
print "<table><tr><td>";
// column 1
switch ($get_vars["report_menu"]) {
case "TCL":
$n->form_inclusive_dates($menu_id, $post_vars, $get_vars);
if ($post_vars["submitreport"]) {
$n->process_inclusive_dates($menu_id, $post_vars, $get_vars);
}
$n->display_tcl_inclusive_dates($menu_id, $post_vars, $get_vars);
break;
case "SUMMARY":
$n->form_inclusive_dates($menu_id, $post_vars, $get_vars);
if ($post_vars["submitreport"]) {
$n->generate_summary($menu_id, $post_vars, $get_vars);
}
break;
case "GRAPHS":
$g->graph_menu($menu_id, $post_vars, $get_vars);
switch ($get_vars["graph"]) {
case "LINE":
$get_vars["module"] = $this->module;
$g->graph_line($menu_id, $post_vars, $get_vars);
break;
case "BAR":
$get_vars["module"] = $this->module;
$g->graph_bar($menu_id, $post_vars, $get_vars);
break;
case "PIE":
$get_vars["module"] = $this->module;
$g->graph_pie($menu_id, $post_vars, $get_vars);
break;
}
break;
}
print "</td></tr></table>";
}
示例14: print_profit_and_loss_statement
function print_profit_and_loss_statement()
{
global $comp_path, $path_to_root;
include_once $path_to_root . "reporting/includes/pdf_report.inc";
$dim = get_company_pref('use_dimension');
$dimension = $dimension2 = 0;
$from = $_REQUEST['PARAM_0'];
$to = $_REQUEST['PARAM_1'];
$compare = $_REQUEST['PARAM_2'];
if ($dim == 2) {
$dimension = $_REQUEST['PARAM_3'];
$dimension2 = $_REQUEST['PARAM_4'];
$graphics = $_REQUEST['PARAM_5'];
$comments = $_REQUEST['PARAM_6'];
} else {
if ($dim == 1) {
$dimension = $_REQUEST['PARAM_3'];
$graphics = $_REQUEST['PARAM_4'];
$comments = $_REQUEST['PARAM_5'];
} else {
$graphics = $_REQUEST['PARAM_3'];
$comments = $_REQUEST['PARAM_4'];
}
}
if ($graphics) {
include_once $path_to_root . "reporting/includes/class.graphic.inc";
$pg = new graph();
}
$dec = 0;
$pdec = user_percent_dec();
$cols = array(0, 50, 200, 350, 425, 500);
//------------0--1---2----3----4----5--
$headers = array(tr('Account'), tr('Account Name'), tr('Period'), tr('Accumulated'), tr('Achieved %'));
$aligns = array('left', 'left', 'right', 'right', 'right');
if ($dim == 2) {
$params = array(0 => $comments, 1 => array('text' => tr('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => tr('Dimension') . " 1", 'from' => get_dimension_string($dimension), 'to' => ''), 3 => array('text' => tr('Dimension') . " 2", 'from' => get_dimension_string($dimension2), 'to' => ''));
} else {
if ($dim == 1) {
$params = array(0 => $comments, 1 => array('text' => tr('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => tr('Dimension'), 'from' => get_dimension_string($dimension), 'to' => ''));
} else {
$params = array(0 => $comments, 1 => array('text' => tr('Period'), 'from' => $from, 'to' => $to));
}
}
if ($compare == 0 || $compare == 2) {
$end = $to;
if ($compare == 2) {
$begin = $from;
$headers[3] = tr('Budget');
} else {
$begin = begin_fiscalyear();
}
} elseif ($compare == 1) {
$begin = add_months($from, -12);
$end = add_months($to, -12);
$headers[3] = tr('Period Y-1');
}
$rep = new FrontReport(tr('Profit and Loss Statement'), "ProfitAndLoss.pdf", user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
$rep->Header();
$classname = '';
$group = '';
$totalper = 0.0;
$totalacc = 0.0;
$classper = 0.0;
$classacc = 0.0;
$salesper = 0.0;
$salesacc = 0.0;
$accounts = get_gl_accounts_all(0);
while ($account = db_fetch($accounts)) {
$per_balance = get_gl_trans_from_to($from, $to, $account["account_code"], $dimension, $dimension2);
if ($compare == 2) {
$acc_balance = get_budget_trans_from_to($begin, $end, $account["account_code"], $dimension, $dimension2);
} else {
$acc_balance = get_gl_trans_from_to($begin, $end, $account["account_code"], $dimension, $dimension2);
}
if (!$per_balance && !$acc_balance) {
continue;
}
if ($account['AccountClassName'] != $classname) {
if ($classname != '') {
$closeclass = true;
}
}
if ($account['AccountTypeName'] != $group) {
if ($group != '') {
$rep->Line($rep->row + 6);
$rep->row -= 6;
$rep->TextCol(0, 2, tr('Total') . " " . $group);
$rep->TextCol(2, 3, number_format2($totalper, $dec));
$rep->TextCol(3, 4, number_format2($totalacc, $dec));
$rep->TextCol(4, 5, number_format2(Achieve($totalper, $totalacc), $pdec));
if ($graphics) {
$pg->x[] = $group;
$pg->y[] = abs($totalper);
$pg->z[] = abs($totalacc);
}
$totalper = $totalacc = 0.0;
$rep->row -= $rep->lineHeight + 4;
if ($closeclass) {
//.........这里部分代码省略.........
示例15: PN_BlogStatisticsProcess
function PN_BlogStatisticsProcess($target)
{
global $blogid, $pluginURL, $defaultURL, $blog;
if (doesHaveOwnership()) {
include_once 'lib/open-flash-chart.php';
$grpStyle = $_GET['grpStyle'];
$grpData = explode("|", $_GET['grpData']);
$grpTotal = $_GET['grpTotal'];
$grpYear = $_GET['grpYear'];
$grpTypeName = $_GET['grpTypeName'];
$grpLinkType = $_GET['grpLinkType'];
$grpXLabelType = isset($_GET['grpXLabelType']) ? $_GET['grpXLabelType'] : 0;
$grpLabel = explode("|", $_GET['grpLabel']);
$grpSubTitle = array();
$grpLabelTemp = array();
if (!empty($_GET['grpData'])) {
if ($grpTypeName == "category") {
for ($i = 0; $i < count($grpLabel); $i++) {
$grpSubTitle[] = rawurlencode($grpLabel[$i] == 0 ? _t('분류없음') : htmlspecialchars(UTF8::lessenAsEm(getCategoryNameById($blogid, $grpLabel[$i]), 15)));
}
} else {
if ($grpTypeName == "hits" || $grpTypeName == "cmmax" || $grpTypeName == "tbmax" || $grpTypeName == "tagmax") {
for ($i = 0; $i < count($grpLabel); $i++) {
$grpSubTitle[] = rawurlencode(htmlspecialchars(UTF8::lessenAsEm(str_replace(",", "-", getEntryTitleById($blogid, $grpLabel[$i])), 25)));
}
} else {
if ($grpTypeName == "commenter" || $grpTypeName == "tag") {
for ($i = 0; $i < count($grpLabel); $i++) {
$grpSubTitle[] = htmlspecialchars(UTF8::lessenAsEm($grpLabel[$i], 15));
$grpLabelTemp[] = htmlspecialchars(UTF8::lessenAsEm($grpLabel[$i], 6, ''));
}
$grpLabel = $grpLabelTemp;
} else {
if ($grpTypeName == "time") {
for ($i = 0; $i < count($grpLabel); $i++) {
$grpSubTitle[] = rawurlencode($grpLabel[$i] . "시");
}
} else {
if ($grpTypeName == "refer") {
for ($i = 0; $i < count($grpLabel); $i++) {
$tmpHost = explode('.', $grpLabel[$i]);
$tmpHostCnt = count($tmpHost) - 1;
$tmpDomain = (strlen($tmpHost[$tmpHostCnt]) < 3 ? $tmpHost[$tmpHostCnt - 2] . '.' : '') . $tmpHost[$tmpHostCnt - 1] . '.' . $tmpHost[$tmpHostCnt];
$cutDomain = explode('.', $tmpDomain);
$grpSubTitle[] = htmlspecialchars($grpLabel[$i]);
$grpLabelTemp[] = htmlspecialchars(UTF8::lessenAsEm($cutDomain[0], 6, ''));
}
$grpLabel = $grpLabelTemp;
} else {
if ($grpTypeName == "referkey") {
for ($i = 0; $i < count($grpLabel); $i++) {
$tmpLabel = explode('(', $grpLabel[$i]);
$grpSubTitle[] = htmlspecialchars(UTF8::lessenAsEm($grpLabel[$i], 15));
$grpLabelTemp[] = htmlspecialchars(UTF8::lessenAsEm($tmpLabel[0], 6, ''));
}
$grpLabel = $grpLabelTemp;
}
}
}
}
}
}
$g = new graph();
$g->bg_colour = '#FFFFFF';
if ($grpStyle == "pie") {
$grpClickLink = "";
$grpPercent = array();
$grpLink = array();
for ($i = 0; $i < count($grpData); $i++) {
$grpPercent[] = round($grpData[$i] / $grpTotal * 100, 0);
}
if ($grpLinkType == "archiveYear") {
for ($i = 0; $i < count($grpLabel); $i++) {
$permalink = $defaultURL . "/archive/" . substr($grpLabel[$i], 0, 4);
$grpLink[] = "javascript:window.open('{$permalink}');void(0)";
}
$grpClickLink = "<br>click on the pie.";
} else {
if ($grpLinkType == "archiveMonth" && $grpYear != "9999") {
for ($i = 0; $i < count($grpLabel); $i++) {
$cutMonth = str_replace("월", "", $grpLabel[$i]);
$tmpMonth = strlen($cutMonth) == 1 ? "0" . $cutMonth : $cutMonth;
$permalink = $defaultURL . "/archive/" . $grpYear . $tmpMonth;
$grpLink[] = "javascript:window.open('{$permalink}');void(0)";
}
$grpClickLink = "<br>click on the pie.";
} else {
if ($grpLinkType == "category") {
for ($i = 0; $i < count($grpLabel); $i++) {
$permalink = $defaultURL . "/category/" . getCategoryLabelById($blogid, $grpLabel[$i]);
$grpLink[] = "javascript:window.open('{$permalink}');void(0)";
}
$grpClickLink = "<br>click on the pie.";
} else {
if ($grpLinkType == "entry") {
for ($i = 0; $i < count($grpLabel); $i++) {
$permalink = $defaultURL . ($blog['useSlogan'] ? "/entry/" . getEntrySloganById($blogid, $grpLabel[$i]) : "/" . $grpLabel[$i]);
$grpLink[] = "javascript:window.open('{$permalink}');void(0)";
}
$grpClickLink = "<br>click on the pie.";
//.........这里部分代码省略.........