File: /home/asjudine/www/avigilajudicial/formulario_respuesta_solicitudes_ticket.php
<?php
global $dbi;
require_once("../Conectarse_.php");
$control = mysql_query('SELECT cedula, Nombre_Completo, Cargo, codigo, email, nombre_escrito, ticket, asunto, prioridad, mensaje, fecha, hora FROM tickets WHERE cedula = "'.$_GET["cedula"].'" and ticket = "'.$_GET["ticket"].'" ');
if (!$control) {
die('Invalid query 2: ' . mysql_error());
}
if ((mysql_num_rows($control)!=0))
{
list($cedula, $nombre_completo, $cargo, $codigo, $email, $nombre_escrito, $ticket, $asunto, $prioridad, $mensaje, $fecha, $hora) = mysql_fetch_row($control);
}
$fecha_hora = $fecha." / ".$hora;
$fecha_auto = date("Y-m-d");
if(isset($_POST["submit"]))
{
$archivo = $_FILES["archivito"]["tmp_name"];
$tamanio = $_FILES["archivito"]["size"];
$tipo = $_FILES["archivito"]["type"];
$nombre = $_FILES["archivito"]["name"];
$fp = fopen($archivo, "rb");
$contenido = fread($fp, $tamanio);
$contenido = addslashes($contenido);
fclose($fp);
$fechast = date("y").'-'.date("m").'-'.date("d");
$nombre=$_FILES['archivito']['name'];
$guardado=$_FILES['archivito']['tmp_name'];
if(!file_exists('archivostickets')){
mkdir('archivostickets',0777,true);
if(file_exists('archivostickets')){
if(move_uploaded_file($guardado, 'archivostickets/'.$nombre)){
echo "Archivo guardado con exito";
}else{
echo "Archivo no se pudo guardar";
}
}
}else{
if(move_uploaded_file($guardado, 'archivostickets/'.$nombre)){
echo "Archivo guardado con exito";
}else{
echo "Archivo no se pudo guardar";
}
}
$ruta_archivo = "archivostickets/$nombre";
//$ruta_archivo = "$nombre";
$insertar_actua = mysql_query("UPDATE tickets SET respuesta = '".$_POST["respuesta"]."', nombre = '".$nombre."', tipo = '".$tipo."', ruta_archivo = '".$ruta_archivo."', fecha_respuesta = '".$fecha_auto."', estado = '1' ");
//////el estado 10 es para que aparezca la revista a los directores de servicio
if (!$insertar_actua) {
die('Invalid query insert : ' . mysql_error());
}
echo "<script>alert('Los datos fueron grabados correctamente');</script>";
echo "<script languaje='javascript' type='text/javascript'>window.close();</script>";
}
/*else
{
echo "<script>alert('Usted no pertenece a este proceso');</script>";
}*/
?>
<!DOCTYPE html>
<html>
<head>
<title>Datos Ticket</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">
<link rel="stylesheet" href="css/estilos.css">
<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>
<script Language="JavaScript">
function validar_campos(formulario)
{
if (formulario.funcionario.value == "")
{
alert("Seleccione El Funcionario");
formulario.funcionario.focus();
return (false);
}
if (formulario.archivito.value == "")
{
alert("Seleccione Un Archivo");
formulario.archivito.focus();
return (false);
}
if (formulario.archivito2.value == "")
{
alert("Seleccione Un Archivo");
formulario.archivito2.focus();
return (false);
}
if (formulario.seguimiento.value == "")
{
alert("Describa La Actividad");
formulario.seguimiento.focus();
return (false);
}
if (formulario.funcionario.value == "")
{
alert("Seleccione El Funcionario");
formulario.funcioanrio.focus();
return (false);
}
if (formulario.archivito.value == "")
{
alert("Anexe Un Archivo");
formulario.archivito.focus();
return (false);
}
if (formulario.respuesta.value == "")
{
alert("Escriba la respuesta");
formulario.respuesta.focus();
return (false);
}
if (confirm("Los datos de la consulta son correctos"))
{
return (true);
}
else
{
return (false);
}
return (true);
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<?php include('header.php'); ?>
<h3 class="titulo">VISUALIZACION DE DATOS TICKET </h3>
<form name="consulta" action="" method="post" enctype="multipart/form-data" onSubmit="return validar_campos(this)">
<table width="600" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td colspan="4" align="center" class="fecha">
<script languaje="JavaScript">Mostrar_Fecha()</script>
</td>
</tr>
<tr>
<td class="tdbig"><fieldset><legend>Datos del ticket:</legend>
<table width="600" border="0" cellspacing="1" cellpadding="0">
<tr>
<td class="tdcen">cedula:</td>
<td class="tdizq"><input name="cedula" type="text" id="cedula" value="<?php echo $cedula; ?>" size="15" maxlength="15" readonly=""></td>
<td class="tdcenroja"># Ticket:</td>
<td class="tdizq"><input name="ticket" type="text" id="ticket" value="<?php echo $ticket; ?>" size="25" maxlength="25" readonly=""></td>
</tr>
<tr>
<td class="tdcen">Nombre:</td>
<td class="tdizq"><input name="nombre_completo" type="text" id="nombre_completo" value="<?php echo $nombre_completo; ?>" size="50" maxlength="50" readonly=""></td>
<td class="tdcen">Cargo:</td>
<td class="tdizq"><input name="cargo" type="text" id="cargo" value="<?php echo $cargo; ?>" size="25" maxlength="25" readonly=""></td>
</tr>
<tr>
<td class="tdcen">Email :</td>
<td class="tdizq" colspan="3"><input name="email" type="text" id="email" value="<?php echo $email; ?>" size="50" maxlength="50" readonly=""></td>
</tr>
<tr>
<td class="tdcen">Asunto:</td>
<td class="tdizq" colspan="3"><input name="asunto" type="text" id="asunto" value="<?php echo $asunto; ?>" size="50" maxlength="50" readonly=""></td>
</tr>
<tr>
<td class="tdcen">Prioridad:</td>
<td class="tdizq" colspan="4"><input name="prioridad" type="text" id="prioridad" value="<?php echo $prioridad; ?>" size="50" maxlength="50" readonly=""></td>
</tr>
<tr>
<td class="tdcen">Mensaje:</td>
<td class="tdizq" colspan="3">
<textarea name="" id="" cols="90" rows="10" readonly><?php echo $mensaje;?></textarea>
<!--<input name="mensaje" type="text" id="mensaje" value="<?php echo $mensaje; ?>" size="50" maxlength="50" readonly="">-->
</td>
</tr>
<tr>
<td class="tdcen">Solicitud Fecha/Hora:</td>
<td class="tdizq" colspan="3"><input name="fecha_hora" type="text" id="fecha_hora" value="<?php echo $fecha_hora; ?>" size="50" maxlength="50" readonly=""></td>
</tr>
<tr>
<td class="tdcen">Respuesta:</td>
<td class="tdizq" colspan="3">
<textarea name="respuesta" id="respuesta" cols="90" rows="10"><?php echo $respuesta; ?></textarea>
</td>
</tr>
<tr>
<td class="tdc">Seleccione El Archivo</td>
<td class="tdc"><input name="archivito" id="archivito" type="file" class="polici3" size="40" maxlength="40"></td>
</tr>
<tr>
<td colspan="5">
<input name="submit" type="submit" id="submit" class= "direcciona" value="Actualizar">
<!--<table width="662" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="td"><MARQUEE class=marquee scrolldelay="100">Una vez que haya grabado el registro, haga click sobre el botón **Actualizar** para visualizar el último folio</MARQUEE> </td>
<td class="td"><input name="actualiza" type="submit" id="actualiza" class= "boton1" value="Actualizar"></td>
</tr>
</table>-->
</td>
</tr>
</table>
</fieldset></td>
</tr>
</table>
</form>
</body>
</html>