public function imprimirResgeraldeanaliseAction()
 {
     //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(1);
         //idPronac
         $ordenacao = null;
     }
     $pag = 1;
     $get = Zend_Registry::get('post');
     if (isset($get->pag)) {
         $pag = $get->pag;
     }
     $inicio = $pag > 1 ? ($pag - 1) * $this->intTamPag : 0;
     /* ================== PAGINACAO ======================*/
     $where = array();
     if (isset($_POST['pronac']) && !empty($_POST['pronac'])) {
         $where["p.AnoProjeto+p.Sequencial = ?"] = $_POST['pronac'];
         $this->view->pronac = $_POST['pronac'];
     }
     if (isset($_POST['nmProjeto']) && !empty($_POST['nmProjeto'])) {
         $where["p.NomeProjeto like '%" . $_POST['nmProjeto'] . "%'"] = '';
         $this->view->nmProjeto = $_POST['nmProjeto'];
     }
     if (isset($_POST['unVinculada']) && !empty($_POST['unVinculada'])) {
         $where["d.idOrgao = ?"] = $_POST['unVinculada'];
         $this->view->unVinculada = $_POST['unVinculada'];
     }
     if (isset($_POST['qtDiasDistribuir']) && !empty($_POST['qtDiasDistribuir'])) {
         if ($_POST['qtDiasDistribuir'] == 1) {
             $where["DATEDIFF(day, d.DtEnvio, isnull(d.DtDistribuicao,GETDATE())) >= ?"] = $_POST['qtDiasDistribuirVl'];
         } else {
             $where["DATEDIFF(day, d.DtEnvio, isnull(d.DtDistribuicao,GETDATE())) <= ?"] = $_POST['qtDiasDistribuirVl'];
         }
         $this->view->qtDiasDistribuir = $_POST['qtDiasDistribuir'];
         $this->view->qtDiasDistribuirVl = $_POST['qtDiasDistribuirVl'];
     }
     if (isset($_POST['qtDiasAnalisar']) && !empty($_POST['qtDiasAnalisar'])) {
         if ($_POST['qtDiasDistribuir'] == 1) {
             $where["\n                    (d.DtDevolucao is null and DATEDIFF(day, d.DtDistribuicao, GETDATE()) >= " . $_POST['qtDiasAnalisarVl'] . ") or\n                    (d.DtDevolucao is not null and DATEDIFF(day, d.DtDistribuicao, d.DtDevolucao) >= " . $_POST['qtDiasAnalisarVl'] . ") or\n                    (Situacao = 'B14' and DATEDIFF(day, d.DtDistribuicao, GETDATE()) - DATEDIFF(day, p.dtSituacao, GETDATE()) >= " . $_POST['qtDiasAnalisarVl'] . ")\n                "] = '';
         } else {
             $where["\n                    (d.DtDevolucao is null and DATEDIFF(day, d.DtDistribuicao, GETDATE()) <= " . $_POST['qtDiasAnalisarVl'] . ") or\n                    (d.DtDevolucao is not null and DATEDIFF(day, d.DtDistribuicao, d.DtDevolucao) <= " . $_POST['qtDiasAnalisarVl'] . ") or\n                    (Situacao = 'B14' and DATEDIFF(day, d.DtDistribuicao, GETDATE()) - DATEDIFF(day, p.dtSituacao, GETDATE()) <= " . $_POST['qtDiasAnalisarVl'] . ")\n                "] = '';
         }
         $this->view->qtDiasAnalisar = $_POST['qtDiasAnalisar'];
         $this->view->qtDiasAnalisarVl = $_POST['qtDiasAnalisarVl'];
     }
     if (isset($_POST['qtDiasCoord']) && !empty($_POST['qtDiasCoord'])) {
         if ($_POST['qtDiasCoord'] == 1) {
             $where["d.DtDevolucao is not null and d.DtRetorno is null AND d.FecharAnalise=0 and DATEDIFF(day, d.DtDevolucao,GETDATE()) >= ?"] = $_POST['qtDiasCoordVl'];
         } else {
             $where["d.DtDevolucao is not null and d.DtRetorno is null AND d.FecharAnalise=0 and DATEDIFF(day, d.DtDevolucao,GETDATE()) <= ?"] = $_POST['qtDiasCoordVl'];
         }
         $this->view->qtDiasCoord = $_POST['qtDiasCoord'];
         $this->view->qtDiasCoordVl = $_POST['qtDiasCoordVl'];
     }
     if (isset($_POST['qtDiasIniExec']) && !empty($_POST['qtDiasIniExec'])) {
         if ($_POST['qtDiasIniExec'] == 1) {
             $where["DATEDIFF(day,GETDATE(), p.DtInicioExecucao) >= ?"] = $_POST['qtDiasIniExecVl'];
         } else {
             $where["DATEDIFF(day,GETDATE(), p.DtInicioExecucao) <= ?"] = $_POST['qtDiasIniExecVl'];
         }
         $this->view->qtDiasIniExec = $_POST['qtDiasIniExec'];
         $this->view->qtDiasIniExecVl = $_POST['qtDiasIniExecVl'];
     }
     $Projetos = new Projetos();
     $total = $Projetos->painelRelatoriosGeralAnalise($where, $order, null, null, true);
     $fim = $inicio + $this->intTamPag;
     $tamanho = $fim > $total ? $total - $inicio : $this->intTamPag;
     $busca = $Projetos->painelRelatoriosGeralAnalise($where, $order, $tamanho, $inicio);
     if (isset($_POST['xls']) && $_POST['xls']) {
         $html = '';
         $html .= '<table>';
         $html .= '<tr>';
         $html .= '<th>PRONAC</th>';
         $html .= '<th>Nome do Projeto</th>';
         $html .= '<th>Produto</th>';
         $html .= '<th>Dt.Primeiro Envio p/ Vinculada</th>';
         $html .= '<th>Dt.Último Envio p/ Vinculada</th>';
         $html .= '<th>Dt.Distribuição Parecerista</th>';
         $html .= '<th>Parecerista</th>';
         $html .= '<th>Qtde Dias Para Distribuir</th>';
         $html .= '<th>Qtde Dias Para Parecerista Analisar</th>';
         $html .= '<th>Qtde Dias Devolvidos Para Coordenador</th>';
         $html .= '<th>Status da Diligência</th>';
         $html .= '<th>Unidade Vinculada</th>';
         $html .= '<th>Dt.Início Execução</th>';
         $html .= '<th>Dt.Fim Execução</th>';
         $html .= '<th>Dias vencidos ou a vencer para execução do Projeto</th>';
         $html .= '</tr>';
         foreach ($busca as $v) {
             $html .= '<tr>';
             $html .= '<td>' . $v->Pronac . '</td>';
             $html .= '<td>' . $v->NomeProjeto . '</td>';
             $html .= '<td>' . $v->Produto . '</td>';
             $html .= '<td>' . Data::tratarDataZend($v->DtPrimeiroEnvio, 'Brasileira') . '</td>';
             $html .= '<td>' . Data::tratarDataZend($v->DtUltimoEnvio, 'Brasileira') . '</td>';
             $html .= '<td>' . Data::tratarDataZend($v->DtDistribuicao, 'Brasileira') . '</td>';
             $html .= '<td>' . $v->Parecerista . '</td>';
             $html .= '<td>' . $v->QtdeDiasParaDistribuir . '</td>';
             $html .= '<td>' . $v->QtdeDiasParaParecAnalisar . '</td>';
             $html .= '<td>' . $v->QtdeDiasDevolvidosParaCoord . '</td>';
             $html .= '<td>' . $v->Diligencia . '</td>';
             $html .= '<td>' . $v->Vinculada . '</td>';
             $html .= '<td>' . Data::tratarDataZend($v->DtInicioExecucao, 'Brasileira') . '</td>';
             $html .= '<td>' . Data::tratarDataZend($v->DtFimExecucao, 'Brasileira') . '</td>';
             $html .= '<td>' . $v->QtdeDiasVencido . '</td>';
             $html .= '</tr>';
         }
         $html .= '</table>';
         header("Content-Type: application/vnd.ms-excel");
         header("Content-Disposition: inline; filename=file.xls;");
         echo $html;
         die;
     } else {
         $this->view->qtdRegistros = $total;
         $this->view->dados = $busca;
         $this->_helper->layout->disableLayout();
         // Desabilita o Zend Layout
     }
 }