File: /home/asjudine/www/acorreos/subir_archivos_respuestas_correos_afiliados.php
<?php
global $dbi;
require_once("../Conectarse.php");
$time=strftime( "%H-%M", time() );
$sql = mysql_query('SELECT Nombre_Completo FROM Usuarios WHERE cargo = "CONTROL INTERNO" order by Nombre_Completo ');
if (!$sql) {
die('Invalid query usuarios interno: ' . mysql_error());
}
$row_sql = mysql_fetch_assoc($sql);
$totalRows_sql = mysql_num_rows($sql);
$res = mysql_query('SELECT Id FROM correspondencias ORDER BY Id DESC LIMIT 1');
if (!$res) {
die('Invalid query: ' . mysql_error());
}
list($Conta) = mysql_fetch_row($res);
$rest = mysql_query('SELECT Nombre_Completo FROM Usuarios WHERE Cedula = "' . $_POST[cedula] . '" ');
if (!$rest) {
die('Invalid query: ' . mysql_error());
}
if($rest){list($Nom) = mysql_fetch_row($rest); }
$resta = mysql_query('SELECT * FROM Dependencias ORDER BY Nombre ');
if (!$resta) {
die('Invalid query: ' . mysql_error());
}
$row_Recordset1 = mysql_fetch_assoc($resta);
$totalRows_Recordset1 = mysql_num_rows($resta);
// esto lo cambie yo
$contr = mysql_query('SELECT Id, numradica, Identificacion, Nombre_Completo, Dia_Recibe, Mes_Recibe, Ano_Recibe, Hora_Recibe, funcinario_recibe, tipo FROM correspondencias WHERE Identificacion = "' . $_GET["cedula"] . '" and id = "' .$_GET["id"] . '" and numradica = "'.$_GET["radica"] . '" ');
if (!$contr) {
die('Invalid query 1: ' . mysql_error());
}
list($id, $radica, $iden, $nom, $di, $me, $an, $horare, $funre, $tipo) = mysql_fetch_row($contr);
$contrw = mysql_query('SELECT Nombre_Completo FROM Usuarios WHERE codigo = "'.$funre.'" ');
if (!$contrw) {
die('Invalid query 1: ' . mysql_error());
}
list($funre) = mysql_fetch_row($contrw);
$recibo = $di."-".$me."-".$an;
$datosamostrar = mysql_query('SELECT cedula, nombre, direccion, telefono, celular, ciudad, email FROM cartera_serviasjudinet WHERE cedula = "' . $_GET["cedula"] . '" ');
if (!$datosamostrar) {
die('Invalid query: ' . mysql_error());
}
if($datosamostrar)
{
list($lacedula, $elnombre, $dire, $eltelefonofijo, $celular, $ciudad, $email) = mysql_fetch_row($datosamostrar);
}
//-------------------- Aca es para traer el consecutivo que sigue
$datosconsecutivo = mysql_query('SELECT Id FROM correspondencias ORDER BY Id DESC LIMIT 1');
if (!$datosconsecutivo) {
die('Invalid query: ' . mysql_error());
}
if($datosconsecutivo){list($elId) = mysql_fetch_row($datosconsecutivo); }
?>
<html>
<head>
<title>Registro de Formulario Juridico</title>
<meta http-equiv="X-UA-Compatible" content="IE=8; IE=9; IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
*{margin: 0;padding: 0;}
body{background-color:#EAEAEA;font-family:Geneva, Arial, Helvetica, sans-serif;}
header {background-color: #B7271F; text-align: center;}
.cerrarsesion{width: auto;height: 20px;background-color: #DBD8C9;color: #000;font-size: 13px;position:absolute;top: 15px;right:10px;z-index:0;padding: 10px;border-radius: 10px;cursor: pointer;}
.cerrarsesion:hover{background-color: #ffffff;color: #000;}
.titulo{width: 100%;text-align: center;background-color: #dbd8c9;color: #b20606;padding: 6px 0;font-size: 18px;}
table{margin: 0 auto;border: 8px solid #bebebe; text-align: center;}
.divirmenu{text-align: center;}
.irmenu{width: 200px;background-color: #1c4fa0;color: #fff; padding: 2px;border-radius: 6px; border:2px solid #C0C0C0;}
.irmenu:hover{background-color: #67a0d9; color: #000;}
.fecha{background-color: #d6e08b; padding: 2px;color: #000;font-size: 15px; text-align: center;}
td{border: #969696 solid 1px;}
.tdizq{background-color: #EEE; padding: 1px 10px;color: #00135F;font-size: 13px;font-weight: 600; text-align: left;}
.tdcen{background-color: #EEE; padding: 1px 10px;color: #00135F;font-size: 13px;font-weight: 600; text-align: center;}
.tdder{background-color: #EEE; padding: 1px 10px;color: #00135F;font-size: 13px;font-weight: 600; text-align: right;}
.exp{color:#8A0000; font-size:10px;}
.boton1{width:200px;background-color: #FFF;color: #000; padding: 2px;border-radius: 6px; border:2px solid #7D0000;}
.boton1:hover{background-color: #6f0000;color: #fff;cursor: pointer;}
input[type=text], select{border-radius: 5px; padding: 3px;background-color: #fffef7;}
.tdtitulo{background-color: #e3dec0; color: #b20606; padding: 2px; text-align: center; font-size: 12px; font-weight: 900}
.tdfull{background-color: #fff; color: #000; padding: 1px; text-align: center; font-size: 12px;}
.tdd{background-color: #092B62; padding: 1px 10px;color: #fff;font-size: 13px;font-weight: 600; text-align: right;}
</style>
<script languaje="JavaScript">
function validar_campos(formulario)
{
if (formulario.codigo.value == "")
{
alert("Seleccione Dependencia Que Envia");
formulario.codigo.focus();
return (false);
}
if (formulario.archivito.value == "")
{
alert("Seleccione Un Archivo");
formulario.archivito.focus();
return (false);
}
if (formulario.archivito3.value == "")
{
alert("Seleccione Archivo De Notificacion");
formulario.archivito3.focus();
return (false);
}
if (formulario.mensajea.value == "")
{
alert("Seleccione El Funcionario");
formulario.mensajea.focus();
return (false);
}
if (formulario.Nombre_Elabora.value == "")
{
alert("Seleccione El Funcionario que elaboró el documento");
formulario.Nombre_Elabora.focus();
return (false);
}
if (confirm("Los datos de la consulta son correctos"))
{
return (true);
}
else
{
return (false);
}
return (true);
}
//-->
</script>
</head>
<body bgcolor="#EFEFEF" text="#000000" topmargin="0" leftmargin="0">
<header>
<img src="../ELEMENTS/bannerInterasjudinet.png" alt="" width=" 700" height="70">
</header>
<h3 class="titulo">ENVIAR RESPUESTA CORRESPONDENCIA</h3>
<form name="formulario" method="post" action="" enctype="multipart/form-data" onSubmit="return validar_campos(this)">
<table border="3" bgcolor="#EFEFEF" cellspacing="5" align="center">
<tr>
<td class="tdder">Digite el número de radicación :</td>
<td class="tdizq">RADICACION <input name="numradica" type="text" size="5" maxlength="5" value="<?php echo $radica ?>" readonly>-ID
<input name="Iden" type="text" size="5" maxlength="5" value="<?php echo $id ?>" readonly ></b></td>
</tr>
<tr>
<td class="tdder">Digitar Número <span>(Cédula, Código Militar o NIT) :</span></td>
<td class="tdizq"><input name='Identificacion' id='Identificacion' type='text' size='18' maxlength='18' value="<?php echo $lacedula; ?>"></td>
</tr>
<tr>
<td class="tdder">Referencia(Señor o Señora):</td>
<td class="tdizq">
<select name="Referencia">
<option value="Sr." selected>Sr.</option>
<option value="Sra.">Sra.</option>
</select>
</td>
</tr>
<tr>
<td class="tdder">Apellidos - Nombres <span class="exp">(Afiliado, Beneficiario o Persona Natural ) : </span></td>
<td class="tdizq"><input name="Nombre_Completo" type="text" size="50" maxlength="50" value="<?php echo $elnombre; ?>"></td>
</tr>
<tr>
<td class="tdder">Celular : </td>
<td class="tdizq"><input name='celular' id='celular' type='text' size='15' maxlength='15' value="<?php echo $celular; ?>"></td>
</tr>
<tr>
<td class="tdder">Teléfono Fijo</td>
<td class="tdizq"><input name='telefonofijo' id='telefonofijo' type='text' size='15' maxlength='15' value="<?php echo $eltelefonofijo; ?>"></td>
</tr>
<tr>
<td class="tdder">Ciudad : </td>
<td class="tdizq"><input name='ciudad' id='ciudad' type='text' size='15' maxlength='15' value="<?php echo $ciudad; ?>"></td>
</tr>
<tr>
<td class="tdder">Direccion :</td>
<td class="tdizq"><input name='direcc' id='direcc' type='text' size='50' maxlength='50' value="<?php echo $dire; ?>"></td>
</tr>
<tr>
<td class="tdder">Email :</td>
<td class="tdizq"><input name='email' id='email' type='text' size='50' maxlength='50' value="<?php echo $email; ?>"></td>
</tr>
<!--<tr>
<td align="right"><b>Funcionario que Recibe: </b></td>
<td ><input name="recibo" type="text" size="50" maxlength="50" value="<?php echo $funre; ?>" readonly></td>
</tr>
<tr>
<td align="right"><b>Fecha y Hora de Recibo Correspondencia: </b></td>
<td ><input name="recibo" type="text" size="12" maxlength="12" value="<?php echo $recibo; ?>" readonly>-<input name="horare" type="text" size="12" maxlength="12" value="<?php echo $horare; ?>" readonly> </td>
</tr>
-->
<tr>
<td class="tdder">Dependencia que envía :</td>
<!-- <td><SELECT NAME="codigo">
<OPTION value="">--SELECCIONE NOMBRE DEPENDENCIA ENVIA--</OPTION>
<?php
do {
?>
<option value="<?php echo $row_Recordset1['Codigo']?>"><?php echo $row_Recordset1['Nombre']?></option>
<?php
} while ($row_Recordset1 = mysql_fetch_assoc($resta));
$rows = mysql_num_rows($resta);
if($rows > 0) {
mysql_data_seek($resta, 0);
$row_Recordset1 = mysql_fetch_assoc($resta);
}
//-------------------- Aca es para traer el consecutivo que sigue
$datosconsecutivo = mysql_query('SELECT Id FROM correspondencias ORDER BY Id DESC LIMIT 1');
if (!$datosconsecutivo) {
die('Invalid query: ' . mysql_error());
}
if($datosconsecutivo){list($elId) = mysql_fetch_row($datosconsecutivo); }
?>
</SELECT></td> -->
<td class="tdizq"><input name="codigo" type="text" value="Gerencia General" size="50" maxlength="50"></td>
</tr>
<tr>
<td class="tdder">Funcionario que elaboró el Documento :</td>
<td class="tdizq">
<!--<input name="Nombre_Elabora" value="SALAZAR HERNANDEZ DANIELA" type="text" size="50" maxlength="50">-->
<select name="Nombre_Elabora" id="Nombre_Elabora">
<option value="">--SELECCIONE FUNCIONARIO-</option>
<?php
do {
?>
<option value="<?php echo $row_sql['Nombre_Completo']; ?>"><?php echo $row_sql['Nombre_Completo'] ?></option>
<?php
} while ($row_sql = mysql_fetch_assoc($sql));
$rows = mysql_num_rows($sql);
if ($rows > 0) {
mysql_data_seek($sql, 0);
$row_sql = mysql_fetch_assoc($sql);
}
?>
</select>
</td>
</tr>
<tr>
<td class="tdder">Fecha de Envio de la Correspondencia : </td>
<td class="tdizq"><input name="Dia_Envio" type="text" size="2" maxlength="2" value="<?php echo date("d"); ?>" readonly> <input name="Mes_Envio" type="text" size="2" maxlength="2" value="<?php echo date("m"); ?>" readonly> <input name="Ano_Envio" type="text" value="<?php echo date("Y"); ?>" size="4" maxlength="4" readonly></td>
</tr>
<tr>
<td class="tdder">Hora de Envío :</td>
<td class="tdizq"><input name="hora_envio" type="text" value="<?php echo $time;?>" size="11" maxlength="11"></td>
</tr>
<tr>
<td class="tdder">Tipo : </td>
<td class="tdizq"> <input name='tipo' id='tipo' type='text' size='3' maxlength='3' value="<?php echo $tipo; ?>"></td>
</tr>
<tr>
<td class="tdder">Asunto :</td>
<td class="tdizq"><input name="Asunto" type="text" size="50" maxlength="50"></td>
</tr>
<tr>
<td class="titulo" colspan="2">Emita una instrucción y acciones a seguir del archivo adjunto:</td>
</tr>
<tr>
<td class="tdder" colspan="3">
<textarea name="Contenido" cols="85" rows="4"></textarea>
</td>
</tr>
<tr>
<td class="tdder">Funcionario que Firma el documento : </td>
<td class="tdizq"><input name="Quien_Expide" type="text" value="YAMILE JALAL" size="50" maxlength="50"></td>
</tr>
<tr>
<td class="tdder">SUBIR ARCHIVO CARA 1 :</td>
<td class="tdizq" colspan="3"><input name="archivito" id = "archivito" type="file" class="polici3" size="40" maxlength="40"></td>
</tr>
<tr>
<td class="tdder">SUBIR ARCHIVO CARA 2:</td>
<td class="tdizq" colspan="3"><input name="archivito2" id = "archivito2" type="file" class="polici3" size="40" maxlength="40"></td>
</tr>
<tr>
<td class="tdd">SUBIR ARCHIVO NOTIFICACION :</td>
<td class="tdizq" colspan="3"><input name="archivito3" id = "archivito3" type="file" class="polici3" size="40" maxlength="40"></td>
</tr>
<tr>
<td colspan="2">
<input name="guardar" type="submit" class="boton1" id="guardar" value="GUARDAR"/>
</td>
</tr>
</table>
</form>
<td height="22" colspan="2" bgcolor="#EFEFEF" class="fecha"><div align="center">
<input name="button" type="button" class="irmenu" onClick="window.location.href='consulta_ced_enviar_correo_afi.php'" value="REGRESAR A LA BUSQUEDA">
</div></td>
<br>
</body>
</html>
<?
global $dbi;
require_once("../Conectarse.php");
$fecha_actual=date("Y/m/d");
$time=strftime( "%H-%M-%S", time() );
if(isset($_POST["guardar"]))
{
$dia = date("d");
$mes = date("m");
$ano = date("Y");
$fecha = $dia."-".$mes."-".$ano;
$archivo = $_FILES["archivito"]["tmp_name"];
$tamanio = $_FILES["archivito"]["size"];
$tipo = $_FILES["archivito"]["type"];
$nombre = $_FILES["archivito"]["name"];
///////////////////////////////////////////////
$archivo2 = $_FILES["archivito2"]["tmp_name"];
$tamanio2 = $_FILES["archivito2"]["size"];
$tipo2 = $_FILES["archivito2"]["type"];
$nombre2 = $_FILES["archivito2"]["name"];
///////////////////////////////////////////////
$archivo3 = $_FILES["archivito3"]["tmp_name"];
$tamanio3 = $_FILES["archivito3"]["size"];
$tipo3 = $_FILES["archivito3"]["type"];
$nombre3 = $_FILES["archivito3"]["name"];
if ( $archivo != "none" || $archivo2 != "none" || $archivo3 != "none")
{
$fp = fopen($archivo, "rb");
$contenido = fread($fp, $tamanio);
$contenido = addslashes($contenido);
fclose($fp);
$fp2 = fopen($archivo2, "rb");
$contenido2 = fread($fp2, $tamanio2);
$contenido2 = addslashes($contenido2);
fclose($fp2);
$fp3 = fopen($archivo3, "rb");
$contenido3 = fread($fp3, $tamanio3);
$contenido3 = addslashes($contenido3);
fclose($fp3);
//$res = mysql_query("INSERT INTO archivos (id, nombre, fecha, hora, contenido, tipo, Identificacion, registro, registro_interno) VALUES ('', '" . $_POST["nombre"] . "', '" ."$fecha". "', '" . $_POST["hora_envio"] . "', '" . $_POST["contenido"] . "', '" . $_POST["tipo"] . "', '" . $_POST["identificacion"] . "', '" . $_POST["contador"] . "', '')");
$res = mysql_query("INSERT INTO archivos (id,nombre,fecha,hora,contenido,tipo,Identificacion,registro, registro_interno) VALUES ('','".$nombre."','".$fecha."','".$_POST["Hora_envio"]."','".$contenido."','".$tipo."','". $_POST["Identificacion"]."', '".$_POST["numradica"]."','')");
$mssql2 = mysql_query("UPDATE archivos set nombredos = '".$nombre2."',contenidodos = '".$contenido2."',tipodos = '".$tipo2."' WHERE Identificacion = '".$_POST["Identificacion"]."' and nombre = '".$nombre."' ");
if (!$mssql2) {
die('Invalid query update 174: ' . mysql_error());
}
$mssql18 = mysql_query("INSERT INTO notificaciones_correspondencia (cedula,fecha,hora_descargue,radicado,id_archivo,
actuaciones_de_envio,funcionario,nombre,contenido,tipo) VALUES ('".$_POST["Identificacion"]."','".$fecha_actual."','".$time."','" . $_POST[numradica]. "','". $_POST[Iden]."','".$_POST["Contenido"]."','".$_POST["Nombre_Elaboro"]."','".$nombre3."','" .$contenido3. "','".$tipo3."') ");
if (!$mssql18) { // esto es para que aparescan los errores
die('Invalid query csqlsadsad: ' . mysql_error());
}
//////////////////script de guardar formulario
if ($_POST[tipo]=="2")
{
$msq = mysql_query("UPDATE correspondencias set Referencia = '" . $_POST[Referencia] . "', codigo_depen = '" . $_POST[codigo] . "', Nombre_Elabora = '" . $_POST[Nombre_Elabora] . "', Dia_Envio = '" . $_POST[Dia_Envio] . "', Mes_Envio = '" . $_POST[Mes_Envio] . "', Ano_Envio = '" . $_POST[Ano_Envio] . "', Hora_Envio = '" . $_POST[hora_envio] . "', Asunto = '" . $_POST[Asunto] . "', Mensaje = '" . $_POST[Contenido] . "', Quien_Expide = '" . $_POST[Quien_Expide] . "', Notificar = 'N', estado = '5', tipo= '" .$_POST[tipo]. "' WHERE Identificacion = '" . $_POST[Identificacion] . "' and id = '" . $_POST[Iden] . "' and numradica = '" . $_POST[numradica] . "' ");
if (!$msq) {
die('Invalid query 1 msq: ' . mysql_error());
}
$msql2 = mysql_query("UPDATE cartera_serviasjudinet set nombre = '".$_POST[Nombre_Completo]."',direccion = '".$_POST[direcc]."', telefono = '".$_POST[telefonofijo]."',celular = '".$_POST[celular]."',ciudad = '".$_POST[ciudad]."', email = '".$_POST[email]."' WHERE cedula = '".$_POST[Identificacion]."' ");
if (!$msql2) {
die('Invalid query 1 update: ' . mysql_error());
}
echo "<script>alert('Su respuesta ha sido enviada con éxito')</script>";
echo "<SCRIPT LANGUAGE='javascript'>window.location.href='consulta_ced_enviar_correo_afi.php'</SCRIPT>";
}
////////////////////
else {
$msq = mysql_query("UPDATE correspondencias set Referencia = '".$_POST[Referencia]."',codigo_depen = '". $_POST[codigo]."', Nombre_Elabora = '".$_POST[Nombre_Elabora]."',Dia_Envio = '".$_POST[Dia_Envio]."',Mes_Envio = '".$_POST[Mes_Envio]."',Ano_Envio = '".$_POST[Ano_Envio]."',Hora_Envio = '".$_POST[hora_envio]."',Asunto = '".$_POST[Asunto]. "', Mensaje = '".$_POST[Contenido]."',Quien_Expide = '".$_POST[Quien_Expide]."',Notificar = 'N',estado = '1',tipo= '".$_POST[tipo]."' WHERE Identificacion = '".$_POST[Identificacion]."' and id = '".$_POST[Iden]."' and numradica = '". $_POST[numradica]."' ");
if (!$msq) {
die('Invalid query 1 msq: ' . mysql_error());
}
$msql2 = mysql_query("UPDATE cartera_serviasjudinet set nombre = '".$_POST[Nombre_Completo]."',direccion = '".$_POST[direcc]."', telefono = '".$_POST[telefonofijo]."',celular = '".$_POST[celular]."',ciudad = '".$_POST[ciudad]."', email = '".$_POST[email]."' WHERE cedula = '".$_POST[Identificacion]."' ");
if (!$msql2) {
die('Invalid query 1 update: ' . mysql_error());
}
echo "<script>alert('Su respuesta ha sido enviada con éxito')</script>";
echo "<SCRIPT LANGUAGE='javascript'>window.location.href='consulta_ced_enviar_correo_afi.php'</SCRIPT>";
}
}
}
?>
</table>