Home Files
Adminer
Execute Command
PHP Eval
Symlink
File Upload
Owner :
www-data
PHP Version
8.1.8
Disk Space
203.89 GB
Server Addr
171.9.3.2
Your IP
171.9.3.1
Edit File
File:
<?php class Graphics { var $sql; function query ($query, $sqlcomp = null) { switch ($query) { case 'licitacoes': $consulta = " SELECT COUNT(l.NModalidade) as Quant, m.DescModLicita as Descricao, m.IdModLicita FROM TabLicitacao l inner join TabModLicita m on (l.NModalidade = m.IdModLicita), tabvereador r WHERE (l.NResponsavel = r.IdVereador) ".$sqlcomp." GROUP BY m.DescModLicita, m.IdModLicita ORDER BY Quant DESC "; $col = 1; break; case 'contratos': $consulta = " SELECT count(C.IdContratos) AS Quant, T.Descricao FROM tabcontratos C, tabcredor A, tabcontratotipo T, tabsecretarias S WHERE (C.NCredor = A.Idcredor) AND (C.NTipo = T.Idcontratotipo) AND (C.NSec = S.IdSecretarias) ".$sqlcomp." GROUP BY T.Descricao, T.IdContratoTipo "; $col = 1; break; case 'convenio': $consulta = " SELECT count(c.IdConvenio) AS Quant, e.Descricao FROM tabconvenio c, tabtipoesfera e where Site = 'S' AND c.NEsfera = e.IdTipoEsfera ".$sqlcomp." GROUP BY e.Descricao, e.IdTipoEsfera ORDER BY Quant DESC "; $col = 1; break; case 'veiculos': $consulta = " SELECT count(V.Idveiculo) AS Quant, T.Descricao FROM tabveiculos V, TabSecretarias S, tabtipoveiculos T WHERE S.IdSecretarias = V.NSec AND (V.DataFim >= '" . date('Y-m-d') . "' OR V.DataFim IS NULL) AND V.NTipo = T.IdTipoVeiculos ".$sqlcomp." GROUP BY T.Descricao, T.IdTipoVeiculos ORDER BY Quant DESC "; $col = 1; break; case 'materias': $consulta = " SELECT COUNT(M.IdSolicita) as Quant, T.Descricao, T.IdTipoMat FROM TabSolicita M inner join TabTipoMateria T on (M.NTipoReq = T.IdTipoMat) inner join tabsubsolicita O on (O.N_Requerimento = M.IdSolicita) WHERE (Site = 'S' OR Site IS NULL) AND M.Situacao IN ('A','F','2') ".$sqlcomp." AND COALESCE(Subscritor, '') = '' GROUP BY T.Descricao, T.IdTipoMat ORDER BY Quant DESC "; $col = 1; break; case 'materias_perc': $consulta = " SELECT (COUNT(M.IdSolicita) / t.total * 100) as Quant, T.Descricao, T.IdTipoMat FROM TabSolicita M inner join TabTipoMateria T on (M.NTipoReq = T.IdTipoMat) inner join tabsubsolicita O on (O.N_Requerimento = M.IdSolicita) INNER JOIN ( SELECT count(*) as total from TabSolicita M inner join tabsubsolicita O on (O.N_Requerimento = M.IdSolicita) WHERE (Site = 'S' OR Site IS NULL) AND Situacao IN ('A','F','2') ".$sqlcomp." AND COALESCE(Subscritor, '') = '' ) t WHERE (Site = 'S' OR Site IS NULL) AND M.Situacao IN ('A','F','2') ".$sqlcomp." AND COALESCE(Subscritor, '') = '' GROUP BY T.Descricao, T.IdTipoMat ORDER BY Quant DESC "; $col = 1; break; case 'empenhos_unidade': $consulta = " select NomoUnidGest as Descricao, SUM(Valor) AS Quant, Exercicio from TabLCEmpenhos where TipoCredito = 'O' ".$sqlcomp." group by NomoUnidGest ORDER BY SUM(Valor) DESC "; $col = 1; break; case 'despesas': $consulta = " select ChaveGroup , Exercicio, Competencia, sum(ValorPagamento) as ValorPagamento, sum(ValorEmpenho) as ValorEmpenho , sum(ValorLiquidacao) as ValorLiquidacao from ( select concat(Exercicio,Competencia) as ChaveGroup , Exercicio, Competencia, ValorPagamento, 0 as ValorEmpenho , 0 as ValorLiquidacao from tablcpagamentos union all select concat(Exercicio,Competencia) as ChaveGroup , Exercicio, Competencia, 0 as ValorPagamento, 0 as ValorEmpenho , ValorLiquidacao from tablcliquidacoes union all select concat(Exercicio,Competencia) as ChaveGroup , Exercicio, Competencia, 0 as ValorPagamento, Valor as ValorEmpenho , 0 as ValorLiquidacao from tablcempenhos ) as grafico ".$sqlcomp." group by ChaveGroup "; $col = 1; break; } if ($consulta != '') { switch ($col) { case 1: $arrayColor = array(0 => '#15B063', 1 => '#F1491C', 2 => '#A349A4', 3 => '#0DA5AA', 4 => '#C52259', 5 => '#FF7F00', 6 => '#2C93DE', 7 => '#939393'); $qr_list = $this->sql->consulta($consulta, $array); if ($this->sql->registros($qr_list) > 0) { $data[0] = array('Element', "Quantidade", ""); $i = 1; while ($dd_list = $this->sql->resultado($qr_list)) { $dd_list['Quant'] = (int) $dd_list['Quant']; $data[$i] = array($dd_list['Descricao'], $dd_list['Quant'], $arrayColor[$i]); $i++; } } break; case 2: break; case 3: break; } } return json_encode($data); } function render ($chave, $sqlcomp = null) { return $this->query($chave, $sqlcomp ); } }