___uid = isset($_GET['uid']) ? $_GET['uid'] : ''; } function ___ValidaForm() { parent::___ValidaForm(); if (!IsPostBack()) { return; } if ($this->GetIncDac() && !StrToIntDef($this->___dac)) { GeraExcept('Informe uma Fila!'); } } function ___FiltrosRelatorio() { return ""; } protected function ___GetDadosDb() { $query = "SELECT numero_bloq, tipo_bloq, data_bloq FROM pbx_kingdialer_bloqueios WHERE id_camp_bloq = {$this->___uid}"; $result = $this->___GetQuery($query); $row = pg_fetch_all($result); $this->SetData($row ? $row : array()); } protected function ___PreparaGrid() { $dadosCabecalio = array( 'Data' => 'align="center"', 'Número' => 'align="center"', 'Tipo' => 'align="center"' ); $dadosField = array( 'data_bloq' => 'align="center"', 'numero_bloq' => 'align="center"', 'tipo_bloq' => 'align="center"'); /* * Inicia o relatorio. */ $dataRel[] = ''; /* * Monta a linha de cabecalio. */ $linhaH = ''; foreach ($dadosCabecalio as $key => $value) { $linhaH .= sprintf("", $value, $key); } $linhaH .= ""; $dataRel[] = $linhaH; /* * Verifica se retornou dados */ if (!count($this->GetData()[0])) { $dataRel[] = sprintf("
%s
%s
", count($dadosCabecalio), (!IsPostBack() ? 'Informe os parametros e clique em consultar!' : 'Nenhum registro encontado!')); $this->___dataRel[] = $dataRel; return; } /* * Linhas de dados. */ foreach ($this->GetData()[0] as $row) { $row["data_bloq"] = date('d/m/Y H:i:s', strtotime($row["data_bloq"])); $tipo = "INVÁLIDO"; switch ($row["tipo_bloq"]){ case 1: $tipo = 'PENDENTE'; break; case 2: $tipo = 'DISCADO DIA'; break; case 3: $tipo = '15 DISCAGEM'; break; case 4: $tipo = 'NÚMERO INVÁLIDO'; break; } $row["tipo_bloq"] = $tipo; // Formata linha de dados. $linha = ""; foreach ($dadosField as $key => $value) { $linha .= sprintf("%s", $value, $row["$key"]); } $linha .= ""; $dataRel[] = $linha; } $dataRel[] = ''; $this->___dataRel[] = $dataRel; /* * Fecha relatorio. */ $dataRel1[] = ''; $this->___dataRel[] = $dataRel1; } public function ExecutaRelatorio() { global $jsStartup, $jsJQuery, $smarty; try { /* * Use esta fun��o para validar dados do formul�rio. */ $this->___ValidaForm(); /* * Recupera os dados do banco. */ $this->___ConteudoRelatorio(); /* * Imprime relat�rio de acordo com a media passada. */ $conteudoRelatorio = $this->___ImprimeRelatorio(); } catch (Exception $exc) { $this->SetMsg($exc->getMessage()); $jsStartup[] = sprintf("alert('%s');", $this->GetMsg()); $this->___GravaLog(); } /* * Inclua os scripts necess�rios aqui. */ $jsJQuery[] = "\$('#dataIni').keypress(function(){formataDataHora(this);}) "; $jsJQuery[] = "\$('#dataFim').keypress(function(){formataDataHora(this);}) "; $smarty->assign('filtros', $this->___FiltrosRelatorio()); $smarty->assign('conteudo', $conteudoRelatorio); $smarty->assign('msg', $this->GetMsg()); GetTemplate($smarty, 'relatoriosGrid.tpl'); } protected function ___PreparaExcel() { } protected function ___PreparaHtml() { } protected function ___PreparaPdf() { } protected function ___PreparaCsv() { } } $relAbd = new RelCampBloqueio($idProg, $dbcon, 1); $relAbd->ExecutaRelatorio(); ?>