/** * Reescreve o método init() * @access public * @param void * @return void */ public function init() { // verifica as permiss�es $PermissoesGrupo = array(); $PermissoesGrupo[] = 109; // T�cnico de An�lise $PermissoesGrupo[] = 110; // T�cnico de An�lise $PermissoesGrupo[] = 103; // Coordenador de An�lise $PermissoesGrupo[] = 127; // Coordenador - Geral de An�lise $PermissoesGrupo[] = 131; // Coordenador de Admissibilidade $PermissoesGrupo[] = 92; // T�cnico de Admissibilidade $PermissoesGrupo[] = 121; // T�cnico de Acompanhamento $PermissoesGrupo[] = 122; // Coordenador de Acompanhamento $PermissoesGrupo[] = 123; // Coordenador - Geral de Acompanhamento $PermissoesGrupo[] = 108; // Acompanhamento - Coordenador $PermissoesGrupo[] = 138; // Coordenador de Avalia��o $PermissoesGrupo[] = 139; // T�cnico de Avalia��o $PermissoesGrupo[] = 125; // Coordenador de Presta��o de Contas $PermissoesGrupo[] = 124; // T�cnico de Presta��o de Contas $PermissoesGrupo[] = 134; // Coordenador de Fiscaliza��o $PermissoesGrupo[] = 135; // T�cnico de Fiscaliza��o $PermissoesGrupo[] = 131; // Coordenador de Admissibilidade $PermissoesGrupo[] = 140; // T�cnico de Admissibilidade parent::perfil(1, $PermissoesGrupo); parent::init(); // cria a sessao com o grupo ativo $GrupoAtivo = new Zend_Session_Namespace('GrupoAtivo'); $this->codGrupo = $GrupoAtivo->codGrupo; $this->view->codGrupo = $GrupoAtivo->codGrupo; if ($GrupoAtivo->codGrupo == 92 || $GrupoAtivo->codGrupo == 131 || $GrupoAtivo->codGrupo == 140) { $this->view->dsMod = 'Admissibilidade'; } elseif ($GrupoAtivo->codGrupo == 103 || $GrupoAtivo->codGrupo == 109 || $GrupoAtivo->codGrupo == 110 || $GrupoAtivo->codGrupo == 127) { $this->view->dsMod = 'Análise'; } elseif ($GrupoAtivo->codGrupo == 125 || $GrupoAtivo->codGrupo == 124) { $this->view->dsMod = 'Prestação de Contas'; } else { $this->view->dsMod = 'Acompanhamento'; } $cnpjcpf = $this->_request->getParam("cpfCnpj"); if (strlen(retiraMascara($cnpjcpf)) > 11) { $this->proponente = "PJ"; $this->view->proponente = "PJ"; } else { $this->proponente = "PF"; $this->view->proponente = "PF"; } //$this->proponente }
public function gerenciamentodepropostasAction() { //cod_grupo = 131 se perfil do tipo coordenador. //if($_SESSION['GrupoAtivo']['codOrgao'] != 160 && $_SESSION['GrupoAtivo']['codOrgao'] != 251) { if ($_SESSION['GrupoAtivo']['codGrupo'] != 131) { $this->view->mensagem = "Você não tem permissão para acessar essa funcionalidade."; } else { $post = Zend_Registry::get('post'); $numeroProposta = $post->numeroProposta; $tipoNome = $post->tiponome; $nomeProposta = $post->nomeProposta; $tipoCpf = $post->tipocpf; $cpfCnpj = retiraMascara($post->cpfCnpj); $analista = $post->analista; $tipodata = $post->tipodata; $dataPropostaInicial = $post->dataPropostaInicial; $arrBusca = array(); //NUM. PROPOSTA if (!empty($numeroProposta)) { $arrBusca[" idPreProjeto = "] = "'" . $numeroProposta . "'"; } //NOME DA PROPOSTA if (!empty($nomeProposta)) { if ($tipoNome == "contendo") { $arrBusca[" NomeProjeto LIKE "] = "'%" . $nomeProposta . "%'"; } elseif ($tipoNome == "inicioIgual") { $arrBusca[" NomeProjeto LIKE "] = "'" . $nomeProposta . "%'"; } } //CPF / CNPJ PROPONENTE if (!empty($cpfCnpj)) { if ($tipoCpf == "contendo") { $arrBusca[" CNPJCPF LIKE "] = "'%" . $cpfCnpj . "%'"; } elseif ($tipoCpf == "igual") { $arrBusca[" CNPJCPF = "] = "'" . $cpfCnpj . "'"; } elseif ($tipoCpf == "inicioIgual") { $arrBusca[" CNPJCPF LIKE "] = "'" . $cpfCnpj . "%'"; } elseif ($tipoCpf == "diferente") { $arrBusca[" CNPJCPF <> "] = "'" . $cpfCnpj . "'"; } } //ANALISTA if (!empty($analista)) { $arrBusca[" idTecnico = "] = "'" . $analista . "'"; } elseif ($analista == "0") { $arrBusca[" idTecnico <> "] = "''"; } if (!empty($dataPropostaInicial) || $tipodata != '') { if ($tipodata == "igual") { $arrBusca['x.DtAvaliacao > '] = "'" . ConverteData($post->dataPropostaInicial, 13) . " 00:00:00'"; $arrBusca['x.DtAvaliacao < '] = "'" . ConverteData($post->dataPropostaInicial, 13) . " 23:59:59'"; } elseif ($tipodata == "maior") { $arrBusca['x.DtAvaliacao >= '] = "'" . ConverteData($post->dataPropostaInicial, 13) . " 00:00:00'"; } elseif ($tipodata == "menor") { $arrBusca['x.DtAvaliacao <= '] = "'" . ConverteData($post->dataPropostaInicial, 13) . " 00:00:00'"; } elseif ($tipodata == "OT") { $arrBusca['x.DtAvaliacao = '] = "'" . date("Y-m-") . (date("d") - 1) . " 00:00:00'"; } elseif ($tipodata == "U7") { $arrBusca['x.DtAvaliacao > '] = "'" . date("Y-m-") . (date("d") - 7) . " 00:00:00'"; $arrBusca['x.DtAvaliacao < '] = "'" . date("Y-m-d") . " 23:59:59'"; } elseif ($tipodata == "SP") { $arrBusca['x.DtAvaliacao > '] = "'" . date("Y-m-") . (date("d") - 7) . " 00:00:00'"; $arrBusca['x.DtAvaliacao < '] = "'" . date("Y-m-d") . " 23:59:59'"; } elseif ($tipodata == "MM") { $arrBusca['x.DtAvaliacao > '] = "'" . date("Y-m-01") . " 00:00:00'"; $arrBusca['x.DtAvaliacao < '] = "'" . date("Y-m-d") . " 23:59:59'"; } elseif ($tipodata == "UM") { $arrBusca['x.DtAvaliacao > '] = "'" . date("Y-") . (date("m") - 1) . "-01 00:00:00'"; $arrBusca['x.DtAvaliacao < '] = "'" . date("Y-") . (date("m") - 1) . "-31 23:59:59'"; } else { $arrBusca['x.DtAvaliacao > '] = "'" . ConverteData($post->dataPropostaInicial, 13) . " 00:00:00'"; if ($post->dataPropostaFinal != "") { $arrBusca['x.DtAvaliacao < '] = "'" . ConverteData($post->dataPropostaFinal, 13) . " 23:59:59'"; } } } //ORGAO USUARIO SUPERIOR LOGADO //$arrBusca[" SAC.dbo.fnIdOrgaoSuperiorAnalista(x.idTecnico) = "] = $_SESSION['GrupoAtivo']['codOrgao']; $arrBusca[" SAC.dbo.fnIdOrgaoSuperiorAnalista(x.idTecnico) = "] = $this->codOrgaoSuperior; //$arrBusca[" TABELAS.dbo.fnCodigoOrgaoEstrutura(u.usu_orgao, 1) = "] = $this->codOrgaoSuperior; $this->view->analistas = AdmissibilidadeDAO::consultarGerenciamentoProposta($arrBusca, array("Tecnico ASC")); if (!$this->view->analistas) { $this->view->mensagem = 'Nenhum registro encontrado'; } else { $array = array(); foreach ($this->view->analistas as $analistas) { $array[$analistas->Tecnico][$analistas->idProjeto]['NomeProposta'] = $analistas->NomeProposta; $array[$analistas->Tecnico][$analistas->idProjeto]['idAgente'] = $analistas->idAgente; $array[$analistas->Tecnico][$analistas->idProjeto]['CNPJCPF'] = $analistas->CNPJCPF; $array[$analistas->Tecnico][$analistas->idProjeto]['idUsuario'] = $analistas->idUsuario; $array[$analistas->Tecnico][$analistas->idProjeto]['Tecnico'] = $analistas->Tecnico; $array[$analistas->Tecnico][$analistas->idProjeto]['idSecretaria'] = $analistas->idSecretaria; $array[$analistas->Tecnico][$analistas->idProjeto]['DtAdmissibilidade'] = ConverteData($analistas->DtAdmissibilidade, 5); $array[$analistas->Tecnico][$analistas->idProjeto]['dias'] = $analistas->dias; $array[$analistas->Tecnico][$analistas->idProjeto]['idAvaliacaoProposta'] = $analistas->idAvaliacaoProposta; $array[$analistas->Tecnico][$analistas->idProjeto]['idMovimentacao'] = $analistas->idMovimentacao; $array[$analistas->Tecnico][$analistas->idProjeto]['stTipoDemanda'] = $analistas->stTipoDemanda; $array[$analistas->Tecnico][$analistas->idProjeto]['stPlanoAnual'] = $analistas->stPlanoAnual; } $this->view->analistas = $array; } $this->view->urlResumo = $this->_urlPadrao . "/admissibilidade/resumo-gerenciamento-proposta"; } }
public function resultadoAgenciaBancariaAction() { header("Content-Type: text/html; charset=ISO-8859-1"); $this->_helper->layout->disableLayout(); $post = Zend_Registry::get('post'); $arrBusca = array(); if (!empty($post->banco)) { $arrBusca["c.Banco = ?"] = $post->banco; } if (!empty($post->uf)) { $tblUf = new Uf(); $rsUf = $tblUf->buscar(array("idUF = ?" => $post->uf))->current(); $arrBusca["a.Uf = ?"] = $rsUf->Sigla; } if (!empty($post->cidade)) { $tblMunicipio = new Municipios(); $rsMunicipio = $tblMunicipio->buscar(array("idMunicipioIBGE = ?" => $post->cidade))->current(); $arrBusca["a.Cidade = ?"] = $rsMunicipio->Descricao; } if (!empty($post->mecanismo)) { $arrBusca["c.Mecanismo = ?"] = $post->mecanismo; } if (!empty($post->area)) { $arrBusca["p.Area = ?"] = $post->area; } if (!empty($post->tipoPessoa)) { $arrBusca["i.tipoPessoa = ?"] = $post->tipoPessoa; } if (!empty($post->agencia)) { $arrBusca["c.Agencia = ?"] = retiraMascara($post->agencia); } if (!empty($post->dtLoteRemessaCB) || $post->tpDtLoteRemessaCB != '') { if ($post->tpDtLoteRemessaCB == "igual") { $arrBusca['DtLoteRemessaCB >= ?'] = ConverteData($post->dtLoteRemessaCB, 13) . " 00:00:00"; $arrBusca['DtLoteRemessaCB <= ?'] = ConverteData($post->dtLoteRemessaCB, 13) . " 23:59:59"; } elseif ($post->tpDtLoteRemessaCB == "maior") { $arrBusca['DtLoteRemessaCB >= ?'] = ConverteData($post->dtLoteRemessaCB, 13) . " 00:00:00"; } elseif ($post->tpDtLoteRemessaCB == "menor") { $arrBusca['DtLoteRemessaCB <= ?'] = ConverteData($post->dtLoteRemessaCB, 13) . " 00:00:00"; } elseif ($post->tpDtLoteRemessaCB == "OT") { $arrBusca['DtLoteRemessaCB = ?'] = date("Y-m-") . (date("d") - 1) . " 00:00:00"; } elseif ($post->tpDtLoteRemessaCB == "U7") { $arrBusca['DtLoteRemessaCB > ?'] = date("Y-m-") . (date("d") - 7) . " 00:00:00"; $arrBusca['DtLoteRemessaCB < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($post->tpDtLoteRemessaCB == "SP") { $arrBusca['DtLoteRemessaCB > ?'] = date("Y-m-") . (date("d") - 7) . " 00:00:00"; $arrBusca['DtLoteRemessaCB < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($post->tpDtLoteRemessaCB == "MM") { $arrBusca['DtLoteRemessaCB > ?'] = date("Y-m-01") . " 00:00:00"; $arrBusca['DtLoteRemessaCB < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($post->tpDtLoteRemessaCB == "UM") { $arrBusca['DtLoteRemessaCB > ?'] = date("Y-") . (date("m") - 1) . "-01 00:00:00"; $arrBusca['DtLoteRemessaCB < ?'] = date("Y-") . (date("m") - 1) . "-31 23:59:59"; } else { $arrBusca['DtLoteRemessaCB > ?'] = ConverteData($post->dtLoteRemessaCB, 13) . " 00:00:00"; if ($post->dtLoteRemessaCB_Final != "") { $arrBusca['DtLoteRemessaCB < ?'] = ConverteData($post->dtLoteRemessaCB_Final, 13) . " 23:59:59"; } } } if (!empty($post->dtLoteRemessaCL) || $post->tpDtLoteRemessaCL != '') { if ($post->tpDtLoteRemessaCL == "igual") { $arrBusca['DtLoteRemessaCL >= ?'] = ConverteData($post->dtLoteRemessaCL, 13) . " 00:00:00"; $arrBusca['DtLoteRemessaCL <= ?'] = ConverteData($post->dtLoteRemessaCL, 13) . " 23:59:59"; } elseif ($post->tpDtLoteRemessaCL == "maior") { $arrBusca['DtLoteRemessaCL >= ?'] = ConverteData($post->dtLoteRemessaCL, 13) . " 00:00:00"; } elseif ($post->tpDtLoteRemessaCL == "menor") { $arrBusca['DtLoteRemessaCL <= ?'] = ConverteData($post->dtLoteRemessaCL, 13) . " 00:00:00"; } elseif ($post->tpDtLoteRemessaCL == "OT") { $arrBusca['DtLoteRemessaCL = ?'] = date("Y-m-") . (date("d") - 1) . " 00:00:00"; } elseif ($post->tpDtLoteRemessaCL == "U7") { $arrBusca['DtLoteRemessaCL > ?'] = date("Y-m-") . (date("d") - 7) . " 00:00:00"; $arrBusca['DtLoteRemessaCL < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($post->tpDtLoteRemessaCL == "SP") { $arrBusca['DtLoteRemessaCL > ?'] = date("Y-m-") . (date("d") - 7) . " 00:00:00"; $arrBusca['DtLoteRemessaCL < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($post->tpDtLoteRemessaCL == "MM") { $arrBusca['DtLoteRemessaCL > ?'] = date("Y-m-01") . " 00:00:00"; $arrBusca['DtLoteRemessaCL < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($post->tpDtLoteRemessaCL == "UM") { $arrBusca['DtLoteRemessaCL > ?'] = date("Y-") . (date("m") - 1) . "-01 00:00:00"; $arrBusca['DtLoteRemessaCL < ?'] = date("Y-") . (date("m") - 1) . "-31 23:59:59"; } else { $arrBusca['DtLoteRemessaCL > ?'] = ConverteData($post->dtLoteRemessaCL, 13) . " 00:00:00"; if ($post->dtLoteRemessaCL_Final != "") { $arrBusca['DtLoteRemessaCL < ?'] = ConverteData($post->dtLoteRemessaCL_Final, 13) . " 23:59:59"; } } } //xd($arrBusca); $tbl = new ContaBancaria(); //xd($_POST); if ($post->tipo == 'xls' || $post->tipo == 'pdf') { //buscando os registros no banco de dados $tamanho = -1; $inicio = -1; $pag = 0; $totalPag = 0; $total = 0; $fim = 0; $rs = $tbl->buscar($arrBusca, array(), $tamanho, $inicio); $this->_forward('preparar-xls-pdf', null, null, array('dados' => $rs, 'view' => 'operacional/preparar-xls-pdf-agencia-bancaria.phtml', 'tipo' => $post->tipo)); } else { $pag = 1; //$get = Zend_Registry::get('get'); if (isset($post->pag)) { $pag = $post->pag; } if (isset($post->tamPag)) { $this->intTamPag = $post->tamPag; } $inicio = $pag > 1 ? ($pag - 1) * $this->intTamPag : 0; $fim = $inicio + $this->intTamPag; $total = $tbl->pegaTotal($arrBusca); $total = $total["total"]; //xd($total); $totalPag = (int) ($total % $this->intTamPag == 0 ? $total / $this->intTamPag : $total / $this->intTamPag + 1); $tamanho = $fim > $total ? $total - $inicio : $this->intTamPag; if ($fim > $total) { $fim = $total; } //Varifica se foi solicitado a ordenação if (!empty($post->ordenacao)) { $ordem[] = "{$post->ordenacao} {$post->tipoOrdenacao}"; } else { $ordem = array('Descricao ASC'); } $rs = $tbl->buscar($arrBusca, $ordem, $tamanho, $inicio); //xd($total); } $this->view->contasBancarias = $rs; $this->view->pag = $pag; $this->view->total = $total; $this->view->inicio = $inicio + 1; $this->view->fim = $fim; $this->view->totalPag = $totalPag; $this->view->parametrosBusca = $_POST; }
public function imprimirRelatorioReciboCaptacaoAction() { $this->_helper->layout->disableLayout(); //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(9, 7, 3); $ordenacao = null; } $get = Zend_Registry::get('post'); /* ================== PAGINACAO ======================*/ $where = array(); if (!empty($get->pronac)) { $where["c.AnoProjeto+c.Sequencial = ?"] = $get->pronac; } if (!empty($get->numLote)) { $where["c.NumeroRecibo = ?"] = $get->numLote; } if (!empty($get->proponente)) { $where["p.CgcCpf = ?"] = retiraMascara($get->proponente); } if (!empty($get->incentivador)) { $where["c.cgcCpfMecena = ?"] = retiraMascara($get->incentivador); } if (!empty($get->dtLote) || $get->tpDtLote != '') { if ($get->tpDtLote == "igual") { $where['DtChegadaRecibo >= ?'] = ConverteData($get->dtLote, 13) . " 00:00:00"; $where['DtChegadaRecibo <= ?'] = ConverteData($get->dtLote, 13) . " 23:59:59"; } elseif ($get->tpDtLote == "maior") { $where['DtChegadaRecibo >= ?'] = ConverteData($get->dtLote, 13) . " 00:00:00"; } elseif ($get->tpDtLote == "menor") { $where['DtChegadaRecibo <= ?'] = ConverteData($get->dtLote, 13) . " 00:00:00"; } elseif ($get->tpDtLote == "OT") { $where['DtChegadaRecibo = ?'] = date("Y-m-") . (date("d") - 1) . " 00:00:00"; } elseif ($get->tpDtLote == "U7") { $where['DtChegadaRecibo > ?'] = date("Y-m-") . (date("d") - 7) . " 00:00:00"; $where['DtChegadaRecibo < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($get->tpDtLote == "SP") { $where['DtChegadaRecibo > ?'] = date("Y-m-") . (date("d") - 7) . " 00:00:00"; $where['DtChegadaRecibo < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($get->tpDtLote == "MM") { $where['DtChegadaRecibo > ?'] = date("Y-m-01") . " 00:00:00"; $where['DtChegadaRecibo < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($get->tpDtLote == "UM") { $where['DtChegadaRecibo > ?'] = date("Y-") . (date("m") - 1) . "-01 00:00:00"; $where['DtChegadaRecibo < ?'] = date("Y-") . (date("m") - 1) . "-31 23:59:59"; } else { $where['DtChegadaRecibo > ?'] = ConverteData($get->dtLote, 13) . " 00:00:00"; if ($get->dtLote_Final != "") { $where['DtChegadaRecibo < ?'] = ConverteData($get->dtLote_Final, 13) . " 23:59:59"; } } } if (!empty($get->dtCaptacao) || $get->tpDtCaptacao != '') { if ($get->tpDtCaptacao == "igual") { $where['DtRecibo >= ?'] = ConverteData($get->dtCaptacao, 13) . " 00:00:00"; $where['DtRecibo <= ?'] = ConverteData($get->dtCaptacao, 13) . " 23:59:59"; } elseif ($get->tpDtCaptacao == "maior") { $where['DtRecibo >= ?'] = ConverteData($get->dtCaptacao, 13) . " 00:00:00"; } elseif ($get->tpDtCaptacao == "menor") { $where['DtRecibo <= ?'] = ConverteData($get->dtCaptacao, 13) . " 00:00:00"; } elseif ($get->tpDtCaptacao == "OT") { $where['DtRecibo = ?'] = date("Y-m-") . (date("d") - 1) . " 00:00:00"; } elseif ($get->tpDtCaptacao == "U7") { $where['DtRecibo > ?'] = date("Y-m-") . (date("d") - 7) . " 00:00:00"; $where['DtRecibo < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($get->tpDtCaptacao == "SP") { $where['DtRecibo > ?'] = date("Y-m-") . (date("d") - 7) . " 00:00:00"; $where['DtRecibo < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($get->tpDtCaptacao == "MM") { $where['DtRecibo > ?'] = date("Y-m-01") . " 00:00:00"; $where['DtRecibo < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($get->tpDtCaptacao == "UM") { $where['DtRecibo > ?'] = date("Y-") . (date("m") - 1) . "-01 00:00:00"; $where['DtRecibo < ?'] = date("Y-") . (date("m") - 1) . "-31 23:59:59"; } else { $where['DtRecibo > ?'] = ConverteData($get->dtCaptacao, 13) . " 00:00:00"; if ($get->dtCaptacao_Final != "") { $where['DtRecibo < ?'] = ConverteData($get->dtCaptacao_Final, 13) . " 23:59:59"; } } } $tbCaptacao = new Captacao(); $busca = $tbCaptacao->buscaReciboCaptacao($where, $order); $this->view->dados = $busca; $this->view->vlrTotalGrid = $tbCaptacao->buscaReciboCaptacaoTotalValorGrid($where); }
public function imprimirRelatorioAction() { $this->intTamPag = 30; //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(2); //Pronac $ordenacao = null; } $pag = 1; $get = Zend_Registry::get('post'); if (isset($get->pag)) { $pag = $get->pag; } $inicio = $pag > 1 ? ($pag - 1) * $this->intTamPag : 0; $where = array(); if (isset($get->pronac) && !empty($get->pronac)) { $where['pr.AnoProjeto+pr.Sequencial = ?'] = $get->pronac; $this->view->pronac = $get->pronac; } if (isset($get->cnpfcpf) && !empty($get->cnpfcpf)) { $where['pr.CgcCpf = ?'] = retiraMascara($get->cnpfcpf); $this->view->cnpfcpf = $get->cnpfcpf; } if (isset($get->nomeProjeto) && !empty($get->nomeProjeto)) { $where['pr.NomeProjeto like (?)'] = "%" . $get->nomeProjeto . "%"; $this->view->nomeProjeto = $get->nomeProjeto; } if (isset($get->nomeProponente) && !empty($get->nomeProponente)) { $where['nm.Descricao like (?)'] = "%" . $get->nomeProponente . "%"; $this->view->nomeProponente = $get->nomeProponente; } if (isset($get->area) && !empty($get->area)) { $where['ar.Codigo = ?'] = $get->area; $this->view->area = $get->area; } if (isset($get->segmento) && !empty($get->segmento)) { $where['sg.Codigo = ?'] = $get->segmento; $this->view->segmento = $get->segmento; } if (isset($get->mecanismo) && !empty($get->mecanismo)) { $where['pr.Mecanismo = ?'] = $get->mecanismo; $this->view->mecanismo = $get->mecanismo; } if (isset($get->uf) && !empty($get->uf)) { $where['uf.CodUfIbge = ?'] = $get->uf; $this->view->uf = $get->uf; } if (isset($get->municipio) && !empty($get->municipio)) { $where['u.idMunicipio = ?'] = $get->municipio; $this->view->municipio = $get->municipio; } if (isset($get->situacao) && !empty($get->situacao)) { $where['pr.Situacao = ?'] = $get->situacao; $this->view->situacao = $get->situacao; } $where = GenericControllerNew::montaBuscaData($get, "tpDtSituacao", "dtSituacao", "pr.DtSituacao", "dtSituacao_Final", $where); $where = GenericControllerNew::montaBuscaData($get, "tpDtPublicacao", "dtPublicacao", "ap.DtPublicacaoAprovacao", "dtPublicacao_Final", $where); $where = GenericControllerNew::montaBuscaData($get, "tpDtPortaria", "dtPortaria", "ap.DtPortariaAprovacao", "dtPortaria_Final", $where); if (isset($get->dtInicioExec) && isset($get->dtFimExec) && !empty($get->dtInicioExec) && !empty($get->dtFimExec)) { $di = data::dataAmericana($get->dtInicioExec); $df = data::dataAmericana($get->dtFimExec); $where["pr.DtInicioExecucao BETWEEN '{$di}' AND '{$df}'"] = ''; $where["pr.DtFimExecucao BETWEEN '{$di}' AND '{$df}'"] = ''; $this->view->dtInicioExec = $get->dtInicioExec; $this->view->dtFimExec = $get->dtFimExec; } if (isset($get->propRegular) && !empty($get->propRegular)) { $where['inab.Habilitado = ?'] = $get->propRegular; $this->view->propRegular = $get->propRegular; } if (isset($get->planoAnual) && !empty($get->planoAnual)) { $where['p.stPlanoAnual = ?'] = $get->planoAnual; $this->view->planoAnual = $get->planoAnual; } if (isset($get->datafixa) && !empty($get->datafixa)) { $where['p.stDataFixa = ?'] = $get->datafixa; $this->view->datafixa = $get->datafixa; } $Projetos = new Projetos(); $total = $Projetos->relatorioProjeto($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->relatorioProjeto($where, $order, $tamanho, $inicio); if (isset($get->xls) && $get->xls) { $colunas = 12; if ($campo != 12) { $colunas++; } $html = ''; $html .= '<table style="border: 1px">'; $html .= '<tr><td style="border: 1px dotted black; background-color: #EAF1DD; font-size: 16; font-weight: bold;" colspan="' . $colunas . '">Relatório de Projetos - Resultado da pesquisa</td></tr>'; $html .= '<tr><td style="border: 1px dotted black; background-color: #EAF1DD; font-size: 10" colspan="' . $colunas . '">Data do Arquivo: ' . Data::mostraData() . '</td></tr>'; $html .= '<tr><td colspan="' . $colunas . '"></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;">Nome do Projeto</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">Agente</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">Área</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">Segmento</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">UF</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">Município</th>'; if ($campo != 12) { $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">Situação</th>'; } $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">Vl. Solicitado</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">Vl. Aprovado</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">Vl. Captado</th>'; $html .= '<th style="border: 1px dotted black; background-color: #9BBB59;">Habilitado</th>'; $html .= '</tr>'; $ds = ''; $i = 1; foreach ($busca as $v) { if ($v->Situacao != $ds && $campo == 12) { $html .= '<tr><td style="border: 1px dotted black; background-color: #EAF1DD;" colspan="12">' . $v->Situacao . ' - ' . $v->dsSituacao . '</td></tr>'; } $html .= '<tr>'; $html .= '<td style="border: 1px dotted black;">' . $i . '</td>'; $html .= '<td style="border: 1px dotted black;">' . $v->Pronac . '</td>'; $html .= '<td style="border: 1px dotted black;">' . $v->NomeProjeto . '</td>'; $html .= '<td style="border: 1px dotted black;">' . $v->NomeAgente . '</td>'; $html .= '<td style="border: 1px dotted black;">' . $v->Area . '</td>'; $html .= '<td style="border: 1px dotted black;">' . $v->Segmento . '</td>'; $html .= '<td style="border: 1px dotted black;">' . $v->UfProjeto . '</td>'; $html .= '<td style="border: 1px dotted black;">' . $v->Municipio . '</td>'; if ($campo != 12) { $html .= '<td style="border: 1px dotted black;">' . $v->Situacao . ' - ' . $v->dsSituacao . '</td>'; } $html .= '<td style="border: 1px dotted black;">' . @number_format($v->ValorSolicitado, 2, ",", ".") . '</td>'; $html .= '<td style="border: 1px dotted black;">' . @number_format($v->ValorAprovado, 2, ",", ".") . '</td>'; $html .= '<td style="border: 1px dotted black;">' . @number_format($v->ValorCaptado, 2, ",", ".") . '</td>'; $html .= '<td style="border: 1px dotted black;">' . $v->Habilitado . '</td>'; $html .= '</tr>'; $i++; $ds = $v->Situacao; } $html .= '</table>'; header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: inline; filename=Resultado_Relatorio_Projetos.xls;"); echo $html; die; } else { $this->view->qtdRegistros = $total; $this->view->dados = $busca; $this->view->campo = $campo; $this->_helper->layout->disableLayout(); // Desabilita o Zend Layout } }