File: /home/asjudine/public_html/requerimiento_respuesta_admin.php
<?PHP
require_once("mainfile.php");
include ("config.php");
global $dbi;
require_once("Conectarse.php");
//$sql= sql_query("select Id from correspondencias ORDER BY Id DESC LIMIT 1",$dbi)
$res = mysql_query('SELECT id FROM requerimientos 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,numero_proceso,nombre_completo,fecha_envio,hora_envio, codigo_funcionario_recibe,funcionario_requiere,mensaje FROM requerimientos WHERE identificacion = "'.$_GET["cedula"].'" and id = "'.$_GET["id"].'" and numradica = "'.$_GET["radica"].'" and estado = "0" ');
if (!$contr) {
die('Invalid query 1: ' . mysql_error());
}
list($id,$radica,$lacedula,$numpro,$elnombre,$fechaen,$horare,$funre,$funexpi,$Mensaje) = mysql_fetch_row($contr);
$sql = mysql_query('SELECT * FROM Usuarios ORDER BY Nombre_Completo ');
if (!$sql) {
die('Invalid query: ' . mysql_error());
}
$row_sql = mysql_fetch_assoc($sql);
$totalRows_sql = mysql_num_rows($sql);
?>
<html>
<head>
<title>Aplicativo de Correspondencia</title>
<META HTTP-EQUIV="refresh" content="URL=http://www.asjudinet.com/Enviar_Respuestas.php/">
<script languaje="JavaScript">
function Mostrar_Fecha()
{
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado")
var montharray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre")
document.write("<b><font face='Arial, Helvetica, sans-serif'>"+dayarray[day]+" "+daym+" de "+montharray[month]+" de "+year+"</font></b>")
}
</script>
<style type="text/css">
<!--
.Estilo1 {
color: #000099;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
}
.Estilo7 {font-family: Arial, Helvetica, sans-serif; font-size: 14px; }
.Estilo14 {color: #990000}
.Estilo17 {color: #FF3300}
.Estilo18 {
color: #FF0000;
font-weight: bold;
}
-->
</style>
<script Language="JavaScript">
<!--
function Valida_Fecha(formulario)
{
if (formulario.Identificacion.value == "")
{
alert("Por favor llenar el campo número de identificación");
formulario.Identificacion.focus();
return (false);
}
if (formulario.codigo.value == "")
{
alert("Por favor seleccoine el nombre de la dependencia");
formulario.codigo.focus();
return (false);
}
if (formulario.Nombre_Completo.value == "")
{
alert("Por favor llenar el campo con Apellidos y Nombre del Afiliado");
formulario.Nombre_Completo.focus();
return (false);
}
if (formulario.Asunto.value == "")
{
alert("Por favor llenar el campo Asunto");
formulario.Asunto.focus();
return (false);
}
/* if (formulario.Contenido.value == "")
{
alert("Por favor llenar el campo Respuesta o Contenido del Mensaje");
formulario.Contenido.focus();
return (false);
}
*/
if (formulario.Quien_Expide.value == "")
{
alert("Por favor llenar el campo Quien Expide el Documento");
formulario.Quien_Expide.focus();
return (false);
}
if (confirm("Es correcta está información"))
{
return (true);
}
else
{
return (false);
}
return (true);
}
//--></script>
<SCRIPT LANGUAGE="JavaScript">
var timerID = null;
var timerRunning = false;
var id,pause=0,position=0;
function stopclock ()
{
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function showtime ()
{
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timeValue = "" + ((hours >12) ? hours -12 :hours)
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
timeValue += (hours >= 12) ? " P.M." : " A.M."
document.formulario.hora_envio.value = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
function startclock ()
{
stopclock ();
showtime ();
}
//--> </SCRIPT>
<script language="JavaScript">
function update(envio)
{
envio.iden.value = formulario.Iden.value
envio.identificacion.value = formulario.Identificacion.value
envio.contador.value = formulario.radica.value
envio.hora_envio.value = formulario.hora_envio.value;
}
</script>
</head>
<body OnLoad="startclock()">
<form name="formulario" method="post" action="" enctype="multipart/form-data" onSubmit="return Valida_Fecha(this)">
<table width="698" border="0" align="center" cellpadding="1" cellspacing="0">
<tr bgcolor="#0099FF">
<td colspan="3"><div align="center" class="Estilo1">INGRESAR CORRESPONDENCIAS </div></td>
</tr>
<tr bgcolor="#FFFFCC">
<td colspan="3"><div align="center">
<script languaje="JavaScript">Mostrar_Fecha()</script>
</div></td>
</tr>
<tr>
<td> </td>
<td width="360" colspan="2"> </td>
</tr>
<tr bgcolor="#ECE9D8">
<td width="383"><div align="right"><span class="Estilo7">Digite el número de radicación: </span></div></td>
<td colspan="2">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="" ></td>
</tr>
<tr bgcolor="#ECE9D8">
<td><div align="right"><span class="Estilo7">Identificacion <span class="Estilo14"></span></div></td>
<td colspan="2"><input name='Identificacion' id='Identificacion' type='text' size='15' maxlength='15' value="<?php echo $lacedula; ?>" readonly="">
</td>
</tr>
<tr bgcolor="#ECE9D8">
<td><div align="right"><span class="Estilo7">Funcionario Requerido </span></div></td>
<td colspan="2"><input name="Nombre_Completo" type="text" size="50" maxlength="50" value="<?php echo $elnombre; ?>"></td>
</tr>
<tr bgcolor="#ECE9D8">
<td colspan="2"><div align="right"><span class="Estilo7">Dependencia que Recibe: </span></div></td>
<td ><input name="funre" type="text" size="50" maxlength="50" value="<?php echo $funre; ?>" readonly=""></td>
</tr>
<tr bgcolor="#ECE9D8">
<td colspan="2"><div align="right"><span class="Estilo7">Funcionario que envio Requerimiento: </span></div></td>
<td ><input name="funexpi" type="text" size="50" maxlength="50" value="<?php echo $funexpi; ?>" readonly=""></td>
</tr>
<tr bgcolor="#ECE9D8">
<td colspan="2"><div align="right"><span class="Estilo7">Fecha y Hora expedido el requerimiento: </span></div></td>
<td ><input name="recibo" type="text" size="12" maxlength="12" value="<?php echo $fechaen; ?>" readonly="">-<input name="horare" type="text" size="12" maxlength="12" value="<?php echo $horare; ?>" readonly=""> </td>
</tr>
<tr bgcolor="#ECE9D8">
<td><div align="right" class="Estilo17"><strong><span class="Estilo7">Fecha Respuesta Requerimiento: </span></strong></div></td>
<td colspan="2"><input name="enviofec" type="text" size="12" maxlength="12" value="<?php echo date("Y"); ?>-<?php echo date("m"); ?>-<?php echo date("d"); ?>" readonly=""> </td>
</tr>
<tr bgcolor="#ECE9D8">
<td><div align="right" class="Estilo17"><strong><span class="Estilo7">Hora Respuesta Requerimiento: </span></strong></div></td>
<td colspan="2"><input name="hora_envio" type="text" size="11" maxlength="11"></td>
</tr>
<tr bgcolor="#ECE9D8">
<td><div align="right" class="Estilo17"><strong><span class="Estilo7">Asunto:</span></strong></div></td>
<td colspan="2"><input name="Asunto" type="text" size="50" maxlength="50"></td>
</tr>
<tr bgcolor="#ECE9D8">
<td><div align="right"><span class="Estilo7">Visualización del Requerimiento: </span></div></td>
<td colspan="2"> </td>
</tr>
<tr bgcolor="#ECE9D8">
<td colspan="3"><p align="right"><?php
echo "<textarea name='Contenido' cols='85' rows='4' title='RESPUESTA ENVIADA' readonly>\n";
echo htmlspecialchars($Mensaje)."\n";
echo "</textarea>"; ?></p></td>
</tr>
<tr bgcolor="#7897DD">
<td colspan="3"><div align="left"><span class="Estilo7">Emita una Respuesta Clara y Precisa Justificando Su Accionar: </span></div></td>
</tr>
<tr bgcolor="#ECE9D8" bordercolordark="#000000">
<td colspan="3"><p align="right">
<textarea name="Contenido" cols="85" rows="4"></textarea>
</p> </td>
</tr>
<tr bgcolor="#ECE9D8">
<td><div align="right" class="Estilo18">Funcionario Remitente:</div></td>
<td colspan="2"><input name="elabora" type="text" size="50" maxlength="50" value="<?php echo $elnombre; ?>"></td>
</tr>
<tr>
<td align="right"><b>Seleccione El Archivo:</b></td>
<td colspan="3" bgcolor="#EFEFEF"><input name="archivito" type="file" size="40" maxlength="40"></td>
</tr>
<tr bgcolor="#ECE9D8">
<td colspan="3"><div align="left"></div></td>
</tr>
<tr>
<td height="34" colspan="3"><div align="center">
<input name="guardar" type="submit" id = "guardar" value="Enviar Comunicación" style="font-family: Verdana; font-size: 8 pt; color: #000080; background-color: #C0C0C0; border-style: solid">
<input name="button" type="button" style="font-family: Verdana; font-size: 8 pt; color: #FF0000; background-color: #FFFFCC; border-style: solid" onClick="window.location.href='menu_admin.php'" value="VOLVER AL MENU">
</div></td>
</tr>
</table>
</form>
</body>
</html>
<html>
<head>
<title>Documento sin título</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.Estilo1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>
</head>
</html>
<?php
if ((isset($_POST["guardar"])))
{
$Quien = strtoupper($Funcionario_Expide);
$Noti = "N";
require_once("mainfile.php");
include ("config.php");
global $dbi;
$con = mysql_query('SELECT Nombre_Completo, Cargo FROM Usuarios WHERE Cedula = "' ."$Cedula". '" ');
if (!$con) {
die('Invalid query: ' . mysql_error());
}
if($con){list($Nombre, $Cargo) = mysql_fetch_row($con);}
$mss = mysql_query("UPDATE requerimientos set fecha_respuesta = '".$_POST[enviofec]."',hora_respuesta = '". $_POST[hora_envio]."',asunto_respuesta = '".$_POST[Asunto]."',funcionario_respuesta = '".$_POST[elabora]."',mesaje_respuesta = '".$_POST[Contenido]."', estado = '1' WHERE identificacion = '".$_GET[cedula] . "' and id = '" . $_GET[id] . "' and numradica = '" . $_GET[radica] . "' and estado = '0'");
if (!$mss ) {
die('Invalid query cartera_estado_contable MODIFICAR: ' . mysql_error());
}
$archivo = $_FILES["archivito"]["tmp_name"];
$tamanio = $_FILES["archivito"]["size"];
$tipo = $_FILES["archivito"]["type"];
$nombre = $_FILES["archivito"]["name"];
if ( $archivo != "none" )
{
$fp = fopen($archivo, "rb");
$contenido = fread($fp, $tamanio);
$contenido = addslashes($contenido);
fclose($fp);
$mssarchivo = mysql_query("UPDATE archivosrequerimientos set nombre5 = '".$nombre."',contenido5 = '". $contenido."',tipo5 = '".$tipo."' WHERE correointerno = '".$_GET['id'] ."'");
if (!$mssarchivo ) {
die('Invalid query cartera_estado_contable mssarchivo: ' . mysql_error());
}
echo "<script>alert('Su respuesta ha sido enviada con éxito' )</script>";
/* echo "<SCRIPT LANGUAGE='javascript'>window.location.href='menu_admin.php'</SCRIPT>"; **/
}
}
mysql_free_result($sql);
?>