function Novo() { $totais = array(); $legenda = array(); $dataInicio01 = "{$this->ano}/{$this->mes}/01 00:00:00"; $dataInicio02 = "{$this->ano}/{$this->mes}/07 00:00:00"; $dataInicio03 = "{$this->ano}/{$this->mes}/14 00:00:00"; $dataInicio04 = "{$this->ano}/{$this->mes}/21 00:00:00"; if ($this->mes < 12) { $dataInicio05 = $this->ano . "/" . ($this->mes + 1) . "/01 00:00:00"; } else { $dataInicio05 = $this->ano + 1 . "/01/01 00:00:00"; } $arr = array(); $meses = array('', 'Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'); // gera a lista de pecas utilizadas no intervalo de tempo definido $db1 = new clsBanco(); $db1->Consulta("SELECT COUNT( ref_cod_mailling_email ) AS total FROM mailling_historico, mailling_grupo_email WHERE data_hora >= '{$dataInicio01}' AND data_hora <= '{$dataInicio02}' AND mailling_grupo_email.ref_cod_mailling_grupo = mailling_historico.ref_cod_mailling_grupo"); $db1->ProximoRegistro(); $semana1 = $db1->Campo("total"); $arr["Semana 1"] = $semana1; $db2 = new clsBanco(); $db2->Consulta("SELECT COUNT( ref_cod_mailling_email ) AS total FROM mailling_historico, mailling_grupo_email WHERE data_hora >= '{$dataInicio02}' AND data_hora <= '{$dataInicio03}' AND mailling_grupo_email.ref_cod_mailling_grupo = mailling_historico.ref_cod_mailling_grupo"); $db2->ProximoRegistro(); $semana2 = $db2->Campo("total"); $arr["Semana 2"] = $semana2; $db3 = new clsBanco(); $db3->Consulta("SELECT COUNT( ref_cod_mailling_email ) AS total FROM mailling_historico, mailling_grupo_email WHERE data_hora >= '{$dataInicio03}' AND data_hora <= '{$dataInicio04}' AND mailling_grupo_email.ref_cod_mailling_grupo = mailling_historico.ref_cod_mailling_grupo"); $db3->ProximoRegistro(); $semana3 = $db3->Campo("total"); $arr["Semana 3"] = $semana3; $db4 = new clsBanco(); $db4->Consulta("SELECT COUNT( ref_cod_mailling_email ) AS total FROM mailling_historico, mailling_grupo_email WHERE data_hora >= '{$dataInicio04}' AND data_hora <= '{$dataInicio05}' AND mailling_grupo_email.ref_cod_mailling_grupo = mailling_historico.ref_cod_mailling_grupo"); $db4->ProximoRegistro(); $semana4 = $db4->Campo("total"); $arr["Semana 4"] = $semana4; if (count($arr)) { $titulo = "Gráfico de Mailling Semanal - {$meses[$this->mes]} de {$this->ano}"; $grafico = new clsGrafico($arr, $titulo, 500); $grafico->setAlign("left"); die($grafico->graficoBarraHor()); } else { $this->campoRotulo("alerta", "Alerta", "Nenhum resultado foi encontrado com este filtro"); } $this->largura = "100%"; return true; }
function Novo() { $totais = array(); $legenda = array(); $ObjPecasSaida = new clsPecasSaida(); if (!$this->data_inicial) { $this->data_inicial = false; } else { $data = explode("/", $this->data_inicial); $this->data_inicial = "{$data[2]}/{$data[1]}/{$data[0]}"; } if (!$this->data_final) { $this->data_final = false; } else { $data = explode("/", $this->data_final); $this->data_final = "{$data[2]}/{$data[1]}/{$data[0]}"; } // gera a lista de pecas utilizadas no intervalo de tempo definido $db = new clsBanco(); $where = ""; $gruda = ""; if ($this->data_inicial) { $where .= "data_hora >= '{$this->data_inicial}' AND "; } if ($this->data_final) { $where .= "data_hora <= '{$this->data_final}' AND"; } //$db->Consulta( "SELECT CONCAT( YEAR(data_hora), '/', MONTH(data_hora) ) AS mes, COUNT( ref_cod_mailling_email ) AS total FROM mailling_historico, mailling_grupo_email WHERE $where mailling_grupo_email.ref_cod_mailling_grupo = mailling_historico.ref_cod_mailling_grupo GROUP BY mes ORDER BY mes ASC" ); $db->Consulta("SELECT (YEAR(data_hora)||'/'|| MONTH(data_hora)) AS mes, COUNT( ref_cod_mailling_email ) AS total FROM mailling_historico, mailling_grupo_email WHERE {$where} mailling_grupo_email.ref_cod_mailling_grupo = mailling_historico.ref_cod_mailling_grupo GROUP BY mes ORDER BY mes ASC"); $arr = array(); $meses = array('', 'Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'); while ($db->ProximoRegistro()) { list($nome, $qtd) = $db->Tupla(); $dataContrato = explode('/', $nome); $indice = "{$dataContrato[0]} - {$meses[$dataContrato[1]]}"; $arr[$indice] = $qtd; } if (count($arr)) { $titulo = "Gráfico de Mailling por quantidade"; if ($this->data_inicial) { if (!$this->data_final) { $titulo .= " - A partir de {$this->data_inicial}"; } else { $titulo .= " - De {$this->data_inicial} até {$this->data_final}"; } } else { if ($this->data_final) { $titulo .= " - Até {$this->data_final}"; } } $grafico = new clsGrafico($arr, $titulo, 500); $grafico->setAlign("left"); die($grafico->graficoBarraHor()); } else { $this->campoRotulo("alerta", "Alerta", "Nenhum resultado foi encontrado com este filtro"); } $this->largura = "100%"; return true; }
function Novo() { $totais = array(); $legenda = array(); $dataInicio = "{$this->ano}/{$this->mes}/01 00:00:00"; if ($this->mes < 12) { $dataFim = "{$this->ano}/" . ($this->mes + 1) . "/01 00:00:00"; } else { $dataFim = $this->ano + 1 . "/01/01 00:00:00"; } $arr = array(); $meses = array('', 'Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'); // gera a lista de pecas utilizadas no intervalo de tempo definido $db = new clsBanco(); $db->Consulta("SELECT DAY( data_hora ) AS dia, COUNT( ref_cod_mailling_email ) AS total FROM mailling_historico, mailling_grupo_email WHERE data_hora >= '{$dataInicio}' AND data_hora <= '{$dataFim}' AND mailling_grupo_email.ref_cod_mailling_grupo = mailling_historico.ref_cod_mailling_grupo GROUP BY dia ORDER BY dia ASC"); while ($db->ProximoRegistro()) { list($dia, $qtd) = $db->Tupla(); $arr[$dia] = $qtd; } if (count($arr)) { $titulo = "Gráfico de Mailling Diário - {$meses[$this->mes]} de {$this->ano}"; $grafico = new clsGrafico($arr, $titulo, 500); $grafico->setAlign("left"); die($grafico->graficoBarraHor()); } else { $this->campoRotulo("alerta", "Alerta", "Nenhum resultado foi encontrado com este filtro"); } $this->largura = "100%"; return true; }
function Novo() { $totais = array(); $legenda = array(); $ObjPecasSaida = new clsPecasSaida(); if (!$this->data_inicial) { $this->data_inicial = false; } else { $data = explode("/", $this->data_inicial); $this->data_inicial = "{$data[2]}-{$data[1]}-{$data[0]}"; } if (!$this->data_final) { $this->data_final = false; } else { $data = explode("/", $this->data_final); $this->data_final = "{$data[2]}-{$data[1]}-{$data[0]}"; } $where = ""; if ($this->data_inicial) { $where .= "data_noticia >= '{$this->data_inicial}' AND "; } if ($this->data_final) { $where .= "data_noticia <= '{$this->data_final}' AND "; } // gera a lista de pecas utilizadas no intervalo de tempo definido $db = new clsBanco(); $db->Consulta("SELECT nm_tipo, COUNT(0) AS total FROM not_portal, not_portal_tipo, not_tipo WHERE {$where} ref_cod_not_portal = cod_not_portal AND cod_not_tipo = ref_cod_not_tipo GROUP BY nm_tipo, ref_cod_not_tipo"); $arr = array(); while ($db->ProximoRegistro()) { list($nome, $qtd) = $db->Tupla(); $arr[$nome] = $qtd; } if (count($arr)) { $titulo = "Gráfico de Notícias por tipo"; if ($this->data_inicial) { if (!$this->data_final) { $titulo .= " - A partir de {$this->data_inicial}"; } else { $titulo .= " - De {$this->data_inicial} até {$this->data_final}"; } } else { if ($this->data_final) { $titulo .= " - Até {$this->data_final}"; } } $grafico = new clsGrafico($arr, $titulo, 500); $grafico->setAlign("left"); die($grafico->graficoBarraHor()); } else { $this->campoRotulo("alerta", "Alerta", "Nenhum resultado foi encontrado com este filtro"); } $this->largura = "100%"; return true; }