コード例 #1
0
ファイル: demo.php プロジェクト: enderochoa/tortuga
 function grafico($titulo)
 {
     $this->load->library('Graph');
     $mSQL_1 = "SELECT cod_cli,nombre,   \r\n\t\t\tsum(totalg*IF(tipo_doc='D', -1, 1)) AS grantotal, \r\n\t\t\tsum(totalg*(referen IN ('E', 'M'))*IF(tipo_doc='D', -1, 1)) AS contado,\r\n\t\t\tsum(totalg*(referen NOT IN ('E', 'M'))*IF(tipo_doc='D', -1, 1)) AS credito \r\n\t\t\tFROM sfac\r\n\t\t\tWHERE tipo_doc<>'X' AND fecha>='20070101' AND fecha<='20071231' \r\n\t\t\tGROUP BY cod_cli ORDER BY grantotal DESC LIMIT 10";
     // generate some random data
     srand((double) microtime() * 1000000);
     $bar_1 = new bar_fade(50, '#209B2C');
     $bar_1->key('Contado', 10);
     $bar_2 = new bar_fade(50, '#9933CC');
     $bar_2->key('Credito', 10);
     $bar_3 = new bar_fade(50, '#639F45');
     $bar_3->key('Total', 10);
     $maxval = 0;
     $label = $tips = array();
     $query = $this->db->query($mSQL_1);
     foreach ($query->result() as $row) {
         if ($row->grantotal > $maxval) {
             $maxval = $row->grantotal;
         }
         $bar_1->data[] = $row->contado;
         $bar_2->data[] = $row->credito;
         $bar_3->data[] = $row->grantotal;
         //$bar_1->tips = $data_tips_3;
         $tips[] = $row->nombre;
         $label[] = $row->cod_cli;
     }
     $g = new graph();
     $g->title($titulo, '{font-size: 26px;}');
     $g->data_sets[] = $bar_1;
     $g->data_sets[] = $bar_2;
     $g->data_sets[] = $bar_3;
     $g->set_x_labels($label);
     $g->set_x_label_style(10, '#9933CC', 2, 1);
     $g->set_x_axis_steps(10);
     $g->bg_colour = '#FFFFFF';
     $g->set_tool_tip('#key#<br>Codigo de Clinte: #x_label# <br>Monto: #tip#');
     $g->tips = $tips;
     $g->set_y_max($maxval);
     $g->y_label_steps(3);
     $g->set_y_legend('Open Flash Chart', 12, '0x736AFF');
     echo utf8_encode($g->render());
 }
コード例 #2
0
ファイル: mensuales.php プロジェクト: codethics/proteoerp
 function grafico($mes = NULL, $anio = NULL)
 {
     if (empty($mes) and empty($anio)) {
         return;
     }
     $this->load->library('Graph');
     $titulo = $data_1 = $data_2 = $data_3 = $data_tips_1 = $data_tips_2 = $data_tips_3 = array();
     $fechai = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '01';
     $fechaf = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '31';
     $data = $this->_sincrodata($fechai, $fechaf);
     $om = 1;
     while ($this->maxval / $om > 100) {
         $om = $om * 10;
     }
     foreach ($data as $row) {
         $titulo[] = $row['dia'];
         $data_1[] = $row['contado'] / $om;
         $data_2[] = $row['credito'] / $om;
         $data_3[] = $row['cobrado'] / $om;
         $data_tips_1[] = graph::esc(number_format($row['contado'], 2, ',', '.'));
         $data_tips_2[] = graph::esc(number_format($row['credito'], 2, ',', '.'));
         $data_tips_3[] = graph::esc(number_format($row['cobrado'], 2, ',', '.'));
     }
     $odata_1 = new bar_fade(50, '0xCC3399');
     $odata_1->key('Contado', 10);
     $odata_1->data = $data_1;
     $odata_1->tips = $data_tips_1;
     $odata_2 = new bar_fade(50, '0x80a033');
     $odata_2->key('Cr&eacute;dito', 10);
     $odata_2->data = $data_2;
     $odata_2->tips = $data_tips_2;
     $odata_3 = new line_hollow(2, 3, '0x9933CC');
     $odata_3->key('Cobranzas a Cr&eacute;dito', 10);
     $odata_3->data = $data_3;
     $odata_3->tips = $data_tips_3;
     $g = new Graph();
     if ($this->maxval > 0) {
         $g->title('Ventas del mes ' . $mes . '/' . $anio, '{font-size:18px; color: #d01f3c}');
         $g->set_is_decimal_separator_comma(1);
         $g->data_sets[] = $odata_3;
         $g->data_sets[] = $odata_1;
         $g->data_sets[] = $odata_2;
         $g->set_y_max(ceil($this->maxval / $om));
         $g->y_label_steps(5);
         $g->set_x_labels($titulo);
         $ejey = number_format($om, 0, '', '.');
         $g->set_y_legend('Venta X ' . $ejey . ' (Bs)', 14, '0x639F45');
         $g->set_x_legend('D&iacute;as del mes ' . $mes, 14, '0x639F45');
         $g->set_tool_tip('#key#<br>D&iacute;a: #x_label# <br>Monto: #tip#');
     } else {
         $g->title('No existen ventas en la Fecha Seleccionada', '{font-size:18px; color: #d01f3c}');
     }
     $g->bg_colour = '#FFFFFF';
     //$g->set_bg_image(site_url('/images/ventafon.png'), 'center', 'middle' );
     echo utf8_encode($g->render());
 }
コード例 #3
0
ファイル: anuales.php プロジェクト: codethics/proteoerp
 function grafico($anio = '')
 {
     if (empty($anio)) {
         return;
     }
     $this->load->library('Graph');
     $titulo = $data_1 = $data_2 = $data_3 = $data_tips_1 = $data_tips_2 = $data_tips_3 = array();
     $fechai = $anio . '0101';
     $fechaf = $anio . '1231';
     $data = $this->_sincrodata($fechai, $fechaf);
     $om = 1;
     while ($this->maxval / $om > 100) {
         $om = $om * 10;
     }
     //print_r($data);
     foreach ($data as $row) {
         $titulo[] = $row['mes'];
         $data_1[] = $row['contado'] / $om;
         $data_2[] = $row['credito'] / $om;
         $data_3[] = $row['cobrado'] / $om;
         $data_tips_1[] = graph::esc(number_format($row['contado'], 2, ',', '.'));
         $data_tips_2[] = graph::esc(number_format($row['credito'], 2, ',', '.'));
         $data_tips_3[] = graph::esc(number_format($row['cobrado'], 2, ',', '.'));
     }
     $odata_1 = new bar_fade(50, '0xCC3399');
     $odata_1->key('Contado', 10);
     $odata_1->data = $data_1;
     $odata_1->tips = $data_tips_1;
     $odata_2 = new bar_fade(50, '0x80a033');
     $odata_2->key('Cr&eacute;dito', 10);
     $odata_2->data = $data_2;
     $odata_2->tips = $data_tips_2;
     $odata_4 = new line_hollow(2, 3, '0x9933CC');
     $odata_4->key('Cobranzas a Cr&eacute;dito', 10);
     $odata_4->data = $data_3;
     $odata_4->tips = $data_tips_3;
     for ($i = 0; $i < count($data_1); $i++) {
         $mes = $i + 1;
         $odata_1->links[] = site_url("/hospitalidad/mensuales/index/{$mes}/{$anio}");
         $odata_2->links[] = site_url("/hospitalidad/mensuales/index/{$mes}/{$anio}");
         $odata_3->links[] = site_url("/hospitalidad/mensuales/index/{$mes}/{$anio}");
     }
     $g = new Graph();
     $g->set_is_decimal_separator_comma(1);
     if ($this->maxval > 0) {
         $g->title('Ventas en el a&ntilde;o ' . $anio, '{font-size:18px; color: #d01f3c}');
         $g->data_sets[] = $odata_1;
         $g->data_sets[] = $odata_2;
         $g->data_sets[] = $odata_4;
         $g->set_y_max(ceil($this->maxval / $om));
         $g->y_label_steps(5);
         $g->set_x_labels($titulo);
         $ejey = number_format($om, 0, '', ' ');
         $g->set_y_legend('Venta X ' . $ejey . ' (Bs)', 14, '0x639F45');
         $g->set_x_legend('Meses', 14, '0x639F45');
         $g->set_tool_tip('#key#<br>Mes: #x_label# <br>Monto: #tip#');
     } else {
         $g->title('NO existen ventas en el a&ntilde;o seleccionado', '{font-size:18px; color: #d01f3c}');
     }
     $g->bg_colour = '#FFFFFF';
     echo utf8_encode($g->render());
 }
コード例 #4
0
ファイル: tventas.php プロジェクト: codethics/proteoerp
 function gproducto($anio = '', $depto = '', $fami = '', $grupo = '')
 {
     $this->load->library('Graph');
     if (empty($anio)) {
         return;
     }
     $fechai = $anio . '0101';
     $fechaf = $anio . '1231';
     $mSQL = "SELECT a.codigo,a.depto,a.familia,a.grupo,e.descrip as nombre,\n\t\tSUM(a.monto) AS grantotal,  \n\t\tSUM(a.costo) AS costo,      \n\t\tSUM(a.cantidad) AS cantidad,\n\t\tSUM(a.monto)-SUM(a.costo) AS ganancia\n\t\tFROM  est_item AS a\n\t\tJOIN  maes AS e ON a.codigo= e.codigo\n\t\tWHERE a.fecha>='{$fechai}' AND a.fecha<='{$fechaf}' AND a.depto='{$depto}' AND a.familia='{$fami}' AND a.grupo='{$grupo}'\n\t\tGROUP BY a.codigo LIMIT 10";
     //echo $mSQL;
     $maxval = 0;
     $query = $this->db->query($mSQL);
     foreach ($query->result() as $row) {
         if ($row->grantotal > $maxval) {
             $maxval = $row->grantotal;
         }
         $nombre[] = $row->nombre;
         $famili = $row->famili;
         $dpto = $row->dpto;
         $grup = $row->grup;
         $data_1[] = $row->grantotal;
         $data_2[] = $row->ganancia;
     }
     $om = 1;
     while ($maxval / $om > 100) {
         $om = $om * 10;
     }
     $bar_1 = new bar_fade(55, '#C31812');
     $bar_2 = new bar_fade(55, '#424581');
     $bar_1->key('Total', 10);
     $bar_2->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_2->add_data_tip($data_2[$i] / $om, graph::esc(number_format($data_2[$i], 2, ',', '.')));
     }
     $g = new graph();
     $g->set_is_decimal_separator_comma(1);
     if ($maxval > 0) {
         $g->title('Ventas de el a&ntilde;o ' . $anio, '{font-size: 16px; color:#0F3054}');
         $g->data_sets[] = $bar_1;
         $g->data_sets[] = $bar_2;
         $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->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('Ventas x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381');
     } else {
         $g->title('No existen ventas en el a&ntilde;o seleccionado', '{font-size:18px; color: #d01f3c}');
     }
     $g->bg_colour = '#FFFFFF';
     echo utf8_encode($g->render());
 }
コード例 #5
0
ファイル: cajas.php プロジェクト: codethics/proteoerp
 function gdiarias($anio = '', $caja = '', $mes = '')
 {
     $this->load->library('Graph');
     $this->lang->load('calendar');
     if (empty($anio) or empty($caja)) {
         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 DATE_FORMAT(fecha,'%d')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}' AND caja='{$caja}'\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;
         }
         $dia[] = $row->dia;
         $data_1[] = $row->grantotal;
     }
     $om = 1;
     while ($maxval / $om > 100) {
         $om = $om * 10;
     }
     $bar_1 = new bar_fade(55, '#424581');
     $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 el' . $mes . '/' . $anio, 'Cajero' . $caja, '{font-size: 16px; color:##00264A}');
             $g->data_sets[] = $bar_1;
             $g->x_axis_colour('#A6A6A6', '#ADB5C7');
             $g->set_x_labels($dia);
             $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());
     }
 }