MOON
Server: Apache/2.2.34 (Unix) mod_ssl/2.2.34 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 FrontPage/5.0.2.2635
System: Linux server.asjudinet.com 2.6.32-042stab141.3 #1 SMP Fri Nov 15 22:45:34 MSK 2019 i686
User: asjudine (504)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: /home/asjudine/public_html/modificar_atencion_hist.php
<?php
require_once("mainfile.php");
include ("config.php");
global $dbi;

  require_once("Conectarse.php"); 
 
	  
	   $misql = mysql_query('SELECT id, cedula, numero_atencion, fecha_servicio, hora_servicio, sucursal, nombre_funcionario, cedula_funcionario, tipo FROM record_servicios WHERE cedula = "' . $_GET["id"]  . '" and numero_atencion = "' . $_GET["atencion"]  . '" ');
			if (!$misql) {
				die('Invalid query: ' . mysql_error());
			} 

	  list($idn, $cc, $na, $fs, $hs, $su, $nf, $cedf, $ts) = mysql_fetch_row($misql);
	  
	 //  $msql5 = "select nombre from sucursal where codigo = $su";
     // $misql5 = mysql_query($msql5, $dbi) or die(mysql_error());	
	    $misql5 = mysql_query('SELECT nombre FROM sucursal WHERE codigo = "' ."$su". '" ');
			if (!$misql5) {
				die('Invalid query: ' . mysql_error());
			} 
	  list($nomsuc) = mysql_fetch_row($misql5);
	
		
	//$query_sql = "SELECT * FROM sucursal order by nombre";
	//$sql = mysql_query($query_sql, $dbi) or die(mysql_error());
	$sql = mysql_query('SELECT * FROM sucursal order by nombre');
			if (!$sql) {
				die('Invalid query: ' . mysql_error());
			}
	$row_sql = mysql_fetch_assoc($sql);
	$totalRows_sql = mysql_num_rows($sql); 
	
	//$query_sql2 = "SELECT * FROM Usuarios where (Cargo = 'ABOGADO' || Cargo = 'ABOGADA'  || Cargo = 'DIRECTORA COMERCIAL MOCOA'  || Cargo = 'DIRECTORA DE SERVICIO BARRANQUILLA' || Cargo = 'DIRECTOR DE SERVICIOS BUCARAMANGA' || Cargo = 'DIRECTOR DE SERVICIOS CALI' || Cargo = 'DIRECTOR DE SERVICIOS FLORENCIA' || Cargo = 'DIRECTOR DE SERVICIOS IBAGUE' || Cargo = 'DIRECTOR DE SERVICIOS MEDELLIN' || Cargo = 'DIRECTOR DE SERVICIOS NEIVA' || Cargo = 'DIRECTORA DE SERVICIOS PEREIRA' || Cargo = 'DIRECTORA DE SERVICIOS TUNJA'  || Cargo = 'DIRECTORA SERVICIOS VILLAVICENCIO' || Cargo = 'MEDICO')  order by Nombre_Completo";
//	$sql2 = mysql_query($query_sql2, $dbi) or die(mysql_error());
	$sql2 = mysql_query('SELECT * FROM Usuarios WHERE (Cargo = "ABOGADO" || Cargo = "ABOGADA"  || Cargo = "DIRECTORA COMERCIAL MOCOA"  || Cargo = "DIRECTORA DE SERVICIO BARRANQUILLA" || Cargo = "DIRECTOR DE SERVICIOS BUCARAMANGA" || Cargo = "DIRECTOR DE SERVICIOS CALI" || Cargo = "DIRECTOR DE SERVICIOS FLORENCIA" || Cargo = "DIRECTOR DE SERVICIOS IBAGUE" || Cargo = "DIRECTOR DE SERVICIOS MEDELLIN" || Cargo = "DIRECTOR DE SERVICIOS NEIVA" || Cargo = "DIRECTORA DE SERVICIOS PEREIRA" || Cargo = "DIRECTORA DE SERVICIOS TUNJA"  || Cargo = "DIRECTORA SERVICIOS VILLAVICENCIO" || Cargo = "MEDICO")  order by Nombre_Completo');
			if (!$sql2) {
				die('Invalid query: ' . mysql_error());
			}
	$row_sql2 = mysql_fetch_assoc($sql2);
	$totalRows_sql2 = mysql_num_rows($sql2); 

      
if(isset($_POST["guardar"]))
{
	
	if($_POST[ts1]!='')
	{
			$tipo_servicio=$_POST[ts1];
	}else
	{
		$tipo_servicio=$_POST[tipo_servicio];
	}
	
	if($_POST[sucursal] == "")
	{
		
			$misql7 = mysql_query('SELECT codigo FROM sucursal WHERE nombre = "' . $_POST[nomsuc] . '" ');
			if (!$misql7) {
				die('Invalid query: ' . mysql_error());
			} 
	  		list($suc1) = mysql_fetch_row($misql7);
			
			
	}else
	{
		$suc1= $_POST[sucursal];
	}
	
	
	if($_POST[ced_funcionario] == "")
	{
	
			$misql6 = mysql_query('SELECT nombre_funcionario, cedula_funcionario FROM record_servicios WHERE cedula = "' . $_POST[cedula] . '" and numero_atencion = "' . $_POST[numero_atencion] . '" ');
			if (!$misql6) {
				die('Invalid query: ' . mysql_error());
			}  
			list($nf3, $cedf3) = mysql_fetch_row($misql6);
			
			$cc_fun = $cedf3;
			$nombre_funcionar = $nf3;	
			
	}else{
	

$misql5 = mysql_query('SELECT Nombre_Completo FROM Usuarios WHERE Cedula = "' . $_POST[ced_funcionario] . '" ');
			if (!$misql5) {
				die('Invalid query: ' . mysql_error());
			}
	  		list($nf2) = mysql_fetch_row($misql5);
			$cc_fun = $_POST[ced_funcionario];
			$nombre_funcionar= $nf2;	
	
			
	}
 
	 			 $guard = mysql_query("UPDATE  record_servicios  set cedula = '" . $_POST[cedula] . "', numero_atencion = '" . $_POST[numero_atencion] . "', fecha_servicio = '" . $_POST[fecha_ser] . "', hora_servicio = '" . $_POST[hora_ser] . "', sucursal  = '" .$suc1 . "', nombre_funcionario = '" .$nombre_funcionar. "', cedula_funcionario = '" .$cc_fun. "', tipo = '" .$tipo_servicio. "'  WHERE cedula = '" . $_GET["id"]  . "' and numero_atencion = '" . $_GET["atencion"]  . "' ");
	  if (!$guard) {
				die('Invalid query guard: ' . mysql_error());
			}
	  
	  $mssql2 = mysql_query("UPDATE  actuaciones_servicios  set cedula = '" . $_POST[cedula] . "', numero_atencion = '" . $_POST[numero_atencion] . "', nombre_funcionario = '" . $nombre_funcionar. "',  asesoria = '" . $_POST[asesoria] . "', solucion = '" . $_POST[solucion] . "',   documentos_re = '" . $_POST[documentos_re] . "',  documentos_ap = '" . $_POST[documentos_ap] . "',  concepto = '" . $_POST[concepto] . "',  observaciones = '" . $_POST[observaciones] . "',  estado = '" . $_POST[estado] . "'  WHERE cedula = '" . $_GET["id"]  . "' and numero_atencion = '" . $_GET["atencion"]  . "' ");
	  if (!$mssql2) {
				die('Invalid query: ' . mysql_error());
			}
	  

	   $misql = mysql_query('SELECT id, cedula, numero_atencion, fecha_servicio, hora_servicio, sucursal, nombre_funcionario, cedula_funcionario, tipo FROM record_servicios WHERE cedula = "' . $_GET["id"]  . '" and numero_atencion = "' . $_GET["atencion"]  . '" ');
			if (!$misql) {
				die('Invalid query: ' . mysql_error());
			} 

	  list($idn, $cc, $na, $fs, $hs, $su, $nf, $cedf, $ts) = mysql_fetch_row($misql);
	   
	  
	 // $msql4 = "select nombre from sucursal where codigo = '$su'";
     // $misql4 = mysql_query($msql4, $dbi) or die(mysql_error());
	  $misql4 = mysql_query('SELECT nombre FROM sucursal WHERE codigo = "' ."$su". '" ');
			if (!$misql4) {
				die('Invalid query: ' . mysql_error());
			} 	 
	  list($nomsuc) = mysql_fetch_row($misql4);
	
}	  


?>
<html>
<head>
<title>MODIFICACION - PROGRAMACION DE ATENCION</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
<!--
.titulos {font: 16px; color: red; font-family:Arial; font-weight:bold}
.boton {  background-color: #FFCCCC; color:#FFFFFF; width:150px; border: 4px solid #0000CC; font-family:Arial; color:#990000;}
.texto {background-color: #CCFFCC; font-size: 13px; font-family: Arial; color:#0000CC; display: block;}
.fecha {background-color: #CCFFCC; font-size: 12px; font-family: Arial; color: #000099; width:10px display: block;}
.campo {background-color: #FFFFCC; border:1px solid #990000; font-family:Arial;  font-size:11px; height: inherit}
.lista { background-color:#99FFFF; font-family: Arial; font-size: 11px;	color: #990000;}
.label {background-color: #00CCFF ; font-size: 14px; font-family: Arial; color:#0000CC; display: block;}
.area {background-color: #CCFFCC; font-size: 13px; width:40px font-family: Arial; color:#0000CC; display: block;}
.variables {background-color: #CCFFCC; font-size: 12px; font-family: Arial; color: #003333 ; width:10px display: block; border: 2px solid #006633;}
.sel { background-color:#DDFFFF; width:400px; border: 1px solid #0099FF; font-family:Arial; font-style:italic; color:#990000 }
.sel2{ background-color:#DDFFFF; border: 1px solid #0099FF; font-family:Arial; font-style:italic; font-weight:bold; color:#990000 }
.seleccion { background-color: #CCFFCC; width:340px; border: 1px solid #0099FF; font-family:Arial; color:#990000;}
.boton2 {font-family: Verdana; font-size: 8 pt; color: #000080; background-color: #C0C0C0; border-style: solid; }
.letras {background-color: #99CCFF; font-size: 10px; font-family: Arial; color:#0000CC; display: block;}
.campo2 {background-color: #99CCCC; border:1px solid #0066FF; font-family:Arial; font-size:10px; height: inherit}
.sel3{ background-color:#DDFFFF; font-family:Arial; font-size:10px; color: #000066 }
body {
	background-image: url(fondo_argollado.gif);
}
.Estilo10 {font-size: 11px; font-family: Arial, Helvetica, sans-serif; }
-->
</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()
{

  if (formulario.folio2.value == "")
  {
    alert("Falta ingresar el Folio2");
    formulario.folio2.focus();
    return (false);
  }   

	if(formulario.folio2.value < pf)
	{	 
     	   alert('El folio2 no debe ser menor que el folio1');
           formulario.folio2.focus();
           return (false);	
	}	

  if (formulario.actuacion.value == "")
  {
    alert("Falta ingresar la actuación");
    formulario.actuacion.focus();
    return (false);
  }

  if (formulario.codigo_funcionario.value == "")
  {
    alert("Falta seleccionar el nombre del funcionario");
    formulario.codigo_funcionario.focus();
    return (false);
  }

return (true);
}
//--></script>

<SCRIPT LANGUAGE='JavaScript'>
var default1 = "VENTANA PARA MODIFICAR ATENCION"; // only shown once at page load
var text1 = "El primer encabezado muestra en detalle los datos de la atencion seleccionada";
var text2 = "La segunda parte muestra los datos de actuaciones de servicio ";
var changeRate = 3000; // 1000 = 1 second
var messageNumber = 0;

function changeStatus()
{
  if (messageNumber == 0) {
     window.status=default1;
     document.title=default1;
    }
  else if (messageNumber == 1) {
     window.status=text1;
    }
  else if (messageNumber == 2) {
     window.status=text2;
     }
  else if (messageNumber == 3) {
     window.status=text3;
     messageNumber = 0;
     }
  messageNumber++;
  setTimeout("changeStatus();",changeRate);
}
changeStatus(); // leave here to run right away
// -->
</SCRIPT>

</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="document.formulario.folio1.focus()">
<form name="formulario" action="" method="post" onSubmit="return validar(this)">
<input name="codigo_funcionario" type="hidden" value="<?php echo $codigo_funcionario; ?>">
<table width="855" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr bgcolor="#FFFFCC">
    <td width="847" class="titulos"><div align="center">VISUALIZACION DE DATOS DE LA ATENCION SELECCIONADA</div></td>
  </tr>
  <tr bgcolor="#ECE9D8">
    <td height="3" class="fecha"><div align="center">
      <script languaje="JavaScript">Mostrar_Fecha()</script>
    </div></td>
  </tr>
  <tr bgcolor="#FFCC99">
    <td height="20" bgcolor="#FFFFFF"><fieldset>
   <legend><span class="texto">Datos de la atenci&ograve;n:</span></legend>
   <table width="810" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#ECE9D8">
     <tr bgcolor="#FFFFFF">
       <td width="205"><span class="label">C&eacute;dula (Titular-Beneficiario):</span></td>
       <td width="173"><input name="cedula" type="text" class="campo" id="cedula" value="<?php echo $cc; ?>" size="15" maxlength="15" readonly="">
         <input name="projuridico" type="hidden" class="campo" id="projuridico" value="<?php echo $na ?>" size="6" maxlength="6"></td>
       <td width="141"><span class="label">N&uacute;mero de Atencion:</span></td>
       <td width="167"><input name="numero_atencion" readonly type="text" class="campo" value="<?php echo $na ?>" size="15" maxlength="15"> </td>
       </tr>
     <tr bgcolor="#FFFFFF">
       <td><span class="label">Tipo de servicio:</span></td>
       <td colspan="3"><input name="tipo_servicio" type="text" class="campo" id="tipo_servicio" value="<?php echo $ts ?>" size="20" maxlength="20" readonly="">
         -
           <select name="ts1" class="sel3" id="select2">
             <option value="" selected>--TIPO DE SERVICIO--</option>
             <option value="ASESORIA JURIDICA">ASESORIA JURIDICA</option>
             <option value="DISCIPLINARIA">DISCIPLINARIA</option>
             <option value="SUSTANCIACION">SUSTANCIACION</option>
			 <option value="MEDICA LABORAL">MEDICA LABORAL</option>
			 <option value="TRAMITE DOCUMENTOS">TRAMITE DOCUMENTOS</option>
			 <option value="TELEFONICO">TELEFONICO</option>
           </select></td>
     </tr>
     <tr bgcolor="#FFFFFF">
       <td><span class="label">Nombre funcionario :</span></td>
       <td colspan="3"><input name="nombre_funcionario" type="text" class="campo" id="nombre_funcionario" value="<?php echo $nf ?>" size="50" maxlength="50"> 
       -         
		 <select name="ced_funcionario" id="ced_funcionario">
		 <option value=""> SELECCION FUNCIONARIO</option>
      <?php
     do {  
?>
      <option value="<?php echo $row_sql2['Cedula'];?>"><?php echo $row_sql2['Nombre_Completo']?></option>
      <?php
} while ($row_sql2 = mysql_fetch_assoc($sql2));
  $rows2 = mysql_num_rows($sql2);
  if($rows2 > 0) {
      mysql_data_seek($sql2, 0);
       $row_sql2 = mysql_fetch_assoc($sql2);
  }
?>
    </select> </td>
     </tr>
     <tr bgcolor="#FFFFFF">
       <td><span class="label">Fecha Servicio :</span></td>
       <td colspan="3"><input name="fecha_ser" type="text" class="campo" id="despacho_judicial" value="<?php echo $fs ?>" size="30" maxlength="30"></td>
     </tr>
     <tr bgcolor="#FFFFFF">
       <td><span class="label">Hora Servicio  :</span></td>
       <td colspan="3"><input name="hora_ser" type="text" class="campo" id="ciudad_despacho" value="<?php echo $hs ?>" size="30" maxlength="30"></td>
       </tr>
	   <tr bgcolor="#FFFFFF">
       <td height="39"><span class="label">Sucursal  :</span></td>
       <td colspan="3"><input name="nomsuc" type="text" class="campo" id="nomsuc" value="<?php echo $nomsuc ?>" size="30" maxlength="30" readonly=""> 
         - 
           <select name="sucursal" id="sucursal">
             <option value="">--SELECCIONE SUCURSAL--</option>
             <?php
     do {  
?>
             <option value="<?php echo $row_sql['codigo'];?>"><?php echo $row_sql['nombre']?></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>
   </table> 
   </fieldset></td>
  </tr><tr><td><?php
		 
		 
//$msql = "select id, numero_atencion, nombre_funcionario ,asesoria, solucion, documentos_re,documentos_ap, concepto, observaciones from actuaciones_servicios where cedula = $cedula and numero_atencion = '$numero_atencion' ";
//$result = mysql_query($msql, $dbi);
 $result = mysql_query('SELECT id, numero_atencion, nombre_funcionario ,asesoria, solucion, documentos_re,documentos_ap, concepto, observaciones FROM actuaciones_servicios WHERE cedula = "' . $_GET["id"] . '" and numero_atencion = "' . $_GET["atencion"] . '" ');
		if (!$result) {
				die('Invalid query: ' . mysql_error());
		} 
if(mysql_num_rows($result) != 0)
{ //   <td width="600" class="titulos"><div align="center">VISUALIZACION DE DATOS DE ATENCION SELECCIONADA </div></td>

   while(list($id, $numero_atencion, $nombre_fun, $asesoria, $solucion, $documentos_re, $documentos_ap, $concepto, $observaciones) = mysql_fetch_row($result))
   {
       echo "<table width=700 border=1 align=center cellpadding=1 cellspacing=1>
	  <tr>
		<td colspan=8 bgcolor=#ECE9D8><div align=center class='titulos'>ASESORIA SOLICITADA Y SOLUCION</div></td>
	  </tr>
	  <tr align=center>
		<td width='350' class=fecha>ASESORIA</td>
		<td width='350' class=fecha>SOLUCION</td>
	  </tr>";
	   ?>
  
  <tr class=lista><td><label>
  <input name="asesoria" type="text" id="asesoria" value="<?php echo $asesoria; ?>">
  </label></td><td><input name="solucion" type="text" id="solucion" value="<?php echo $solucion; ?>"></td>
  </tr>
		
		<?php
	   echo "<table width=700 border=1 align=center cellpadding=1 cellspacing=1>
	  <tr>
		<td bgcolor=#ECE9D8><div align=center class='titulos'>DOCUMENTOS REQUERIDOS Y APORTADOS</div></td>
	  </tr>
	  <tr align=center>
		<td width='350' class=fecha>DOCUMENTOS REQUERIDOS</td>
		<td width='350' class=fecha>DOCUMENTOS APORTADOS</td>
	  </tr>";
	  
	    echo "<tr class=lista><td>"; ?><label>
  <input name="documentos_re" type="text" id="documentos_re" value="<?php echo $documentos_re; ?>">
  </label><?php echo"</td><td>";   ?><label>
  <input name="documentos_ap" type="text" id="documentos_ap" value="<?php echo $documentos_ap; ?>">
  </label><?php echo "</td></tr>";

	  echo "<table width=700 border=1 align=center cellpadding=1 cellspacing=1>
	  <tr>
		<td colspan=8 bgcolor=#ECE9D8><div align=center class='titulos'>CONCEPTO Y OBSERVACIONES</div></td>
	  </tr>
	  <tr align=center>
		<td width='350' class=fecha>CONCEPTO</td>
		<td width='350' class=fecha>OBSERVACIONES</td>
	  </tr>";
	  	    
		echo "<tr class=lista><td>" ?> <label>
  <input name="concepto" type="text" id="concepto" value="<?php echo $concepto; ?>">
  </label> <?php echo "</td><td>"; ?> <label>
  <input name="observaciones" type="text" id="observaciones" value="<?php echo $observaciones; ?>">
  </label> <?php echo "</td></tr>";


   }

}
?>  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr bgcolor="#FFCC99">
    <td height="20" align="center" bgcolor="#99CCFF"><div align="center">
        <input name = "guardar" type="submit" class="boton2" value="Modificar datos">
    </div></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
</form>
</body>
</html>