include_once INTERNAL_ROOT_PORTAL . '/medicao/DAO/ListagemRelacionamentoDAO.php'; include_once INTERNAL_ROOT_PORTAL . '/cadastros/Usuario.class.php'; include_once INTERNAL_ROOT_PORTAL . '/medicao/ListagemRelacionamento.class.php'; checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true'); include_once INTERNAL_ROOT_PORTAL . '/head.php'; $usuario = new Usuario(); $item = new ListagemRelacionamento(); $DAO = new ListagemRelacionamentoDao(); //Verifica se a opcao de salvar foi iniciada if (!empty($_POST['cmd']) && $_POST['cmd'] == 'inserir') { $item->setIdPessoa($_POST['pessoa']); $item->setIdItem($_POST['item']); $item->setEmpresa($_POST['empresa']); $item->setUsuario(userId()); //Verifica se o item foi preenchido if ($item->getIdPessoa() != null || $item->getIdItem() != null) { echo $item->getEmpresa(); $retorno = $DAO->Gravar($item); if ($retorno == true) { echo '<script language= "JavaScript">alert("Registro cadastrado com sucesso");</script>'; echo '<script language= "JavaScript">location.href="new.php";</script>'; } else { echo '<script language= "JavaScript">alert("Erro ao cadastrar Registro");</script>'; } } else { echo '<script language= "JavaScript">alert("Preenchas todos os campos.");</script>'; } } ?> <style type="text/css">
include_once INTERNAL_ROOT_PORTAL . '/medicao/ListagemRelacionamento.class.php'; checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true'); include_once INTERNAL_ROOT_PORTAL . '/head.php'; $usuario = new Usuario(); $Listar = new ListagemRelacionamento(); $DAO = new ListagemRelacionamentoDao(); $Listar->setId(limpaTexto($_GET['id'])); //Verifica se foi executado a acao de salvar if (!empty($_POST['cmd']) && $_POST['cmd'] == 'editar') { $Listar->setIdPessoa($_POST['id_pessoa']); $Listar->setIdItem($_POST['id_item']); $Listar->setUsuario(userId()); $Listar->setId($_POST['id']); $Listar->setEmpresa($_POST['empresa']); // Verifica os campos obrigatorios if ($Listar->getIdPessoa() != null || $Listar->getIdItem() != null) { //Atualiza os dados do Usu�rio e Pessoa $retorno = $DAO->Atualizar($Listar); if ($retorno == true) { echo '<script language= "JavaScript">alert("Registro alterado com sucesso");</script>'; echo '<script language= "JavaScript">location.href="index.php";</script>'; } else { echo $retorno . 'erro'; } } else { echo 'erro'; } } else { $resultado = $DAO->Listar("SELECT * FROM " . MYSQL_BASE_CONTRATO_ITEM_PESSOA . " WHERE id=" . $Listar->getId()); if ($resultado) { foreach ($resultado as $item) {