File: /home/asjudine/www/ingreso_reporte_ausentismo.php
<?PHP extract($_POST,EXTR_SKIP); ?>
<?php
require_once("mainfile.php");
include ("config.php");
global $dbi;
require_once("Conectarse.php");
$sql = mysql_query('SELECT * FROM sucursal WHERE codigo != "20" and codigo != "25" and codigo != "28" and codigo != "41" and codigo != "42" and codigo != "45" and codigo != "46" ORDER BY nombre ');
if (!$sql) {
die('Invalid query: ' . mysql_error());
}
$row_sql = mysql_fetch_assoc($sql);
$totalRows_sql = mysql_num_rows($sql);
$sqlem = mysql_query('SELECT * FROM sucursal WHERE codigo != "27" AND codigo != "1" AND codigo != "36" AND codigo != "41" AND codigo != "37" AND codigo != "35" AND codigo != "34" AND codigo != "39" AND codigo != "38" AND codigo != "25" AND codigo != "24" AND codigo != "28" AND codigo != "31" AND codigo != "5" AND codigo != "40" AND codigo != "32" AND codigo != "20" AND codigo != "23" AND codigo != "21" AND codigo != "29" ORDER BY nombre ');
if (!$sqlem) {
die('Invalid query: ' . mysql_error());
}
$row_sql = mysql_fetch_assoc($sqlem);
$totalRows_sql = mysql_num_rows($sql);
if ($_GET[id]!="")
{
$Recordset1 = mysql_query('SELECT * FROM Usuarios WHERE sucursal_servicio = "' .$_GET[id].'" order by Nombre_Completo');
if (!$Recordset1)
{
die('Invalid query: ' . mysql_error());
}
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
}
$id = $_GET["id"];
$cedula = $_GET["cedula"];
$consulta = mysql_query('SELECT id,cedula,funcionario,motivo,fecha,hora FROM ausentismo_admin WHERE cedula = "'.$cedula.'" and id = "'.$id.'" ');
if (!$consulta) {
die('Invalid query 1: ' . mysql_error());
}
list($id, $cedula, $funcionario, $motivo, $fecha, $hora) = mysql_fetch_row($consulta);
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Ingresar Informacion</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<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">
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>
<style type="text/css">
<!--
.Estilo1 {
font-family: Arial, Helvetica, sans-serif;
color: #00C;
}
.Estilo2 {
color: #FF0000;
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
}
body {
background-image: url(ELEMENTOS/beig.jpg );
}
.Estilo3 {color: #006633}
.Estilo4 {color: #FFFFFF}
.Estilo5 {
font-size: 12px;
font-style: italic;
color: #09F;
font-weight: bold;
}
.Estilo7 {
color: #FF0000;
font-weight: bold;
}
.Estilo8 {color: #FFFFFF; font-weight: bold; }
-->
</style>
<script Language="JavaScript">
function Valida_Fecha()
{
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.Quien_Expide.value == "")
{
alert("Por favor llenar el campo Quien Expide el Documento");
formulario.Quien_Expide.focus();
return (false);
}
if (formulario.archivito.value == "")
{
alert("Por favor Seleccione la Imagen");
formulario.archivito.focus();
return (false);
}
if (formulario.actuacion_cam.value == "")
{
alert("Por favor Escriba Actuacion");
formulario.actuacion_cam.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.identificacion.value = formulario.Identificacion.value
envio.contador.value = formulario.Contador.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 validar_campos(this)">-->
<center>
<h1><span style="width:100%"><font color="#2E7068">INGRESAR GESTION CAMARAS</font></span></h1>
</center>
</center>
<script>
<!--
var from = 2;
var to = 12;
var delay = 55;
var glowColor = "#0000ff";
var i = to;
var j = 0;
textPulseDown();
function textPulseUp()
{
if (!document.all)
return
if (i < to)
{
TexteBat.style.filter = "Glow(Color=" + glowColor + ", Strength=" + i + ")";
i++;
theTimeout = setTimeout('textPulseUp()',delay);
return 0;
}
if (i = to)
{
theTimeout = setTimeout('textPulseDown()',delay);
return 0;
}
}
//-->
</script>
<form name="formulario" method="post" action="" enctype="multipart/form-data" onSubmit="return valida_Fecha()">
<table width="691" border="8" align="center" cellpadding="2" cellspacing="2">
<tr bgcolor="#006633">
<td colspan="4" bgcolor="#2E7068"><div align="center" class="Estilo3"><span class="Estilo4 Estilo2"><span class="Estilo8">INGRESAR INFORMACION</span></span></div></td>
</tr>
<tr bgcolor="#006633">
<td height="30" colspan="4" bgcolor="#FFFFFF"><div align="center">
<script languaje="JavaScript">Mostrar_Fecha()</script>
</div></td>
</tr>
<tr bgcolor="#ECE9D8">
<td width="289" align="right" bgcolor="#EFEFEF"><b>Cedula:</b></div></td>
<td width="368" bgcolor="#EFEFEF"><input type="text" name="cedula" value="<?php echo $cedula; ?>" readonly></td>
</tr>
<tr bgcolor="#ECE9D8">
<td bgcolor="#EFEFEF" align="right"><b>Funcionario:</b></div></td>
<td width="368" bgcolor="#EFEFEF"><input type="text" name="cedula" size="40" value="<?php echo $funcionario; ?>" readonly></td>
</tr>
<tr bgcolor="#ECE9D8">
<td bgcolor="#EFEFEF" align="right"><b>MOTIVO:</b></div></td>
<td width="368" bgcolor="#EFEFEF"><?php
echo "<textarea name='Contenido' cols='60' rows='4' title='RESPUESTA ENVIADA' readonly>\n";
echo $motivo;
echo "</textarea>"; ?></td>
</tr>
<tr>
<td align="right" bgcolor="#EFEFEF"><b>FECHA</b></td>
<td colspan="3" bgcolor="#EFEFEF"><input type="text" name="cedula" size="40" value="<?php echo $fecha; ?>" readonly></td>
</tr>
<tr>
<td align="right" bgcolor="#EFEFEF"><b>Hora Salida</b></td>
<td colspan="3" bgcolor="#EFEFEF"><input type="text" name="cedula" size="40" value="<?php echo $hora; ?>" readonly></td>
</tr>
<tr bgcolor="#ECE9D8">
<td><div align="right"><span class="Estilo7">Hora de Regreso: </span></div></td>
<td colspan="2"><input name="hora_envio" type="text" size="14" maxlength="14"></td>
</tr>
<tr>
<td align="right" bgcolor="#EFEFEF"><b>Actuacion:</b></td>
<td colspan="3" bgcolor="#EFEFEF"><textarea name="actuacion_cam" id="actuacion_cam" required cols="60" rows="4"></textarea></td>
</tr>
<tr>
<td align="right"><b>Seleccione El Archivo:</b></td>
<td colspan="3" bgcolor="#EFEFEF"><input name="archivito" type="file" class="polici3" size="40" maxlength="40" required></td>
</tr>
<!--
<tr>
<td align="right" bgcolor="#EFEFEF"><b>Adjuntar Imagen Camara:</b>
</td>
<td colspan="3" bgcolor="#EFEFEF"><input name="archivito" type="file" class="Estilo1" size="40" maxlength="40"></td>
</tr>
-->
<tr bgcolor="#FFFFCC">
<td height="30" colspan="4" bgcolor="#EFEFEF"><div align="center">
<input name="guardar" type="submit" class="Estilo1" id="guardar" value="ENVIAR">
<!--<input name="button" type="button" class="Estilo1" onClick="window.location.href='menu_admin.php'" value="REGRESAR">-->
</div></td>
</tr>
</table>
</form>
</body>
</html>
<?php
///////////////////////////ENVIADO ESTADO 0
if(isset($_POST["guardar"]))
{
require_once("Conectarse.php");
$archivo = $_FILES["archivito"]["tmp_name"];
$tamanio = $_FILES["archivito"]["size"];
$tipo = $_FILES["archivito"]["type"];
$nombre = $_FILES["archivito"]["name"];
if($archivo =="" || $archivo==NULL || $archivo == "none")
{
echo "<script>alert('Seleccione El Archivo');</script>";
}
else
{
$fp = fopen($archivo, "rb");
$contenido = fread($fp, $tamanio);
$contenido = addslashes($contenido);
fclose($fp);
$fechast = date("y").'-'.date("m").'-'.date("d");
$time =time();
$hora=date("H:i:s",$time);
$hora = Time() + (60 * 60);
$hora=date('H:i:s',$hora);
//
ini_set('date.timezone','America/Bogota');
$horas = date("g:i A");
$actualiza = mysql_query('UPDATE ausentismo_admin set hora_regreso="'.$horas.'", actuacion_cam = "'.$_POST["actuacion_cam"].'", nombre= "'.$nombre.'", contenido = "'.$contenido.'", tipo = "'.$tipo.'", estado = "1" WHERE cedula = "'.$_GET["cedula"].'" and id = "'.$_GET["id"].'" ');
if (!$actualiza) {
die('Invalid query Actualiza Info: ' . mysql_error());
}
echo "<script>alert('Registro guardado correctamente');</script>";
echo "<script languaje='javascript' type='text/javascript'>window.close();</script>";
}
}
?>