File: /home/asjudine/www/formulario_consultorio_juridico.php
<?php
require_once("mainfile.php");
include ("config.php");
require_once("Conectarse.php");
$Recordset1 = mysql_query('SELECT * FROM Usuarios WHERE cargo = "ASESOR COMERCIAL" || Cargo like "DISER %" || cargo like "mercaderista" || codigo = "540" ORDER BY nombre_completo ');
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<html>
<head>
<title>Registro de Formulario Juridico</title>
<style type="text/css">
<!--
img {border: 0}
body,td {font-family: Verdana,Arial; font-size: 8pt; color: #000000}
input,select {font-family: Verdana,Arial; font-size: 7.5pt}
a:link, a:visited {text-decoration: none; color: #2030F0}
a:hover, a:active {text-decoration: underline; color: #D02010}
body table tr td table tr td form table {
font-size: 14px;
font-family: Georgia, "Times New Roman", Times, serif;
}
body table tr td table tr td form table tr td div strong {
font-size: 10pt;
}
body table tr td table tr td form table tr td div strong {
font-size: 9pt;
}
body table tr td table tr td form table tr td b {
font-size: 9pt;
}
body table tr td table tr td form table tr td div {
font-size: 7pt;
}
-->
</style>
</head>
<body bgcolor="#EFEFEF" text="#000000" topmargin="0" leftmargin="0">
<br>
<center> <img src="ELEMENTOS\CABEZOTE SERVIASJUDINET.jpg" WIDTH=60% > </center>
<br>
<table width="100%" height="75%" bgcolor="#FFFFFF" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="10" valign="top">
<table width="70%" border="0" cellspacing="0" cellpadding="0">
</table>
</td>
</tr>
<tr>
<td align="center">
<table width="44%" bgcolor="#EFEFEF" align="center" border="0" cellspacing="0" cellpadding="6">
<tr>
<td align="center" bgcolor="#306090"><big style="color:#FFFFFF"><b>INGRESAR CONSULTA JURIDICA</b></big></td>
</tr>
<tr>
<td align="center" colspan="2">
<script>
function Verificar() {
if(document.frm.apellidos.value == "") {
alert("Por Favor Escriba Los Apellidos");
document.frm.apellidos.focus();
return false;
}
if(document.frm.nombre.value == "") {
alert("Por Favor Escriba El Nombre");
document.frm.nombre.focus();
return false;
}
/*if(document.frm.ced.value == "") {
alert("Por Favor Escriba El Numero De Cedula");
document.frm.ced.focus();
return false;
}*/
if(document.frm.celular.value == "") {
alert("Por Favor Escriba El Numero De CELULAR");
document.frm.celular.focus();
return false;
}
if(document.frm.actuaprocesojuridico.value == "") {
alert("Escriba Proceso a Adelantar");
document.frm.actuaprocesojuridico.focus();
return false;
}
if(document.frm.mensaje.value == "") {
alert("ESCRIBA LA GESTION");
document.frm.mensaje.focus();
return false;
}
if(document.frm.funcionario.value == "") {
alert("Seleccione al funcionario");
document.frm.funcionario.focus();
return false;
}
return true;
}
</script>
<form method="post" name="frm" onSubmit="return Verificar()">
<table border="0" bgcolor="#EFEFEF" cellspacing="5">
<td><div align="right"><strong> Fecha Registro</strong></div></td>
<td><div align="left">
<input name="dia" type="text" id="dia2" value="<?php echo date("d"); ?>" size="2" maxlength="2" readonly>
<input name="mes" type="text" id="mes2" value="<?php echo date("m"); ?>" size="2" maxlength="2" readonly>
<input name="ano" type="text" id="ano2" value="<?php echo date("Y"); ?>" size="4" maxlength="4" readonly>
</div></td>
</tr>
<tr>
<td align="right"><b>Apellidos:</b></td>
<td><input type="text" name="apellidos" size="50" maxlength="40"></td>
</tr>
<tr>
<td align="right"><b>Nombres:</b></td>
<td><input type="text" name="nombre" size="50" maxlength="40"></td>
</tr>
<tr>
<td align="right"><b>Cedula de Ciudadania:</b></td>
<td><input type="text" name="ced" size="50" maxlength="40"></td>
</tr>
<tr>
<td align="right"><b>Celular:</b></td>
<td><input type="text" name="celular" size="50" maxlength="40"></td>
</tr>
<tr>
<td align="right"><b>Correo Electronico:</b></td>
<td><input type="text" name="email" size="50"></td>
</tr>
<tr>
<td align="right"><b>Empresa Laboral:</b></td>
<td><input type="text" name="empre" size="50"></td>
</tr>
<tr>
<td align="right"><b>Direccion Personal:</b></td>
<td><input type="text" name="dirempre" size="50"></td>
</tr>
<tr>
<td align="right"><b>Telefono Fijo:</b></td>
<td><input type="text" name="telempre" size="50"></td>
</tr>
<tr>
<td align="right"><b>Direccion Residencia:</b></td>
<td><input type="text" name="dirresi" size="50"></td>
</tr>
<tr>
<td align="right"><b>Ciudad Residencia:</b></td>
<td><input type="text" name="ciudadresi" size="50"></td>
</tr>
<tr>
<td align="center" colspan="2"><b>PROCESO JURIDICO ADELANTAR:</b></td>
</tr>
<td colspan="2" align="center"><textarea name="actuaprocesojuridico" id="actuaprocesojuridico" cols="60" rows="6" ></textarea></td>
</tr>
<tr>
<td align="right"><b>Funcionario:</b></td>
<td><SELECT NAME="funcionario">
<OPTION value="">--Nombre Funcionario--</OPTION>
<?php
do {
?>
<option value="<?php echo $row_Recordset1['codigo']?>"><?php echo $row_Recordset1['Nombre_Completo']?></option>
<?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
?>
</SELECT>
</td>
</tr>
</table>
</table><br>
<b>Gestion De Telemercadeo</b><br>
<textarea name="mensaje" cols="100" rows="8"><? echo $moticonsu?></textarea><br><br>
<!--<input name="menu2" type="button" class="Estilo50" id="menu2" onClick="window.location.href='menu_consultorio_juridico.php'" value="IR AL MENU" />-->
<input name="guardar" type="submit" class="Estilo53" id="guardar" value="ENVIAR " />
<br><br>
<?php
$ced = $_GET["ced"];
$nom = $_GET["nom"];
echo"<div class='divirmenu'>
<input type='button' name='menu' id='menu' class='irmenu' onClick='window.location.href=\"menu_consultorio_juridico.php?ced=$ced&nom=$nom\"' value='Menu Consultorio Juridico'></div>";
?>
</td>
</tr>
</table><br>
</td>
</tr>
<tr>
<td height="10" align="center" bgcolor="#000052"><b style="font-size:7.5p;color:#FFFFFF">Registro Formulario Juridico</b></td>
</tr>
</table>
</body>
</html>
<?php
$fechast = date("Y-m-d");
$controlusua = mysql_query('SELECT nombre_completo FROM Usuarios WHERE codigo = "'.$_POST["funcionario"].'" ');
if (!$controlusua) {
die('Invalid query 1: ' . mysql_error());
}
$num=mysql_num_rows($controlusua);
list($nombreusuar) = mysql_fetch_row($controlusua);
if(isset($_POST["guardar"]))
{
$fecha_asignac = date("Y")."-".date("m")."-".date("d");
$nombre_completo =$_POST["nombre"]." ".$_POST["apellidos"] ;
/*$csql = mysql_query("SELECT cedula, celular FROM consultorio_juridico WHERE cedula= '".$_POST["ced"]. "' && (apellidos= '".$_POST["apellidos"]. "' and nombres= '".$_POST["nombre"]. "') && celular = '".$_POST["celular"]."' ");*/
$csql = mysql_query("SELECT cedula, celular FROM consultorio_juridico WHERE cedula= '".$_POST["ced"]. "' OR celular = '".$_POST["celular"]."' ");
if (!$csql) {
die('Invalid query: ' . mysql_error());
}
if ((mysql_num_rows($csql)==0))
{
$csql6 = mysql_query("INSERT INTO consultorio_juridico (fecha_registro,apellidos,nombres, cedula , celular, email ,numero_contrato,tipo_contrato, empresa_laboral, direccion_empresa, telefono_empresa,direccion_residencia,ciudad_residencia, fecha_consulta, hora_consulta, proceso_juridico, motivo_consulta, relsutado_consulta,asesor_comercial,estado) VALUES ('" ."$fecha_asignac". "', UPPER('".$_POST["apellidos"]."'), UPPER('".$_POST["nombre"]."'), '".$_POST["ced"]. "', '" .$_POST["celular"]. "', '" .$_POST["email"]. "', 'CORPORATIVO','CORPORATIVO', '" .$_POST["empre"]. "', '" . $_POST["dirempre"]. "', '" .$_POST["telempre"]. "', '" .$_POST["dirresi"]. "', UPPER('".$_POST["ciudadresi"]."'), '" . $_POST["fech"] . "', '" . $_POST["hora"] . "', UPPER('".$_POST["actuaprocesojuridico"]."'), UPPER('".$_POST["mensaje"]."'),'" . $_POST["mensaje"] . "', '".$_POST["funcionario"]."', '0' )");
if (!$csql6) { // esto es para que aparescan los errores
die('Invalid query csql: ' . mysql_error());
}
/*
$csql2 = mysql_query("INSERT INTO impresion_carnet (cedula , nombre,fecha,estado) VALUES ('".$_POST["ced"]. "','" ."$nombre_completo. "."', '" ."$fecha_asignac". "','0' )");
if (!$csql2) { // esto es para que aparescan los errores
die('Invalid query csql: ' . mysql_error());
} */
$csqle1 = mysql_query("INSERT INTO actuaciones_consultorio_juridico (cedula, apellidos, nombres, celular,actuaciones, fecha, funcionario, codigo_funcionario) VALUES ('".$_POST[ced]."', '".$_POST["apellidos"]."', '".$_POST["nombre"]."', '".$_POST["celular"]."', UPPER('".$_POST[mensaje]."'),'".$fechast."','".$nombreusuar."','".$_POST["funcionario"]."')");
echo "<script>alert('Los datos fueron grabados correctamente');</script>";
}
else
{
echo "<script>alert('Usuario Ya Esta Registrado ');</script>";
}
}
?>