public function resultadopesquisaAction()
 {
     //DEFINE PARAMETROS DE ORDENACAO / QTDE. REG POR PAG. / PAGINACAO
     if ($this->_request->getParam("qtde")) {
         $this->intTamPag = $this->_request->getParam("qtde");
     }
     $order = array();
     //==== parametro de ordenacao  ======//
     if ($this->_request->getParam("ordem")) {
         $ordem = $this->_request->getParam("ordem");
         if ($ordem == "ASC") {
             $novaOrdem = "DESC";
         } else {
             $novaOrdem = "ASC";
         }
     } else {
         $ordem = "ASC";
         $novaOrdem = "ASC";
     }
     //==== campo de ordenacao  ======//
     if ($this->_request->getParam("campo")) {
         $campo = $this->_request->getParam("campo");
         $order = array($campo . " " . $ordem);
         $ordenacao = "&campo=" . $campo . "&ordem=" . $ordem;
     } else {
         $campo = null;
         $order = array('AnoProjeto', 'Sequencial');
         $ordenacao = null;
     }
     $pag = 1;
     $get = Zend_Registry::get('get');
     $this->view->filtros = $get;
     if (isset($get->pag)) {
         $pag = $get->pag;
     }
     $inicio = $pag > 1 ? ($pag - 1) * $this->intTamPag : 0;
     /* ================== PAGINACAO ======================*/
     $where = array();
     if ($get->pronac != '') {
         $where['(p.AnoProjeto+p.Sequencial) = ?'] = $get->pronac;
     } else {
         if ($get->regiaoFake != '' || $get->regiao != '') {
             $where['u.Regiao = ?'] = isset($get->regiaoFake) ? $get->regiaoFake : $get->regiao;
         } else {
             $where['u.Regiao ?'] = new Zend_Db_Expr('IS NOT NULL');
         }
     }
     if ($get->uf != '') {
         $where['u.idUF = ?'] = $get->uf;
     }
     if ($get->cidade != '') {
         $where['mu.idMunicipioIBGE = ?'] = $get->cidade;
     }
     if ($get->mecanismo != '') {
         $where['p.Mecanismo = ?'] = $get->mecanismo;
     }
     if ($get->planoAnual == 'sim') {
         $where['pr.stPlanoAnual = ?'] = 1;
     }
     if ($get->situacaoprojeto != '') {
         $where['p.Situacao = ?'] = $get->situacaoprojeto;
     }
     if ($get->area != '') {
         $where['p.Area = ?'] = $get->area;
     }
     if ($get->Segmento != '') {
         $where['p.Segmento = ?'] = $get->Segmento;
     }
     if ($get->valorMenor != '') {
         $where['(sac.dbo.fnTotalAprovadoProjeto(p.AnoProjeto, p.Sequencial)) >= ?'] = $get->valorMenor;
     }
     if ($get->valorMaior != '') {
         $where['(sac.dbo.fnTotalAprovadoProjeto(p.AnoProjeto, p.Sequencial)) <= ?'] = $get->valorMaior;
     }
     $where["p.IdPRONAC NOT IN (SELECT IdPRONAC FROM SAC.dbo.tbFiscalizacao where stFiscalizacaoProjeto IN ('0','1') )"] = '';
     //$where["e.Status = ?"] = 1;
     $projetos = new Projetos();
     $total = $projetos->gridFiscalizacaoProjetoFiltro($where, $order, null, null, true);
     $fim = $inicio + $this->intTamPag;
     $totalPag = (int) ($total % $this->intTamPag == 0 ? $total / $this->intTamPag : $total / $this->intTamPag + 1);
     $tamanho = $fim > $total ? $total - $inicio : $this->intTamPag;
     $busca = $projetos->gridFiscalizacaoProjetoFiltro($where, $order, $tamanho, $inicio);
     $paginacao = array("pag" => $pag, "qtde" => $this->intTamPag, "campo" => $campo, "ordem" => $ordem, "ordenacao" => $ordenacao, "novaOrdem" => $novaOrdem, "total" => $total, "inicio" => $inicio + 1, "fim" => $fim, "totalPag" => $totalPag, "Itenspag" => $this->intTamPag, "tamanho" => $tamanho);
     $this->view->paginacao = $paginacao;
     $this->view->qtdDocumentos = $total;
     $this->view->dados = $busca;
     $this->view->intTamPag = $this->intTamPag;
     //        xd('aqui');
     //Apagar daqui pra frente
     /*$post = Zend_Registry::get('post');
             $projetosDao = new Projetos();
     
             if ($post->PRONAC != '')
                 $where['(p.AnoProjeto+p.Sequencial) = ?'] = $post->PRONAC;
     
             if ($post->regiaoFake != '' || $post->regiao != ''){
                 $where['u.Regiao = ?'] = isset($post->regiaoFake) ? $post->regiaoFake : $post->regiao;
             } else {
                 $where['u.Regiao ?'] = new Zend_Db_Expr('IS NOT NULL');
             }
     
             if ($post->uf != '')
                 $where['u.idUF = ?'] = $post->uf;
     
             if ($post->cidade != '')
                 $where['mu.idMunicipioIBGE = ?'] = $post->cidade;
     
             if ($post->mecanismo != '')
                 $where['p.Mecanismo = ?'] = $post->mecanismo;
     
             if ($post->planoAnual == 'sim')
                 $where['pr.stPlanoAnual = ?'] = 1;
     
             if ($post->situacaoprojeto != '')
                 $where['p.Situacao = ?'] = $post->situacaoprojeto;
     
             if ($post->area != '')
                 $where['p.Area = ?'] = $post->area;
     
             if ($post->Segmento != '')
                 $where['p.Segmento = ?'] = $post->Segmento;
     
             if ($post->valorMenor != '')
                 $where['(sac.dbo.fnTotalAprovadoProjeto(p.AnoProjeto, p.Sequencial)) >= ?'] = $post->valorMenor;
     
             if ($post->valorMaior != '')
                 $where['(sac.dbo.fnTotalAprovadoProjeto(p.AnoProjeto, p.Sequencial)) <= ?'] = $post->valorMaior;
             
     //        $GrupoAtivo = new Zend_Session_Namespace('GrupoAtivo'); // cria a sess?o com o grupo ativo
     //        $codOrgao = $GrupoAtivo->codOrgao;
     //        $where['p.Orgao =?'] = $codOrgao;
     //        $where['sac.dbo.fnPercentualCaptado(p.AnoProjeto, p.Sequencial) >= ?'] = 20;
             $where["p.IdPRONAC NOT IN (SELECT IdPRONAC FROM SAC.dbo.tbFiscalizacao where stFiscalizacaoProjeto IN ('0','1') )"] = '';
             $resp = $projetosDao->projetosFiscalizacaoPesquisar($where);
     
             $this->view->projetosFiscalizacao = array(
                 array('nome' => 'PROJETOS', 'qtd' => 0, 'projetos' => array())
             );
     
             foreach ($resp as $key => $val) {
                 $num = 0;
     
                 if (!isset($this->view->projetosFiscalizacao[$num]['projetos'][$val->IdPRONAC])) {
                     $this->view->projetosFiscalizacao[$num]['qtd']++;
                 }
                 $this->view->projetosFiscalizacao[$num]['projetos'][$val->IdPRONAC]['&nbsp;']           = $this->view->projetosFiscalizacao[$num]['qtd'];
                 $this->view->projetosFiscalizacao[$num]['projetos'][$val->IdPRONAC]['PRONAC']           = "<a target='_blank' href='" . $this->url(array('controller' => 'consultardadosprojeto', 'action' => 'index')) . "?idPronac=" . $val->IdPRONAC . "' >" . $val->AnoProjeto . $val->Sequencial . "</a>";
                 $this->view->projetosFiscalizacao[$num]['projetos'][$val->IdPRONAC]['Nome do Projeto']  = $val->NomeProjeto;
                 $this->view->projetosFiscalizacao[$num]['projetos'][$val->IdPRONAC]['Regi&atilde;o']    = $val->Regiao;
                 $this->view->projetosFiscalizacao[$num]['projetos'][$val->IdPRONAC]['UF']               = $val->uf;
                 $this->view->projetosFiscalizacao[$num]['projetos'][$val->IdPRONAC]['Cidade']           = $val->cidade;
                 $this->view->projetosFiscalizacao[$num]['projetos'][$val->IdPRONAC]['&Aacute;rea']      = $val->dsArea;
                 $this->view->projetosFiscalizacao[$num]['projetos'][$val->IdPRONAC]['Segmento']         = $val->dsSegmento;
                 $this->view->projetosFiscalizacao[$num]['projetos'][$val->IdPRONAC]['Valor']            = number_format($val->somatorio, 2, ',', '.');
                 $this->view->projetosFiscalizacao[$num]['projetos'][$val->IdPRONAC]['Mecanismo']        = $val->dsMecanismo;
                 if ($val->stPlanoAnual == 0)
                     $this->view->projetosFiscalizacao[$num]['projetos'][$val->IdPRONAC]['Plano Anual'] = 'N&atilde;o';
                 else
                     $this->view->projetosFiscalizacao[$num]['projetos'][$val->IdPRONAC]['Plano Anual'] = 'Sim';
                 $oficializarfiscalizacaoHref = $this->url(array('controller' => 'pesquisarprojetofiscalizacao', 'action' => 'oficializarfiscalizacao')).'?idPronac='.$val->IdPRONAC;
                 $this->view->projetosFiscalizacao[$num]['projetos'][$val->IdPRONAC]['Fiscalizar'] = '<center><a href="' . $oficializarfiscalizacaoHref . '"><img src="../public/img/btn_busca.gif" alt="Dados da Fiscalização"/></a></center>';
             }*/
 }