public function imprimirExtratoDeContaCaptacaoAction() { $this->_helper->layout->disableLayout(); // Desabilita o Zend Layout $post = Zend_Registry::get('post'); //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); //PRONAC $ordenacao = null; } $pag = 1; if (isset($post->pag)) { $pag = $post->pag; } $inicio = $pag > 1 ? ($pag - 1) * $this->intTamPag : 0; /* ================== PAGINACAO ======================*/ $Usuariosorgaosgrupos = new Usuariosorgaosgrupos(); $orgaoSuperior = $Usuariosorgaosgrupos->buscarOrgaoSuperiorUnico($this->getIdOrgao); $where = array(); $where['c.siTransferenciaRecurso = ?'] = 0; $where['o.idSecretaria = ?'] = $orgaoSuperior->org_superior; if (isset($_POST['pronac']) && !empty($_POST['pronac']) || isset($_GET['pronac']) && !empty($_GET['pronac'])) { $where["c.AnoProjeto+c.Sequencial = ?"] = isset($_POST['pronac']) ? $_POST['pronac'] : $_GET['pronac']; $this->view->pronacProjeto = isset($_POST['pronac']) ? $_POST['pronac'] : $_GET['pronac']; } if (isset($_POST['tipoFiltro']) || isset($_GET['tipoFiltro'])) { $filtro = isset($_POST['tipoFiltro']) ? $_POST['tipoFiltro'] : $_GET['tipoFiltro']; $this->view->filtro = $filtro; switch ($filtro) { case '': //captou 20% $where['SAC.dbo.fnPercentualCaptado(c.AnoProjeto, c.Sequencial) >= ?'] = 20; break; case 'nc': //não captou 20% $where['SAC.dbo.fnPercentualCaptado(c.AnoProjeto, c.Sequencial) < ?'] = 20; break; } } else { $where['SAC.dbo.fnPercentualCaptado(c.AnoProjeto, c.Sequencial) >= ?'] = 20; } $tbCaptacao = new Captacao(); $total = $tbCaptacao->buscaExtratoCaptacao($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; if (isset($_POST['pronac']) && !empty($_POST['pronac']) || isset($_GET['pronac']) && !empty($_GET['pronac'])) { $busca = $tbCaptacao->buscaExtratoCaptacao($where, $order); } else { $busca = $tbCaptacao->buscaExtratoCaptacao($where, $order, $tamanho, $inicio); } if (isset($post->xls) && $post->xls) { $html = ''; $html .= '<table style="border: 1px">'; $html .= '<tr><td style="border: 1px dotted black; background-color: #EAF1DD; font-size: 16; font-weight: bold;" colspan="12">Transferência de Recurso</td></tr>'; $html .= '<tr><td style="border: 1px dotted black; background-color: #EAF1DD; font-size: 10" colspan="12">Data do Arquivo: ' . Data::mostraData() . '</td></tr>'; $html .= '<tr><td colspan="12"></td></tr>'; $html .= '<tr>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">#</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">PRONAC</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">Situação</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">CPF/CNPJ</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">Incentivador</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">Nº do Lote</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">Dt. do Lote</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">Dt. Captação</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">Tipo de Apoio</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">Conta Liberada</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">% Captado</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">Vl. Captado</th>'; $html .= '</tr>'; $i = 1; foreach ($busca as $projeto) { if (isset($projeto->DtLiberacao) && !empty($projeto->DtLiberacao)) { $DtLiberacao = 'Sim'; } else { $DtLiberacao = '<span style="color:red; font-weight: bold;">Não</span>'; } $CaptacaoReal = 'R$ ' . number_format($projeto->CaptacaoReal, '2', ',', '.'); $html .= '<tr>'; $html .= '<td style="border: 1px dotted black;">' . $i . '</td>'; $html .= '<td style="border: 1px dotted black;">' . $projeto->PRONAC . '</td>'; $html .= '<td style="border: 1px dotted black;">' . $projeto->Situacao . '</td>'; $html .= '<td style="border: 1px dotted black;">' . Validacao::mascaraCPFCNPJ($projeto->CgcCpfMecena) . '</td>'; $html .= '<td style="border: 1px dotted black;">' . $projeto->Incentivador . '</td>'; $html .= '<td style="border: 1px dotted black;">' . $projeto->NumeroRecibo . '</td>'; $html .= '<td style="border: 1px dotted black;">' . date("d/m/Y", strtotime($projeto->DtChegadaRecibo)) . '</td>'; $html .= '<td style="border: 1px dotted black;">' . date("d/m/Y", strtotime($projeto->DtRecibo)) . '</td>'; $html .= '<td style="border: 1px dotted black;">' . $projeto->TipoApoio . '</td>'; $html .= '<td style="border: 1px dotted black;">' . $DtLiberacao . '</td>'; $html .= '<td style="border: 1px dotted black;">' . $projeto->Percentual . '</td>'; $html .= '<td style="border: 1px dotted black;">' . $CaptacaoReal . '</td>'; $html .= '</tr>'; $i++; } $html .= '</table>'; header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: inline; filename=Transferencia_de_recurso.xls;"); echo $html; die; } else { $this->view->dados = $busca; $this->_helper->layout->disableLayout(); // Desabilita o Zend Layout } }
public function detalharAction() { $prorrogacao = 0; if ($this->_request->getParam("prorrogacao")) { $prorrogacao = $this->_request->getParam("prorrogacao"); } else { parent::message("Item não encontrado!", "analisarsituacaoitem", "ERROR"); } $Usuariosorgaosgrupos = new Usuariosorgaosgrupos(); $dadosOrgaos = $Usuariosorgaosgrupos->buscarOrgaoSuperiorUnico($this->getIdOrgao); $where = array(); if (PerfilModel::TECNICO_DE_ACOMPANHAMENTO == $this->getIdGrupo) { $where['pr.Atendimento = ?'] = ProrrogacaoModel::EM_ANALISE; } elseif (PerfilModel::COORDENADOR_DE_ACOMPANHAMENTO == $this->getIdGrupo) { $where['pr.Atendimento = ?'] = ProrrogacaoModel::DEFERIDO; } $where['p.Situacao in (?)'] = array('E10', 'E11', 'E12', 'E15', 'E16', 'E23'); $where['o.idSecretaria = ?'] = $dadosOrgaos->org_superior; $where['pr.idProrrogacao = ?'] = $prorrogacao; $Projetos = new Projetos(); $busca = $Projetos->pedidosDeProrrogacao($where, array(), null, null); $this->view->dados = $busca; $this->view->justificativa = $busca[0]->Observacao; $this->view->analise = $busca[0]->Atendimento; }