public function dadosetiquetaAction() { //ini_set('max_execution_time', 500); $this->_helper->layout->disableLayout(); // Desabilita o Zend Layout if (isset($_GET['pronac'])) { $pronac = $_GET['pronac']; $etiquetaApenas = "nao"; if (!empty($_GET['etiqueta'])) { $etiquetaApenas = $_GET['etiqueta']; } $this->view->etiquetaApenas = $etiquetaApenas; $barcodeOptions = array('text' => $pronac); $rendererOptions = array(); $documentRoot = explode("/index.php", $_SERVER["DOCUMENT_ROOT"] . $_SERVER["PHP_SELF"]); $documentRoot = str_replace("//", "/", $documentRoot[0]); $caminho = $documentRoot . "/public/barcode/imagem-" . $pronac . ".jpg"; // $caminho = "../public/barcode/imagem-".$pronac.".jpg"; $imageResource = Zend_Barcode::draw('code39', 'image', $barcodeOptions, $rendererOptions); imagejpeg($imageResource, $caminho); $caminhoView = "../public/barcode/imagem-" . $pronac . ".jpg"; $this->view->caminho = $caminhoView; $projetosDAO = new Projetos(); $consulta = array('pro.AnoProjeto + pro.Sequencial = ?' => $pronac); $resp = $projetosDAO->buscarEditalProjeto($consulta); $idPreProjeto = $resp->idPreProjeto; if (!empty($resp->idEdital)) { $this->view->edital = true; } else { $this->view->edital = false; } //DADOS DA ETIQUETA $dados = GerenciarparecertecnicoDAO::dadosEtiqueta($pronac); $this->view->DadosEtiqueta = $dados; $dao = new AnalisarPropostaDAO(); $this->view->itensGeral = $dao->buscarGeral($idPreProjeto); $propostaPorEdital = false; if ($this->view->itensGeral[0]->idEdital && $this->view->itensGeral[0]->idEdital != 0) { $propostaPorEdital = true; } $this->view->itensTelefone = $dao->buscarTelefone($this->view->itensGeral[0]->idAgente); $this->view->itensPlanosDistribuicao = $dao->buscarPlanoDeDistribucaoProduto($idPreProjeto); $this->view->itensFonteRecurso = $dao->buscarFonteDeRecurso($idPreProjeto); $this->view->itensLocalRealiazacao = $dao->buscarLocalDeRealizacao($idPreProjeto); $this->view->itensDeslocamento = $dao->buscarDeslocamento($idPreProjeto); $this->view->itensPlanoDivulgacao = $dao->buscarPlanoDeDivulgacao($idPreProjeto); $tblDocsPreProjeto = new tbDocumentosPreProjeto(); $rsDocsPreProjeto = $tblDocsPreProjeto->buscar(array("idProjeto = ?" => $idPreProjeto)); $this->view->itensDocumentoPreProjeto = $rsDocsPreProjeto; $this->view->itensDocumentoAgente = $dao->buscarDocumentoAgente($this->view->itensGeral[0]->idAgente); $this->view->itensHistorico = $dao->buscarHistorico($idPreProjeto); $this->view->itensPlanilhaOrcamentaria = $dao->buscarPlanilhaOrcamentaria($idPreProjeto); $buscarProduto = ManterorcamentoDAO::buscarProdutos($idPreProjeto); $this->view->Produtos = $buscarProduto; $buscarEtapa = ManterorcamentoDAO::buscarEtapasProdutos($idPreProjeto); $this->view->Etapa = $buscarEtapa; $buscarItem = ManterorcamentoDAO::buscarItensProdutos($idPreProjeto); $this->view->Item = $buscarItem; $this->view->AnaliseCustos = PreProjeto::analiseDeCustos($idPreProjeto); $this->view->idPreProjeto = $idPreProjeto; $buscarIdPronac = $projetosDAO->buscarIdPronac($pronac); $idPronac = $buscarIdPronac->IdPRONAC; $rst = $projetosDAO->buscarDadosUC75($idPronac); $this->view->projeto = $rst[0]; //UNIDADES DE ANÁLISE $vwProjetoDistribuidoVinculada = new vwProjetoDistribuidoVinculada(); $this->view->unidadesAnalise = $vwProjetoDistribuidoVinculada->buscarUnidades(array('Pronac = ?' => $pronac), array('Produto', 'DescricaoAnalise')); //VALORES DO PROJETO $planilhaproposta = new PlanilhaProposta(); $planilhaprojeto = new PlanilhaProjeto(); $planilhaAprovacao = new PlanilhaAprovacao(); $rsPlanilhaAtual = $planilhaAprovacao->buscar(array('IdPRONAC = ?' => $idPronac), array('dtPlanilha DESC'))->current(); $tpPlanilha = !empty($rsPlanilhaAtual) && $rsPlanilhaAtual->tpPlanilha == 'SE' ? 'SE' : 'CO'; $arrWhereSomaPlanilha = array(); $arrWhereSomaPlanilha['idPronac = ?'] = $idPronac; if ($this->bln_readequacao == "false") { $fonteincentivo = $planilhaproposta->somarPlanilhaProposta($idPreProjeto, 109); $outrasfontes = $planilhaproposta->somarPlanilhaProposta($idPreProjeto, false, 109); $parecerista = $planilhaprojeto->somarPlanilhaProjeto($idPreProjeto, 109); } else { $arrWhereFontesIncentivo = $arrWhereSomaPlanilha; $arrWhereFontesIncentivo['idPlanilhaItem <> ? '] = '206'; //elaboracao e agenciamento $arrWhereFontesIncentivo['tpPlanilha = ? '] = 'SR'; $arrWhereFontesIncentivo['stAtivo = ? '] = 'N'; $arrWhereFontesIncentivo['NrFonteRecurso = ? '] = '109'; $arrWhereFontesIncentivo["idPedidoAlteracao = (?)"] = new Zend_Db_Expr("(SELECT TOP 1 max(idPedidoAlteracao) from SAC.dbo.tbPlanilhaAprovacao where IdPRONAC = '{$idPronac}')"); $arrWhereFontesIncentivo["tpAcao <> ('E') OR tpAcao IS NULL "] = '(?)'; $fonteincentivo = $planilhaAprovacao->somarItensPlanilhaAprovacao($arrWhereFontesIncentivo); $arrWhereOutrasFontes = $arrWhereSomaPlanilha; $arrWhereOutrasFontes['idPlanilhaItem <> ? '] = '206'; //elaboracao e agenciamento $arrWhereOutrasFontes['tpPlanilha = ? '] = 'SR'; $arrWhereOutrasFontes['stAtivo = ? '] = 'N'; $arrWhereOutrasFontes['NrFonteRecurso <> ? '] = '109'; $arrWhereOutrasFontes["idPedidoAlteracao = (?)"] = new Zend_Db_Expr("(SELECT TOP 1 max(idPedidoAlteracao) from SAC.dbo.tbPlanilhaAprovacao where IdPRONAC = '{$idPronac}')"); $arrWhereOutrasFontes["tpAcao <> ('E') OR tpAcao IS NULL "] = '(?)'; $outrasfontes = $planilhaAprovacao->somarItensPlanilhaAprovacao($arrWhereOutrasFontes); $arrWherePlanilhaPA = $arrWhereSomaPlanilha; $arrWherePlanilhaPA['idPlanilhaItem <> ? '] = '206'; //elaboracao e agenciamento $arrWherePlanilhaPA['tpPlanilha = ? '] = 'PA'; $arrWherePlanilhaPA['stAtivo = ? '] = 'N'; $arrWherePlanilhaPA['NrFonteRecurso = ? '] = '109'; $arrWherePlanilhaPA["idPedidoAlteracao = (?)"] = new Zend_Db_Expr("(SELECT TOP 1 max(idPedidoAlteracao) from SAC.dbo.tbPlanilhaAprovacao where IdPRONAC = '{$idPronac}')"); $arrWherePlanilhaPA["tpAcao <> ('E') OR tpAcao IS NULL "] = '(?)'; $parecerista = $planilhaAprovacao->somarItensPlanilhaAprovacao($arrWherePlanilhaPA); } //valor do componetne $arrWhereSomaPlanilha = array(); $arrWhereSomaPlanilha['idPronac = ?'] = $idPronac; $arrWhereSomaPlanilha['idPlanilhaItem <> ? '] = '206'; //elaboracao e agenciamento $arrWhereSomaPlanilha['tpPlanilha = ? '] = $tpPlanilha; $arrWhereSomaPlanilha['NrFonteRecurso = ? '] = '109'; $arrWhereSomaPlanilha['stAtivo = ? '] = 'S'; $componente = $planilhaAprovacao->somarItensPlanilhaAprovacao($arrWhereSomaPlanilha); $valoresProjeto = new ArrayObject(); $valoresProjeto['fontesincentivo'] = $fonteincentivo['soma']; $valoresProjeto['outrasfontes'] = $outrasfontes['soma']; $valoresProjeto['valorproposta'] = $fonteincentivo['soma'] + $outrasfontes['soma']; $valoresProjeto['valorparecerista'] = $parecerista['soma']; $valoresProjeto['valorcomponente'] = $componente['soma']; $this->view->valoresDoProjeto = $valoresProjeto; $tblCaptacao = new Captacao(); $rsCount = $tblCaptacao->buscaCompleta(array('idPronac = ?' => $idPronac), array(), null, null, true); $this->view->totalGeralCaptado = $rsCount->totalGeralCaptado; /***************** FIM - MODO NOVO ********************/ if ($propostaPorEdital) { $tbFormDocumentoDAO = new tbFormDocumento(); $edital = $tbFormDocumentoDAO->buscar(array('idEdital = ?' => $this->view->itensGeral[0]->idEdital, 'idClassificaDocumento not in (?,24,25)' => 23)); $arrPerguntas = array(); $arrRespostas = array(); $tbPerguntaDAO = new tbPergunta(); $tbRespostaDAO = new tbResposta(); foreach ($edital as $registro) { $questoes = $tbPerguntaDAO->montarQuestionario($registro["nrFormDocumento"], $registro["nrVersaoDocumento"]); $questionario = ''; if (is_object($questoes) and count($questoes) > 0) { foreach ($questoes as $questao) { $resposta = ''; $where = array('nrFormDocumento = ?' => $registro["nrFormDocumento"], 'nrVersaoDocumento = ?' => $registro["nrVersaoDocumento"], 'nrPergunta = ?' => $questao->nrPergunta, 'idProjeto = ?' => $idPreProjeto); $resposta = $tbRespostaDAO->buscar($where); $arrPerguntas[$registro["nrFormDocumento"]]["titulo"] = $registro["nmFormDocumento"]; $arrPerguntas[$registro["nrFormDocumento"]]["pergunta"][] = $questao->toArray(); $arrRespostas[] = $resposta->toArray(); } } } $this->view->perguntas = $arrPerguntas; $this->view->respostas = $arrRespostas; } } if (isset($_POST['html']) && isset($_POST['pronac']) && isset($_POST['caminho'])) { ini_set('max_execution_time', 500); $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); /* converte para lê os arquivos html do word */ //$html = mb_convert_encoding($_POST['html'], 'UTF-8', 'HTML-ENTITIES'); //$html = $this->strip_quotes($this->unhtmlentities($_POST['html'])); $filter = new Zend_Filter(); //$filter->addFilter(new Zend_Filter_Alnum()); //$filter->addFilter(new Zend_Filter_Alpha()); //$filter->addFilter(new Zend_Filter_Digits()); //$filter->addFilter(new Zend_Filter_HtmlEntities()); $filter->addFilter(new Zend_Filter_StringTrim()); $filter->addFilter(new Zend_Filter_StripTags()); // $html = $filter->filter($_POST['html']); $html = $_POST['html']; // echo $html; // die; $pdf = new PDFCreator($html); // $pdf = new PDF($html, 'pdf'); $pdf->gerarPdf(); // $pdf->gerarRelatorio(); // die; /* $html = $_POST['html']; $pdf = new PDF($html, 'pdf'); echo $pdf->gerarRelatorio();*/ } }
private function excluirQuestionario() { if (!$_POST) { $nrVersaoDocumento = $_GET['nrVersaoDocumento']; $nrFormDocumento = $_GET['nrFormDocumento']; $where = array('nrFormDocumento = ?' => $nrFormDocumento, 'nrVersaoDocumento = ?' => $nrVersaoDocumento); } else { $nrVersaoDocumento = $_POST['nrVersaoDocumento']; $nrFormDocumento = $_POST['nrFormDocumento']; $where = array('nrFormDocumento = ?' => $nrFormDocumento, 'nrVersaoDocumento = ?' => $nrVersaoDocumento); } $tbRespostaDAO = new tbResposta(); $tbOpcaoRespostaDAO = new tbOpcaoResposta(); $tbPerguntaFormDoctoDAO = new tbPerguntaFormDocto(); $tbPerguntaDAO = new tbPergunta(); if (count($tbRespostaDAO->buscar($where)) == 0) { return array(true, ''); } else { if ($tbRespostaDAO->delete($where)) { if (count($tbOpcaoRespostaDAO->buscar($where)) == 0) { return array(true, ''); } else { if ($tbOpcaoRespostaDAO->delete($where)) { $listaPerguntaFormDocto = $tbPerguntaFormDoctoDAO->buscar($where); $verificar = false; if (is_object($listaPerguntaFormDocto)) { foreach ($listaPerguntaFormDocto as $pergunta) { if ($tbPerguntaDAO->delete(array('nrPergunta = ?' => $pergunta->nrPergunta))) { $verificar = true; } else { $verificar = false; } } } else { $verificar = true; } if ($verificar) { if ($tbPerguntaFormDoctoDAO->delete($where)) { return array(true, ''); } else { return array(false, "Erro ao tentar excluir a Pergunta Form Docto."); } } else { return array(false, "Erro ao tentar excluir a Pergunta."); } } else { return array(false, "Erro ao tentar excluir a Opcao Resposta."); } } } else { return array(false, "Erro ao tentar excluir a Resposta."); } } }
public function imprimirpropostaculturalAction() { $this->_helper->layout->disableLayout(); $idPreProjeto = $this->idPreProjeto; $dao = new AnalisarPropostaDAO(); $this->view->itensGeral = AnalisarPropostaDAO::buscarGeral($idPreProjeto); $propostaPorEdital = false; if ($this->view->itensGeral[0]->idEdital && $this->view->itensGeral[0]->idEdital != 0) { $propostaPorEdital = true; } $this->view->itensTelefone = AnalisarPropostaDAO::buscarTelefone($this->view->itensGeral[0]->idAgente); $this->view->itensPlanosDistribuicao = AnalisarPropostaDAO::buscarPlanoDeDistribucaoProduto($idPreProjeto); $this->view->itensFonteRecurso = AnalisarPropostaDAO::buscarFonteDeRecurso($idPreProjeto); $this->view->itensLocalRealiazacao = AnalisarPropostaDAO::buscarLocalDeRealizacao($idPreProjeto); $this->view->itensDeslocamento = AnalisarPropostaDAO::buscarDeslocamento($idPreProjeto); $this->view->itensPlanoDivulgacao = AnalisarPropostaDAO::buscarPlanoDeDivulgacao($idPreProjeto); $tblAvaliacaoProposta = new AvaliacaoProposta(); $rsAvaliacaoProposta = $tblAvaliacaoProposta->buscar(array("idProjeto = ?" => $idPreProjeto, "idArquivo ?" => new Zend_Db_Expr("IS NOT NULL"))); $tbArquivo = new tbArquivo(); $arrDadosArquivo = array(); $arrRelacionamentoAvaliacaoDocumentosExigidos = array(); if (count($rsAvaliacaoProposta) > 0) { foreach ($rsAvaliacaoProposta as $avaliacao) { $arrDadosArquivo[$avaliacao->idArquivo] = $tbArquivo->buscar(array("idArquivo = ?" => $avaliacao->idArquivo)); $arrRelacionamentoAvaliacaoDocumentosExigidos[$avaliacao->idArquivo] = $avaliacao->idCodigoDocumentosExigidos; } } $this->view->relacionamentoAvaliacaoDocumentosExigidos = $arrRelacionamentoAvaliacaoDocumentosExigidos; $this->view->itensDocumentoPreProjeto = $arrDadosArquivo; //PEGANDO RELACAO DE DOCUMENTOS EXIGIDOS(GERAL, OU SEJA, TODO MUNDO) $tblDocumentosExigidos = new DocumentosExigidos(); $rsDocumentosExigidos = $tblDocumentosExigidos->buscar()->toArray(); $arrDocumentosExigidos = array(); foreach ($rsDocumentosExigidos as $documentoExigido) { $arrDocumentosExigidos[$documentoExigido["Codigo"]] = $documentoExigido; } $this->view->documentosExigidos = $arrDocumentosExigidos; $this->view->itensHistorico = AnalisarPropostaDAO::buscarHistorico($idPreProjeto); /* * PEGANDO DOCUMENTOS ANEXADOS */ $tblAvaliacaoProposta = new AvaliacaoProposta(); $rsAvaliacaoProposta = $tblAvaliacaoProposta->buscar(array("idProjeto = ?" => $idPreProjeto, "idArquivo ?" => new Zend_Db_Expr("IS NOT NULL"))); $tbArquivo = new tbArquivo(); $arrDadosArquivo = array(); $arrRelacionamentoAvaliacaoDocumentosExigidos = array(); if (count($rsAvaliacaoProposta) > 0) { foreach ($rsAvaliacaoProposta as $avaliacao) { $arrDadosArquivo[$avaliacao->idArquivo] = $tbArquivo->buscar(array("idArquivo = ?" => $avaliacao->idArquivo)); $arrRelacionamentoAvaliacaoDocumentosExigidos[$avaliacao->idArquivo] = $avaliacao->idCodigoDocumentosExigidos; } } //x($arrRelacionamentoAvaliacaoDocumentosExigidos); $this->view->relacionamentoAvaliacaoDocumentosExigidos = $arrRelacionamentoAvaliacaoDocumentosExigidos; $this->view->itensDocumentoPreProjeto = $arrDadosArquivo; //PEGANDO RELACAO DE DOCUMENTOS EXIGIDOS(GERAL, OU SEJA, TODO MUNDO) $tblDocumentosExigidos = new DocumentosExigidos(); $rsDocumentosExigidos = $tblDocumentosExigidos->buscar()->toArray(); $arrDocumentosExigidos = array(); foreach ($rsDocumentosExigidos as $documentoExigido) { $arrDocumentosExigidos[$documentoExigido["Codigo"]] = $documentoExigido; } //xd($arrDocumentosExigidos); $this->view->documentosExigidos = $arrDocumentosExigidos; //xd($rsDocumentosExigidos); /* * FINAL - PEGANDO DOCUMENTOS ANEXADOS */ $this->view->itensPlanilhaOrcamentaria = $dao->buscarPlanilhaOrcamentaria($idPreProjeto); $buscarProduto = ManterorcamentoDAO::buscarProdutos($this->idPreProjeto); $this->view->Produtos = $buscarProduto; $buscarEtapa = ManterorcamentoDAO::buscarEtapasProdutos($this->idPreProjeto); $this->view->Etapa = $buscarEtapa; $buscarItem = ManterorcamentoDAO::buscarItensProdutos($this->idPreProjeto); $this->view->Item = $buscarItem; $this->view->AnaliseCustos = PreProjeto::analiseDeCustos($this->idPreProjeto); $this->view->idPreProjeto = $this->idPreProjeto; //========== inicio codigo dirigente ================ /*==================================================*/ $arrMandatos = array(); $this->view->mandatos = $arrMandatos; $preProjeto = new PreProjeto(); $rsDirigentes = array(); $Empresa = $preProjeto->buscar(array('idPreProjeto = ?' => $this->idPreProjeto))->current(); $idEmpresa = $Empresa->idAgente; if (isset($this->view->itensGeral[0]->CNPJCPFdigirente) && $this->view->itensGeral[0]->CNPJCPFdigirente != "") { $tblAgente = new Agentes(); $tblNomes = new Nomes(); foreach ($this->view->itensGeral as $v) { $rsAgente = $tblAgente->buscarAgenteNome(array('CNPJCPF=?' => $v->CNPJCPFdigirente))->current(); $rsDirigentes[$rsAgente->idAgente]['CNPJCPFDirigente'] = $rsAgente->CNPJCPF; $rsDirigentes[$rsAgente->idAgente]['idAgente'] = $rsAgente->idAgente; $rsDirigentes[$rsAgente->idAgente]['NomeDirigente'] = $rsAgente->Descricao; } $tbDirigenteMandato = new tbAgentesxVerificacao(); foreach ($rsDirigentes as $dirigente) { $rsMandato = $tbDirigenteMandato->listarMandato(array('idEmpresa = ?' => $idEmpresa, 'idDirigente = ?' => $dirigente['idAgente'], 'stMandato = ?' => 0)); $NomeDirigente = $dirigente['NomeDirigente']; $arrMandatos[$NomeDirigente] = $rsMandato; } } //$tbDirigentes = $geral->buscarDirigentes($idPronac); $this->view->dirigentes = $rsDirigentes; $this->view->mandatos = $arrMandatos; //============== fim codigo dirigente ================ /*==================================================*/ if ($propostaPorEdital) { $tbFormDocumentoDAO = new tbFormDocumento(); $edital = $tbFormDocumentoDAO->buscar(array('idEdital = ?' => $this->view->itensGeral[0]->idEdital, 'idClassificaDocumento = ?' => $this->COD_CLASSIFICACAO_DOCUMENTO)); $arrPerguntas = array(); $arrRespostas = array(); $tbPerguntaDAO = new tbPergunta(); $tbRespostaDAO = new tbResposta(); foreach ($edital as $registro) { $questoes = $tbPerguntaDAO->montarQuestionario($registro["nrFormDocumento"], $registro["nrVersaoDocumento"]); $questionario = ''; if (is_object($questoes) and count($questoes) > 0) { foreach ($questoes as $questao) { $resposta = ''; $where = array('nrFormDocumento = ?' => $registro["nrFormDocumento"], 'nrVersaoDocumento = ?' => $registro["nrVersaoDocumento"], 'nrPergunta = ?' => $questao->nrPergunta, 'idProjeto = ?' => $this->idPreProjeto); $resposta = $tbRespostaDAO->buscar($where); $arrPerguntas[$registro["nrFormDocumento"]]["titulo"] = $registro["nmFormDocumento"]; $arrPerguntas[$registro["nrFormDocumento"]]["pergunta"][] = $questao->toArray(); $arrRespostas[] = $resposta->toArray(); } } } $this->view->perguntas = $arrPerguntas; $this->view->respostas = $arrRespostas; $this->montaTela("admissibilidade/imprimir-proposta-por-edital.phtml"); } else { $this->montaTela("admissibilidade/imprimir-proposta-por-incentivo-fiscal.phtml"); } }
public function salvarprojetoAction() { $idusuario = $this->idusuario; $tblRes = new tbResposta(); if ($_POST) { //xd($_POST); // pega o id do edital $tbFormDocumento = new tbFormDocumento(); $idEdital = $tbFormDocumento->buscar(array('nrFormDocumento = ?' => $_POST['nrFormDocumento'], 'nrVersaoDocumento = ?' => $_POST['nrVersaoDocumento']))->current()->toArray(); $idEdital = $idEdital['idEdital']; // pega os documentos de critérios $criterios = $tbFormDocumento->buscar(array('idEdital = ?' => $idEdital, 'idClassificaDocumento = ?' => 25))->toArray(); // varre todos os critérios e adiciona na tbFormDocumentoProjeto $tbFormDocumentoProjeto = new tbFormDocumentoProjeto(); /*foreach ($criterios as $c) { $buscarFormDocumentoProjeto = $tbFormDocumentoProjeto->buscar( array('nrFormDocumento = ?' => $c['nrFormDocumento']) )->toArray(); if (count($buscarFormDocumentoProjeto) <= 0) : // cadastra na tbFormDocumentoProjeto $dadosFormDocumentoProjeto = array( 'nrFormDocumento' => $c['nrFormDocumento'] ,'nrVersaoDocumento' => $_POST['nrVersaoDocumento'] ,'idProjeto' => $_POST['idPreProjeto'] ,'idPessoaCadastro' => $idusuario ,'dtIniValidade' => '1900-01-01' ,'dtFimValidade' => '1900-01-01' ); $tbFormDocumentoProjeto->inserir($dadosFormDocumentoProjeto); endif; } // endforeach*/ $where = array('idProjeto = ?' => $_POST['idPreProjeto'], 'idPessoaCadastro = ?' => $idusuario); $notas = 0; $contPeso = 0; $totalPeso = 0; foreach ($_POST['perguntas'] as $value) { $notas += (double) $_POST['nota_' . $value] * (double) $_POST['nrPeso'][$contPeso]; $totalPeso += (double) $_POST['nrPeso'][$contPeso]; $contPeso++; $where['nrOpcao = ?'] = $_POST['Opcao_' . $value]; $verifica = $tblRes->buscar($where); if (count($verifica) >= 1) { $dados = array('dtResposta' => date('Y-m-d H:i:s'), 'dsRespostaSubj' => $_POST['nota_' . $value]); try { $tblRes->alterar($dados, $where); } catch (Exception $e) { parent::message("Falha ao salvar avaliação", "Avaliarprojetos/index", "ERROR"); } } else { /*$dados = array( 'nrFormDocumento' => $_POST['nrFormDocumento'], 'nrVersaoDocumento' => $_POST['nrVersaoDocumento'], 'nrPergunta' => $value, 'nrOpcao' => $_POST['Opcao_'.$value], 'idPessoaCadastro' => $idusuario, 'dtResposta ' => new Zend_Db_Expr('GETDATE()'), 'idProjeto' => $_POST['idPreProjeto'], 'dsRespostaSubj' => $_POST['nota_'.$value] );*/ //xd($dados); /*try{ $tblRes->inserir($dados); }catch (Exception $e){ parent::message("Falha ao salvar avaliação", "avaliarprojetos/index", "ERROR"); }*/ } } // parent::message("Dados salvos com sucesso!", "avaliarprojetos/index", "CONFIRM"); $tbAvaliacaoPreProjeto = new tbAvaliacaoPreProjeto(); $dadosAvaliacao = array('idPreProjeto' => $_POST['idPreProjeto'], 'idAvaliador' => $this->idusuario, 'nrNotaFinal' => number_format($notas / $totalPeso, 2, '.', ''), 'dtAvaliacao' => new Zend_Db_Expr('GETDATE()'), 'stAvaliacao' => 0); //xd($dadosAvaliacao); try { $tbAvaliacaoPreProjeto->inserir($dadosAvaliacao); parent::message("Dados salvos com sucesso!", "avaliarprojetos/index", "CONFIRM"); } catch (Exception $e) { parent::message("Falha ao salvar avaliação", "avaliarprojetos/index", "ERROR"); } } else { parent::message("Dados inválidos", "avaliarprojetos/index", "ERROR"); } }