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 Filtros { private function typeFilter ($name, $type, $class = null, $option, $value = null, $id = null, $placeholder = null, $encode = false) { if ($class == null) { $class = 'form-control'; } switch ($type) { case 'text': $html = "<input type='".$type."' name='".$name."' class='".$class."' value='".$value."' id='".$id."' placeholder='".$placeholder."'>"; break; case 'select': $html = "<select id='".$id."' name='".$name."' class='".$class."' >"; if ($placeholder != '') { $html .= "<option value=''>".$placeholder."</option>"; } foreach ($option as $key => $valor) { if ($encode == true) { $key = urlencode($key); } if ($key == $value) { $html .= "<option value='".$key."' selected='selected' >".$valor."</option>"; } else { $html .= "<option value='".$key."'>".$valor."</option>"; } } $html .= "<select>"; break; case 'date': $html = "<input type='".$type."' name='".$name."' class='".$class." data_format' value='".$value."' id='".$id."' placeholder='".$placeholder."'>"; break; case 'datecompare': $html .= "<div class='row'>"; $html .= "<div class='col-lg-6 col-md-6 col-sm-12'>"; $html .= "<input type='text' name='dtini' class='".$class." data_format' value='".$value[0]."' id='".$id."' placeholder='".$placeholder."'>"; $html .= "</div>"; $html .= "<div class='col-lg-6 col-md-6 col-sm-12'>"; $html .= "<input type='text' name='dtfim' class='".$class." data_format' value='".$value[1]."' id='".$id."' placeholder='".$placeholder."'>"; $html .= "</div>"; $html .= "</div>"; break; } return $html; } function addFilter ($sql, $array) { $icons['text'] = '<i class="fa fa-pencil"></i>'; $icons['select'] = '<i class="fa fa-filter"></i>'; $icons['date'] = '<i class="fa fa-calendar"></i>'; $icons['datecompare'] = '<i class="fa fa-calendar"></i>'; $i = 0; $html .= "<div class='row'>"; foreach ($array as $key) { if ($key['type'] == 'select') { $option = $this->addOption($sql, $key['option'], $key['sqlcomp']); } else { $option = null; } if ($key['value'] == '' and $key['filter'] != '') { $key['value'] = key($option); $key['placeholder'] = ''; } if (count($option) > 0 or $key['type'] <> 'select') { $html .= "<div class='col-lg-4 col-md-6 col-sm-12'>"; $html .= "<div class='form-group'>"; $html .= "<label>".$icons[$key['type']]." <b>".$key['label']."</b></label>"; $html .= $this->typeFilter($key['name'], $key['type'], $key['class'], $option, $key['value'], $key['id'], $key['placeholder'], $key['encode']); $html .= "</div>"; $html .= "</div>"; } if ($i == 2) { $i = 0; $html .= "</div>"; $html .= "<div class='row'>"; } else { $i++; } } $html .= "</div>"; if ($key['filter'] != '') { $html[0] = $html; $html[1] = 'AND '.$key['filter'].' = '.key($option); } return $html; } function filteredFilter ($array) { foreach ($array as $key => $value) { if ($_GET[$key] != "" && $key != 'datecompare' && $value['option'] == '' ) { $Filtered = $Filtered." <div class='badge badge-secondary mr-1'>".$value['label'].": ".$_GET[$key]."</div>"; } else if ($value['option'] != 'option' && $_GET[$key] != "" && $key != 'datecompare') { $Filtered = $Filtered." <div class='badge badge-secondary mr-1'>".$value['label'].": <span id='".$key."' class='option_select' >".$_GET[$key]."</span></div>"; } else if ($key == 'datecompare' && ($_GET['dtini'] != '' or $_GET['dtfim'] != '')) { if ($_GET['dtini'] != '' && $_GET['dtfim'] == '') { $Filtered = $Filtered." <div class='badge badge-secondary mr-1'>".$value['label'].": ".$_GET['dtini']." até agora.</div>"; } else if ($_GET['dtini'] == '' && $_GET['dtfim'] != '') { $Filtered = $Filtered." <div class='badge badge-secondary mr-1'>".$value['label'].": do início até ".$_GET['dtfim']."</div>"; } else if ($_GET['dtini'] != '' && $_GET['dtfim'] != '') { $Filtered = $Filtered." <div class='badge badge-secondary mr-1'>".$value['label'].": ".$_GET['dtini']." - ".$_GET['dtfim']."</div>"; } } } return $Filtered; } function addOption ($sql, $query, $sqlcomp = null) { switch ($query) { case 'secretarias': $consulta = "SELECT IdSecretarias as Id, Descricao FROM tabsecretarias ORDER BY Descricao"; break; case 'exerciciolicitacoes': $consulta = "SELECT distinct (Exercicio) as Id, Exercicio as Descricao FROM tablicitacao WHERE Site = 'S' ORDER BY Exercicio Desc"; break; case 'situacaolicitacoes': $consulta = "SELECT IdSitacaoLicita as Id, DescSituacaoLicita as Descricao FROM tabsituacaolicita WHERE IdSitacaoLicita > 0 ORDER BY DescSituacaoLicita"; break; case 'modalidadelicitacoes': $consulta = "SELECT IdModLicita as Id, DescModLicita as Descricao FROM TabModLicita"; break; case 'exerciciocontratos': $consulta = "SELECT distinct (Exercicio) as Id, Exercicio FROM tabcontratos ORDER BY Exercicio DESC"; break; case 'modalidadecontrato': $consulta = "SELECT Idcontratotipo as Id, Descricao FROM tabcontratotipo ORDER BY Descricao DESC"; break; case 'convenioconcedente': $consulta = "SELECT Id, Descricao FROM tabconvenioconcedente ORDER BY Descricao DESC"; break; case 'tipoesfera': $consulta = "SELECT IdTipoEsfera as Id, Descricao FROM tabtipoesfera ORDER BY Descricao DESC"; break; case 'tipoesfera': $consulta = "SELECT IdTipoEsfera as Id, Descricao FROM tabtipoesfera ORDER BY Descricao DESC"; break; case 'tipoveiculos': $consulta = "SELECT IdTipoVeiculos AS Id, Descricao FROM tabtipoveiculos ORDER BY Descricao"; break; case 'veiculossituacao': $consulta = "SELECT IdVeiculosSituacao AS Id, Descricao FROM TabVeiculosSituacao ORDER BY Descricao"; break; case 'tipoarq': $consulta = "SELECT IdTipoArq as Id, DescTipoArq as Descricao FROM TabTipoArq ORDER BY DescTipoArq"; break; case 'tipoarqlrf': $consulta = "SELECT IdTipoArq as Id, DescTipoArq as Descricao FROM TabTipoArq WHERE NTipoCat = 1 ORDER BY DescTipoArq"; break; case 'tipoarqpublicacoes': $consulta = "SELECT IdTipoArq as Id, DescTipoArq as Descricao FROM TabTipoArq WHERE NTipoCat = 3 ORDER BY DescTipoArq"; break; case 'tipoarqprocesso': $consulta = "SELECT IdTipoArq as Id, DescTipoArq as Descricao FROM TabTipoArq WHERE NTipoCat = 6 ORDER BY DescTipoArq"; break; case 'competencia': $consulta = "SELECT IdComp as Id, DescComp as Descricao FROM TabCompetencia"; break; case 'grupopublica': $consulta = "SELECT IdGrupoPublica as Id, Descricao as Descricao FROM tabogrupopublica ORDER BY Descricao"; break; case 'anoreceita': $consulta = "SELECT DISTINCT (Exercicio) as Id, Exercicio as Descricao FROM tablcreceitas ORDER BY Exercicio DESC"; break; case 'classificacaoreceita': $consulta = "SELECT CdClassificacao as Id, NomeClassificacao as Descricao FROM tablcreceitas group by NomeClassificacao ORDER BY NomeClassificacao"; break; case 'fornecedorreceita': $consulta = "SELECT DISTINCT (NomeFornecedor) as Id, NomeFornecedor as Descricao FROM tablcreceitas ORDER BY NomeFornecedor"; break; case 'orcorgao': $consulta = "SELECT DISTINCT (codigo_orgao) as Id, CONCAT(codigo_orgao,' - ',nome_orgao) as Descricao FROM taborcorgao ORDER BY codigo_orgao"; break; case 'tipoportaria': $consulta = "SELECT IdTipoPortaria as Id, Descricao FROM tabtipoportaria"; break; case 'inidoneastipo': $consulta = "SELECT IdInidoneasTipo as Id, Descricao FROM tabinidoneastipo ORDER BY Descricao"; break; case 'linguagemartistica': $consulta = "SELECT IdTipoArtistica as Id, Descricao FROM tabtipoartistica WHERE IdTipoArtistica > 0 ORDER BY Descricao"; break; case "culturatipoandamento": $consulta = "SELECT IdCulturaTipoAndamento as Id, Descricao FROM tabculturatipoandamento WHERE IdCulturaTipoAndamento > 0 ORDER BY Descricao"; break; case 'vereadorlegislatura': $consulta = "SELECT V.IdVereador as Id, V.Nome as Descricao FROM TabVereador V, tablegislaturavereador L WHERE L.NPessoa = V.IdVereador AND L.NVinculo IN ('1','2','3') GROUP BY V.IdVereador, V.Nome ORDER BY V.Nome"; break; case 'tipomateria': $consulta = "SELECT IdTipoMat as Id, Descricao FROM TabTipoMateria ORDER BY Descricao"; break; case 'materiacategoria': $consulta = "SELECT IdMateriaCategoria as Id, Descricao FROM tabmateriacategoria ORDER BY Descricao"; break; case 'tiposessao': $consulta = "SELECT IdTipoSessao as Id, Descricao FROM TabTipoSessao"; break; case 'legislatura': $consulta = "SELECT Id, DescLeg as Descricao FROM tablegislatura ORDER BY AnoInicio DESC"; break; case 'cargo': $consulta = "SELECT IdCargo as Id, DescCargo as Descricao FROM TabCargo ORDER BY IdCargo"; break; case 'lcempenhoscredor': $consulta = "SELECT NomeFornecedor as Id, NomeFornecedor as Descricao FROM TabLCEmpenhos group by NomeFornecedor ORDER BY NomeFornecedor"; break; case 'orccategoriaeconomica': $consulta = "SELECT IdCategoriaEconomica as Id, CONCAT(codigo_elemento_despesa,' - ',nome_elemento_despesa) as Descricao FROM taborccategoriaeconomica group by codigo_elemento_despesa ORDER BY codigo_elemento_despesa"; break; case 'exercicioempenhos': $consulta = "SELECT DISTINCT (Exercicio) as Id, Exercicio as Descricao FROM TabLCEmpenhos WHERE TipoCredito = 'O' ORDER BY Exercicio DESC"; break; case 'exercicioliquidacoes': $consulta = "SELECT DISTINCT (Exercicio) as Id, Exercicio as Descricao FROM tablcliquidacoes ORDER BY Exercicio DESC"; break; case 'exerciciopagamentos': $consulta = "SELECT DISTINCT (Exercicio) FROM tablcpagamentos ORDER BY Exercicio DESC"; break; case 'exerciciofolhavinculo': $consulta = "SELECT DISTINCT (CdANO) as Id, CdANO as Descricao FROM tabfolhavinculo ORDER BY CdANO DESC"; break; case 'competenciafolhavinculo': $ArrayMes = array('01' => 'JANEIRO', '02' => 'FEVEREIRO', '03' => 'MARÇO', '04' => 'ABRIL', '05' => 'MAIO', '06' => 'JUNHO', '07' => 'JULHO', '08' => 'AGOSTO', '09' => 'SETEMBRO', '10' => 'OUTUBRO', '11' => 'NOVEMBRO', '12' => 'DEZEMBRO'); $ArrayTipoFolha = array('FN' => 'FOLHA NORMAL', 'FC' => 'FOLHA COMPLEMENTAR', 'AD' => 'FOLHA DE ADIANTAMENTO DE DÉCIMO', 'DF' => 'FOLHA DE DÉCIMO FINAl'); $consulta2 = "SELECT CdAno, CdMes, CASE when TipoFolha IS NULL THEN 'FN' ELSE TipoFolha END AS TipoFolhaN, TipoFolhaSeq from tabfolhamovimento".$sqlcomp." group by CdAno, CdMes, TipoFolha, TipoFolhaSeq"; $qr_list2 = $sql->consulta($consulta2); if ($sql->registros($qr_list2) > 0) { while ($dd_list2 = $sql->resultado($qr_list2)) { if ($ddMes['TipoFolhaSeq'] != '') { $folhaNumero = utf8_decode($ddMes['TipoFolhaSeq'] . "ª "); } else { $folhaNumero = ''; } $option[$dd_list2['CdMes'].$dd_list2['TipoFolhaN'].$dd_list2['TipoFolhaSeq']] = $ArrayMes[$dd_list2['CdMes']]." - ".$folhaNumero.$ArrayTipoFolha[$dd_list2['TipoFolhaN']]; } } break; case 'folhalotacao': $consulta = "SELECT CdSetor as Id, CONCAT(CdSecNovo, '.', CdSetorNovo,' - ',Descricao) AS Descricao FROM tabfolhalotacao WHERE CdSetorNovo IS NOT NULL".$sqlcomp." ORDER BY CdANO, CdMES, CdSecNovo, CdSetorNovo"; break; case 'folhacargo': $consulta = "SELECT CdCargo as Id, CONCAT(CdCargo, ' - ',Descricao) AS Descricao FROM tabfolhacargo".$sqlcomp." ORDER BY Descricao "; break; case 'folhavinculo': $consulta = "SELECT CdVINCULO as Id, Descricao FROM tabfolhavinculo".$sqlcomp." ORDER BY Descricao "; break; case 'licitacaotcemamodalidade': $consulta = "SELECT modalidadeLicitacao as Id, modalidadeLicitacao as Descricao FROM tablicitacaotcema GROUP BY modalidadeLicitacao"; break; case 'licitacaotcemasituacao': $consulta = "SELECT statusLicitacao as Id, statusLicitacao as Descricao FROM tablicitacaotcema GROUP BY statusLicitacao"; break; case 'contratotcemaunidade': $consulta = "SELECT unidade as Id, unidade as Descricao FROM tabcontratotcema GROUP BY unidade"; break; case 'contratotcemafornecedor': $consulta = "SELECT fornecedor as Id, fornecedor as Descricao FROM tabcontratotcema GROUP BY fornecedor"; break; case 'situacaosessao': $option['1'] = 'Aberta'; $option['2'] = 'Encerrada'; break; case 'tiporeceita': $option['O'] = 'ORÇAMENTÁRIA'; $option['E'] = 'EXTRA-ORÇAMENTÁRIA'; break; case 'simnao': $option['S'] = 'Sim'; $option['N'] = 'Não'; break; } if ($consulta != '') { $qr_list = $sql->consulta($consulta, $array); if ($sql->registros($qr_list) > 0) { while ($dd_list = $sql->resultado($qr_list)) { $option[$dd_list['Id']] = $dd_list['Descricao']; } } } return $option; } function securityFilter ($arrayValue, $FildFilter) { foreach ($FildFilter as $key => $value) { if ($arrayValue[':'.$key] != '' and $arrayValue[':'.$key] != null ) { $array[':'.$key] = $arrayValue[':'.$key]; } } return $array; } }