public function GravarPergunta($pedidoInformacao) { try { $query = "INSERT INTO " . MYSQL_BASE_PEDIDO_INFORMACAO_ARQUIVO . " (id, id_pedido_informacao, id_lista_arquivo, pergunta, file, dat_pergunta) "; $query .= "VALUES (NULL, ?, ?, ?, ?, NOW())"; $stmt = $this->p->prepare($query); $stmt->bindValue(1, $pedidoInformacao->getPedidoInformacao()); $stmt->bindValue(2, $pedidoInformacao->getListaArquivo()); $stmt->bindValue(3, $pedidoInformacao->getPergunta()); $stmt->bindValue(4, $pedidoInformacao->getFile()); if (!$stmt->execute()) { return $stmt->errorInfo(); } else { $DAO = new PedidoInformacaoDAO(); connectSQL(); // return $this->p->lastInsertId(); $sql_remessa = mysql_query("SELECT\r\n\t\t\t\t\t\t\t\t\t\t \tA.id_remessa_lista, \r\n\t\t\t\t\t\t\t\t\t\t \tB.id_nucleo, \r\n\t\t\t\t\t\t\t\t\t\t\tB.id_contrato, \r\n\t\t\t\t\t\t\t\t\t\t\tB.id_obra, \r\n\t\t\t\t\t\t\t\t\t\t\tB.id_trecho, \r\n\t\t\t\t\t\t\t\t\t\t\tB.id_fase_projeto,\r\n\t\t\t\t\t\t\t\t\t\t\tB.id_disciplina,\r\n\t\t\t\t\t\t\t\t\t\t\tB.id_tipo_documento,\r\n\t\t\t\t\t\t\t\t\t\t\tB.sequencial \r\n\t\t\t\t\t\t\t\t\t\tFROM " . MYSQL_BASE_REMESSA_ARQUIVOS . " A\r\n\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_REMESSA_LISTAS . " B ON A.id_remessa_lista = B.id\r\n\t\t\t\t\t\t\t\t\tWHERE A.excluido IS NULL\r\n\t\t\t\t\t\t\t\t\tAND A.id = " . $pedidoInformacao->getListaArquivo()); while ($item = mysql_fetch_array($sql_remessa)) { $id_remessa_lista = $item['id_remessa_lista']; $id_obra = $item['id_remessa_lista']; $id_fase = $item['id_fase_projeto']; $id_disciplina = $item['id_disciplina']; $id_tipo_doc = $item['id_tipo_documento']; $sequencial = $item['id_tipo_documento']; } $sql_pi = mysql_query("SELECT criado\r\n\t\t\t\t\t\t\t\t\tFROM " . MYSQL_BASE_PEDIDO_INFORMACAO . "\r\n\t\t\t\t\t\t\t\t\tWHERE excluido IS NULL\r\n\t\t\t\t\t\t\t\t\tAND id = " . $pedidoInformacao->getPedidoInformacao() . " LIMIT 1"); while ($item = mysql_fetch_array($sql_pi)) { $data_pi = $item['criado']; } $sql = mysql_query("SELECT id_cad_projeto \r\n\t\t\t\t\t\t\t\t\tFROM " . MYSQL_BASE_PROJETO_CADASTRO . "\r\n\t\t\t\t\t\t\t\t\tWHERE excluido IS NULL\r\n\t\t\t\t\t\t\t\t\tAND id_obra = " . $id_obra . "\r\n\t\t\t\t\t\t\t\t\tAND id_fase = " . $id_fase . "\r\n\t\t\t\t\t\t\t\t\tAND id_disciplina = " . $id_disciplina . "\r\n\t\t\t\t\t\t\t\t\tAND id_tipo_doc = " . $id_tipo_doc . "\r\n\t\t\t\t\t\t\t\t\tAND id_nucleo IS NULL\r\n\t\t\t\t\t\t\t\t\tAND numero = " . $sequencial . " LIMIT 1"); while ($item = mysql_fetch_array($sql)) { $id_projeto_cad = $item['id_cad_projeto']; } $resultado = $DAO->AtualizarProjetoTerceirizada($pedidoInformacao->getPedidoInformacao(), $data_pi, $id_projeto_cad); return 1; } // fecho a conex���o $this->p->__destruct(); // caso ocorra um erro, retorna o erro; } catch (PDOException $ex) { echo "Mensagem de erro: " . $ex->getMessage(); } }
<style> table, th, td { border: 1px solid black; border-collapse: collapse; margin: 0 5px 0 5px; } th, td { padding: 10px; } </style> <?php include_once 'includes.sys/ini.php'; include_once 'includes.sys/metodos.php'; include_once 'remessa/DAO/PedidoInformacaoDAO.php'; connectSQL(); $DAO = new PedidoInformacaoDAO(); $array = array(10, 8, 9); $count = 0; foreach ($array as $item) { //Montando o corpo do e-mail $query = mysql_query("SELECT\r\n\t\t\t\t\t\t\tA.id as ck_id,\r\n\t\t\t\t\t\t\tH.nome as fase,\r\n\t\t\t\t\t\t\tE.codigo as cod_disciplina,\r\n\t\t\t\t\t\t\tE.nome as disciplina,\r\n\t\t\t\t\t\t\tF.codigo as cod_obra,\r\n\t\t\t\t\t\t\tF.nome as obra,\r\n\t\t\t\t\t\t\tA.revisao,\r\n\t\t\t\t\t\t\tP1.nome_completo as verificador,\r\n\t\t\t\t\t\t\tP2.nome_completo as aprovador,\r\n\t\t\t\t\t\t\tDATE_FORMAT(A.criado, '%d/%m/%Y') as criado,\r\n\t\t\t\t\t\t\tDATE_FORMAT(A.aprovado, '%d/%m/%Y') as aprovado,\r\n\t\t\t\t\t\t\tG.pergunta,\r\n\t\t\t\t\t\t\tD.id as id_lista,\r\n\t\t\t\t\t\t\tA.aprovado_por\r\n\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t" . MYSQL_BASE_CHECK_LISTS . " A\r\n\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_REMESSA_ARQUIVOS . " B ON B.file = CONCAT('../', A.nome_arquivo)\r\n\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_REMESSA_LISTAS . " D ON D.id = B.id_remessa_lista\r\n\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_DISCIPLINAS . " E ON E.id = A.id_disciplina\r\n\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_PROJETO_OBRA . " F ON F.id = A.id_obra_codigo\r\n\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_PEDIDO_INFORMACAO_ARQUIVO . " G ON G.id_lista_arquivo = B.id\r\n\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_EMPRESAS . " I ON D.id_empresa = I.id\r\n\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_FASE_PROJETOS . " H ON H.id = A.id_fase_projeto\r\n\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_PESSOAS . " P1 ON P1.id = A.id_usuario\r\n\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_PESSOAS . " P2 ON P2.id = A.aprovado_supervisor\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\tA.aprovado IS NOT NULL AND \r\n\t\t\t\t\t\t\tA.aprovado_por IN (2,3) AND \r\n\t\t\t\t\t\t\tI.id = " . $item . " AND\r\n\t\t\t\t\t\t\t(A.email_pi = 'N' OR A.email_pi IS NULL)\r\n\t\t\t\t\t\tGROUP BY D.id"); $num = mysql_num_rows($query); $count += 1; if ($num == 0) { //Se nao tiver nem um projeto para enviar e-mail ele pula para a proxima linha do foreach continue; } if ($num == 1) { $msg = "Existe PI para ser analisada:<br><br>"; } else { $msg = utf8_encode("Existem PI's para serem analisadas:<br><br>");
<?php include_once '../../includes.sys/ini.php'; include_once '../../includes.sys/metodos.php'; include_once '../PedidoInformacao.class.php'; include_once '../DAO/PedidoInformacaoDAO.php'; checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true'); if (!in_array(234, listarAcesso())) { echo '<script language= "JavaScript">location.href="index.php";</script>'; } $pedidoInformacao = new PedidoInformacao(); $DAO = new PedidoInformacaoDAO(); $pedidoInformacao->setId(limpaTexto($_GET['id'])); $id_empresa = 0; $resultado = $DAO->Listar("SELECT \r\n\t\t\t\t\t\t\t\tpi.*, e.nome, \r\n\t\t\t\t\t\t\t\t(SELECT nome_completo FROM " . MYSQL_BASE_PESSOAS . " WHERE id = pi.id_responsavel) as responsavel, p.nome_completo FROM " . MYSQL_BASE_PEDIDO_INFORMACAO . " pi, \r\n\t\t\t\t\t\t\t" . MYSQL_BASE_EMPRESAS . " e, " . MYSQL_BASE_PESSOAS . " p WHERE pi.id_usuario = p.id AND pi.id_empresa = e.id AND pi.id = " . $pedidoInformacao->getId()); foreach ($resultado as $item) { $pedidoInformacao->setEmpresa($item['nome']); $pedidoInformacao->setResponsavel($item['responsavel']); $pedidoInformacao->setUsuario($item['nome_completo']); $pedidoInformacao->setAssunto($item['assunto']); $pedidoInformacao->setCriado(dataBrasil($item['criado'], null)); $pedidoInformacao->setFinalizado(""); $id_empresa = $item['id_empresa']; $id_responsavel = $item['id_responsavel']; $id_usuario = $item['id_usuario']; if (!empty($item['fim'])) { $pedidoInformacao->setFinalizado(dataBrasil($item['fim'], false)); } } ?>
$conteudo = $msg; $mensagem->setAssunto($assunto); $mensagem->setUsuario($id_pessoa); $mensagem->setConteudo($conteudo); if ($checkList->getAprovadoPor() == 1 || $checkList->getAprovadoPor() == 3) { $destinatario = $DAOMsg->Listar("SELECT DISTINCT B.id\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . MYSQL_BASE_LOG_DOWNLOAD . " A\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_PESSOAS . " B ON B.id = A.id_usuario\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_USUARIOS . " C ON C.id_pessoa = B.id\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE A.arquivo LIKE '%" . $arquivo . "%'"); } else { $destinatario = $DAOMsg->Listar("SELECT DISTINCT B.id\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . MYSQL_BASE_CHECK_LISTS . " A\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_PESSOAS . " B ON B.id = A.id_usuario\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_USUARIOS . " C ON C.id_pessoa = B.id\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE A.id=" . $checkList->getId()); } foreach ($destinatario as $item) { $mensagem->setDestinatario($item['id']); $retorno_msg = $DAOMsg->Gravar($mensagem); } if ($checkList->getAprovadoPor() == 2 || $checkList->getAprovadoPor() == 3) { $pedido = new PedidoInformacao(); $DAO_Pedido = new PedidoInformacaoDAO(); if ($checkList->getAprovadoPor() == 2) { $pedido->setAssunto("Projeto Reprovado"); } else { $pedido->setAssunto("Projeto Aprovado com comentários"); } $resultado = $DAO->Listar("SELECT \r\n\t\t\t\t\t\t\t\t\t\t\t\t\tC.id as responsavel,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tC.nome_completo,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tC.email,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tD.id_empresa,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tB.id,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tB.id_remessa_lista\r\n\t\t\t\t\t\t\t\t\t\t\t\tFROM \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t" . MYSQL_BASE_CHECK_LISTS . " A\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_REMESSA_ARQUIVOS . " B ON B.file = CONCAT('../', A.nome_arquivo)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_PESSOAS . " C ON C.id = B.id_usuario\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_REMESSA_LISTAS . " D ON D.id = B.id_remessa_lista\r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tA.id = " . $checkList->getId()); foreach ($resultado as $item) { $pedido->setResponsavel($item['responsavel']); $pedido->setUsuario(userId()); $pedido->setListaArquivo($item['id']); $pedido->setLista($item['id_remessa_lista']); $pedido->setPergunta($checkList->getConsideracoes()); $pedido->setEmpresa($item['id_empresa']); } $pedido->setPedidoInformacao($DAO_Pedido->Gravar($pedido));
<?php include_once '../../includes.sys/ini.php'; include_once '../../includes.sys/metodos.php'; include_once '../DAO/PedidoInformacaoDAO.php'; include_once '../PedidoInformacao.class.php'; checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true'); include_once '../../head.php'; $pedidoInformacao = new PedidoInformacao(); $DAO = new PedidoInformacaoDAO(); $pedidoInformacao->setId(limpaTexto($_GET['lista'])); if (!in_array(213, listarAcesso())) { echo '<script language= "JavaScript">location.href="' . EXTERNAL_ROOT_PORTAL . '/modulos.php";</script>'; } if (!empty($_POST['cmd']) && $_POST['cmd'] == 'responder') { $post = $_POST; $id_pi = $_POST['id']; foreach (array_keys($post) as $row) { $pedidoInformacao->setIdArquivo($row); $pedidoInformacao->setResposta($post[$row]); /*Inicio - Anexar arquivo*/ if ($_FILES['file']['error'] != 4) { $name = $_FILES['file']['name']; $tmp_name = $_FILES['file']['tmp_name']; $uploadDir = '../../arquivos/pedido_informacao/'; $uploadFile = $uploadDir . $name; $query = mysql_query("SELECT id FROM " . MYSQL_BASE_PEDIDO_INFORMACAO_ARQUIVO . " WHERE file = '" . $name . "' AND dat_excluido IS NULL"); $num = mysql_num_rows($query); if ($num > 0) { $msg_erro .= "J� existe um arquivo com esse mesmo nome na base de dados."; echo '<script language= "JavaScript">alert("' . $msg_erro . '");</script>';
<?php include_once '../../includes.sys/ini.php'; include_once '../../includes.sys/metodos.php'; include_once '../DAO/PedidoInformacaoDAO.php'; include_once '../PedidoInformacao.class.php'; checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true'); include_once '../../head.php'; $pedido = new PedidoInformacao(); $DAO = new PedidoInformacaoDAO(); if (!in_array(212, listarAcesso())) { echo '<script language= "JavaScript">location.href="' . EXTERNAL_ROOT_PORTAL . '/modulos.php";</script>'; } if (!empty($_POST['cmd']) && $_POST['cmd'] == 'inserir') { $pedido->setLista($_POST['lista']); $pedido->setAssunto(limpaTexto($_POST['assunto'])); $lista_info = $DAO->Listar("SELECT rl.*, nome_completo as responsavel FROM " . MYSQL_BASE_REMESSA_LISTAS . " rl\r\n\t\t\t\t\t\t\t\tINNER JOIN \r\n\t\t\t\t\t\t\t\t\t" . MYSQL_BASE_PESSOAS . " p ON rl.id_usuario = p.id \r\n\t\t\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t\t\t\texcluido IS NULL AND rl.id= " . $pedido->getLista()); foreach ($lista_info as $lista) { $pedido->setResponsavel($lista['id_usuario']); $pedido->setEmpresa($lista['id_empresa']); $pedido->setUsuario($lista['responsavel']); } if ($pedido->getLista() != '') { if ($pedido->getAssunto() != '') { $retorno = $DAO->Gravar($pedido); if ($retorno > 0) { $post = $_POST; foreach (array_keys($post) as $row) { $explode = explode("-", $row); if ($explode[0] == 'pergunta' && !empty($post[$row]) && $post['selecionado' . $explode[1]] == '1') { $pedido->setPedidoInformacao($retorno);
function listar($id = null) { $DAO = new PedidoInformacaoDAO(); $sql = $DAO->Listar("SELECT * FROM " . MYSQL_BASE_REMESSA_LISTAS . " WHERE excluido IS NULL"); foreach ($sql as $pedido) { if ($id == $pedido['id']) { echo '<option selected="selected" value="' . $pedido['id'] . '">Lista ' . $pedido['id'] . '</option>'; } else { echo '<option value="' . $pedido['id'] . '">Lista ' . $pedido['id'] . '</option>'; } } }
<?php include_once '../../includes.sys/ini.php'; include_once '../../includes.sys/metodos.php'; include_once '../DAO/PedidoInformacaoDAO.php'; include_once '../PedidoInformacao.class.php'; checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true'); include_once '../../head.php'; $pedido = new PedidoInformacao(); $DAO = new PedidoInformacaoDAO(); $acesso = listarAcesso(); if (!in_array(211, $acesso)) { echo '<script language= "JavaScript">location.href="' . EXTERNAL_ROOT_PORTAL . '/modulos.php";</script>'; } if (!empty($_GET['cmd']) && $_GET['cmd'] == 'del') { $id = ValidateInteger(INPUT_GET, 'id'); $retorno = $DAO->Deletar($id); $retorno2 = $DAO->DeletarArquivo($id); if ($retorno == 1 && $retorno2 == 1) { echo '<script language= "JavaScript">alert("Registro removido com sucesso");</script>'; echo '<script language= "JavaScript">location.href="index.php";</script>'; } else { echo '<script language= "JavaScript">alert("Erro ao remover o registro.");</script>'; } } if (!empty($_GET['cmd']) && $_GET['cmd'] == 'compact') { $pedido->zipar(limpaTexto($_GET['id'])); } ?> <!-- topbar ends --> <div class="container-fluid">
if ($fluxo->getFinaliza() == 'S') { $status_cliente = "A"; } elseif ($fluxo->getFinaliza() == 'SC') { $status_cliente = "AC"; } else { $status_cliente = "R"; } if ($status_cliente == "R" || ($status_cliente = "AC")) { if ($status_cliente == "AC") { $complemento = "Reprovou"; } else { $complemento = "Aprovou com comentário"; } $query = mysql_query("SELECT\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tD.cod_documento,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tRA.id_remessa_lista,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tRA.id as id_remessa_arquivo,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tP.email,\r\n\t\t\t \t\t\t\t\t\t\tE.nome as empresa,\r\n\t\t\t \t\t\t\t\t\t\tE.id as id_empresa,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tP.id as id_responsavel\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . MYSQL_BASE_WORK_FLOW . " WF\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_DOCUMENTOS . " D ON D.id = WF.id_documento\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_REMESSA_ARQUIVOS . " RA ON RA.file LIKE CONCAT('../',D.cod_documento, '%')\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_PESSOAS . " P ON P.id = RA.id_usuario\r\n\t\t\t\t\t\t\t \t\t\tINNER JOIN " . MYSQL_BASE_REMESSA_LISTAS . " RL ON RL.id = RA.id_remessa_lista\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_EMPRESAS . " E ON E.id = RL.id_empresa\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWF.id = " . $fluxo->getWorkFlow()); $pedido = new PedidoInformacao(); $DAO_PI = new PedidoInformacaoDAO(); while ($row = mysql_fetch_array($query)) { $pedido->setResponsavel('id_responsavel'); $pedido->setEmpresa($row['id_empresa']); $pedido->setAssunto("Projeto " . $complemento); } $resultado_pi = $DAO_PI->Gravar($pedido); $pedido->setPedidoInformacao($resultado_pi); $pedido->setPergunta($_POST['despacho']); $resultado_pi_a = $DAO_PI->GravarPergunta($pedido); //$resultado_pi_a = $DAO_PI->GravarPergunta($pedidoInformacao); $msg = utf8_encode("O NGTM " . $complemento); } /*Pergunta - Anderson pra que serve isso? e a consulta esta errada e não existe esse tipo de codigo*/ $atualizar_proj_cad_cliente = $DAO->AtualizarProjetoCliente($status_cliente, $fluxo->getWorkFlow() . "-WF", $id_proj_cliente); // echo "Id_WF: ".$fluxo->getWorkFlow()."<br>id_fluxo:".$fluxo->getId()."<br>Pessoa: ".$fluxo->getIdPessoaDespachou()."<br>";