function grafico($anio = '') { $this->load->library('Graph'); if (empty($anio)) { return; } $fechai = $anio . '0101'; $fechaf = $anio . '1231'; $mSQL = "SELECT a.vd, LEFT(b.nombre, 8)as nombre2, \n\t\t sum(a.totalg*IF(a.tipo_doc='D', -1, 1)) AS grantotal, \n\t\t sum(a.totalg*(a.referen IN ('E', 'M'))*IF(a.tipo_doc='D', -1, 1)) AS contado, \n\t\t sum(a.totalg*(a.referen NOT IN ('E', 'M'))*IF(a.tipo_doc='D', -1, 1)) AS credito \n\t\t FROM sfac AS a \n\t\t JOIN vend AS b ON a.vd=b.vendedor \n\t\t WHERE a.tipo_doc<>'X' AND a.fecha>='{$fechai}' AND a.fecha<='{$fechaf}' \n\t\t GROUP BY a.vd ORDER BY a.vd,grantotal DESC LIMIT 10"; $maxval = 0; $query = $this->db->query($mSQL); $data_1 = $data_2 = $data_3 = $vendedor = array(); foreach ($query->result() as $row) { if ($row->grantotal > $maxval) { $maxval = $row->grantotal; } $nombre[] = $row->nombre2; $vendedor[] = $row->vd; $data_1[] = $row->contado; $data_2[] = $row->credito; $data_3[] = $row->grantotal; } $om = 1; while ($maxval / $om > 100) { $om = $om * 10; } $bar_1 = new bar(75, '#0053A4'); $bar_2 = new bar(75, '#9933CC'); $bar_3 = new bar(75, '#639F45'); $bar_1->key('Contado', 10); $bar_2->key('Credito', 10); $bar_3->key('Total', 10); for ($i = 0; $i < count($data_1); $i++) { $bar_1->add_data_tip($data_1[$i] / $om, graph::esc(number_format($data_1[$i], 2, ',', '.'))); $bar_2->add_data_tip($data_2[$i] / $om, graph::esc(number_format($data_2[$i], 2, ',', '.'))); $bar_3->add_data_tip($data_3[$i] / $om, graph::esc(number_format($data_3[$i], 2, ',', '.'))); $bar_1->links[] = site_url("/ventas/vendedoresmensuales/index/{$anio}/" . $vendedor[$i]); $bar_2->links[] = site_url("/ventas/vendedoresmensuales/index/{$anio}/" . $vendedor[$i]); $bar_3->links[] = site_url("/ventas/vendedoresmensuales/index/{$anio}/" . $vendedor[$i]); } $g = new graph(); $g->title('Los 10 vendedores con los indice de ventas más altos en el año' . $anio, '{font-size: 22px; color:##00264A}'); $g->set_is_decimal_separator_comma(1); $g->data_sets[] = $bar_1; $g->data_sets[] = $bar_2; $g->data_sets[] = $bar_3; $g->set_x_labels($nombre); $g->set_x_label_style(10, '#000000', 3, 1); $g->set_x_axis_steps(10); $g->set_x_legend('Vendedores', 14, '#004381'); $g->bg_colour = '#FFFFFF'; $g->set_tool_tip('#key#<br>Vendedor: #x_label# <br>Monto: #tip#'); $g->set_y_max(ceil($maxval / $om)); $g->y_label_steps(5); $g->set_y_legend('Ventas x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381'); echo utf8_encode($g->render()); }
public function fiz() { self::test(); parent::test(); static::test(); bar::test(); }
public function __construct() { parent::__construct(); $p = new reflectionobject($this); var_dump($h = $p->getProperty('a')); var_dump($h->isDefault(), $h->isProtected(), $h->isPrivate(), $h->isPublic(), $h->isStatic()); var_dump($p->getProperties()); }
public function test() { self::ABC(); bar::ABC(); call_user_func(array('BAR', 'xyz')); call_user_func('BAR::www'); call_user_func(array('self', 'y')); call_user_func('self::y'); }
<?php include_once 'php-ofc-library/open-flash-chart.php'; $x_labels = array(); $g = $_GET['g']; $g = explode('*', $g); $ilosc_stref = count($g); //=========================================================== $bar_red = new bar(50, '#D54C78'); $bar_red->key('T1(8:00-16:00)', 10); $bar_blue = new bar(50, '#3334AD'); $bar_blue->key('T2(16:00-24:00)', 10); $bar_green = new bar(50, '#00dd00'); $bar_green->key('T3(0:00-8:00)', 10); //=========================================================== for ($k = 0; $k < $ilosc_stref; $k++) { $strefa[$k] = explode('|', $g[$k]); $x_labels[] = $strefa[$k][0]; $t = explode('@', $strefa[$k][1]); if ($t[0] == null) { $t[0] = 0; } $bar_red->data[] = $t[0]; if ($t[1] == null) { $t[1] = 0; } $bar_blue->data[] = $t[1]; if ($t[2] == null) { $t[2] = 0; } $bar_green->data[] = $t[2]; if ($t[0] > $tmax) {
<? // assertEcho 'hello world' class bar { function hi() { echo 'hello world'; } } $foo = new bar(); $foo->hi(); ?>
function _render_statistic($x = array(), $yout = array(), $yin = array(), $type = 'bar', $points) { $this->load->helper('date'); $this->load->library('OpenFlashChartLib', NULL, 'OFCL'); $data_1 = array(); $data_2 = array(); $data_3 = array(); switch ($type) { case 'bar': for ($i = 0; $i <= $points; $i++) { $data_1[$i] = $x[$i]; $data_2[$i] = (int) $yout[$i]; // force to integer $data_3[$i] = (int) $yin[$i]; // force to integer } $data_1 = array_reverse($data_1); $data_2 = array_reverse($data_2); $data_3 = array_reverse($data_3); $bar_1 = new bar(); $bar_1->set_values($data_3); $bar_1->set_colour('#639F45'); $bar_1->key(lang('kalkun_incoming_sms'), 10); $bar_1->set_tooltip('#x_label#<br>#val# SMS'); //$bar_1->set_key("SMS used in last 7 days", 10); $bar_2 = new bar(); $bar_2->set_values($data_2); $bar_2->set_colour('#21759B'); $bar_2->key(lang('kalkun_outgoing_sms'), 10); $bar_2->set_tooltip('#x_label#<br>#val# SMS'); $x = new x_axis(); $labels = new x_axis_labels(); $labels->set_labels($data_1); $labels->set_steps(1); $x->set_labels($labels); $y = new y_axis(); $max = max(max($data_2), max($data_3)); if ($max < 10) { $max = 10; } $max = ceil($max / 5) * 5; $range = ceil($max / 5); $range = ceil($range / 10) * 10; $y->set_range(0, $max, $range); $element1 = $bar_1; $element2 = $bar_2; break; case 'line': for ($i = 0; $i <= 7; $i++) { $data_1[$i] = new scatter_value($x[$i], $yin[$i]); $data_2[$i] = new scatter_value($x[$i], $yout[$i]); $data_3[$i] = (int) $yin[$i]; $data_4[$i] = (int) $yout[$i]; } $def = new solid_dot(); $def->size(4)->halo_size(0)->colour('#21759B')->tooltip('#date:d M y#<br>#val# SMS'); $line_1 = new scatter_line('#639F45', 3); $line_1->set_values($data_1); $line_1->set_default_dot_style($def); $line_1->set_key("Incoming SMS", 10); $line_2 = new scatter_line('#21759B', 3); $line_2->set_values($data_2); $line_2->set_default_dot_style($def); $line_2->set_key("Outgoing SMS", 10); $x = new x_axis(); // grid line and tick every 10 $x->set_range(mktime(0, 0, 0, date("m"), date("d") - 7, date('Y')), mktime(0, 0, 0, date("m"), date("d"), date('Y'))); // show ticks and grid lines for every day: $x->set_steps(86400); $labels = new x_axis_labels(); // tell the labels to render the number as a date: $labels->text('#date:M-d#'); // generate labels for every day $labels->set_steps(86400); // only display every other label (every other day) $labels->visible_steps(1); $labels->rotate(45); // finally attach the label definition to the x axis $x->set_labels($labels); $y = new y_axis(); $max = max(max($data_3), max($data_4)); if ($max < 1) { $max = 10; } $y->set_range(0, $max, round($max / 100) * 10); $element1 = $line_1; $element2 = $line_2; break; } $chart = new open_flash_chart(); $chart->add_element($element1); $chart->add_element($element2); $chart->set_x_axis($x); $chart->set_y_axis($y); echo $chart->toPrettyString(); }
echo "b = " . $this->b . "\n"; } function mul() { return $this->a * $this->b; } } class bar extends foo { public $c; function display() { /* alternative display function for class bar */ echo "This is class bar\n"; echo "a = " . $this->a . "\n"; echo "b = " . $this->b . "\n"; echo "c = " . $this->c . "\n"; } } $foo1 = new foo(); $foo1->a = 2; $foo1->b = 5; $foo1->display(); echo $foo1->mul() . "\n"; echo "-----\n"; $bar1 = new bar(); $bar1->a = 4; $bar1->b = 3; $bar1->c = 12; $bar1->display(); echo $bar1->mul() . "\n";
<?php require_once 'php-ofc-library/open-flash-chart.php'; // generate some random data srand((double) microtime() * 1000000); $max = 20; $tmp = array(); for ($i = 0; $i < 13; $i++) { $tmp[] = rand(0, $max); } $title = new title(date("D M d Y")); $bar = new bar(); $bar->set_values(array(3, 2, 3, 4, 5, 6, 7, 8, 9, 3, 12, 4)); $chart = new open_flash_chart(); $chart->set_title($title); $chart->add_element($bar); $path = "data.json.inc"; $file = fopen($path, "w"); fwrite($file, $chart->toString()); fclose($file);
function gdiarias($anio = '', $proveed = '', $mes = '') { $this->load->library('Graph'); if (empty($mes) or empty($anio) or empty($proveed)) { return; } $proveed = radecode($proveed); $fechai = $anio . str_pad($mes, 2, '0', STR_PAD_LEFT) . '01'; $fechaf = $anio . str_pad($mes, 2, '0', STR_PAD_LEFT) . '31'; $dbfechai = $this->db->escape($fechai); $dbfechaf = $this->db->escape($fechaf); $dbproveed = $this->db->escape($proveed); $mSQL = "SELECT LEFT(nombre,10)as nombre,proveed,DAYOFMONTH(fecha) AS dia ,\n\t\tSUM(montonet*IF(tipo_doc='NC', -1, 1)) AS grantotal,\n\t\tSUM(credito*IF( tipo_doc='NC', -1, 1)) AS credito,\n\t\tSUM(inicial*IF( tipo_doc='NC', -1, 1)) AS contado\n\t\tFROM scst\n\t\tWHERE tipo_doc<>'NE' AND fecha>={$dbfechai} AND fecha<={$dbfechaf} AND proveed={$dbproveed}\n\t\t\tAND actuali >= fecha\n\t\tGROUP BY fecha ORDER BY fecha,grantotal DESC LIMIT 31"; //echo $mSQL; $maxval = 0; $query = $this->db->query($mSQL); foreach ($query->result() as $row) { if ($row->grantotal > $maxval) { $maxval = $row->grantotal; } $fecha[] = $row->dia; $nombre = str_replace('&', '', $row->nombre); //$data_1[]=$row->contado; //$data_2[]=$row->credito; $data_3[] = $row->grantotal; } $om = 1; while ($maxval / $om > 100) { $om = $om * 10; } //$bar_1 = new bar(75, '#0053A4'); //$bar_2 = new bar(75, '#9933CC'); $bar_3 = new bar(75, '#639F45'); //$bar_1->key('Contado',10); //$bar_2->key('Credito',10); $bar_3->key('Total Bs.', 10); for ($i = 0; $i < count($data_3); $i++) { //$bar_1->add_data_tip($data_1[$i]/$om, graph::esc( number_format($data_1[$i],2,',','.'))); //$bar_2->add_data_tip($data_2[$i]/$om, graph::esc( number_format($data_2[$i],2,',','.'))); $bar_3->add_data_tip($data_3[$i] / $om, graph::esc(number_format($data_3[$i], 2, ',', '.'))); } $g = new graph(); $g->set_is_decimal_separator_comma(1); if ($maxval > 0) { $g->title('Compras a ' . $nombre . ' en el mes ' . $mes . '/' . $anio, '{font-size: 16px; color:##00264A}'); //$g->data_sets[] = $bar_1; //$g->data_sets[] = $bar_2; $g->data_sets[] = $bar_3; $g->set_x_labels($fecha); $g->set_x_label_style(10, '#000000', 3, 1); $g->set_x_axis_steps(10); $g->set_x_legend('Dias', 14, '#004381'); $g->bg_colour = '#FFFFFF'; $g->set_tool_tip('#key#<br>Dia: #x_label# <br>Monto: #tip#'); $g->set_y_max(ceil($maxval / $om)); $g->y_label_steps(5); $g->set_y_legend('Compras x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381'); } else { $g->title('No existen compras con los datos seleccionados', '{font-size:18px; color: #d01f3c}'); } $g->bg_colour = '#FFFFFF'; echo utf8_encode($g->render()); }
{ function test() { var_dump(property_exists("foo", "pp1")); var_dump(property_exists("foo", "pp2")); var_dump(property_exists("foo", "pp3")); } } var_dump(property_exists()); var_dump(property_exists("")); var_dump(property_exists("foo", "pp1")); var_dump(property_exists("foo", "pp2")); var_dump(property_exists("foo", "pp3")); var_dump(property_exists("foo", "nonexistent")); var_dump(property_exists("fo", "nonexistent")); var_dump(property_exists("foo", "")); var_dump(property_exists("", "test")); var_dump(property_exists("", "")); $foo = new foo(); var_dump(property_exists($foo, "pp1")); var_dump(property_exists($foo, "pp2")); var_dump(property_exists($foo, "pp3")); var_dump(property_exists($foo, "nonexistent")); var_dump(property_exists($foo, "")); var_dump(property_exists(array(), "test")); var_dump(property_exists(1, "test")); var_dump(property_exists(true, "test")); $foo->bar(); $bar = new bar(); $bar->test(); echo "Done\n";
function display() { /* alternative display function for class bar */ echo "This is class bar\n"; echo "a = " . $this->a . "\n"; echo "b = " . $this->b . "\n"; echo "c = " . $this->c . "\n"; } } $foo1 = new foo(); $foo1->a = 2; $foo1->b = 5; $foo1->display(); echo $foo1->mul() . "\n"; echo "-----\n"; $bar1 = new bar(); $bar1->a = 4; $bar1->b = 3; $bar1->c = 12; $bar1->display(); echo $bar1->mul() . "\n"; # Background Syntax Checking: # - Syntax errors are underlined in red. # - Syntax warnings are underlined in green. # - Configure PHP Preferences to customize errors and warnings. # - Position the cursor over the underline to view the error or warning # message. $x = 1; # Syntax Coloring: # - Language elements are colored according to the Fonts and Colors # preference.
public function test() { parent::show(); }
function gproducto($anio = '', $departamento = '', $linea = '', $grupo = '') { $this->load->library('Graph'); $this->load->library('calendar'); //$this->calendar->generate(); if (empty($anio) or empty($departamento) or empty($linea) or empty($grupo)) { return; } $fechai = $anio . '0101'; $fechaf = $anio . '1231'; $mSQL = "SELECT a.fecha,b.codigo,b.descrip AS nnombre,LEFT(b.descrip,20)AS nombre,e.depto,e.descrip,d.linea,d.descrip,b.grupo,b.descrip,c.nom_grup as ngrupo,\n SUM(a.promedio*a.cantidad) AS costo,\n SUM(a.venta) AS ventas,\n SUM(a.venta)-SUM(a.promedio*a.cantidad) AS ganancias\n FROM {$this->from} "; foreach ($this->join as $valor) { $mSQL .= "{$valor['2']} JOIN {$valor['0']} ON {$valor['1']}"; } $mSQL .= " WHERE a.origen IN ('3I','3M') AND a.fecha>='{$fechai}' AND a.fecha<='{$fechaf}' AND e.depto='{$departamento}' AND d.linea='{$linea}' AND b.grupo='{$grupo}'\n GROUP BY a.codigo ORDER BY ganancias DESC LIMIT 15"; //echo $mSQL; $maxval = 0; $query = $this->db->query($mSQL); foreach ($query->result() as $row) { if ($row->ganancias > $maxval) { $maxval = $row->ganancias; } $nombre[] = $row->nombre; $data_1[] = $row->ganancias; } $ngrupo = $row->ngrupo; $om = 1; while ($maxval / $om > 100) { $om = $om * 10; } $bar_1 = new bar(75, '#639F45'); $bar_1->key('Ganancias', 10); for ($i = 0; $i < count($data_1); $i++) { $bar_1->add_data_tip($data_1[$i] / $om, graph::esc(number_format($data_1[$i], 2, ',', '.'))); //$bar_1->links[]= site_url("ventas/gananciasproducto/index/$anio/$departamento/".$linea[$i]); } $g = new graph(); $g->set_is_decimal_separator_comma(1); if ($maxval > 0) { $g->title('Ganancias por producto de el grupo ' . $ngrupo . ' en el año ' . $anio, '{font-size: 16px; color:#0F3054}'); $g->data_sets[] = $bar_1; $g->set_x_axis_3d(5); $g->x_axis_colour('#909090', '#ADB5C7'); $g->set_x_labels($nombre); $g->set_x_label_style(10, '#000000', 2, 1); $g->set_x_axis_steps(10); $g->set_x_legend('Productos', 14, '#004381'); $g->y_axis_colour('#909090', '#ADB5C7'); $g->bg_colour = '#FFFFFF'; $g->set_tool_tip('#key#<br>Producto: #x_label# <br>Monto: #tip#'); $g->set_y_max(ceil($maxval / $om)); $g->y_label_steps(5); $g->set_y_legend('Ganancia x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381'); } else { $g->title('No existen ganancias con los datos seleccionados', '{font-size:18px; color: #d01f3c}'); } $g->bg_colour = '#FFFFFF'; echo utf8_encode($g->render()); }
<?php include 'php-ofc-library/open-flash-chart.php'; // generate some random data srand((double) microtime() * 1000000); $max = 20; $tmp = array(); for ($i = 0; $i < 9; $i++) { $tmp[] = rand(0, $max); } $title = new title(date("D M d Y")); $bar = new bar(); $bar->set_values(array(1, 2, 3, 4, 5, 6, 7, 8, 9)); $chart = new open_flash_chart(); $chart->set_title($title); $chart->add_element($bar); echo $chart->toString();
function grafico4($codigoadm, $partida) { $this->load->library('Graph'); $mSQL = "SELECT codigopres,a.ordinal, \r\n\t\t\t\t\tSUM(asignacion+aumento-disminucion+traslados) as presupuesto, \r\n\t\t SUM(comprometido) comprometido, \r\n\t\t SUM(causado) causado, \r\n\t\t SUM(pagado) pagado\r\n\t\tFROM ordinal a JOIN ppla b ON a.codigopres=b.codigo\r\n\t\tWHERE b.movimiento='S' AND a.codigoadm='{$codigoadm}' AND codigopres LIKE '{$partida}%'\r\n\t\tGROUP BY codigopres,a.ordinal\r\n\t\tHAVING presupuesto<>0"; $maxval = 0; $query = $this->db->query($mSQL); foreach ($query->result() as $row) { if ($row->presupuesto > $maxval) { $maxval = $row->presupuesto; } $codigopres[] = $row->ordinal; $data_1[] = $row->presupuesto; $data_2[] = $row->comprometido; $data_3[] = $row->causado; $data_4[] = $row->pagado; } $om = 1; while ($maxval / $om > 100) { $om = $om * 10; } $bar_1 = new bar(75, '#0053A4'); $bar_2 = new bar(75, '#9933CC'); $bar_3 = new bar(75, '#639F45'); $bar_4 = new bar(75, '#C34F33'); $bar_1->key('Presupuesto', 10); $bar_2->key('Comprometido', 10); $bar_3->key('Causado', 10); $bar_4->key('Pagado', 10); for ($i = 0; $i < count($data_1); $i++) { $bar_1->add_data_tip($data_1[$i] / $om, graph::esc(number_format($data_1[$i], 2, ',', '.'))); $bar_2->add_data_tip($data_2[$i] / $om, graph::esc(number_format($data_2[$i], 2, ',', '.'))); $bar_3->add_data_tip($data_3[$i] / $om, graph::esc(number_format($data_3[$i], 2, ',', '.'))); $bar_4->add_data_tip($data_4[$i] / $om, graph::esc(number_format($data_4[$i], 2, ',', '.'))); } $g = new graph(); $g->set_is_decimal_separator_comma(1); if ($maxval > 0) { $g->data_sets[] = $bar_1; $g->data_sets[] = $bar_2; $g->data_sets[] = $bar_3; $g->data_sets[] = $bar_4; $g->set_x_labels($codigopres); $g->set_x_label_style(10, '#000000', 2, 1); $g->set_x_axis_steps(10); $g->set_x_legend('Presupuestos', 14, '#004381'); $g->bg_colour = '#FFFFFF'; $g->set_tool_tip('#key#<br>Codigo: #x_label# <br>Monto: #tip#'); $g->set_y_max(ceil($maxval / $om)); $g->y_label_steps(5); $g->set_y_legend('Presupuesto x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381'); } else { $g->title('No existen Presupuestos', '{font-size:18px; color: #d01f3c}'); } $g->bg_colour = '#FFFFFF'; echo utf8_encode($g->render()); }
<?php class bar { function __construct() { } static function bar() { var_dump(1); } } bar::bar(); class foo { static function foo() { var_dump(2); } function __construct() { } } foo::foo(); class baz { static function baz() { var_dump(3); } }
function gdiarias($anio = '', $producto = '', $mes = '') { $this->load->library('Graph'); $this->lang->load('calendar'); if (empty($anio)) { return; } $producto = radecode($producto); $fechai = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '01'; $fechaf = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '31'; //echo "fechai=".$fechai; //echo "fechaf=".$fechaf; $mSQL = "SELECT codigo, LEFT(descrip,20)AS nombre,DAYOFMONTH(a.fecha) as dia,\n SUM(cantidad)AS cantidad,\n SUM(importe)AS grantotal\n FROM itscst AS a\n WHERE fecha>='{$fechai}' AND fecha<='{$fechaf}' AND codigo='{$producto}'\n GROUP BY dia ORDER BY fecha"; //echo $mSQL; $maxval = 0; $query = $this->db->query($mSQL); foreach ($query->result() as $row) { if ($row->grantotal > $maxval) { $maxval = $row->grantotal; } $fecha[] = $row->dia; $nombre = $row->nombre; $data_1[] = $row->grantotal; } $om = 1; while ($maxval / $om > 100) { $om = $om * 10; } $bar_1 = new bar(75, '#ADD8E6'); $bar_1->key('Compras', 10); for ($i = 0; $i < count($data_1); $i++) { $bar_1->add_data_tip($data_1[$i] / $om, graph::esc(number_format($data_1[$i], 2, ',', '.'))); } $g = new graph(); $g->set_is_decimal_separator_comma(1); if ($maxval > 0) { $g->title('Compra de ' . $nombre . ' en el mes ' . $mes . '/' . $anio, '{font-size: 16px; color:##00264A}'); $g->data_sets[] = $bar_1; $g->set_x_labels($fecha); $g->set_x_label_style(9, '#000000', 3, 1); $g->set_x_axis_steps(10); $g->x_axis_colour('#A6A6A6', '#ADB5C7'); $g->set_x_legend('Dias', 16, '#004381'); $g->bg_colour = '#FFFFFF'; $g->set_tool_tip('#key#<br>Dia: #x_label# <br>Monto: #tip#'); $g->set_y_max(ceil($maxval / $om)); $g->y_label_steps(5); $g->y_axis_colour('#A6A6A6', '#ADB5C7'); $g->set_y_legend('Compras x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381'); } else { $g->title('No existen compras con los datos seleccionados', '{font-size:18px; color: #d01f3c}'); } $g->bg_colour = '#FFFFFF'; echo utf8_encode($g->render()); }
} class bar extends foo { function test_bar() { var_dump(get_parent_class()); } } class goo extends bar { function test_goo() { var_dump(get_parent_class()); } } $bar = new bar(); $foo = new foo(); $goo = new goo(); $foo->test(); $bar->test(); $bar->test_bar(); $goo->test(); $goo->test_bar(); $goo->test_goo(); var_dump(get_parent_class($bar)); var_dump(get_parent_class($foo)); var_dump(get_parent_class($goo)); var_dump(get_parent_class("bar")); var_dump(get_parent_class("foo")); var_dump(get_parent_class("goo")); var_dump(get_parent_class("i"));
function gdiarias($anio = '', $producto = '', $mes = '') { $this->load->library('Graph'); if (empty($mes) or empty($anio) or empty($producto)) { return; } $fechai = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '01'; $fechaf = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '31'; $mSQL = "SELECT a.codigo AS codigo,b.descrip AS nombre,DAYOFMONTH(a.fecha) as dia,a.cantidad AS cantidad,\n SUM(a.venta)AS grantotal \n FROM costos AS a \n JOIN maes AS b ON a.codigo=b.codigo\n WHERE a.fecha >='{$fechai}' AND a.fecha <='{$fechaf}' AND a.codigo='{$producto}'\n GROUP BY fecha ORDER BY grantotal DESC"; echo $mSQL; $maxval = 0; $query = $this->db->query($mSQL); foreach ($query->result() as $row) { if ($row->grantotal > $maxval) { $maxval = $row->grantotal; } $fecha[] = $row->dia; $data_1[] = $row->grantotal; } $nombre = $row->nombre; $om = 1; while ($maxval / $om > 100) { $om = $om * 10; } $bar_1 = new bar(75, '#0F235F'); $bar_1->key('supermercado', 10); for ($i = 0; $i < count($data_1); $i++) { $bar_1->add_data_tip($data_1[$i] / $om, graph::esc(number_format($data_1[$i], 2, ',', '.'))); } $g = new graph(); $g->set_is_decimal_separator_comma(1); if ($maxval > 0) { $g->title('Ventas de ' . $nombre . ' en el mes ' . $mes . '/' . $anio, '{font-size: 16px; color:#0F3054}'); $g->data_sets[] = $bar_1; $g->set_x_labels($fecha); $g->set_x_label_style(10, '#000000', 3, 1); $g->set_x_axis_steps(10); $g->set_x_legend('Dias', 14, '#004381'); $g->bg_colour = '#FFFFFF'; $g->set_tool_tip('#key#<br>Dia: #x_label# <br>Monto: #tip#'); $g->set_y_max(ceil($maxval / $om)); $g->y_label_steps(5); $g->set_y_legend('supermercado x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381'); } else { $g->title('No existen ventas con los datos seleccionados', '{font-size:18px; color: #d01f3c}'); } $g->bg_colour = '#FFFFFF'; echo utf8_encode($g->render()); }
} } class bar extends foo { public $i = 0; public $idx; function bar($idx) { $this->idx = $idx; } function &a($arg) { return parent::a($arg); } function d() { return $this->idx; } } $a = new bar(5); __var_dump($a->idx); $a->c(); $b = $a->b(); __var_dump($b); __var_dump($a->test); $a = new bar(2); __var_dump($a->idx); @$a->c(); $b = $a->b(); __var_dump($b); __var_dump($a->test);
function gmensuales($anio = '', $mes = '') { $this->load->library('Graph'); if (empty($mes) or empty($anio)) { return; } $fechai = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '01'; $fechaf = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '31'; $mSQL = "SELECT DAYOFMONTH(fecha)as dia, fecha,\n\t\tSUM(monto)AS grantotal,SUM(impuesto)AS IVA,SUM(transac)as transacciones \n\t\tfrom est_fecha where fecha>='{$fechai}' AND fecha<='{$fechaf}'\n\t\tGROUP BY fecha \n\t\tORDER BY fecha ASC"; //echo $mSQL; $maxval = 0; $query = $this->db->query($mSQL); foreach ($query->result() as $row) { if ($row->grantotal > $maxval) { $maxval = $row->grantotal; } $fecha[] = $row->dia; $data_1[] = $row->grantotal; } $om = 1; while ($maxval / $om > 100) { $om = $om * 10; } $bar_1 = new bar(75, '#44AC37'); $bar_1->key('Monto', 10); for ($i = 0; $i < count($data_1); $i++) { $bar_1->add_data_tip($data_1[$i] / $om, graph::esc(number_format($data_1[$i], 2, ',', '.'))); } $g = new graph(); $g->set_is_decimal_separator_comma(1); if ($maxval > 0) { $g->title('Ventas de en el mes ' . $mes . '/' . $anio, '{font-size: 16px; color:##00264A}'); $g->data_sets[] = $bar_1; $g->x_axis_colour('#A6A6A6', '#ADB5C7'); $g->set_x_labels($fecha); $g->set_x_label_style(10, '#000000', 3, 1); $g->set_x_axis_steps(10); $g->set_x_legend('Dias', 14, '#004381'); $g->bg_colour = '#FFFFFF'; $g->set_tool_tip('#key#<br>Dia: #x_label# <br>Monto: #tip#'); $g->set_y_max(ceil($maxval / $om)); $g->y_label_steps(5); $g->y_axis_colour('#A6A6A6', '#ADB5C7'); $g->set_y_legend('Ventas x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381'); } else { $g->title('No existen ventas con los datos seleccionados', '{font-size:18px; color: #d01f3c}'); } $g->bg_colour = '#FFFFFF'; echo utf8_encode($g->render()); }
function bar_outline($alpha, $colour, $outline_colour) { parent::bar($alpha, $colour); $this->var = 'filled_bar'; $this->outline_colour = $outline_colour; }
<?php class foo { function sayMyName() { // echo "I am: {get_class($this)}."; // does not work, fatal error echo 'I am: ' . get_class($this) . '.'; // need the $this, otherwise get "foo" as output } } class bar extends foo { } $bar = new bar(); $bar->sayMyName();
--TEST-- Trying to override final method --FILE-- <?php trait foo { public function test() { return 3; } } class baz { public final function test() { return 4; } } class bar extends baz { use foo { test as public; } } $x = new bar(); var_dump($x->test()); ?> --EXPECTF-- Fatal error: Cannot override final method baz::test() with foo::test() in %s on line %d, position %d
function grafico($anio = '', $codigo = '') { $this->load->library('Graph'); if (empty($anio) or empty($codigo)) { return; } $fechai = $anio . '0101'; $fechaf = $anio . '1231'; $mSQL = "SELECT MONTHNAME(fecha)AS mes,codigo,nombre,sueldoa,sueldo FROM ausu\n WHERE fecha>='{$fechai}' AND fecha<='{$fechaf}'AND codigo='{$codigo}'\n ORDER BY fecha"; //echo $mSQL; $maxval = 0; $query = $this->db->query($mSQL); foreach ($query->result() as $row) { if ($row->sueldoa > $maxval) { $maxval = $row->sueldoa; } $nombre = $row->nombre; $meses[] = $row->mes; $data_1[] = $row->sueldoa; $data_2[] = $row->sueldo; //$data_3[]=$row->sueldoa; } $om = 1; while ($maxval / $om > 100) { $om = $om * 10; } $bar_1 = new bar(75, '#0053A4'); $bar_2 = new bar(75, '#9933CC'); //$bar_3 = new bar(75, '#639F45'); $bar_1->key('Sueldo Anterior', 10); $bar_2->key('Sueldo con Aumento', 10); //$bar_3->key('Total' ,10); for ($i = 0; $i < count($data_1); $i++) { $bar_1->add_data_tip($data_1[$i] / $om, graph::esc(number_format($data_1[$i], 2, ',', '.'))); $bar_2->add_data_tip($data_2[$i] / $om, graph::esc(number_format($data_2[$i], 2, ',', '.'))); //$bar_3->add_data_tip($data_3[$i]/$om, graph::esc( number_format($data_3[$i],2,',','.'))); } $g = new graph(); $g->title('Aumento de ' . $nombre . ' en el año ' . $anio, '{font-size: 20px; color:##00264A}'); $g->set_is_decimal_separator_comma(1); $g->data_sets[] = $bar_1; $g->data_sets[] = $bar_2; //$g->data_sets[] = $bar_3; $g->set_x_labels($meses); $g->set_x_label_style(10, '#000000', 3, 1); $g->set_x_axis_steps(10); $g->set_x_legend('Meses', 16, '#004381'); $g->bg_colour = '#FFFFFF'; $g->set_tool_tip('#key#<br>Mes: #x_label# <br>Monto: #tip#'); $g->set_y_max(ceil($maxval / $om)); $g->y_label_steps(5); $g->set_y_legend('Ventas x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381'); echo utf8_encode($g->render()); }
function gdiarias($anio = '', $cliente = '', $mes = '') { $this->load->library('Graph'); if (empty($mes) or empty($anio) or empty($cliente)) { return; } $fechai = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '01'; $fechaf = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '31'; $mSQL = "SELECT cod_cli,nombre,fecha,DAYOFMONTH(fecha) as dia, \n\t\tsum(gtotal*IF(tipo='D', -1, 1)) AS grantotal, \n\t\tsum(gtotal*IF(tipo='D', -1, 1)) AS contado, \n\t\tsum(gtotal*IF(tipo='D', -1, 1)) AS credito \n\t\tFROM fmay \n\t\tWHERE tipo<>'X' AND fecha>='{$fechai}' AND fecha<='{$fechaf}' AND cod_cli='{$cliente}' \n\t\tGROUP BY fecha ORDER BY fecha,grantotal DESC LIMIT 31"; //echo $mSQL; $maxval = 0; $query = $this->db->query($mSQL); foreach ($query->result() as $row) { if ($row->grantotal > $maxval) { $maxval = $row->grantotal; } $fecha[] = $row->dia; $data_1[] = $row->contado; $data_2[] = $row->credito; $data_3[] = $row->grantotal; } $nombre = $row->nombre; $om = 1; while ($maxval / $om > 100) { $om = $om * 10; } $bar_1 = new bar(75, '#0053A4'); $bar_2 = new bar(75, '#9933CC'); $bar_3 = new bar(75, '#639F45'); $bar_1->key('Contado', 10); $bar_2->key('Credito', 10); $bar_3->key('Total', 10); for ($i = 0; $i < count($data_1); $i++) { $bar_1->add_data_tip($data_1[$i] / $om, graph::esc(number_format($data_1[$i], 2, ',', '.'))); $bar_2->add_data_tip($data_2[$i] / $om, graph::esc(number_format($data_2[$i], 2, ',', '.'))); $bar_3->add_data_tip($data_3[$i] / $om, graph::esc(number_format($data_3[$i], 2, ',', '.'))); } $g = new graph(); $g->set_is_decimal_separator_comma(1); if ($maxval > 0) { $g->title('Compras de el cliente ' . $nombre . ' en el mes ' . $mes . '/' . $anio, '{font-size: 16px; color:#0F3054}'); $g->data_sets[] = $bar_1; $g->data_sets[] = $bar_2; $g->data_sets[] = $bar_3; $g->set_x_labels($fecha); $g->set_x_label_style(10, '#000000', 3, 1); $g->set_x_axis_steps(10); $g->set_x_legend('Dias', 14, '#004381'); $g->bg_colour = '#FFFFFF'; $g->set_tool_tip('#key#<br>Dia: #x_label# <br>Monto: #tip#'); $g->set_y_max(ceil($maxval / $om)); $g->y_label_steps(5); $g->set_y_legend('hospitalidad x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381'); } else { $g->title('No existen ventas con los datos seleccionados', '{font-size:18px; color: #d01f3c}'); } $g->bg_colour = '#FFFFFF'; echo utf8_encode($g->render()); }
public function __construct() { parent::__construct(); $this->id_ref =& $this->id; }
function grafico($anio = '') { $this->load->library('Graph'); $this->lang->load('calendar'); if (empty($anio)) { return; } $fechai = $anio . '0101'; $fechaf = $anio . '1231'; $mSQL = "SELECT MONTHNAME(fecha)AS mes,\n\t\tAVG(sueldoa) AS anterior,\n\t\tAVG(sueldo) AS actual\n\t\tFROM ausu\n\t\tWHERE fecha>='{$fechai}' AND fecha<='{$fechaf}'\n\t\tGROUP BY mes ORDER BY fecha"; //echo $mSQL; $maxval = 0; $query = $this->db->query($mSQL); foreach ($query->result() as $row) { if ($row->anterior > $maxval) { $maxval = $row->anterior; } $nmes[] = $this->lang->line('cal_' . strtolower($row->mes)); $data_1[] = $row->anterior; $data_2[] = $row->actual; //$data_3[]=$row->actual; } $om = 1; while ($maxval / $om > 100) { $om = $om * 10; } $bar_1 = new bar(75, '#0053A4'); $bar_2 = new bar(75, '#9933CC'); $bar_3 = new bar(75, '#639F45'); $bar_1->key('Sueldo Anterior', 10); $bar_2->key('Sueldo con Aumento', 10); //$bar_3->key('Total' ,10); for ($i = 0; $i < count($data_1); $i++) { $bar_1->add_data_tip($data_1[$i] / $om, graph::esc(number_format($data_1[$i], 2, ',', '.'))); $bar_2->add_data_tip($data_2[$i] / $om, graph::esc(number_format($data_2[$i], 2, ',', '.'))); $bar_3->add_data_tip($data_3[$i] / $om, graph::esc(number_format($data_3[$i], 2, ',', '.'))); } $g = new graph(); $g->title('Promedio de Aumento de Sueldos en el año ' . $anio, '{font-size: 22px; color:##00264A}'); $g->set_is_decimal_separator_comma(1); $g->data_sets[] = $bar_1; $g->data_sets[] = $bar_2; $g->data_sets[] = $bar_3; $g->set_x_labels($nmes); $g->set_x_label_style(9, '#000000', 3, 1); $g->set_x_axis_steps(8); $g->set_x_legend('Meses ', 16, '#004381'); $g->bg_colour = '#FFFFFF'; $g->set_tool_tip('#key#<br>Mes: #x_label# <br>Monto: #tip#'); $g->set_y_max(ceil($maxval / $om)); $g->y_label_steps(5); $g->set_y_legend('Sueldo x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381'); echo utf8_encode($g->render()); }
function __construct() { parent::__construct(); echo 'foobar'; }