File: /home/asjudine/www/ingresar_atencion_histoser_func.php
<?php
require_once("mainfile.php");
include ("config.php");
global $dbi;
require_once("Conectarse.php");
//$sql = "select id, cedula, numero_atencion, fecha_servicio, nombre_funcionario, cedula_funcionario, tipo from record_servicios where cedula = $id and numero_atencion = $atencion ";
//$control = mysql_query($sql, $dbi) or die(mysql_error());
$resul = mysql_query('SELECT id, cedula, numero_atencion, fecha_servicio, nombre_funcionario, cedula_funcionario, tipo FROM record_servicios WHERE cedula = "' . $_GET["id"] . '" and numero_atencion ="'.$_GET["atencion"].'"');
if (!$resul) {
die('Invalid query: ' . mysql_error());
}
if ((mysql_num_rows($resul)!=0))
{
list($id_at, $cedula_at, $numero_atencion_at, $fecha_servicio_at, $nombre_funcionario_at, $cedu_funcionario_at,$tipo_at) = mysql_fetch_row($resul);
// $sqlnom = "select nombre from asjudinet_cartera where cedula = $cedula_at";
// $control = mysql_query($sqlnom, $dbi) or die(mysql_error());
$resu = mysql_query('SELECT nombre FROM cartera_serviasjudinet WHERE cedula = "'.$cedula_at.'" ');
if (!$resu) {
die('Invalid query: ' . mysql_error());
}
list($nombre_completo) = mysql_fetch_row($resu);
$fil = mysql_num_rows($resu);
if ($fil == 0)
{
$resu = mysql_query('SELECT nombre FROM beneficiarios WHERE cedula = "'.$cedula_at.'"');
if (!$resu) {
die('Error de consulta: ' . mysql_error());
}
list($nombre_completo) = mysql_fetch_row($resu);
$fil = mysql_num_rows($resu);
if ($fil == 0)
{
$resu = mysql_query('SELECT nombre FROM solicitud_credito WHERE cedula = "'.$cedula_at.'"');
if (!$resu) {
die('Error de consulta: ' . mysql_error());
}
list($nombre_completo) = mysql_fetch_row($resu);
}
}
}
?>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>INGRESO ATENCION AL AFILIADO</title>
<style type="text/css">
<!--
.Estilo1 {font-family: "Arial Narrow"}
.Estilo2 {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
}
.Estilo18 {font-family: "Arial Narrow"; font-weight: bold; font-size: 14; }
.Estilo19 {font-family: "Arial Narrow"; font-weight: bold; }
.Estilo20 {color: #990000}
.Estilo21 {font-family: "Arial Narrow"; font-weight: bold; font-size: 14; color: #990000; }
.Estilo23 {color: #990000; font-family: "Arial Narrow";}
.Estilo13 {font-size: 12px; font-weight: bold; }
.Estilo41 {font-family: "Times New Roman", Times, serif}
.Estilo42 {color: #009933}
.Estilo44 {font-family: "Arial Narrow"; font-weight: bold; font-size: 16px; color: #3366FF; }
.Estilo45 {
color: #0066FF;
font-size: 16px;
}
.Estilo46 {color: #666699}
.Estilo47 {font-family: "Arial Narrow"; font-weight: bold; font-size: 14; color: #666699; }
.Estilo48 {
color: #CC3333;
font-weight: bold;
}
.Estilo49 {color: #CC3333}
.Estilo50 {
color: #CC3333;
font-family: "Arial Narrow";
font-weight: bold;
}
.Estilo51 {color: #003333}
.Estilo52 {
font-size: 14px;
color: #0066FF;
font-weight: bold;
}
.Estilo53 {color: #666633}
.Estilo54 {
font-size: 14px;
font-family: "Courier New", Courier, mono;
color: #FF0033;
font-weight: bold;
}
-->
</style>
<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(formulario)
{
if (formulario.asesoria.value == "")
{
alert("Ingrese la asesoria");
formulario.asesoria.focus();
return (false);
}
if (formulario.documentosap.value == "")
{
alert("Ingrese documentos aportados");
formulario.documentosap.focus();
return (false);
}
if (formulario.solucion.value == "")
{
alert("Ingrese solucion dada");
formulario.solucion.focus();
return (false);
}
if (formulario.documentosre.value == "")
{
alert("Ingrese documentosre requeridos");
formulario.documentosre.focus();
return (false);
}
if (formulario.concepto.value == "")
{
alert("Ingrese concepto del servicio");
formulario.concepto.focus();
return (false);
}
observaciones
if (formulario.observaciones.value == "")
{
alert("Ingrese observaciones");
formulario.observaciones.focus();
return (false);
}
if (formulario.ciudad.value == "")
{
alert("Ingrese el nombre de la ciudad");
formulario.ciudad.focus();
return (false);
}
if (formulario.cedula.value == "")
{
alert("Ingrese el número de la cédula");
formulario.cedula.focus();
return (false);
}
if (formulario.nombre_completo.value == "")
{
alert("Ingrese apellidos y nombres");
formulario.nombre_completo.focus();
return (false);
}
if (formulario.expedicion_cedula.value == "")
{
alert("Ingrese la ciudad donde expidió su cédula");
formulario.expedicion_cedula.focus();
return (false);
}
if (formulario.edad.value == "")
{
alert("Ingrese su edad");
formulario.edad.focus();
return (false);
}
if (formulario.estado_civil.value == "")
{
alert("Ingrese su estado civil");
formulario.estado_civil.focus();
return (false);
}
if (formulario.ciudad.value == "")
{
alert("Ingrese el nombre de la ciudad");
formulario.ciudad.focus();
return (false);
}
if (formulario.natural_de.value == "")
{
alert("Ingrese de donde es usted");
formulario.natural_de.focus();
return (false);
}
if (formulario.residente_en.value == "")
{
alert("Ingrese la dirección de residencia");
formulario.residente_en.focus();
return (false);
}
if (formulario.ciudad_reside.value == "")
{
alert("Ingrese la ciudad donde reside");
formulario.ciudad_reside.focus();
return (false);
}
if (formulario.telefono_fijo.value == "")
{
alert("Ingrese el su número de teléfono fijo");
formulario.telefono_fijo.focus();
return (false);
}
if (formulario.celular.value == "")
{
alert("Ingrese el número de su celular");
formulario.celular.focus();
return (false);
}
if (formulario.grado.value == "")
{
alert("Ingrese su grado militar");
formulario.grado.focus();
return (false);
}
if (formulario.cargo.value == "")
{
alert("Ingrese su cargo actual");
formulario.cargo.focus();
return (false);
}
if (formulario.hechos.value == "")
{
alert("Redacte los hechos por el cual se le imputan los cargos");
formulario.hechos.focus();
return (false);
}
if (formulario.nom_funcionario.value == "")
{
alert("Escriba el nombre del funcionario investigador");
formulario.nom_funcionario.focus();
return (false);
}
if (formulario.cargo_funcionario.value == "")
{
alert("Escriba el cargo del funcionario investigador");
formulario.cargo_funcionario.focus();
return (false);
}
if (formulario.dia_noti.value == "")
{
alert("Escriba el día de la notificación");
formulario.dia_noti.focus();
return (false);
}
if (formulario.mes_noti.value == "")
{
alert("Escriba el mes de la notificación");
formulario.mes_noti.focus();
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;
}
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) ? " pm" : " am"
document.formulario.Hora_Envio.value = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
function startclock ()
{
stopclock ();
showtime ();
}
//--></script>
<link href="file:///C|/Documents%20and%20Settings/web%20master/Mis%20documentos/job9.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Estilo57 {color: #006666}
-->
</style>
</head>
<body onLoad="document.formulario.ciudad.focus();startclock()">
<form method="post" name="formulario" action="<?php echo $editFormAction; ?>" onSubmit="return validar(this)">
<table width="863" border="0" align="center" cellpadding="3" cellspacing="3" bgcolor="#FAFAF5">
<tr valign="baseline" bgcolor="#FF6600">
<td colspan="8" align="right" nowrap><div align="center"><span class="Estilo2">INGRESO ATENCIONES AL AFILIADO </span></div></td>
</tr>
<tr valign="baseline" bgcolor="#FAFAF5">
<td colspan="8" align="right" nowrap><div align="center" class="Estilo2">
<script languaje="JavaScript">Mostrar_Fecha()</script></div></td>
</tr>
<tr valign="baseline" bgcolor="#F2F2E6">
<td colspan="8"><table width="852">
<tr>
<td width="265"><div align="center"></div></td>
<td width="289"><div align="center"><span class="Estilo19 Estilo20">Fecha dd-mm/aaaa:</span><span class="Estilo21"> <span class="Estilo13">
<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="">
</span></span></div></td>
<td width="282"></td>
</tr>
</table></td>
</tr>
<tr valign="baseline" bgcolor="#FFCC99">
<td colspan="8"><div align="right" class="Estilo19 Estilo20">
<div align="left" class="Estilo41">
<div align="center" class="Estilo42">
<p> </p>
</div>
</div>
</div> </td>
</tr>
<tr valign="baseline" bgcolor="#F2F2E6">
<td width="175" bgcolor="#66CCCC"><div align="right" class="Estilo20">
<div align="left"><strong><span class="Estilo5 Estilo1 Estilo45 Estilo57"> Cedula: </span></strong></div>
</div></td>
<td width="261" bordercolor="#ECE9D8" bgcolor="#FFFFCC"><input name="ced_at" type="text" id="ced_at" value="<?php echo $cedula_at ?>" size="35" maxlength="35" readonly=""> </td>
<td width="125" bgcolor="#66CCCC"><strong><span class="Estilo5 Estilo1 Estilo45 Estilo57">Nombre :</span></strong></td>
<td bgcolor="#FFFFCC"><input name="tipo_s" type="text" value="<?php echo $nombre_completo ?>" size="35" maxlength="35" readonly=""> </td>
</tr> <tr valign="baseline" bgcolor="#F2F2E6">
<td bgcolor="#66CCCC"><div align="right" class="Estilo20">
<div align="left"><strong><span class="Estilo5 Estilo1 Estilo45 Estilo57"> Numero de Atencion:</span></strong></div>
</div></td>
<td width="261" bordercolor="#ECE9D8" bgcolor="#FFFFCC"><input name="atencionnum" type="text" value="<?php echo $numero_atencion_at ?>" size="15" maxlength="15" readonly=""></td>
<td width="125" bgcolor="#66CCCC"><strong><span class="Estilo5 Estilo1 Estilo45 Estilo57">Fecha de servicio:</span></strong></td>
<td width="264" bgcolor="#FFFFCC"><input name="fechas" type="text" value="<?php echo $fecha_servicio_at ?>" size="15" maxlength="15" readonly=""></td>
</tr>
<tr valign="baseline" bgcolor="#F2F2E6">
<td bgcolor="#66CCCC"><div align="right" class="Estilo20">
<div align="left"><strong><span class="Estilo5 Estilo1 Estilo45 Estilo57"> Nombre Funcionario:</span></strong></div>
</div></td>
<td width="261" bordercolor="#ECE9D8" bgcolor="#FFFFCC"><input name="nombre_funci" type="text" value="<?php echo $nombre_funcionario_at ?>" size="35" maxlength="35" readonly=""> </td>
<td width="125" bgcolor="#66CCCC"><strong><span class="Estilo5 Estilo1 Estilo45 Estilo57">Tipo de servicio :</span></strong></td>
<td bgcolor="#FFFFCC"><input name="tipo_s" type="text" value="<?php echo $tipo_at ?>" size="35" maxlength="35" readonly=""> </td>
</tr>
<tr valign="baseline" bgcolor="#F2F2E6">
<td align="right" nowrap bgcolor="#99CCCC"><div align="center" class="Estilo57">
<p class="Estilo18"><span class="Estilo5 ">ASESORIA</span></p>
<p class="Estilo18">SOLICITADA<span class="Estilo5 "></span></p>
</div></td>
<td colspan="7" align="right" nowrap><div align="center">
<table width="508" align="center">
<tr>
<td width="500" bgcolor="#0099CC"><div align="justify" class="Estilo23">
<p align="center" class="Estilo48">ASESORIA</p>
</div></td>
</tr>
</table>
<table width="587" align="center">
<tr>
<td width="579"><div align="justify" class="Estilo23">
<div align="center"><span class="Estilo20">
<textarea name="asesoria" cols="50" rows="4" id="asesoria"></textarea>
</span></div>
</div></td>
</tr>
</table>
</div></td>
</tr>
<tr valign="baseline" bgcolor="#F2F2E6">
<td align="right" nowrap bgcolor="#99CCCC"><p align="center" class="Estilo20"><span class="Estilo57"><span class="Estilo47 Estilo57">DOCUMENTOS</span></span></p>
<p align="center" class="Estilo20"><span class="Estilo57"><span class="Estilo47 Estilo57">APORTADOS</span></span></p>
<p align="center" class="Estilo57"> </p> </td>
<td colspan="7" align="right" nowrap><div align="center">
<table width="508" align="center">
<tr>
<td width="500" bgcolor="#0099CC"><div align="justify" class="Estilo23 Estilo49">
<div align="center"><span class="Estilo48">DOCUMENTOS</span></div>
</div></td>
</tr>
</table>
<table width="508" align="center">
<tr>
<td width="500"><div align="justify" class="Estilo23">
<div align="center"><span class="Estilo20">
<textarea name="documentosap" cols="50" rows="4" id="textarea7">
</textarea>
</span></div>
</div></td>
</tr>
</table>
</div></td>
</tr>
<tr valign="baseline" bgcolor="#F2F2E6">
<td align="right" nowrap bgcolor="#99CCCC"><p align="center" class="Estilo20"><span class="Estilo47 Estilo57">SOLUCION </span></p>
<p align="center" class="Estilo20"><span class="Estilo47 Estilo57">DADA </span></p></td>
<td colspan="7" align="right" nowrap><div align="center">
<table width="508" align="center">
<tr>
<td width="500" bgcolor="#0099CC"><div align="justify" class="Estilo50">
<div align="center"><span class="Estilo48">SOLUCION</span></div>
</div></td>
</tr>
</table>
<table width="508" align="center">
<tr>
<td width="500"><div align="justify" class="Estilo23">
<div align="center"><span class="Estilo20">
<textarea name="solucion" cols="50" rows="4" id="textarea7"></textarea>
</span></div>
</div></td>
</tr>
</table>
</div></td>
</tr>
<tr valign="baseline" bgcolor="#F2F2E6">
<td align="right" nowrap bgcolor="#99CCCC"><div align="center">
<p align="center" class="Estilo20"><span class="Estilo57"><span class="Estilo47 Estilo57">DOCUMENTOS</span></span></p>
<p align="center" class="Estilo20"><span class="Estilo57"><span class="Estilo47 Estilo57">REQUERIDOS</span></span></p>
<p align="center" class="Estilo20"> </p>
</div></td>
<td colspan="7" align="right" nowrap><div align="center">
<table width="508" align="center">
<tr>
<td width="500" bgcolor="#0099CC"><div align="justify" class="Estilo50">
<div align="center"><span class="Estilo48">DOCUMENTOS</span></div>
</div></td>
</tr>
</table>
<table width="508" align="center">
<tr>
<td width="500"><div align="justify" class="Estilo23">
<div align="center"><span class="Estilo20">
<textarea name="documentosre" cols="50" rows="4" id="textarea9"></textarea>
</span></div>
</div></td>
</tr>
</table>
</div></td>
</tr>
<tr valign="baseline" bgcolor="#F2F2E6">
<td align="right" nowrap bgcolor="#99CCCC"><div align="center">
<p align="center" class="Estilo51 Estilo52"><span class="Estilo20"><span class="Estilo57"><span class="Estilo47 Estilo57">CONCEPTO</span></span></span></p>
<p align="center" class="Estilo51 Estilo52"><span class="Estilo20"><span class="Estilo57"><span class="Estilo47 Estilo57">DEL</span></span></span></p>
<p align="center" class="Estilo51 Estilo52"><span class="Estilo20"><span class="Estilo57"><span class="Estilo47 Estilo57">SERVICIO</span></span></span></p>
</div></td>
<td colspan="7" align="right" nowrap><div align="center">
<table width="508" align="center">
<tr>
<td width="500" bgcolor="#0099CC"><div align="justify" class="Estilo50 Estilo53">
<div align="center"><span class="Estilo48">CONCEPTO</span></div>
</div></td>
</tr>
</table>
<table width="508" align="center">
<tr>
<td width="500"><div align="justify" class="Estilo23">
<div align="center"><span class="Estilo20">
<textarea name="concepto" cols="50" rows="4" id="textarea9"></textarea>
</span></div>
</div></td>
</tr>
</table>
<p class="Estilo54"> </p>
</div></td>
</tr>
<tr valign="baseline" bgcolor="#F2F2E6">
<td align="right" nowrap bgcolor="#99CCCC"><div align="center">
<p align="center" class="Estilo51 Estilo52"> </p>
<p align="center" class="Estilo51 Estilo52"><span class="Estilo20"><span class="Estilo57"><span class="Estilo47 Estilo57">OBSERVACIONES</span></span></span></p>
</div></td>
<td colspan="7" align="right" nowrap><div align="center">
<table width="508" align="center">
<tr>
<td width="500" bgcolor="#0099CC"><div align="justify" class="Estilo50 Estilo53">
<div align="center"><span class="Estilo48">OBSERVACIONES</span></div>
</div></td>
</tr>
</table>
<table width="508" align="center">
<tr>
<td width="500"><div align="justify" class="Estilo23">
<div align="center"><span class="Estilo20">
<textarea name="observaciones" cols="50" rows="4" id="textarea9"></textarea>
</span></div>
</div></td>
</tr>
</table>
<p class="Estilo54"> </p>
</div></td>
</tr>
<tr valign="baseline" bgcolor="#009999">
<td colspan="8" align="right" nowrap><div align="center" class="Estilo20">
<p>
<input name="submit" type="submit" value="ENVIAR" style="font-family: Verdana; font-size: 8 pt; background-color: #C0C0C0; border-style: solid">
<input name="button" type="button" style="font-family: Verdana; font-size: 8 pt; background-color: #C0C0C0; border-style: solid" onClick="window.location.href='index.php'" value="IR A LA PAGINA PRINCIPAL">
<input name="button" type="button" style="font-family: Verdana; font-size: 8 pt; background-color: #C0C0C0; border-style: solid" onClick="window.location.reload()" value="Actualizar">
</p>
<p> </p>
</div></td>
</tr>
</table>
<div align="center">
<input type="hidden" name="MM_insert" value="formulario">
</div>
</form>
</body>
</html>
<?php
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "formulario"))
{
require_once("mainfile.php");
include ("config.php");
global $dbi;
if($_POST[ced_at]!='' && $_POST[atencionnum]!='' && $_POST[nombre_funci]!='' && $_POST[asesoria]!='' && $_POST[solucion]!='' && $_POST[documentosre] !='' && $_POST[documentosap] !='' && $_POST[concepto] !='' && $_POST[observaciones]!='')
{
$resul4 = mysql_query('SELECT numero_atencion FROM actuaciones_servicios WHERE cedula = "' . $_POST[ced_at] . '" and numero_atencion = "' . $_POST[atencionnum] . '"');
if (!$resul4) {
die('Invalid query: ' . mysql_error());
}
$num=mysql_num_rows($resul4);
if($num != '0')
{
echo "<script>alert('Ya fue ingresada esta informacion');</script>";
}
else
{
$observaciones = strtoupper($_POST['observaciones']);
$concepto = strtoupper($_POST['concepto']);
$asesoria = strtoupper($_POST['asesoria']);
$solucion = strtoupper($_POST['solucion']);
$documentosre = strtoupper($_POST['documentosre']);
$documentosap = strtoupper($_POST['documentosap']);
$mssqliNSERT = mysql_query("INSERT INTO actuaciones_servicios (cedula, numero_atencion, nombre_funcionario, asesoria, solucion, documentos_re, documentos_ap, concepto, observaciones, estado) VALUES ('" . $_POST["ced_at"] . "', '" . $_POST["atencionnum"] . "', '" . $_POST["nombre_funci"] . "', '" . $asesoria . "', '" ."$solucion". "', '" . "$documentosre". "', '" . "$documentosap" . "', '" . "$concepto". "', '" . "$observaciones". "', '5')");
if (! $mssqliNSERT) {
die('Invalid query: ERROR INSERTAR' . mysql_error());
}
$mssql2 = mysql_query(" UPDATE record_servicios set estado = '5' WHERE cedula = '".$_GET[id]."' and numero_atencion = '" .$_GET[atencion]."' and estado = '4' ");
if (! $mssql2) {
die('Invalid query: ' . mysql_error());
}
echo "<script>alert('La información se ha enviado correctamente ');</script>";
echo "<SCRIPT LANGUAGE='javascript'> window.close();</SCRIPT>";
}
}else{
echo "<script>alert('Falta ingresar informacion en algun campo, Debe ingresar toda la informacion ');</script>";
}
}
?>