function grafico($v, $nomegraph, $titolo, $x, $upper = Null) { # $chart = new VerticalBarChart(800,200); $chart = new LineChart(700, 245); // var_dump($x); $ii = 0; $serie = array(); // echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><br>"; foreach ($v as $s) { // var_dump($s); // echo "<br>"; $serie[$ii] = new XYDataSet(); $nome_serie[] = $s[0]; // echo $s[0]."<br>"; // unset($s[0]); $flag = True; $i = 0; $ib = 0; foreach ($s as $e) { if (!$flag) { # per saltare il primo elemento // var_dump($e+0.0); while ($ib < $x[$i]) { $serie[$ii]->addPoint(new Point(sprintf("%02d", $ib), 0.0)); $ib = $ib + 1; } $serie[$ii]->addPoint(new Point(sprintf("%02d", $x[$i]), $e + 0.0)); // echo "i=",$i,"x=",$x[$i],"ib=",$ib."<br>"; $ib = $ib + 1; $i = $i + 1; } $flag = False; } $ii = $ii + 1; } $ii = 0; $dataSet = new XYSeriesDataSet(); foreach ($serie as $ds) { $dataSet->addSerie($nome_serie[$ii], $ds); $ii = $ii + 1; } if ($upper) { // echo "Set massimo valore",$upper,"<br>"; $chart->setUpper($upper); //solo con LineChar() $chart->setLower(0.0); //solo con LineChar() } $chart->setDataSet($dataSet); $chart->setTitle($titolo); $chart->render($nomegraph); }
function renderLineChart($value_arrays, $labels = NULL, $title = '', $xlabels = NULL) { $chart = new LineChart(1000, 400); $dataSet = new XYSeriesDataSet(); for ($va = 0; $va < sizeof($value_arrays); $va++) { $value_array = $value_arrays[$va]; $ds = new XYDataSet(); if (sizeof($value_array)) { for ($x = 0; $x < sizeof($value_array); $x++) { if ($xlabels) { $label = $xlabels[$x]; } else { $label = $x + 1; } $ds->addPoint(new Point($label, $value_array[$x])); } } else { // need at least one point or will except $ds->addPoint(new Point(1, 0)); } if ($labels) { $label = $labels[$va]; } else { $label = $va; } $dataSet->addSerie($label, $ds); } $chart->setDataSet($dataSet); $chart->setTitle($title); $name = tempnam('/tmp', '.png'); $chart->render($name); $image = base64_encode(file_get_contents($name)); unlink($name); echo '<div style="text-align: center"><img src="data:image/png;base64,'; echo $image; echo '"></div>'; }
public function display() { $session = SessionFactory::create(); $clientIp = $session->get("selected-client-ip"); $date = $session->get("selected-date"); $beginTime = $this->data[0]['time']; $endTime = end($this->data)['time']; /*CHART*/ $chart = new LineChart(1400, 500); $serie1 = new XYDataSet(); foreach ($this->data as $key => $datum) { $serie1->addPoint(new Point("", $datum['client_data'])); } $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("Client: " . $clientIp . " at " . $date, $serie1); $chart->setDataSet($dataSet); $chart->getPlot()->setGraphPadding(new Padding(5, 3, 20, 140)); $chart->setTitle(""); //clear the image title $chart->getPlot()->setLogoFileName(""); //clear the image logo $chart->render("front-end/images/client_data_line_plot.png"); /*CHART*/ //DOM: $dom = DOMHandlerFactory::create(); $dom->setDocumentFromFile(STATISTICAL_LOG_ANALIZER_HTML)->whereIdIs('login-user')->insertNode($session->get('session-user-name')); //INSERT TITLE: $title = "<h3>Client (" . $clientIp . ") Data Consumption Line Chart, \n at: " . $date . " between: " . $beginTime . " and " . $endTime . "</h3>"; $dom->whereIdIs("body-title")->insertNode($title); //INSERT GRAPH: $graph = '<div style="text-align: center;"> <img src="front-end/images/client_data_line_plot.png" alt="" border="0"> </div>'; $dom->whereIdIs("squidDataContainer")->insertNode($graph); $dom->display(); }
$reembolso_real = floor($reembolso_real / 1000); $remuneracao = floor($item['remuneracao'] / 1000); $serie1->addPoint(new Point($mes . "- G" . $item['grupo'], $remuneracao)); $serie3->addPoint(new Point($mes . "- G" . $item['grupo'], $remuneracao_real)); $serie2->addPoint(new Point($mes . "- G" . $item['grupo'], $reembolso)); $serie4->addPoint(new Point($mes . "- G" . $item['grupo'], $reembolso_real)); } $ano_grafico = $acompanhamento->getAno(); } //$chart = new VerticalBarChart(1480,450); if ($acompanhamento->getGrafico() == 1) { $chart = new VerticalBarChart(1390, 390); } else { $chart = new LineChart(1480, 450); } $dataSet = new XYSeriesDataSet(); if ($acompanhamento->getRemuneracao() != null) { $dataSet->addSerie("Remuneração Previsto", $serie1); //Legenda do grafico $dataSet->addSerie("Remuneração Realizado", $serie3); //Legenda do grafico } if ($acompanhamento->getReembolso() != null) { $dataSet->addSerie("Reembolso", $serie2); //Legenda do grafico $dataSet->addSerie("Remuneracao", $serie4); //Legenda do grafico } if ($acompanhamento->getReembolso() == null && $acompanhamento->getRemuneracao() == null) { $dataSet->addSerie("Remuneração Previsto", $serie1); //Legenda do grafico
function PostByForum() { G::LoadThirdParty("libchart/classes", "libchart"); $chart = new VerticalBarChart(430, 220); $dataSet = $this->getPostByForum(); $dataPostSet = new XYDataSet(); $dataTopicSet = new XYDataSet(); foreach ($dataSet['label'] as $key => $label) { $dataPostSet->addPoint(new Point($label, $dataSet['data'][$key])); $dataTopicSet->addPoint(new Point($label, $dataSet['series2'][$key])); } $multidataSet = new XYSeriesDataSet(); $multidataSet->addSerie("Posts", $dataPostSet); $multidataSet->addSerie("Topics", $dataTopicSet); $chart->setDataSet($multidataSet); $chart->setTitle("Posts by Forum ( last month ) "); $chart->render(); }
* Multiple horizontal bar chart demonstration. * */ include "../libchart/classes/libchart.php"; $chart = new HorizontalBarChart(450, 250); $serie1 = new XYDataSet(); $serie1->addPoint(new Point("18-24", 22)); $serie1->addPoint(new Point("25-34", 17)); $serie1->addPoint(new Point("35-44", 20)); $serie1->addPoint(new Point("45-54", 25)); $serie2 = new XYDataSet(); $serie2->addPoint(new Point("18-24", 13)); $serie2->addPoint(new Point("25-34", 18)); $serie2->addPoint(new Point("35-44", 23)); $serie2->addPoint(new Point("45-54", 22)); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("Male", $serie1); $dataSet->addSerie("Female", $serie2); $chart->setDataSet($dataSet); $chart->setTitle("Firefox vs IE users: Age"); $chart->render("generated/demo8.png"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Libchart line demonstration</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" /> </head> <body> <img alt="Line chart" src="generated/demo8.png" style="border: 1px solid gray;"/> </body>
$serie2->addPoint(new Point("{$month} 13", $ro->getMonthlyDiscount_opd($month, "13", $year) / 100)); $serie2->addPoint(new Point("{$month} 12", $ro->getMonthlyDiscount_opd($month, "12", $year) / 1000)); $serie2->addPoint(new Point("{$month} 11", $ro->getMonthlyDiscount_opd($month, "11", $year) / 1000)); $serie2->addPoint(new Point("{$month} 10", $ro->getMonthlyDiscount_opd($month, "10", $year) / 1000)); $serie2->addPoint(new Point("{$month} 09", $ro->getMonthlyDiscount_opd($month, "09", $year) / 1000)); $serie2->addPoint(new Point("{$month} 08", $ro->getMonthlyDiscount_opd($month, "08", $year) / 1000)); $serie2->addPoint(new Point("{$month} 07", $ro->getMonthlyDiscount_opd($month, "07", $year) / 1000)); $serie2->addPoint(new Point("{$month} 06", $ro->getMonthlyDiscount_opd($month, "06", $year) / 1000)); $serie2->addPoint(new Point("{$month} 05", $ro->getMonthlyDiscount_opd($month, "05", $year) / 1000)); $serie2->addPoint(new Point("{$month} 04", $ro->getMonthlyDiscount_opd($month, "04", $year) / 1000)); $serie2->addPoint(new Point("{$month} 03", $ro->getMonthlyDiscount_opd($month, "03", $year) / 1000)); $serie2->addPoint(new Point("{$month} 02", $ro->getMonthlyDiscount_opd($month, "02", $year) / 1000)); $serie2->addPoint(new Point("{$month} 01", $ro->getMonthlyDiscount_opd($month, "01", $year) / 1000)); $ipdDisc = $ro->getMonthlyDiscount_ipd($month, "01", $year) + $ro->getMonthlyDiscount_ipd($month, "02", $year) + $ro->getMonthlyDiscount_ipd($month, "03", $year) + $ro->getMonthlyDiscount_ipd($month, "04", $year) + $ro->getMonthlyDiscount_ipd($month, "05", $year) + $ro->getMonthlyDiscount_ipd($month, "06", $year) + $ro->getMonthlyDiscount_ipd($month, "07", $year) + $ro->getMonthlyDiscount_ipd($month, "08", $year) + $ro->getMonthlyDiscount_ipd($month, "09", $year) + $ro->getMonthlyDiscount_ipd($month, "10", $year) + $ro->getMonthlyDiscount_ipd($month, "11", $year) + $ro->getMonthlyDiscount_ipd($month, "12", $year) + $ro->getMonthlyDiscount_ipd($month, "13", $year) + $ro->getMonthlyDiscount_ipd($month, "14", $year) + $ro->getMonthlyDiscount_ipd($month, "15", $year) + $ro->getMonthlyDiscount_ipd($month, "16", $year) + $ro->getMonthlyDiscount_ipd($month, "17", $year) + $ro->getMonthlyDiscount_ipd($month, "18", $year) + $ro->getMonthlyDiscount_ipd($month, "19", $year) + $ro->getMonthlyDiscount_ipd($month, "20", $year) + $ro->getMonthlyDiscount_ipd($month, "21", $year) + $ro->getMonthlyDiscount_ipd($month, "22", $year) + $ro->getMonthlyDiscount_ipd($month, "23", $year) + $ro->getMonthlyDiscount_ipd($month, "24", $year) + $ro->getMonthlyDiscount_ipd($month, "25", $year) + $ro->getMonthlyDiscount_ipd($month, "26", $year) + $ro->getMonthlyDiscount_ipd($month, "27", $year) + $ro->getMonthlyDiscount_ipd($month, "28", $year) + $ro->getMonthlyDiscount_ipd($month, "29", $year) + $ro->getMonthlyDiscount_ipd($month, "30", $year) + $ro->getMonthlyDiscount_ipd($month, "31", $year); $opdDisc = $ro->getMonthlyDiscount_opd($month, "01", $year) + $ro->getMonthlyDiscount_opd($month, "02", $year) + $ro->getMonthlyDiscount_opd($month, "03", $year) + $ro->getMonthlyDiscount_opd($month, "04", $year) + $ro->getMonthlyDiscount_opd($month, "05", $year) + $ro->getMonthlyDiscount_opd($month, "06", $year) + $ro->getMonthlyDiscount_opd($month, "07", $year) + $ro->getMonthlyDiscount_opd($month, "08", $year) + $ro->getMonthlyDiscount_opd($month, "09", $year) + $ro->getMonthlyDiscount_opd($month, "10", $year) + $ro->getMonthlyDiscount_opd($month, "11", $year) + $ro->getMonthlyDiscount_opd($month, "12", $year) + $ro->getMonthlyDiscount_opd($month, "13", $year) + $ro->getMonthlyDiscount_opd($month, "14", $year) + $ro->getMonthlyDiscount_opd($month, "15", $year) + $ro->getMonthlyDiscount_opd($month, "16", $year) + $ro->getMonthlyDiscount_opd($month, "17", $year) + $ro->getMonthlyDiscount_opd($month, "18", $year) + $ro->getMonthlyDiscount_opd($month, "19", $year) + $ro->getMonthlyDiscount_opd($month, "20", $year) + $ro->getMonthlyDiscount_opd($month, "21", $year) + $ro->getMonthlyDiscount_opd($month, "22", $year) + $ro->getMonthlyDiscount_opd($month, "23", $year) + $ro->getMonthlyDiscount_opd($month, "24", $year) + $ro->getMonthlyDiscount_opd($month, "25", $year) + $ro->getMonthlyDiscount_opd($month, "26", $year) + $ro->getMonthlyDiscount_opd($month, "27", $year) + $ro->getMonthlyDiscount_opd($month, "28", $year) + $ro->getMonthlyDiscount_opd($month, "29", $year) + $ro->getMonthlyDiscount_opd($month, "30", $year) + $ro->getMonthlyDiscount_opd($month, "31", $year); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("IPD (" . number_format($ipdDisc, 2) . ")", $serie1); $dataSet->addSerie("OPD (" . number_format($opdDisc, 2) . ")", $serie2); $chart->setDataSet($dataSet); $chart->setTitle("Discount Given from {$month} {$year}"); $chart->render("../../../COCONUT/graphicalReport/chartList/monthlyDisc.png"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Libchart line demonstration</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" /> </head> <body> <img alt="Line chart" src="/COCONUT/graphicalReport/chartList/monthlyDisc.png" style="border: 1px solid gray;"/> </body>
$serie2->addPoint(new Point("{$month} 17, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "17", $year), 2))); $serie2->addPoint(new Point("{$month} 18, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "18", $year), 2))); $serie2->addPoint(new Point("{$month} 19, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "19", $year), 2))); $serie2->addPoint(new Point("{$month} 20, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "20", $year), 2))); $serie2->addPoint(new Point("{$month} 21, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "21", $year), 2))); $serie2->addPoint(new Point("{$month} 22, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "22", $year), 2))); $serie2->addPoint(new Point("{$month} 23, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "23", $year), 2))); $serie2->addPoint(new Point("{$month} 24, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "24", $year), 2))); $serie2->addPoint(new Point("{$month} 25, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "25", $year), 2))); $serie2->addPoint(new Point("{$month} 26, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "26", $year), 2))); $serie2->addPoint(new Point("{$month} 27, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "27", $year), 2))); $serie2->addPoint(new Point("{$month} 28, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "28", $year), 2))); $serie2->addPoint(new Point("{$month} 29, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "29", $year), 2))); $serie2->addPoint(new Point("{$month} 30, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "30", $year), 2))); $serie2->addPoint(new Point("{$month} 31, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "31", $year), 2))); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("OPD", $serie1); $dataSet->addSerie("IPD", $serie2); $chart->setDataSet($dataSet); $chart->getPlot()->setGraphCaptionRatio(0.35); $chart->setTitle("Registration Census for {$month} {$year}"); $chart->render("../../../COCONUT/graphicalReport/chartList/monthlyRegistration.png"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Registration Census for <?php echo $month; echo $year; ?> </title>
$serie1->addPoint(new Point("{$month} 15", number_format($ro->getBestSellingChart_opd($month, "15", $year, $description) / 100, 2))); $serie1->addPoint(new Point("{$month} 14", number_format($ro->getBestSellingChart_opd($month, "14", $year, $description) / 100, 2))); $serie1->addPoint(new Point("{$month} 13", number_format($ro->getBestSellingChart_opd($month, "13", $year, $description) / 100, 2))); $serie1->addPoint(new Point("{$month} 12", number_format($ro->getBestSellingChart_opd($month, "12", $year, $description) / 100, 2))); $serie1->addPoint(new Point("{$month} 11", number_format($ro->getBestSellingChart_opd($month, "11", $year, $description) / 100, 2))); $serie1->addPoint(new Point("{$month} 10", number_format($ro->getBestSellingChart_opd($month, "10", $year, $description) / 100, 2))); $serie1->addPoint(new Point("{$month} 9", number_format($ro->getBestSellingChart_opd($month, "09", $year, $description) / 100, 2))); $serie1->addPoint(new Point("{$month} 8", number_format($ro->getBestSellingChart_opd($month, "08", $year, $description) / 100, 2))); $serie1->addPoint(new Point("{$month} 7", number_format($ro->getBestSellingChart_opd($month, "07", $year, $description) / 100, 2))); $serie1->addPoint(new Point("{$month} 6", number_format($ro->getBestSellingChart_opd($month, "06", $year, $description) / 100, 2))); $serie1->addPoint(new Point("{$month} 5", number_format($ro->getBestSellingChart_opd($month, "05", $year, $description) / 100, 2))); $serie1->addPoint(new Point("{$month} 4", number_format($ro->getBestSellingChart_opd($month, "04", $year, $description) / 100, 2))); $serie1->addPoint(new Point("{$month} 3", number_format($ro->getBestSellingChart_opd($month, "03", $year, $description) / 100, 2))); $serie1->addPoint(new Point("{$month} 2", number_format($ro->getBestSellingChart_opd($month, "02", $year, $description) / 100, 2))); $serie1->addPoint(new Point("{$month} 1", number_format($ro->getBestSellingChart_opd($month, "01", $year, $description) / 100, 2))); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("{$description} ", $serie1); $chart->setDataSet($dataSet); $chart->getPlot()->setGraphCaptionRatio(0.35); $chart->setTitle("{$description} for {$month} {$year}"); $chart->render("../../../COCONUT/graphicalReport/chartList/sellingDetails.png"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Sales of <?php echo $description; ?> for <?php echo $month; echo $year;
$datasetBonus = new XYDataSet(); $datasetBonus->addPoint(new Point("1,0", $summary["10"]["countBonus"])); $datasetBonus->addPoint(new Point("1,3", $summary["13"]["countBonus"])); $datasetBonus->addPoint(new Point("1,7", $summary["17"]["countBonus"])); $datasetBonus->addPoint(new Point("2,0", $summary["20"]["countBonus"])); $datasetBonus->addPoint(new Point("2,3", $summary["23"]["countBonus"])); $datasetBonus->addPoint(new Point("2,7", $summary["27"]["countBonus"])); $datasetBonus->addPoint(new Point("3,0", $summary["30"]["countBonus"])); $datasetBonus->addPoint(new Point("3,3", $summary["33"]["countBonus"])); $datasetBonus->addPoint(new Point("3,7", $summary["37"]["countBonus"])); $datasetBonus->addPoint(new Point("4,0", $summary["40"]["countBonus"])); $datasetBonus->addPoint(new Point("5,0", $summary["50"]["countBonus"])); $datasetBonus->addPoint(new Point("NT", $summary["NT"]["countBonus"])); $datasetBonus->addPoint(new Point("BV", $summary["BV"]["countBonus"])); $datasetBonus->addPoint(new Point("SICK", $summary["SICK"]["countBonus"])); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie(gettext("with bonus"), $datasetBonus); $dataSet->addSerie(gettext("without bonus"), $datasetNoBonus); $chart->setDataSet($dataSet); $chart->setTitle(""); $chart->render(EXAM_ORGANIZATION_TEMP_DIR . $key . "notenspiegel.png"); $pdf->Image(EXAM_ORGANIZATION_TEMP_DIR . $key . 'notenspiegel.png', 47, 145, 180, 90, '', '', '', false, 300); // --------------------------------------------------------- $passed = count($participants) - $notPassed - $summary["NT"]["countBonus"] - $summary["BV"]["countBonus"] - $summary["SICK"]["countBonus"]; $passedPercent = number_format($passed / count($participants) * 100, 2); $notPassedPercent = number_format($notPassed / count($participants) * 100, 2); $NTpercent = number_format($summary["NT"]["countBonus"] / count($participants) * 100, 2); $BVpercent = number_format($summary["BV"]["countBonus"] / count($participants) * 100, 2); $SICKpercent = number_format($summary["SICK"]["countBonus"] / count($participants) * 100, 2); $tbl = "<table border=\"1\" cellpadding=\"1\" cellspacing=\"0\">"; $tbl .= "<thead>";
$serie2->addPoint(new Point("{$month} 13 ", $ro->getPxRevenueDaily_ipd($month, "13", $year) / 1000)); $serie2->addPoint(new Point("{$month} 12 ", $ro->getPxRevenueDaily_ipd($month, "12", $year) / 1000)); $serie2->addPoint(new Point("{$month} 11 ", $ro->getPxRevenueDaily_ipd($month, "11", $year) / 1000)); $serie2->addPoint(new Point("{$month} 10 ", $ro->getPxRevenueDaily_ipd($month, "10", $year) / 1000)); $serie2->addPoint(new Point("{$month} 09 ", $ro->getPxRevenueDaily_ipd($month, "09", $year) / 1000)); $serie2->addPoint(new Point("{$month} 08 ", $ro->getPxRevenueDaily_ipd($month, "08", $year) / 1000)); $serie2->addPoint(new Point("{$month} 07 ", $ro->getPxRevenueDaily_ipd($month, "07", $year) / 1000)); $serie2->addPoint(new Point("{$month} 06 ", $ro->getPxRevenueDaily_ipd($month, "06", $year) / 1000)); $serie2->addPoint(new Point("{$month} 05 ", $ro->getPxRevenueDaily_ipd($month, "05", $year) / 1000)); $serie2->addPoint(new Point("{$month} 04 ", $ro->getPxRevenueDaily_ipd($month, "04", $year) / 1000)); $serie2->addPoint(new Point("{$month} 03 ", $ro->getPxRevenueDaily_ipd($month, "03", $year) / 1000)); $serie2->addPoint(new Point("{$month} 02 ", $ro->getPxRevenueDaily_ipd($month, "02", $year) / 1000)); $serie2->addPoint(new Point("{$month} 01 ", $ro->getPxRevenueDaily_ipd($month, "01", $year) / 1000)); $totalOPD = $ro->getPxRevenueDaily_opd($month, "01", $year) + $ro->getPxRevenueDaily_opd($month, "02", $year) + $ro->getPxRevenueDaily_opd($month, "03", $year) + $ro->getPxRevenueDaily_opd($month, "04", $year) + $ro->getPxRevenueDaily_opd($month, "05", $year) + $ro->getPxRevenueDaily_opd($month, "06", $year) + $ro->getPxRevenueDaily_opd($month, "07", $year) + $ro->getPxRevenueDaily_opd($month, "08", $year) + $ro->getPxRevenueDaily_opd($month, "09", $year) + $ro->getPxRevenueDaily_opd($month, "10", $year) + $ro->getPxRevenueDaily_opd($month, "11", $year) + $ro->getPxRevenueDaily_opd($month, "12", $year) + $ro->getPxRevenueDaily_opd($month, "13", $year) + $ro->getPxRevenueDaily_opd($month, "14", $year) + $ro->getPxRevenueDaily_opd($month, "15", $year) + $ro->getPxRevenueDaily_opd($month, "16", $year) + $ro->getPxRevenueDaily_opd($month, "17", $year) + $ro->getPxRevenueDaily_opd($month, "18", $year) + $ro->getPxRevenueDaily_opd($month, "19", $year) + $ro->getPxRevenueDaily_opd($month, "20", $year) + $ro->getPxRevenueDaily_opd($month, "21", $year) + $ro->getPxRevenueDaily_opd($month, "22", $year) + $ro->getPxRevenueDaily_opd($month, "23", $year) + $ro->getPxRevenueDaily_opd($month, "24", $year) + $ro->getPxRevenueDaily_opd($month, "25", $year) + $ro->getPxRevenueDaily_opd($month, "26", $year) + $ro->getPxRevenueDaily_opd($month, "27", $year) + $ro->getPxRevenueDaily_opd($month, "28", $year) + $ro->getPxRevenueDaily_opd($month, "29", $year) + $ro->getPxRevenueDaily_opd($month, "30", $year) + $ro->getPxRevenueDaily_opd($month, "31", $year); $totalIPD = $ro->getPxRevenueDaily_ipd($month, "01", $year) + $ro->getPxRevenueDaily_ipd($month, "02", $year) + $ro->getPxRevenueDaily_ipd($month, "03", $year) + $ro->getPxRevenueDaily_ipd($month, "04", $year) + $ro->getPxRevenueDaily_ipd($month, "05", $year) + $ro->getPxRevenueDaily_ipd($month, "06", $year) + $ro->getPxRevenueDaily_ipd($month, "07", $year) + $ro->getPxRevenueDaily_ipd($month, "08", $year) + $ro->getPxRevenueDaily_ipd($month, "09", $year) + $ro->getPxRevenueDaily_ipd($month, "10", $year) + $ro->getPxRevenueDaily_ipd($month, "11", $year) + $ro->getPxRevenueDaily_ipd($month, "12", $year) + $ro->getPxRevenueDaily_ipd($month, "13", $year) + $ro->getPxRevenueDaily_ipd($month, "14", $year) + $ro->getPxRevenueDaily_ipd($month, "15", $year) + $ro->getPxRevenueDaily_ipd($month, "16", $year) + $ro->getPxRevenueDaily_ipd($month, "17", $year) + $ro->getPxRevenueDaily_ipd($month, "18", $year) + $ro->getPxRevenueDaily_ipd($month, "19", $year) + $ro->getPxRevenueDaily_ipd($month, "20", $year) + $ro->getPxRevenueDaily_ipd($month, "21", $year) + $ro->getPxRevenueDaily_ipd($month, "22", $year) + $ro->getPxRevenueDaily_ipd($month, "23", $year) + $ro->getPxRevenueDaily_ipd($month, "24", $year) + $ro->getPxRevenueDaily_ipd($month, "25", $year) + $ro->getPxRevenueDaily_ipd($month, "26", $year) + $ro->getPxRevenueDaily_ipd($month, "27", $year) + $ro->getPxRevenueDaily_ipd($month, "28", $year) + $ro->getPxRevenueDaily_ipd($month, "29", $year) + $ro->getPxRevenueDaily_ipd($month, "30", $year) + $ro->getPxRevenueDaily_ipd($month, "31", $year); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("OPD - " . number_format($totalOPD, 2) . "", $serie1); $dataSet->addSerie("IPD - " . number_format($totalIPD, 2) . "", $serie2); $chart->setDataSet($dataSet); $chart->setTitle("Revenue for {$month} {$year}"); $chart->render("../../../COCONUT/graphicalReport/chartList/monthlyRev.png"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Libchart line demonstration</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" /> </head> <body> <img alt="Line chart" src="/COCONUT/graphicalReport/chartList/monthlyRev.png" style="border: 1px solid gray;"/> </body>
$sql3 = "select maddh from dondathang where year(ngaydat)=year('{$date_min}') and trangthai=1"; $chay3 = mysql_query($sql3); $col2 = mysql_num_rows($chay3); while ($ketqua3 = mysql_fetch_array($chay3)) { $madh = $ketqua3[0]; $sql4 = "select ifnull(sum(soluong*dongia),0) from chitietddh where maddh in (" . $madh . ")"; $chay4 = mysql_query($sql4); $r4 = mysql_fetch_row($chay4); $col1 = $col1 + $r4[0]; } $serie1->addPoint(new Point("{$date_min}", $col1)); $serie2->addPoint(new Point("{$date_min}", $col2)); $timestamp1 = strtotime(date("Y-m-d", strtotime($date_min)) . " + 1 year"); $date_min = date('Y-m-d', $timestamp1); } $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("Doanh thu", $serie1); $dataSet->addSerie("Hóa đơn", $serie2); $chart->setDataSet($dataSet); $chart->getPlot()->setGraphCaptionRatio(0.65); $chart->setTitle("THỐNG KÊ DOANH THU"); $chart->render("demo7.png"); } ?> <div align="center"><img alt="Line chart" src="demo7.png" style="border: 1px solid gray;"/></div> <?php } $chay = mysql_query($sql); $tong = mysql_num_rows($chay); $sql1 = "select ifnull(sum(soluong*dongia),0) from chitietddh where maddh in (" . $sql . ")";
<!-- Frequentation par tranche horaires et par semaine--> <h2 class="page-header">Répartition par tranche horaire journalières, année <?php echo $year; ?> </h2> <div class="col-md-6"> <div class="nav-tabs-custom"> <?php ///comptabiliser les connexions pour la journée choisie for ($d = 2; $d < 7; ++$d) { $nomjour = getJourEng($d); $nbPoste = getnbcomputperepn($epn); //initialisation graphiques $chartMardi = new HorizontalBarChart(440, 400); $dataSetMardi = new XYSeriesDataSet(); for ($i = 0; $i < 2; ++$i) { $y = $year - $i; $serieMardi = "serieMardi{$y}"; // series par années $serieMardi = new XYDataSet(); //debug($serieMardi); if ($y < $year) { $nombreSemaines = 52; } else { $nombreSemaines = date('W'); } if (isset($nomjour)) { $n0TH1 = statTrancheHour(600, 660, $nomjour, $y, $epn); //de 10h à 11h : h 600-659 $n0TH2 = statTrancheHour(661, 720, $nomjour, $y, $epn);
function cargar_informe($informe, $en_ventana = 1, $formato = "htm", $estilo = "Informes", $embebido = 0) { global $ConexionPDO, $ArchivoCORE, $TablasCore, $Nombre_Aplicacion, $PCO_ValorBusquedaBD, $PCO_CampoBusquedaBD; // Carga variables de sesion por si son comparadas en alguna condicion. De todas formas pueden ser cargadas por el usuario en el diseno del informe global $PCOSESS_LoginUsuario, $Nombre_usuario, $Descripcion_usuario, $Nivel_usuario, $Correo_usuario, $LlaveDePasoUsuario, $PCO_FechaOperacion; // Carga variables de definicion de tablas global $ListaCamposSinID_informe, $ListaCamposSinID_informe_campos, $ListaCamposSinID_informe_tablas, $ListaCamposSinID_informe_condiciones, $ListaCamposSinID_informe_boton; global $MULTILANG_TotalRegistros, $MULTILANG_ContacteAdmin, $MULTILANG_ObjetoNoExiste, $MULTILANG_ErrorTiempoEjecucion, $MULTILANG_Informes, $MULTILANG_IrEscritorio, $MULTILANG_ErrorDatos, $MULTILANG_InfErrTamano, $MULTILANG_MonCommSQL; global $IdiomaPredeterminado; global $PCO_InformesDataTable; global $ModoDepuracion; // Busca datos del informe $consulta_informe = ejecutar_sql("SELECT id," . $ListaCamposSinID_informe . " FROM " . $TablasCore . "informe WHERE id=? ", "{$informe}"); $registro_informe = $consulta_informe->fetch(); $Identificador_informe = $registro_informe["id"]; //Si no encuentra informe presenta error if ($registro_informe["id"] == "") { mensaje($MULTILANG_ErrorTiempoEjecucion, $MULTILANG_ObjetoNoExiste . " " . $MULTILANG_ContacteAdmin . "<br>(" . $MULTILANG_Informes . " {$informe})", '', 'fa fa-times fa-5x icon-red texto-blink', 'alert alert-danger alert-dismissible'); } //Identifica si el informe requiere un formulario de filtrado previo if ($registro_informe["formulario_filtrado"] != "") { //Determina si solicita el informe desde el formulario de filtrado apropiado, sino redirecciona a este global $PCO_FormularioActivo; if ($registro_informe["formulario_filtrado"] != $PCO_FormularioActivo) { echo '<form name="precarga_form_filtro" action="' . $ArchivoCORE . '" method="POST"> <input type="Hidden" name="PCO_Accion" value="cargar_objeto"> <input type="Hidden" name="PCO_InformeFiltro" value="' . $registro_informe["id"] . '"> <input type="Hidden" name="objeto" value="frm:' . $registro_informe["formulario_filtrado"] . ':1"> <input type="Hidden" name="Presentar_FullScreen" value="' . @$Presentar_FullScreen . '"> <input type="Hidden" name="Precarga_EstilosBS" value="' . @$Precarga_EstilosBS . '"> <script type="" language="JavaScript"> document.precarga_form_filtro.submit(); </script>'; die; } } //Si hay variables de filtro definidas busca su valor en el contexto global if ($registro_informe["variables_filtro"] != "") { $arreglo_variables_filtro = @explode(",", $registro_informe["variables_filtro"]); //Busca y convierte cada variable recibida en global foreach ($arreglo_variables_filtro as $nombre_variable_filtro) { //if (isset($$nombre_variable_filtro)) // {Deprecated} global ${$nombre_variable_filtro}; } } // Inicia CONSTRUCCION DE CONSULTA DINAMICA $numero_columnas = 0; //Busca los CAMPOS definidos para el informe $consulta = "SELECT "; $consulta_campos = ejecutar_sql("SELECT id," . $ListaCamposSinID_informe_campos . " FROM " . $TablasCore . "informe_campos WHERE informe=? ORDER BY peso", "{$informe}"); $PCO_ColumnasOcultas[] = "ArregloDeCamposOcultos"; while ($registro_campos = $consulta_campos->fetch()) { //Si tiene alias definido lo agrega $posfijo_campo = ""; if ($registro_campos["valor_alias"] != "") { $posfijo_campo = " as " . $registro_campos["valor_alias"]; } //Agrega el campo a la consulta $consulta .= $registro_campos["valor_campo"] . $posfijo_campo . ","; //Crea un arreglo con los campos marcados como ocultos para filtrarlos luego if ($registro_campos["visible"] == 0) { $PCO_ColumnasOcultas[] = $registro_campos["valor_campo"] . $posfijo_campo; //Lleva el campo oculto despues del punto $PCO_PartesCampo = explode(".", $registro_campos["valor_campo"] . $posfijo_campo); $PCO_ColumnasOcultas[] = $PCO_PartesCampo[1]; //Lleva el campo oculto si es un alias $PCO_PartesCampo = explode(" as ", $registro_campos["valor_campo"] . $posfijo_campo); $PCO_ColumnasOcultas[] = $PCO_PartesCampo[1]; } } // Elimina la ultima coma en el listado de campos $consulta = substr($consulta, 0, strlen($consulta) - 1); //Busca las TABLAS definidas para el informe $consulta .= " FROM "; $consulta_tablas = ejecutar_sql("SELECT id," . $ListaCamposSinID_informe_tablas . " FROM " . $TablasCore . "informe_tablas WHERE informe=? ", "{$informe}"); while ($registro_tablas = $consulta_tablas->fetch()) { //Si tiene alias definido lo agrega $posfijo_tabla = ""; if ($registro_tablas["valor_alias"] != "") { $posfijo_tabla = " as " . $registro_tablas["valor_alias"]; } //Agrega tabla a la consulta $consulta .= $registro_tablas["valor_tabla"] . $posfijo_tabla . ","; } // Elimina la ultima coma en el listado de tablas $consulta = substr($consulta, 0, strlen($consulta) - 1); // Busca las CONDICIONES para el informe $consulta .= " WHERE "; $consulta_condiciones = ejecutar_sql("SELECT id," . $ListaCamposSinID_informe_condiciones . " FROM " . $TablasCore . "informe_condiciones WHERE informe=? ORDER BY peso", "{$informe}"); $hay_condiciones = 0; while ($registro_condiciones = $consulta_condiciones->fetch()) { //Agrega condicion a la consulta $valor_izquierdo = $registro_condiciones["valor_izq"]; $valor_derecho = $registro_condiciones["valor_der"]; // CONVIERTE VARIABLES DE SESION PHP A VALORES PARA EL QUERY Cuando el primer simbolos es un PESOS ($), es decir, solo se ingreso una variable //LADO IZQUIERDO DE LA CONDICION //Si el valor Izquierdo a comparar inicia por signo pesos y es una variable PHP la usa como tal if (@$valor_izquierdo[0] == "\$") { //Quita el signo pesos inicial para buscar la variable $variable_a_buscar = substr($valor_izquierdo, 1, strlen($valor_izquierdo)); // Si la variable esta definida toma su valor encerrado entre comillas para el query y evitar conflictos de variables con espacios y demas. if (@isset($variable_a_buscar)) { $valor_izquierdo = "'" . ${$variable_a_buscar} . "'"; } } //Evalua casos donde se tienen variables PHP escapadas por llaves. Ej "%{$Variable}%" si fuera para un LIKE, por ejemplo. if (strpos($valor_izquierdo, "{") !== FALSE && strrpos($valor_izquierdo, "}") !== FALSE) { //Determina las posiciones de las llaves en la cadena $PosLlaveIzquierda = strpos($valor_izquierdo, "{"); $PosLlaveDerecha = strrpos($valor_izquierdo, "}"); //Toma solo el pedazo entre llaves para intentar ubicar el valor de la variable por su nombre $NombreVariable = substr($valor_izquierdo, $PosLlaveIzquierda + 2, $PosLlaveDerecha - $PosLlaveIzquierda - 2); //Si la variable no esta definida la busca en el entorno global global ${$NombreVariable}; if (@isset($NombreVariable)) { $ValorVariable = ${$NombreVariable}; //Reemplaza el valor encontrado en la cadena de valor original $valor_izquierdo = str_replace('{$' . $NombreVariable . '}', $ValorVariable, $valor_izquierdo); } } //LADO DERECHO DE LA CONDICION //Si el valor Derecho a comparar inicia por signo pesos y es una variable PHP la usa como tal if (@$valor_derecho[0] == "\$") { //Quita el signo pesos inicial para buscar la variable $variable_a_buscar = substr($valor_derecho, 1, strlen($valor_derecho)); // Si la variable esta definida toma su valor encerrado entre comillas para el query y evitar conflictos de variables con espacios y demas. if (@isset($variable_a_buscar)) { $valor_derecho = "'" . ${$variable_a_buscar} . "'"; } } //Evalua casos donde se tienen variables PHP escapadas por llaves. Ej "%{$Variable}%" si fuera para un LIKE, por ejemplo. if (strpos($valor_derecho, "{") !== FALSE && strrpos($valor_derecho, "}") !== FALSE) { //Determina las posiciones de las llaves en la cadena $PosLlaveIzquierda = strpos($valor_derecho, "{"); $PosLlaveDerecha = strrpos($valor_derecho, "}"); //Toma solo el pedazo entre llaves para intentar ubicar el valor de la variable por su nombre $NombreVariable = substr($valor_derecho, $PosLlaveIzquierda + 2, $PosLlaveDerecha - $PosLlaveIzquierda - 2); //Si la variable no esta definida la busca en el entorno global global ${$NombreVariable}; if (@isset($NombreVariable)) { $ValorVariable = ${$NombreVariable}; //Reemplaza el valor encontrado en la cadena de valor original $valor_derecho = str_replace('{$' . $NombreVariable . '}', $ValorVariable, $valor_derecho); } } $consulta .= " " . $valor_izquierdo . " " . $registro_condiciones["operador"] . " " . $valor_derecho . " "; $hay_condiciones = 1; } if (!$hay_condiciones) { $consulta .= " 1 "; } if (@$registro_informe["agrupamiento"] != "") { $campoagrupa = $registro_informe["agrupamiento"]; $consulta .= " GROUP BY {$campoagrupa}"; } if (@$registro_informe["ordenamiento"] != "") { $campoorden = $registro_informe["ordenamiento"]; $consulta .= " ORDER BY {$campoorden}"; } // Si el informe tiene formato_final = T (tabla de datos) if ($registro_informe["formato_final"] == "T") { $SalidaFinalInforme = ''; $SalidaFinalInformePDF = ''; if ($en_ventana) { //Cuando es embebido (=1) no imprime el boton de retorno pues se asume dentro de un formulario if (!$embebido) { echo '<div align=center><button type="Button" onclick="document.core_ver_menu.submit()" class="btn btn-warning"><i class="fa fa-home fa-fw"></i> ' . $MULTILANG_IrEscritorio . '</button></div><br>'; } //Carga la ventana con el informe abrir_ventana($Nombre_Aplicacion . ' - ' . $registro_informe["titulo"], 'panel panel-info', $registro_informe["ancho"]); } // Si se ha definido un tamano fijo entonces crea el marco if ($registro_informe["ancho"] != "" && $registro_informe["alto"] != "") { echo '<DIV style="DISPLAY: block; OVERFLOW: auto; POSITION: relative; WIDTH: ' . $registro_informe["ancho"] . '; HEIGHT: ' . $registro_informe["alto"] . '">'; } //Genera enlace al PDF cuando se detecta el modulo y ademas el informe lo tiene activado if (@file_exists("mod/pdf") && $registro_informe["genera_pdf"] == 'S') { echo '<div align=right><a href="tmp/Inf_' . $Identificador_informe . '-' . $PCOSESS_LoginUsuario . '.pdf" target="_BLANK"><i class="fa fa-file-pdf-o"></i> PDF </a></div>'; } // Crea encabezado por tipo de formato: 1=html 2=Excel if ($formato == "htm") { echo ' <html> <body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" style="font-size: 12px; font-family: Arial, Verdana, Tahoma;">'; } if ($formato == "xls") { $fecha = date("d-m-Y"); $tituloinforme = trim($registro_informe["titulo"]); $tituloinforme = "Informe"; $nombrearchivo = $tituloinforme . "_" . $fecha; header('Content-type: application/vnd.ms-excel'); header("Content-Disposition: attachment; filename={$nombrearchivo}.xls"); header("Pragma: no-cache"); header("Expires: 0"); } if ($formato == "htm") { //Si el informe va a soportar datatable entonces lo agrega a las tablas que deben ser convertidas en el pageonload if ($registro_informe["soporte_datatable"] == "S") { @($PCO_InformesDataTable .= "TablaInforme_" . $registro_informe["id"] . "|"); } $SalidaFinalInforme .= '<table class="table table-condensed table-hover table-striped table-unbordered ' . $estilo . '" id="TablaInforme_' . $registro_informe["id"] . '"><thead><tr>'; $SalidaFinalInformePDF .= '<table class="' . $estilo . '"><thead><tr>'; } if ($formato == "xls") { $SalidaFinalInforme .= '<table class="font-size: 11px; font-family: Verdana, Tahoma, Arial;"><thead><tr>'; $SalidaFinalInformePDF .= '<table class="font-size: 11px; font-family: Verdana, Tahoma, Arial;"><thead><tr>'; } // Busca si el informe tiene acciones (botones), los cuenta y prepara dentro de un arreglo para repetir en cada registro $consulta_botones = ejecutar_sql("SELECT id," . $ListaCamposSinID_informe_boton . " FROM " . $TablasCore . "informe_boton WHERE informe=? AND visible=1 ORDER BY peso", "{$informe}"); $total_botones = 0; while ($registro_botones = $consulta_botones->fetch()) { //Construye una cadena generica con todos los botones para ser reemplazada luego con valores if ($registro_botones["tipo_accion"] == "interna_eliminar") { $valores = explode(".", $registro_botones["accion_usuario"]); $tabla_vinculada = @$valores[0]; $campo_vinculado = @$valores[1]; //Si solo se indico el campo, sin la tabla, intenta usar solo el campo if ($campo_vinculado == "" && $tabla_vinculada != "") { $campo_vinculado = $valores[0]; $tabla_vinculada = ""; } $comando_javascript = "\r\n\t\t\t\t\t\t\t\t\t\tdocument.FRMBASEINFORME.PCO_Accion.value='eliminar_registro_informe';\r\n\t\t\t\t\t\t\t\t\t\tdocument.FRMBASEINFORME.tabla.value='" . @$tabla_vinculada . "';\r\n\t\t\t\t\t\t\t\t\t\tdocument.FRMBASEINFORME.campo.value='" . @$campo_vinculado . "';\r\n\t\t\t\t\t\t\t\t\t\tdocument.FRMBASEINFORME.valor.value='DELFRMVALVALOR';\r\n\t\t\t\t\t\t\t\t\t\tdocument.FRMBASEINFORME.submit()"; } if ($registro_botones["tipo_accion"] == "interna_cargar") { $comando_javascript = "\r\n document.FRMBASEINFORME.PCO_Accion.value='cargar_objeto';\r\n\t\t\t\t\t\t\t\t\t\tdocument.FRMBASEINFORME.objeto.value='frm:" . $registro_botones["accion_usuario"] . ":DETFRMVALBASE';\r\n\t\t\t\t\t\t\t\t\t\tdocument.FRMBASEINFORME.submit()"; } if ($registro_botones["tipo_accion"] == "externa_formulario") { $comando_javascript = "\r\n\t\t\t\t\t\t\t\t\t\tdocument.FRMBASEINFORME.PCO_Tabla.value='" . @$tabla_vinculada . "';\r\n\t\t\t\t\t\t\t\t\t\tdocument.FRMBASEINFORME.PCO_Campo.value='" . @$campo_vinculado . "';\r\n\t\t\t\t\t\t\t\t\t\tdocument.FRMBASEINFORME.PCO_Valor.value='DELFRMVALVALOR';\r\n document.FRMBASEINFORME.PCO_Accion.value='" . $registro_botones["accion_usuario"] . "';\r\n\t\t\t\t\t\t\t\t\t\tdocument.FRMBASEINFORME.submit()"; } if ($registro_botones["tipo_accion"] == "externa_javascript") { $comando_javascript = $registro_botones["accion_usuario"]; } //Verifica si el registro de botones presenta algun texto de confirmacion y lo antepone al script $cadena_confirmacion_accion_pre = ""; $cadena_confirmacion_accion_pos = ""; if ($registro_botones["confirmacion_texto"] != "") { $cadena_confirmacion_accion_pre = " if (confirm('" . $registro_botones["confirmacion_texto"] . "')) {"; $cadena_confirmacion_accion_pos = " } else {} "; } //Genera la cadena del enlace $cadena_javascript = 'onclick="' . $cadena_confirmacion_accion_pre . ' ' . @$comando_javascript . ' ' . $cadena_confirmacion_accion_pos . ' "'; @($cadena_generica_botones .= '<input type="Button" class="' . $registro_botones["estilo"] . '" value="' . $registro_botones["titulo"] . '" ' . $cadena_javascript . ' > '); $total_botones++; } // Imprime encabezados de columna $resultado_columnas = @ejecutar_sql($consulta); $ConteoColumnas = $resultado_columnas->rowCount(); //Si se tienen registros para mirar las columnas las agrega if ($ConteoColumnas > 0) { $numero_columnas = 0; foreach ($resultado_columnas->fetch(PDO::FETCH_ASSOC) as $key => $val) { //Imprime el encabezado siempre y cuando no se trate de un campo que se desea ocultar if (!in_array($key, $PCO_ColumnasOcultas)) { $SalidaFinalInforme .= '<th>' . $key . '</th>'; $SalidaFinalInformePDF .= '<th>' . $key . '</th>'; } else { //Agrega la columna al indice de columnas ocultas para no mostrarla luego $PCO_NumerosColumnasOcultas[] = $numero_columnas; } $numero_columnas++; } } //Si el informe tiene botones entonces agrega columna adicional if ($total_botones > 0) { $SalidaFinalInforme .= '<th></th>'; $SalidaFinalInformePDF .= '<th></th>'; } $SalidaFinalInforme .= '</tr></thead><tbody>'; $SalidaFinalInformePDF .= '</tr></thead><tbody>'; // Imprime registros del resultado $numero_filas = 0; $consulta_ejecucion = ejecutar_sql($consulta); while ($registro_informe = $consulta_ejecucion->fetch()) { $SalidaFinalInforme .= '<tr>'; $SalidaFinalInformePDF .= '<tr>'; for ($i = 0; $i < $numero_columnas; $i++) { //Muestra la columna solo si no se trata de una de las ocultas if (!in_array($i, $PCO_NumerosColumnasOcultas)) { $SalidaFinalInforme .= '<td>' . $registro_informe[$i] . '</td>'; $SalidaFinalInformePDF .= '<td>' . $registro_informe[$i] . '</td>'; } } //Si el informe tiene botones los agrega if ($total_botones > 0) { //Transforma la cadena generica con los datos especificos del registro, toma por ahora el primer campo $cadena_botones_registro = str_replace("DELFRMVALVALOR", $registro_informe[0], $cadena_generica_botones); $cadena_botones_registro = str_replace("DETFRMVALBASE", $registro_informe[0], $cadena_botones_registro); //Muestra los botones preparados para el registro $SalidaFinalInforme .= '<th>' . $cadena_botones_registro . '</th>'; $SalidaFinalInformePDF .= '<th>' . $cadena_botones_registro . '</th>'; } $SalidaFinalInforme .= '</tr>'; $SalidaFinalInformePDF .= '</tr>'; $numero_filas++; } $SalidaFinalInforme .= '</tbody>'; $SalidaFinalInformePDF .= '</tbody>'; if ($formato == "htm") { //Cuando es embebido (=1) no agrega los totales de registro if (!$embebido) { $SalidaFinalInforme .= '<tfoot> <tr><td colspan=' . $numero_columnas . '> <b>' . $MULTILANG_TotalRegistros . ': </b>' . $numero_filas . ' </td></tr>'; $SalidaFinalInformePDF .= '<tfoot> <tr><td colspan=' . $numero_columnas . '> <b>' . $MULTILANG_TotalRegistros . ': </b>' . $numero_filas . ' </td></tr>'; } echo '</tfoot>'; } $SalidaFinalInforme .= '</table>'; $SalidaFinalInformePDF .= '</table>'; if ($formato == "htm") { echo '</body></html>'; } //Imprime el HTML generado para el informe echo $SalidaFinalInforme; //Genera el PDF cuando se encuentra el modulo y el informe lo tiene activado if (@file_exists("mod/pdf") && $registro_informe["genera_pdf"] == 'S') { require_once 'mod/pdf/html2pdf/html2pdf.class.php'; try { //Define parametros para generar el PDF $IdiomaPDF = $IdiomaPredeterminado; // Acepta solo ca|cs|da|de|en|es|fr|it|nl|pt|tr $OrientacionPDF = 'P'; // P|ortrait L|andscape $TamanoPaginaPDF = 'A4'; // A4|A5|LETTER|LEGAL|100×200...| $MargenPaginaMM = '10'; // Como Entero o arreglo (Izq,Der,Arr,Aba) ej: 10 o array(1, 25, 25, 5) $ModoVistaPDF = 'fullpage'; // fullpage|fullwidth|real|default $FuentePredeterminadaPDF = 'Arial'; // Arial|Courier|Courier-Bold|Courier-BoldOblique|Courier-Oblique|Helvetica|Helvetica-Bold|Helvetica-BoldOblique|Helvetica-Oblique|Symbol|Times-Roman|Times-Bold|Times-BoldItalic|Times-Italic|ZapfDingbats $ContrasenaLecturaPDF = ''; // Si se asigna un valor pedira contrasena para poderlo leer $JavaScriptPDF = ''; // Ej. print(true); // Inicia la generacion del PDF $html2pdf = new HTML2PDF($OrientacionPDF, $TamanoPaginaPDF, $IdiomaPDF, true, 'UTF-8', $MargenPaginaMM); if ($ContrasenaLecturaPDF != "") { $html2pdf->pdf->SetProtection(array('print'), $ContrasenaLecturaPDF); } if ($JavaScriptPDF != "") { $html2pdf->pdf->IncludeJS($JavaScriptPDF); } $html2pdf->pdf->SetDisplayMode($ModoVistaPDF); $html2pdf->setDefaultFont($FuentePredeterminadaPDF); $html2pdf->WriteHTML($SalidaFinalInformePDF); $html2pdf->Output('tmp/Inf_' . $Identificador_informe . '-' . $PCOSESS_LoginUsuario . '.pdf', 'F'); // Antes: $html2pdf->Output('tmp/exemple.pdf'); enviaba salida al navegador directamente } catch (HTML2PDF_exception $e) { echo $e; exit; } } // Si se ha definido un tamano fijo entonces cierra el marco if ($registro_informe["ancho"] != "" && $registro_informe["alto"] != "") { echo '</DIV>'; } } // Fin si informe es T (tabla) //Verifica si es un informe grafico sin dimensiones if ($registro_informe["formato_final"] == "G" && ($registro_informe["ancho"] == "" || $registro_informe["alto"] == "")) { echo '<form name="cancelarXTamano" action="' . $ArchivoCORE . '" method="POST"> <input type="Hidden" name="PCO_Accion" value="Ver_menu"> <input type="Hidden" name="PCO_ErrorTitulo" value="' . $MULTILANG_ErrorDatos . '"> <input type="Hidden" name="PCO_ErrorDescripcion" value="' . $MULTILANG_InfErrTamano . '"> </form> <script type="" language="JavaScript"> document.cancelarXTamano.submit(); </script>'; } // Si el informe tiene formato_final = G (grafico) if ($registro_informe["formato_final"] == "G" && $registro_informe["ancho"] != "" && $registro_informe["alto"] != "") { //Consulta el formato de grafico y datos de series para ponerlo en los campos //Dado por: Tipo|Nombre1!NombreN|Etiqueta1!EtiquetaN|Valor1!ValorN| $formato_base = explode("|", $registro_informe["formato_grafico"]); $tipo_grafico = $formato_base[0]; $lista_nombre_series = explode("!", $formato_base[1]); $lista_etiqueta_series = explode("!", $formato_base[2]); $lista_valor_series = explode("!", $formato_base[3]); //Elimina los nombres de tabla en caso de tener punto y usa los alias si los tiene for ($i = 0; $i < 5; $i++) { //Elimina nombres de tabla encontrando el punto y seleccionando siguiente palabra if (strpos($lista_etiqueta_series[$i], ".")) { $tmp = explode(".", $lista_etiqueta_series[$i]); $lista_etiqueta_series[$i] = $tmp[1]; } if (strpos($lista_valor_series[$i], ".")) { $tmp = explode(".", $lista_valor_series[$i]); $lista_valor_series[$i] = $tmp[1]; } // Prefiere los alias sobre los nombres de campo cuando encuentra un AS if (strpos($lista_etiqueta_series[$i], " AS ")) { $tmp = explode(" AS ", $lista_etiqueta_series[$i]); $lista_etiqueta_series[$i] = $tmp[1]; } if (strpos($lista_valor_series[$i], " AS ")) { $tmp = explode(" AS ", $lista_valor_series[$i]); $lista_valor_series[$i] = $tmp[1]; } } $nombre_serie_1 = $lista_nombre_series[0]; $nombre_serie_2 = $lista_nombre_series[1]; $nombre_serie_3 = $lista_nombre_series[2]; $nombre_serie_4 = $lista_nombre_series[3]; $nombre_serie_5 = $lista_nombre_series[4]; $campo_etiqueta_serie_1 = $lista_etiqueta_series[0]; $campo_etiqueta_serie_2 = $lista_etiqueta_series[1]; $campo_etiqueta_serie_3 = $lista_etiqueta_series[2]; $campo_etiqueta_serie_4 = $lista_etiqueta_series[3]; $campo_etiqueta_serie_5 = $lista_etiqueta_series[4]; $campo_valor_serie_1 = $lista_valor_series[0]; $campo_valor_serie_2 = $lista_valor_series[1]; $campo_valor_serie_3 = $lista_valor_series[2]; $campo_valor_serie_4 = $lista_valor_series[3]; $campo_valor_serie_5 = $lista_valor_series[4]; // Libreria para graficos include "inc/libchart/classes/libchart.php"; //Crea las series para el grafico, dependiendo si es torta (una serie) o cualquier otro (multiples series) if ($tipo_grafico == "torta") { $dataSet = new XYDataSet(); // GENERA DATOS DEL GRAFICO $consulta_ejecucion = ejecutar_sql($consulta); while ($registro = $consulta_ejecucion->fetch()) { if ($nombre_serie_1 != "") { $dataSet->addPoint(new Point($registro[$campo_etiqueta_serie_1], $registro[$campo_valor_serie_1])); } } } else { $dataSet = new XYSeriesDataSet(); if ($nombre_serie_1 != "") { $serie1 = new XYDataSet(); $dataSet->addSerie($nombre_serie_1, $serie1); } if ($nombre_serie_2 != "") { $serie2 = new XYDataSet(); $dataSet->addSerie($nombre_serie_2, $serie2); } if ($nombre_serie_3 != "") { $serie3 = new XYDataSet(); $dataSet->addSerie($nombre_serie_3, $serie3); } if ($nombre_serie_4 != "") { $serie4 = new XYDataSet(); $dataSet->addSerie($nombre_serie_4, $serie4); } if ($nombre_serie_5 != "") { $serie5 = new XYDataSet(); $dataSet->addSerie($nombre_serie_5, $serie5); } // GENERA DATOS DEL GRAFICO $consulta_ejecucion = ejecutar_sql($consulta); while ($registro = $consulta_ejecucion->fetch()) { if ($nombre_serie_1 != "") { $serie1->addPoint(new Point($registro[$campo_etiqueta_serie_1], $registro[$campo_valor_serie_1])); } if ($nombre_serie_2 != "") { $serie2->addPoint(new Point($registro[$campo_etiqueta_serie_2], $registro[$campo_valor_serie_2])); } if ($nombre_serie_3 != "") { $serie3->addPoint(new Point($registro[$campo_etiqueta_serie_3], $registro[$campo_valor_serie_3])); } if ($nombre_serie_4 != "") { $serie4->addPoint(new Point($registro[$campo_etiqueta_serie_4], $registro[$campo_valor_serie_4])); } if ($nombre_serie_5 != "") { $serie5->addPoint(new Point($registro[$campo_etiqueta_serie_5], $registro[$campo_valor_serie_5])); } } } // CREA OBJETO SEGUN TIPO DE GRAFICO if ($tipo_grafico == "linea" || $tipo_grafico == "linea_multiples") { $chart = new LineChart($registro_informe["ancho"], $registro_informe["alto"]); } if ($tipo_grafico == "barrah" || $tipo_grafico == "barrah_multiples") { $chart = new HorizontalBarChart($registro_informe["ancho"], $registro_informe["alto"]); } if ($tipo_grafico == "barrav" || $tipo_grafico == "barrav_multiples") { $chart = new VerticalBarChart($registro_informe["ancho"], $registro_informe["alto"]); } if ($tipo_grafico == "torta") { $chart = new PieChart($registro_informe["ancho"], $registro_informe["alto"]); } // PRESENTA EL GRAFICO EN PANTALLA $chart->setDataSet($dataSet); //$chart->getPlot()->setGraphCaptionRatio(0.75); $chart->setTitle($registro_informe["titulo"]); $chart->render("tmp/Inf_" . $registro_informe["id"] . "-" . $PCOSESS_LoginUsuario . ".png"); echo '<img alt="Grafico" src="tmp/Inf_' . $Identificador_informe . '-' . $PCOSESS_LoginUsuario . '.png" style="border: 1px solid gray;">'; } // Fin si informe es G (grafico) if ($en_ventana) { cerrar_ventana(); } //Si el usuario es admin le muestra el query generador. if (@$PCOSESS_LoginUsuario == "admin" && $ModoDepuracion) { mensaje($MULTILANG_MonCommSQL, $consulta, '', 'fa fa-fw fa-2x fa-database', 'alert alert-info alert-dismissible '); } }
<?php require_once "{$root}/Function/libchart/classes/libchart.php"; require_once "{$root}/Function/DataTime.php"; //Padding::Padding ($top, $right, $bottom, $left) define("ChartPath", "tmp/chart.png"); define("ChartWidth", 1000); define("ChartHeight", 400); switch ($_POST['id_chart']) { case "1": $chart = new VerticalBarChart(ChartWidth, ChartHeight); $rCall4day = GetRows("tab_chiamate WHERE data_att <= '" . date('Y-m-d') . "' AND n_call != 'Pianificata'" . " group by data_att", "", "data_att", $db, 1, "count(id_chiamata) as c_day, data_att"); $rCallclose4day = GetRows("tab_chiamate WHERE data_att <= '" . date('Y-m-d') . "' AND n_call != 'Pianificata' AND id_stato_call = '1'" . " group by data_att", "", "data_att", $db, 1, "count(id_chiamata) as c_day, data_att"); /*$max_day = count($rCall4day); $diff = $max_day - count($rCallclose4day); */ $dataSet = new XYSeriesDataSet(); $call4day = new XYDataSet(); $callclose4day = new XYDataSet(); foreach ($rCall4day as $key => $field) { $call4day->addPoint(new Point(Inverti_Data($field['data_att']), $field['c_day'])); $callclose4day->addPoint(new Point(Inverti_Data($rCallclose4day[$key]['data_att']), $rCallclose4day[$key]['c_day'])); $tot_call += $field['c_day']; $tot_closed_call += $rCallclose4day[$key]['c_day']; } echo "Chiamate totali Gestite: <label>{$tot_call}</label>, " . "Giorni di attività: <label>" . count($rCall4day) . "</label>, " . "Media chiamate giornaliere ricevute: <label>" . round($tot_call / count($rCall4day), 2) . "</label>, " . "Media chiamate giornaliere chiuse: <label>" . round($tot_closed_call / count($rCall4day), 2) . "</label><br />"; $dataSet->addSerie("Chiamate ricevute per giorno", $call4day); $dataSet->addSerie("Chiamate chiuse per giorno", $callclose4day); $chart->setTitle("Statistiche Chiamate Ricevute/Chiuse per giorno"); $chart->setDataSet($dataSet); $chart->render(ChartPath); echo '<img src="' . ChartPath . '" alt="chart" />';
$chart = new revenueLineChart("1500", "500"); $ro = new database1(); $serie1 = new XYDataSet(); $serie1->addPoint(new Point("Jan {$year}", $ro->getAnnualExpenses("01", $year))); $serie1->addPoint(new Point("Feb {$year}", $ro->getAnnualExpenses("02", $year))); $serie1->addPoint(new Point("Mar {$year}", $ro->getAnnualExpenses("03", $year))); $serie1->addPoint(new Point("Apr {$year}", $ro->getAnnualExpenses("04", $year))); $serie1->addPoint(new Point("May {$year}", $ro->getAnnualExpenses("05", $year))); $serie1->addPoint(new Point("Jun {$year}", $ro->getAnnualExpenses("06", $year))); $serie1->addPoint(new Point("Jul {$year}", $ro->getAnnualExpenses("07", $year))); $serie1->addPoint(new Point("Aug {$year}", $ro->getAnnualExpenses("08", $year))); $serie1->addPoint(new Point("Sep {$year}", $ro->getAnnualExpenses("09", $year))); $serie1->addPoint(new Point("Oct {$year}", $ro->getAnnualExpenses("10", $year))); $serie1->addPoint(new Point("Nov {$year}", $ro->getAnnualExpenses("11", $year))); $serie1->addPoint(new Point("Dec {$year}", $ro->getAnnualExpenses("12", $year))); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("Expenses", $serie1); $chart->setDataSet($dataSet); $chart->setTitle("Expenses for {$year}"); $chart->getPlot()->setGraphCaptionRatio(0.62); $chart->render("../../../COCONUT/graphicalReport/chartList/annualExpenses.png"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Libchart line demonstration</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" /> </head> <body> <img alt="Line chart" src="/COCONUT/graphicalReport/chartList/annualExpenses.png" style="border: 1px solid gray;"/> </body>
*/ include "../libchart/classes/libchart.php"; $chart = new VerticalBarChart(); $serie1 = new XYDataSet(); $serie1->addPoint(new Point("YT", 64)); $serie1->addPoint(new Point("NT", 63)); $serie1->addPoint(new Point("BC", 58)); $serie1->addPoint(new Point("AB", 58)); $serie1->addPoint(new Point("SK", 46)); $serie2 = new XYDataSet(); $serie2->addPoint(new Point("YT", 61)); $serie2->addPoint(new Point("NT", 60)); $serie2->addPoint(new Point("BC", 56)); $serie2->addPoint(new Point("AB", 57)); $serie2->addPoint(new Point("SK", 52)); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("1990", $serie1); $dataSet->addSerie("1995", $serie2); $chart->setDataSet($dataSet); $chart->getPlot()->setGraphCaptionRatio(0.65); $chart->setTitle("Average family income (k\$)"); $chart->render("generated/demo7.png"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Libchart line demonstration</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" /> </head> <body> <img alt="Line chart" src="generated/demo7.png" style="border: 1px solid gray;"/>
$serie4->addPoint(new Point("{$month} 21, {$year}", $ro->getGenderDaily($month, "21", $year, "female", "IPD"))); $serie4->addPoint(new Point("{$month} 22, {$year}", $ro->getGenderDaily($month, "22", $year, "female", "IPD"))); $serie4->addPoint(new Point("{$month} 23, {$year}", $ro->getGenderDaily($month, "23", $year, "female", "IPD"))); $serie4->addPoint(new Point("{$month} 24, {$year}", $ro->getGenderDaily($month, "24", $year, "female", "IPD"))); $serie4->addPoint(new Point("{$month} 25, {$year}", $ro->getGenderDaily($month, "25", $year, "female", "IPD"))); $serie4->addPoint(new Point("{$month} 26, {$year}", $ro->getGenderDaily($month, "26", $year, "female", "IPD"))); $serie4->addPoint(new Point("{$month} 27, {$year}", $ro->getGenderDaily($month, "27", $year, "female", "IPD"))); $serie4->addPoint(new Point("{$month} 28, {$year}", $ro->getGenderDaily($month, "28", $year, "female", "IPD"))); $serie4->addPoint(new Point("{$month} 29, {$year}", $ro->getGenderDaily($month, "29", $year, "female", "IPD"))); $serie4->addPoint(new Point("{$month} 30, {$year}", $ro->getGenderDaily($month, "30", $year, "female", "IPD"))); $serie4->addPoint(new Point("{$month} 31, {$year}", $ro->getGenderDaily($month, "31", $year, "female", "IPD"))); $opdMale = $ro->getGenderDaily($month, "01", $year, "male", "OPD") + $ro->getGenderDaily($month, "02", $year, "male", "OPD") + $ro->getGenderDaily($month, "03", $year, "male", "OPD") + $ro->getGenderDaily($month, "04", $year, "male", "OPD") + $ro->getGenderDaily($month, "05", $year, "male", "OPD") + $ro->getGenderDaily($month, "06", $year, "male", "OPD") + $ro->getGenderDaily($month, "07", $year, "male", "OPD") + $ro->getGenderDaily($month, "08", $year, "male", "OPD") + $ro->getGenderDaily($month, "09", $year, "male", "OPD") + $ro->getGenderDaily($month, "10", $year, "male", "OPD") + $ro->getGenderDaily($month, "11", $year, "male", "OPD") + $ro->getGenderDaily($month, "12", $year, "male", "OPD") + $ro->getGenderDaily($month, "13", $year, "male", "OPD") + $ro->getGenderDaily($month, "14", $year, "male", "OPD") + $ro->getGenderDaily($month, "15", $year, "male", "OPD") + $ro->getGenderDaily($month, "16", $year, "male", "OPD") + $ro->getGenderDaily($month, "17", $year, "male", "OPD") + $ro->getGenderDaily($month, "18", $year, "male", "OPD") + $ro->getGenderDaily($month, "19", $year, "male", "OPD") + $ro->getGenderDaily($month, "20", $year, "male", "OPD") + $ro->getGenderDaily($month, "21", $year, "male", "OPD") + $ro->getGenderDaily($month, "22", $year, "male", "OPD") + $ro->getGenderDaily($month, "23", $year, "male", "OPD") + $ro->getGenderDaily($month, "24", $year, "male", "OPD") + $ro->getGenderDaily($month, "25", $year, "male", "OPD") + $ro->getGenderDaily($month, "26", $year, "male", "OPD") + $ro->getGenderDaily($month, "27", $year, "male", "OPD") + $ro->getGenderDaily($month, "28", $year, "male", "OPD") + $ro->getGenderDaily($month, "29", $year, "male", "OPD") + $ro->getGenderDaily($month, "30", $year, "male", "OPD") + $ro->getGenderDaily($month, "31", $year, "male", "OPD"); $opdFemale = $ro->getGenderDaily($month, "01", $year, "female", "OPD") + $ro->getGenderDaily($month, "02", $year, "female", "OPD") + $ro->getGenderDaily($month, "03", $year, "female", "OPD") + $ro->getGenderDaily($month, "04", $year, "female", "OPD") + $ro->getGenderDaily($month, "05", $year, "female", "OPD") + $ro->getGenderDaily($month, "06", $year, "female", "OPD") + $ro->getGenderDaily($month, "07", $year, "female", "OPD") + $ro->getGenderDaily($month, "08", $year, "female", "OPD") + $ro->getGenderDaily($month, "09", $year, "female", "OPD") + $ro->getGenderDaily($month, "10", $year, "female", "OPD") + $ro->getGenderDaily($month, "11", $year, "female", "OPD") + $ro->getGenderDaily($month, "12", $year, "female", "OPD") + $ro->getGenderDaily($month, "13", $year, "female", "OPD") + $ro->getGenderDaily($month, "14", $year, "female", "OPD") + $ro->getGenderDaily($month, "15", $year, "female", "OPD") + $ro->getGenderDaily($month, "16", $year, "female", "OPD") + $ro->getGenderDaily($month, "17", $year, "female", "OPD") + $ro->getGenderDaily($month, "18", $year, "female", "OPD") + $ro->getGenderDaily($month, "19", $year, "female", "OPD") + $ro->getGenderDaily($month, "20", $year, "female", "OPD") + $ro->getGenderDaily($month, "21", $year, "female", "OPD") + $ro->getGenderDaily($month, "22", $year, "female", "OPD") + $ro->getGenderDaily($month, "23", $year, "female", "OPD") + $ro->getGenderDaily($month, "24", $year, "female", "OPD") + $ro->getGenderDaily($month, "25", $year, "female", "OPD") + $ro->getGenderDaily($month, "26", $year, "female", "OPD") + $ro->getGenderDaily($month, "27", $year, "female", "OPD") + $ro->getGenderDaily($month, "28", $year, "female", "OPD") + $ro->getGenderDaily($month, "29", $year, "female", "OPD") + $ro->getGenderDaily($month, "30", $year, "female", "OPD") + $ro->getGenderDaily($month, "31", $year, "female", "OPD"); $ipdMale = $ro->getGenderDaily($month, "01", $year, "male", "IPD") + $ro->getGenderDaily($month, "02", $year, "male", "IPD") + $ro->getGenderDaily($month, "03", $year, "male", "IPD") + $ro->getGenderDaily($month, "04", $year, "male", "IPD") + $ro->getGenderDaily($month, "05", $year, "male", "IPD") + $ro->getGenderDaily($month, "06", $year, "male", "IPD") + $ro->getGenderDaily($month, "07", $year, "male", "IPD") + $ro->getGenderDaily($month, "08", $year, "male", "IPD") + $ro->getGenderDaily($month, "09", $year, "male", "IPD") + $ro->getGenderDaily($month, "10", $year, "male", "IPD") + $ro->getGenderDaily($month, "11", $year, "male", "IPD") + $ro->getGenderDaily($month, "12", $year, "male", "IPD") + $ro->getGenderDaily($month, "13", $year, "male", "IPD") + $ro->getGenderDaily($month, "14", $year, "male", "IPD") + $ro->getGenderDaily($month, "15", $year, "male", "IPD") + $ro->getGenderDaily($month, "16", $year, "male", "IPD") + $ro->getGenderDaily($month, "17", $year, "male", "IPD") + $ro->getGenderDaily($month, "18", $year, "male", "IPD") + $ro->getGenderDaily($month, "19", $year, "male", "IPD") + $ro->getGenderDaily($month, "20", $year, "male", "IPD") + $ro->getGenderDaily($month, "21", $year, "male", "IPD") + $ro->getGenderDaily($month, "22", $year, "male", "IPD") + $ro->getGenderDaily($month, "23", $year, "male", "IPD") + $ro->getGenderDaily($month, "24", $year, "male", "IPD") + $ro->getGenderDaily($month, "25", $year, "male", "IPD") + $ro->getGenderDaily($month, "26", $year, "male", "IPD") + $ro->getGenderDaily($month, "27", $year, "male", "IPD") + $ro->getGenderDaily($month, "28", $year, "male", "IPD") + $ro->getGenderDaily($month, "29", $year, "male", "IPD") + $ro->getGenderDaily($month, "30", $year, "male", "IPD") + $ro->getGenderDaily($month, "31", $year, "male", "IPD"); $ipdFemale = $ro->getGenderDaily($month, "01", $year, "female", "IPD") + $ro->getGenderDaily($month, "02", $year, "female", "IPD") + $ro->getGenderDaily($month, "03", $year, "female", "IPD") + $ro->getGenderDaily($month, "04", $year, "female", "IPD") + $ro->getGenderDaily($month, "05", $year, "female", "IPD") + $ro->getGenderDaily($month, "06", $year, "female", "IPD") + $ro->getGenderDaily($month, "07", $year, "female", "IPD") + $ro->getGenderDaily($month, "08", $year, "female", "IPD") + $ro->getGenderDaily($month, "09", $year, "female", "IPD") + $ro->getGenderDaily($month, "10", $year, "female", "IPD") + $ro->getGenderDaily($month, "11", $year, "female", "IPD") + $ro->getGenderDaily($month, "12", $year, "female", "IPD") + $ro->getGenderDaily($month, "13", $year, "female", "IPD") + $ro->getGenderDaily($month, "14", $year, "female", "IPD") + $ro->getGenderDaily($month, "15", $year, "female", "IPD") + $ro->getGenderDaily($month, "16", $year, "female", "IPD") + $ro->getGenderDaily($month, "17", $year, "female", "IPD") + $ro->getGenderDaily($month, "18", $year, "female", "IPD") + $ro->getGenderDaily($month, "19", $year, "female", "IPD") + $ro->getGenderDaily($month, "20", $year, "female", "IPD") + $ro->getGenderDaily($month, "21", $year, "female", "IPD") + $ro->getGenderDaily($month, "22", $year, "female", "IPD") + $ro->getGenderDaily($month, "23", $year, "female", "IPD") + $ro->getGenderDaily($month, "24", $year, "female", "IPD") + $ro->getGenderDaily($month, "25", $year, "female", "IPD") + $ro->getGenderDaily($month, "26", $year, "female", "IPD") + $ro->getGenderDaily($month, "27", $year, "female", "IPD") + $ro->getGenderDaily($month, "28", $year, "female", "IPD") + $ro->getGenderDaily($month, "29", $year, "female", "IPD") + $ro->getGenderDaily($month, "30", $year, "female", "IPD") + $ro->getGenderDaily($month, "31", $year, "female", "IPD"); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("OPD Male (" . $opdMale . ")", $serie1); $dataSet->addSerie("OPD Female (" . $opdFemale . ")", $serie2); $dataSet->addSerie("IPD Male (" . $ipdMale . ") ", $serie3); $dataSet->addSerie("IPD Female (" . $ipdFemale . ")", $serie4); $chart->setDataSet($dataSet); $chart->getPlot()->setGraphCaptionRatio(0.65); $chart->setTitle("Gender Census for {$month} {$year}"); $chart->render("../../../COCONUT/graphicalReport/chartList/monthlyRegistration.png"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Registration Census for <?php echo $month; echo $year;
<tr> <th>Modules</th> <th>Text Time (in seconds)</th> <th>Multimedia Time (in seconds)</th> </tr> <tr> <td>Download Time</td> <td>' . $totalTextDownloadTime . '</td> <td>' . $total . '</td> </tr> </table> '; } } else { echo '<h1>Upload both the Files ie Text and Multimedia and then Refresh the Page</h1>'; } $chart = new VerticalBarChart(850, 450); $dataSet1 = new XYDataSet(); $dataSet1->addPoint(new Point("DownloadTime", $total)); $dataSet2 = new XYDataSet(); $dataSet2->addPoint(new Point("DownloadTime", $totalTextDownloadTime)); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("Multimedia Download", $dataSet1); $dataSet->addSerie("Text Download", $dataSet2); $chart->setDataSet($dataSet); $chart->setTitle("Graphical Analysis : Downloading"); $chart->render("generated/compareDownload.png"); echo ' <br /><br /> <center><img src="generated/compareDownload.png" height="442" width="542" /></center> ';
$serie2->addPoint(new Point("{$month} 13", $ro->getPHICReceivablesMonthly_package($month, "13", $year) / 1000)); $serie2->addPoint(new Point("{$month} 12", $ro->getPHICReceivablesMonthly_package($month, "12", $year) / 1000)); $serie2->addPoint(new Point("{$month} 11", $ro->getPHICReceivablesMonthly_package($month, "11", $year) / 1000)); $serie2->addPoint(new Point("{$month} 10", $ro->getPHICReceivablesMonthly_package($month, "10", $year) / 1000)); $serie2->addPoint(new Point("{$month} 09", $ro->getPHICReceivablesMonthly_package($month, "09", $year) / 1000)); $serie2->addPoint(new Point("{$month} 08", $ro->getPHICReceivablesMonthly_package($month, "08", $year) / 1000)); $serie2->addPoint(new Point("{$month} 07", $ro->getPHICReceivablesMonthly_package($month, "07", $year) / 1000)); $serie2->addPoint(new Point("{$month} 06", $ro->getPHICReceivablesMonthly_package($month, "06", $year) / 1000)); $serie2->addPoint(new Point("{$month} 05", $ro->getPHICReceivablesMonthly_package($month, "05", $year) / 1000)); $serie2->addPoint(new Point("{$month} 04", $ro->getPHICReceivablesMonthly_package($month, "04", $year) / 1000)); $serie2->addPoint(new Point("{$month} 03", $ro->getPHICReceivablesMonthly_package($month, "03", $year) / 1000)); $serie2->addPoint(new Point("{$month} 02", $ro->getPHICReceivablesMonthly_package($month, "02", $year) / 1000)); $serie2->addPoint(new Point("{$month} 01", $ro->getPHICReceivablesMonthly_package($month, "01", $year) / 1000)); $nonPackage = $ro->getPHICReceivablesMonthly($month, "01", $year) + $ro->getPHICReceivablesMonthly($month, "02", $year) + $ro->getPHICReceivablesMonthly($month, "03", $year) + $ro->getPHICReceivablesMonthly($month, "04", $year) + $ro->getPHICReceivablesMonthly($month, "05", $year) + $ro->getPHICReceivablesMonthly($month, "06", $year) + $ro->getPHICReceivablesMonthly($month, "07", $year) + $ro->getPHICReceivablesMonthly($month, "08", $year) + $ro->getPHICReceivablesMonthly($month, "09", $year) + $ro->getPHICReceivablesMonthly($month, "10", $year) + $ro->getPHICReceivablesMonthly($month, "11", $year) + $ro->getPHICReceivablesMonthly($month, "12", $year) + $ro->getPHICReceivablesMonthly($month, "13", $year) + $ro->getPHICReceivablesMonthly($month, "14", $year) + $ro->getPHICReceivablesMonthly($month, "15", $year) + $ro->getPHICReceivablesMonthly($month, "16", $year) + $ro->getPHICReceivablesMonthly($month, "17", $year) + $ro->getPHICReceivablesMonthly($month, "18", $year) + $ro->getPHICReceivablesMonthly($month, "19", $year) + $ro->getPHICReceivablesMonthly($month, "20", $year) + $ro->getPHICReceivablesMonthly($month, "21", $year) + $ro->getPHICReceivablesMonthly($month, "22", $year) + $ro->getPHICReceivablesMonthly($month, "23", $year) + $ro->getPHICReceivablesMonthly($month, "24", $year) + $ro->getPHICReceivablesMonthly($month, "25", $year) + $ro->getPHICReceivablesMonthly($month, "26", $year) + $ro->getPHICReceivablesMonthly($month, "27", $year) + $ro->getPHICReceivablesMonthly($month, "28", $year) + $ro->getPHICReceivablesMonthly($month, "29", $year) + $ro->getPHICReceivablesMonthly($month, "30", $year) + $ro->getPHICReceivablesMonthly($month, "31", $year); $package = $ro->getPHICReceivablesMonthly_package($month, "01", $year) + $ro->getPHICReceivablesMonthly_package($month, "02", $year) + $ro->getPHICReceivablesMonthly_package($month, "03", $year) + $ro->getPHICReceivablesMonthly_package($month, "04", $year) + $ro->getPHICReceivablesMonthly_package($month, "05", $year) + $ro->getPHICReceivablesMonthly_package($month, "06", $year) + $ro->getPHICReceivablesMonthly_package($month, "07", $year) + $ro->getPHICReceivablesMonthly_package($month, "08", $year) + $ro->getPHICReceivablesMonthly_package($month, "09", $year) + $ro->getPHICReceivablesMonthly_package($month, "10", $year) + $ro->getPHICReceivablesMonthly_package($month, "11", $year) + $ro->getPHICReceivablesMonthly_package($month, "12", $year) + $ro->getPHICReceivablesMonthly_package($month, "13", $year) + $ro->getPHICReceivablesMonthly_package($month, "14", $year) + $ro->getPHICReceivablesMonthly_package($month, "15", $year) + $ro->getPHICReceivablesMonthly_package($month, "16", $year) + $ro->getPHICReceivablesMonthly_package($month, "17", $year) + $ro->getPHICReceivablesMonthly_package($month, "18", $year) + $ro->getPHICReceivablesMonthly_package($month, "19", $year) + $ro->getPHICReceivablesMonthly_package($month, "20", $year) + $ro->getPHICReceivablesMonthly_package($month, "21", $year) + $ro->getPHICReceivablesMonthly_package($month, "22", $year) + $ro->getPHICReceivablesMonthly_package($month, "23", $year) + $ro->getPHICReceivablesMonthly_package($month, "24", $year) + $ro->getPHICReceivablesMonthly_package($month, "25", $year) + $ro->getPHICReceivablesMonthly_package($month, "26", $year) + $ro->getPHICReceivablesMonthly_package($month, "27", $year) + $ro->getPHICReceivablesMonthly_package($month, "28", $year) + $ro->getPHICReceivablesMonthly_package($month, "29", $year) + $ro->getPHICReceivablesMonthly_package($month, "30", $year) + $ro->getPHICReceivablesMonthly_package($month, "31", $year); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("PhilHealth Non-Package (" . number_format($nonPackage, 2) . ")", $serie1); $dataSet->addSerie("PhilHealth Package (" . number_format($package, 2) . ")", $serie2); $chart->setDataSet($dataSet); $chart->setTitle("PhilHealth Receivables for {$month} {$year}"); $chart->render("../../../COCONUT/graphicalReport/chartList/phicReceivables.png"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Libchart line demonstration</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" /> </head> <body> <img alt="Line chart" src="/COCONUT/graphicalReport/chartList/phicReceivables.png" style="border: 1px solid gray;"/> </body>
$chart9 = new VerticalBarChart(1000, 300); $dataSet9 = new XYDataSet(); for ($a = 0; $a <= 23; $a++) { $query9 = "SELECT ip,jam,count(jam) as jumlahjam FROM `statistiksitus` WHERE dateflag BETWEEN '{$_POST['DariTanggal']}' AND '{$_POST['SampaiTanggal']}' and jam='{$a}'"; $hasil9 = mysql_query($query9); $data9 = mysql_fetch_assoc($hasil9); $jam = $data9['jam']; $jumlahjam = $data9['jumlahjam']; $dataSet9->addPoint(new Point("{$a}", $jumlahjam)); } $chart9->setDataSet($dataSet9); $chart9->setTitle("Most visited Hours"); $chart9->render("mosthours.png"); $admin .= '<img alt="Jumlah Kunjungan Jam" src="mosthours.png"/>'; /************************/ $dataSet5 = new XYSeriesDataSet(); $dataSet5->addSerie("Kunjungan", $serie1); $dataSet5->addSerie("Halaman", $serie2); $dataSet5->addSerie("Hits", $serie3); $chart5->setDataSet($dataSet5); $chart5->getPlot()->setGraphCaptionRatio(0.65); $chart5->setTitle("Statistik Kunjungan Tanggal"); $chart5->render("jumlahkunjungan.png"); $admin .= '<img alt="Jumlah Kunjungan" src="jumlahkunjungan.png"/>'; $query8 = "SELECT dateflag,count(distinct(ip)) AS kunjungan,count(distinct(filename)) AS filename,count(*) AS hits FROM statistiksitus WHERE dateflag BETWEEN '{$_POST['DariTanggal']}' AND '{$_POST['SampaiTanggal']}'group by dateflag asc"; $hasil8 = mysql_query($query8); $admin .= ' <div class="row"> <div class="col-md-3">'; $admin .= '<table class="table table-nonfluid"> <tr><td colspan="6" align="center" class="bg-primary"><b>Statistik Per Tanggal</b></td></tr>
$serie3->addPoint(new Point("Nov {$year}", $ro->getGenderAnnual("11", $year, "male", "IPD"))); $serie3->addPoint(new Point("Dec {$year}", $ro->getGenderAnnual("12", $year, "male", "IPD"))); $serie4 = new XYDataSet(); $serie4->addPoint(new Point("Jan {$year}", $ro->getGenderAnnual("01", $year, "female", "IPD"))); $serie4->addPoint(new Point("Feb {$year}", $ro->getGenderAnnual("02", $year, "female", "IPD"))); $serie4->addPoint(new Point("Mar {$year}", $ro->getGenderAnnual("03", $year, "female", "IPD"))); $serie4->addPoint(new Point("Apr {$year}", $ro->getGenderAnnual("04", $year, "female", "IPD"))); $serie4->addPoint(new Point("May {$year}", $ro->getGenderAnnual("05", $year, "female", "IPD"))); $serie4->addPoint(new Point("Jun {$year}", $ro->getGenderAnnual("06", $year, "female", "IPD"))); $serie4->addPoint(new Point("Jul {$year}", $ro->getGenderAnnual("07", $year, "female", "IPD"))); $serie4->addPoint(new Point("Aug {$year}", $ro->getGenderAnnual("08", $year, "female", "IPD"))); $serie4->addPoint(new Point("Sep {$year}", $ro->getGenderAnnual("09", $year, "female", "IPD"))); $serie4->addPoint(new Point("Oct {$year}", $ro->getGenderAnnual("10", $year, "female", "IPD"))); $serie4->addPoint(new Point("Nov {$year}", $ro->getGenderAnnual("11", $year, "female", "IPD"))); $serie4->addPoint(new Point("Dec {$year}", $ro->getGenderAnnual("12", $year, "female", "IPD"))); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("OPD Male", $serie1); $dataSet->addSerie("OPD Female", $serie2); $dataSet->addSerie("IPD Male", $serie3); $dataSet->addSerie("IPD Female", $serie4); $chart->setDataSet($dataSet); $chart->setTitle("Gender Census for {$year}"); $chart->getPlot()->setGraphCaptionRatio(0.62); $chart->render("../../../COCONUT/graphicalReport/chartList/monthlyRegistrationBreakdown.png"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Libchart line demonstration</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" /> </head>
$serie1->addPoint(new Point("{$wordMonth} 14", number_format($ro->getFastMovingChart($month, "14", $year, $description, $type, $chargesCode) / 100, 2))); $serie1->addPoint(new Point("{$wordMonth} 13", number_format($ro->getFastMovingChart($month, "13", $year, $description, $type, $chargesCode) / 100, 2))); $serie1->addPoint(new Point("{$wordMonth} 12", number_format($ro->getFastMovingChart($month, "12", $year, $description, $type, $chargesCode) / 100, 2))); $serie1->addPoint(new Point("{$wordMonth} 11", number_format($ro->getFastMovingChart($month, "11", $year, $description, $type, $chargesCode) / 100, 2))); $serie1->addPoint(new Point("{$wordMonth} 10", number_format($ro->getFastMovingChart($month, "10", $year, $description, $type, $chargesCode) / 100, 2))); $serie1->addPoint(new Point("{$wordMonth} 9", number_format($ro->getFastMovingChart($month, "09", $year, $description, $type, $chargesCode) / 100, 2))); $serie1->addPoint(new Point("{$wordMonth} 8", number_format($ro->getFastMovingChart($month, "08", $year, $description, $type, $chargesCode) / 100, 2))); $serie1->addPoint(new Point("{$wordMonth} 7", number_format($ro->getFastMovingChart($month, "07", $year, $description, $type, $chargesCode) / 100, 2))); $serie1->addPoint(new Point("{$wordMonth} 6", number_format($ro->getFastMovingChart($month, "06", $year, $description, $type, $chargesCode) / 100, 2))); $serie1->addPoint(new Point("{$wordMonth} 5", number_format($ro->getFastMovingChart($month, "05", $year, $description, $type, $chargesCode) / 100, 2))); $serie1->addPoint(new Point("{$wordMonth} 4", number_format($ro->getFastMovingChart($month, "04", $year, $description, $type, $chargesCode) / 100, 2))); $serie1->addPoint(new Point("{$wordMonth} 3", number_format($ro->getFastMovingChart($month, "03", $year, $description, $type, $chargesCode) / 100, 2))); $serie1->addPoint(new Point("{$wordMonth} 2", number_format($ro->getFastMovingChart($month, "02", $year, $description, $type, $chargesCode) / 100, 2))); $serie1->addPoint(new Point("{$wordMonth} 1", number_format($ro->getFastMovingChart($month, "01", $year, $description, $type, $chargesCode) / 100, 2))); $totalDisp = $ro->getFastMovingChart($month, "01", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "02", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "03", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "04", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "05", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "06", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "07", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "08", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "09", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "10", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "11", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "12", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "13", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "14", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "15", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "16", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "17", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "18", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "19", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "20", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "21", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "22", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "23", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "24", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "25", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "26", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "27", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "28", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "29", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "30", $year, $description, $type, $chargesCode) + $ro->getFastMovingChart($month, "31", $year, $description, $type, $chargesCode); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("{$description} (" . number_format($totalDisp, 2) . ") ", $serie1); $chart->setDataSet($dataSet); $chart->getPlot()->setGraphCaptionRatio(0.35); $chart->setTitle("{$description} for {$month} {$year}"); $chart->render("../../../COCONUT/graphicalReport/chartList/dispensed.png"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Sales of <?php echo $description; ?> for <?php echo $month; echo $year;
$serie2->addPoint(new Point("{$month} 19, {$year}", $ro->getPxCensusMonth($month, "19", $year, "IPD"))); $serie2->addPoint(new Point("{$month} 20, {$year}", $ro->getPxCensusMonth($month, "20", $year, "IPD"))); $serie2->addPoint(new Point("{$month} 21, {$year}", $ro->getPxCensusMonth($month, "21", $year, "IPD"))); $serie2->addPoint(new Point("{$month} 22, {$year}", $ro->getPxCensusMonth($month, "22", $year, "IPD"))); $serie2->addPoint(new Point("{$month} 23, {$year}", $ro->getPxCensusMonth($month, "23", $year, "IPD"))); $serie2->addPoint(new Point("{$month} 24, {$year}", $ro->getPxCensusMonth($month, "24", $year, "IPD"))); $serie2->addPoint(new Point("{$month} 25, {$year}", $ro->getPxCensusMonth($month, "25", $year, "IPD"))); $serie2->addPoint(new Point("{$month} 26, {$year}", $ro->getPxCensusMonth($month, "26", $year, "IPD"))); $serie2->addPoint(new Point("{$month} 27, {$year}", $ro->getPxCensusMonth($month, "27", $year, "IPD"))); $serie2->addPoint(new Point("{$month} 28, {$year}", $ro->getPxCensusMonth($month, "28", $year, "IPD"))); $serie2->addPoint(new Point("{$month} 29, {$year}", $ro->getPxCensusMonth($month, "29", $year, "IPD"))); $serie2->addPoint(new Point("{$month} 30, {$year}", $ro->getPxCensusMonth($month, "30", $year, "IPD"))); $serie2->addPoint(new Point("{$month} 31, {$year}", $ro->getPxCensusMonth($month, "31", $year, "IPD"))); $totalOPD = $ro->getPxCensusMonth($month, "01", $year, "OPD") + $ro->getPxCensusMonth($month, "02", $year, "OPD") + $ro->getPxCensusMonth($month, "03", $year, "OPD") + $ro->getPxCensusMonth($month, "04", $year, "OPD") + $ro->getPxCensusMonth($month, "05", $year, "OPD") + $ro->getPxCensusMonth($month, "06", $year, "OPD") + $ro->getPxCensusMonth($month, "07", $year, "OPD") + $ro->getPxCensusMonth($month, "08", $year, "OPD") + $ro->getPxCensusMonth($month, "09", $year, "OPD") + $ro->getPxCensusMonth($month, "10", $year, "OPD") + $ro->getPxCensusMonth($month, "11", $year, "OPD") + $ro->getPxCensusMonth($month, "12", $year, "OPD") + $ro->getPxCensusMonth($month, "13", $year, "OPD") + $ro->getPxCensusMonth($month, "14", $year, "OPD") + $ro->getPxCensusMonth($month, "15", $year, "OPD") + $ro->getPxCensusMonth($month, "16", $year, "OPD") + $ro->getPxCensusMonth($month, "17", $year, "OPD") + $ro->getPxCensusMonth($month, "18", $year, "OPD") + $ro->getPxCensusMonth($month, "19", $year, "OPD") + $ro->getPxCensusMonth($month, "20", $year, "OPD") + $ro->getPxCensusMonth($month, "21", $year, "OPD") + $ro->getPxCensusMonth($month, "22", $year, "OPD") + $ro->getPxCensusMonth($month, "23", $year, "OPD") + $ro->getPxCensusMonth($month, "24", $year, "OPD") + $ro->getPxCensusMonth($month, "25", $year, "OPD") + $ro->getPxCensusMonth($month, "26", $year, "OPD") + $ro->getPxCensusMonth($month, "27", $year, "OPD") + $ro->getPxCensusMonth($month, "28", $year, "OPD") + $ro->getPxCensusMonth($month, "29", $year, "OPD") + $ro->getPxCensusMonth($month, "30", $year, "OPD") + $ro->getPxCensusMonth($month, "31", $year, "OPD"); $totalIPD = $ro->getPxCensusMonth($month, "01", $year, "IPD") + $ro->getPxCensusMonth($month, "02", $year, "IPD") + $ro->getPxCensusMonth($month, "03", $year, "IPD") + $ro->getPxCensusMonth($month, "04", $year, "IPD") + $ro->getPxCensusMonth($month, "05", $year, "IPD") + $ro->getPxCensusMonth($month, "06", $year, "IPD") + $ro->getPxCensusMonth($month, "07", $year, "IPD") + $ro->getPxCensusMonth($month, "08", $year, "IPD") + $ro->getPxCensusMonth($month, "09", $year, "IPD") + $ro->getPxCensusMonth($month, "10", $year, "IPD") + $ro->getPxCensusMonth($month, "11", $year, "IPD") + $ro->getPxCensusMonth($month, "12", $year, "IPD") + $ro->getPxCensusMonth($month, "13", $year, "IPD") + $ro->getPxCensusMonth($month, "14", $year, "IPD") + $ro->getPxCensusMonth($month, "15", $year, "IPD") + $ro->getPxCensusMonth($month, "16", $year, "IPD") + $ro->getPxCensusMonth($month, "17", $year, "IPD") + $ro->getPxCensusMonth($month, "18", $year, "IPD") + $ro->getPxCensusMonth($month, "19", $year, "IPD") + $ro->getPxCensusMonth($month, "20", $year, "IPD") + $ro->getPxCensusMonth($month, "21", $year, "IPD") + $ro->getPxCensusMonth($month, "22", $year, "IPD") + $ro->getPxCensusMonth($month, "23", $year, "IPD") + $ro->getPxCensusMonth($month, "24", $year, "IPD") + $ro->getPxCensusMonth($month, "25", $year, "IPD") + $ro->getPxCensusMonth($month, "26", $year, "IPD") + $ro->getPxCensusMonth($month, "27", $year, "IPD") + $ro->getPxCensusMonth($month, "28", $year, "IPD") + $ro->getPxCensusMonth($month, "29", $year, "IPD") + $ro->getPxCensusMonth($month, "30", $year, "IPD") + $ro->getPxCensusMonth($month, "31", $year, "IPD"); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("OPD (" . $totalOPD . ")", $serie1); $dataSet->addSerie("IPD (" . $totalIPD . ")", $serie2); $chart->setDataSet($dataSet); $chart->getPlot()->setGraphCaptionRatio(0.65); $chart->setTitle("Registration Census for {$month} {$year}"); $chart->render("../../../COCONUT/graphicalReport/chartList/monthlyRegistration.png"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Registration Census for <?php echo $month; echo $year; ?> </title>
/** * Función que genera la gráfica con el promedio de los * errores cometidos por los alumnos. Va a mostrarse * en el panel del profesor. * */ public function generarGraficaMediaErrores() { $chart = new \VerticalBarChart(800, 350); $serie_errores_unitarios = new \XYDataSet(); $serie_errores_excepcion = new \XYDataSet(); $num_alumnos_por_intento = array(); $alumnos_tabla = TableRegistry::get("Alumnos"); $alumnos = $alumnos_tabla->find('all'); $intento_realizado = false; foreach ($alumnos as $alumno) { $intentos_tabla = TableRegistry::get("Intentos"); $intentos = $intentos_tabla->find('all')->where(['tarea_id' => $_SESSION["lti_idTarea"], 'alumno_id' => $alumno->id]); foreach ($intentos as $intento) { $intento_realizado = true; $clave = "Intento " . $intento->numero_intento; if (array_key_exists($clave, $num_alumnos_por_intento)) { $num_alumnos_por_intento[$clave] += 1; } else { $num_alumnos_por_intento[$clave] = 1; } // Errores $num_errores_unitarios = 0; $num_errores_excepcion = 0; $errores_tabla = TableRegistry::get("Errores"); $errores = $errores_tabla->find('all')->where(['intento_id' => $intento->id])->toArray(); foreach ($errores as $error) { if ($error->tipo_error == "failure") { $num_errores_unitarios++; } else { $num_errores_excepcion++; } } $point_error_unitario = $serie_errores_unitarios->getPointWithX($clave); if ($point_error_unitario != null) { $point_error_unitario->setY(round(($point_error_unitario->getY() + $num_errores_unitarios) / $num_alumnos_por_intento[$clave]), 2); } else { $serie_errores_unitarios->addPoint(new \Point($clave, $num_errores_unitarios)); } $point_error_excepcion = $serie_errores_excepcion->getPointWithX($clave); if ($point_error_excepcion != null) { $point_error_excepcion->setY(round(($point_error_excepcion->getY() + $num_errores_excepcion) / $num_alumnos_por_intento[$clave]), 2); } else { $serie_errores_excepcion->addPoint(new \Point($clave, $num_errores_excepcion)); } } } if ($intento_realizado) { $dataSet = new \XYSeriesDataSet(); $dataSet->addSerie("Unitarios", $serie_errores_unitarios); $dataSet->addSerie("Excepciones", $serie_errores_excepcion); $chart->setDataSet($dataSet); $chart->getPlot()->setGraphCaptionRatio(0.75); $chart->setTitle("Promedio de errores cometidos por intento"); $chart->render("img/" . $_SESSION["lti_idTarea"] . "-prof-promedioErroresUnitariosExcepciones.png"); } }
$serie1->addPoint(new Point("Nov {$year}", $ro->getPHICReceivablesAnnual("Nov", $year) / 1000)); $serie1->addPoint(new Point("Dec {$year}", $ro->getPHICReceivablesAnnual("Dec", $year) / 1000)); $serie2 = new XYDataSet(); $serie2->addPoint(new Point("Jan {$year}", $ro->getPHICReceivablesAnnual_package("Jan", $year) / 1000)); $serie2->addPoint(new Point("Feb {$year}", $ro->getPHICReceivablesAnnual_package("Feb", $year) / 1000)); $serie2->addPoint(new Point("Mar {$year}", $ro->getPHICReceivablesAnnual_package("Mar", $year) / 1000)); $serie2->addPoint(new Point("Apr {$year}", $ro->getPHICReceivablesAnnual_package("Apr", $year) / 1000)); $serie2->addPoint(new Point("May {$year}", $ro->getPHICReceivablesAnnual_package("May", $year) / 1000)); $serie2->addPoint(new Point("Jun {$year}", $ro->getPHICReceivablesAnnual_package("Jun", $year) / 1000)); $serie2->addPoint(new Point("Jul {$year}", $ro->getPHICReceivablesAnnual_package("Jul", $year) / 1000)); $serie2->addPoint(new Point("Aug {$year}", $ro->getPHICReceivablesAnnual_package("Aug", $year) / 1000)); $serie2->addPoint(new Point("Sep {$year}", $ro->getPHICReceivablesAnnual_package("Sep", $year) / 1000)); $serie2->addPoint(new Point("Oct {$year}", $ro->getPHICReceivablesAnnual_package("Oct", $year) / 1000)); $serie2->addPoint(new Point("Nov {$year}", $ro->getPHICReceivablesAnnual_package("Nov", $year) / 1000)); $serie2->addPoint(new Point("Dec {$year}", $ro->getPHICReceivablesAnnual_package("Dec", $year) / 1000)); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("PhilHealth Non-Package", $serie1); $dataSet->addSerie("PhilHealth Package", $serie2); $chart->setDataSet($dataSet); $chart->setTitle("PhilHealth Receivables for {$year}"); $chart->getPlot()->setGraphCaptionRatio(0.62); $chart->render("../../../COCONUT/graphicalReport/chartList/monthlyRegistrationBreakdown.png"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Libchart line demonstration</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" /> </head> <body> <img alt="Line chart" src="/COCONUT/graphicalReport/chartList/monthlyRegistrationBreakdown.png" style="border: 1px solid gray;"/>
$serie1->addPoint(new Point("{$month} 14", number_format($ro->getMonthlyExpenses($month, "14", $year), 2))); $serie1->addPoint(new Point("{$month} 13", number_format($ro->getMonthlyExpenses($month, "13", $year), 2))); $serie1->addPoint(new Point("{$month} 12", number_format($ro->getMonthlyExpenses($month, "12", $year), 2))); $serie1->addPoint(new Point("{$month} 11", number_format($ro->getMonthlyExpenses($month, "11", $year), 2))); $serie1->addPoint(new Point("{$month} 10", number_format($ro->getMonthlyExpenses($month, "10", $year), 2))); $serie1->addPoint(new Point("{$month} 09", number_format($ro->getMonthlyExpenses($month, "09", $year), 2))); $serie1->addPoint(new Point("{$month} 08", number_format($ro->getMonthlyExpenses($month, "08", $year), 2))); $serie1->addPoint(new Point("{$month} 07", number_format($ro->getMonthlyExpenses($month, "07", $year), 2))); $serie1->addPoint(new Point("{$month} 06", number_format($ro->getMonthlyExpenses($month, "06", $year), 2))); $serie1->addPoint(new Point("{$month} 05", number_format($ro->getMonthlyExpenses($month, "05", $year), 2))); $serie1->addPoint(new Point("{$month} 04", number_format($ro->getMonthlyExpenses($month, "04", $year), 2))); $serie1->addPoint(new Point("{$month} 03", number_format($ro->getMonthlyExpenses($month, "03", $year), 2))); $serie1->addPoint(new Point("{$month} 02", number_format($ro->getMonthlyExpenses($month, "02", $year), 2))); $serie1->addPoint(new Point("{$month} 01", number_format($ro->getMonthlyExpenses($month, "01", $year), 2))); $totalExpenses = $ro->getMonthlyExpenses($month, "01", $year) * 1000 + $ro->getMonthlyExpenses($month, "02", $year) * 1000 + $ro->getMonthlyExpenses($month, "03", $year) * 1000 + $ro->getMonthlyExpenses($month, "04", $year) * 1000 + $ro->getMonthlyExpenses($month, "05", $year) * 1000 + $ro->getMonthlyExpenses($month, "06", $year) * 1000 + $ro->getMonthlyExpenses($month, "07", $year) * 1000 + $ro->getMonthlyExpenses($month, "08", $year) * 1000 + $ro->getMonthlyExpenses($month, "09", $year) * 1000 + $ro->getMonthlyExpenses($month, "10", $year) * 1000 + $ro->getMonthlyExpenses($month, "11", $year) * 1000 + $ro->getMonthlyExpenses($month, "12", $year) * 1000 + $ro->getMonthlyExpenses($month, "13", $year) * 1000 + $ro->getMonthlyExpenses($month, "14", $year) * 1000 + $ro->getMonthlyExpenses($month, "15", $year) * 1000 + $ro->getMonthlyExpenses($month, "16", $year) * 1000 + $ro->getMonthlyExpenses($month, "17", $year) * 1000 + $ro->getMonthlyExpenses($month, "18", $year) * 1000 + $ro->getMonthlyExpenses($month, "19", $year) * 1000 + $ro->getMonthlyExpenses($month, "20", $year) * 1000 + $ro->getMonthlyExpenses($month, "21", $year) * 1000 + $ro->getMonthlyExpenses($month, "22", $year) * 1000 + $ro->getMonthlyExpenses($month, "23", $year) * 1000 + $ro->getMonthlyExpenses($month, "24", $year) * 1000 + $ro->getMonthlyExpenses($month, "25", $year) * 1000 + $ro->getMonthlyExpenses($month, "26", $year) * 1000 + $ro->getMonthlyExpenses($month, "27", $year) * 1000 + $ro->getMonthlyExpenses($month, "28", $year) * 1000 + $ro->getMonthlyExpenses($month, "29", $year) * 1000 + $ro->getMonthlyExpenses($month, "30", $year) * 1000 + $ro->getMonthlyExpenses($month, "31", $year) * 1000; $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("Expenses (" . number_format($totalExpenses, 2) . ")", $serie1); $chart->setDataSet($dataSet); $chart->getPlot()->setGraphCaptionRatio(0.35); $chart->setTitle("Expenses for {$month} {$year}"); $chart->render("../../../COCONUT/graphicalReport/chartList/monthlyExpenses.png"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Registration Census for <?php echo $month; echo $year; ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" />
$serie2 = new XYDataSet(); $xbins = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); $ybins = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); foreach ($db->loadAssocList() as $row) { if ($row['bin_x']) { $xbins[$row['bin_x'] - 1]++; } if ($row['bin_y']) { $ybins[$row['bin_y'] - 1]++; } } for ($x = 0; $x < 31; $x++) { $serie1->addPoint(new Point($x + 1, $xbins[$x])); $serie2->addPoint(new Point($x + 1, $ybins[$x])); } $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("X", $serie1); $dataSet->addSerie("Y", $serie2); $chart->setDataSet($dataSet); $chart->setTitle("3600 Data Points"); //$chart->render("/home/hddev3/public_html/images/render_bins.png"); ?> <div style="text-align: center"> <img src="data:image/png;base64,<?php $name = tempnam('.', '.png'); $chart->render($name); echo base64_encode(file_get_contents($name)); unlink($name); ?> "> </div>
$serie3->addPoint(new Point("06-06", 900)); $serie4 = new XYDataSet(); $serie4->addPoint(new Point("06-01", 280)); $serie4->addPoint(new Point("06-02", 500)); $serie4->addPoint(new Point("06-03", 612)); $serie4->addPoint(new Point("06-04", 742)); $serie4->addPoint(new Point("06-05", 800)); $serie4->addPoint(new Point("06-06", 1000)); $serie5 = new XYDataSet(); $serie5->addPoint(new Point("06-01", 380)); $serie5->addPoint(new Point("06-02", 600)); $serie5->addPoint(new Point("06-03", 712)); $serie5->addPoint(new Point("06-04", 842)); $serie5->addPoint(new Point("06-05", 900)); $serie5->addPoint(new Point("06-06", 1200)); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("Product 1", $serie1); $dataSet->addSerie("Product 2", $serie2); $dataSet->addSerie("Product 3", $serie3); $dataSet->addSerie("Product 4", $serie4); $dataSet->addSerie("Product 5", $serie5); $chart->setDataSet($dataSet); $chart->setTitle("Sales for 2006"); $chart->getPlot()->setGraphCaptionRatio(0.62); $chart->render("generated/demo6.png"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Libchart line demonstration</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" />
public function lineChartHamSpam($timespan, $title, $size_x, $size_y, $output) { $ydata = array(); $ydata2 = array(); $dates = array(); $session = Registry::get('session'); $chart = new LineChart($size_x, $size_y); $chart->getPlot()->getPalette()->setLineColor(array(new Color(208, 48, 128))); $line1 = new XYDataSet(); $limit = $this->getDataPoints($timespan); $range = $this->getRangeInSeconds($timespan); if ($timespan == "daily") { $grouping = "GROUP BY FROM_UNIXTIME(ts, '%Y.%m.%d. %H')"; } else { $grouping = "GROUP BY FROM_UNIXTIME(ts, '%Y.%m.%d.')"; } if ($timespan == "daily") { $delta = 3600; $date_format = "H:i"; } else { $delta = 86400; $date_format = "m.d."; } if (Registry::get('admin_user') == 0) { $q = ''; $auditdomains = $session->get('auditdomains'); foreach ($auditdomains as $a) { if ($q) { $q .= ",?"; } else { $q = "?"; } } reset($auditdomains); $query = $this->db->query("select arrived-(arrived%{$delta}) as ts, count(*) as num from " . VIEW_MESSAGES . " where arrived > {$range} AND todomain IN ({$q}) {$domains} {$grouping} ORDER BY ts DESC limit {$limit}", $auditdomains); } else { $query = $this->db->query("select arrived-(arrived%{$delta}) as ts, count(*) as num from " . TABLE_META . " where arrived > {$range} {$grouping} ORDER BY ts DESC limit {$limit}"); } foreach ($query->rows as $q) { array_push($ydata, $q['num']); array_push($dates, date($date_format, $q['ts'])); } if ($query->num_rows >= 15) { $i = 0; while (list($k, $v) = each($dates)) { $i++; if ($i % 3) { $dates[$k] = ""; } } reset($dates); } $ydata = array_reverse($ydata); $dates = array_reverse($dates); for ($i = 0; $i < count($ydata); $i++) { $ts = $dates[$i]; $line1->addPoint(new Point("{$ts}", $ydata[$i])); } $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("RCVD", $line1); $chart->setDataSet($dataSet); $chart->setTitle($title); $chart->getPlot()->setGraphCaptionRatio(0.8); $this->sendOutput($chart, $output); }