File: /home/asjudine/public_html/modifica_casos_exito.php
<?php
require_once("mainfile.php");
include ("config.php");
global $dbi;
require_once("Conectarse.php");
mysql_select_db("asjudinet", $dbi);
//$query_Recordset4 = "select * from sucursal order by nombre";
//$Recordset4 = mysql_query($query_Recordset4, $dbi) or die(mysql_error());
$Recordset4 = mysql_query('SELECT * FROM sucursal order by nombre ');
if (!$Recordset4) {
die('Invalid query: ' . mysql_error());
}
$row_Recordset4 = mysql_fetch_assoc($Recordset4);
$totalRows_Recordset4 = mysql_num_rows($Recordset4);
mysql_select_db("asjudinet", $dbi);
//$query_Recordset1 = "select * from asjudinet_abogados where vigentes='1' order by nombre_completo";
//$Recordset1 = mysql_query($query_Recordset1, $dbi) or die(mysql_error());
$Recordset1 = mysql_query('SELECT * FROM asjudinet_abogados WHERE vigentes="1" order by nombre_completo ');
if (!$Recordset1) {
die('Invalid query: ' . mysql_error());
}
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
if ($_POST[consultar])
{
if($cedula and $numero)
{
// $sql = "select cedula, numero_proceso, nombre_completo, codigo_sucursal, clase_negocio, despacho_judicial, codigo_abogado, pretencion, resultado, fecha_termina from casos_exito where cedula = $cedula and numero_proceso = $numero";
// $control = mysql_query($sql, $dbi) or die(mysql_error());
$control = mysql_query('SELECT cedula, numero_proceso, nombre_completo, codigo_sucursal, clase_negocio, despacho_judicial, codigo_abogado, pretencion, resultado, fecha_termina FROM casos_exito WHERE cedula = "' . $_POST[cedula] . '" and numero_proceso = "' . $_POST[numero] . '" ');
if (!$control) {
die('Invalid query: ' . mysql_error());
}
if ((mysql_num_rows($control)!=0))
{
list($cc, $np, $nc, $cs, $cn, $dj, $ca, $pre, $res, $ft) = mysql_fetch_ROW($control);
//traer nombre de la ciudad
// $suc = mysql_query("select * from sucursal where Codigo = $cs",$dbi);
$suc = mysql_query('SELECT * FROM sucursal WHERE Codigo = "' . $_POST[cs] . '" ');
if (!$suc) {
die('Invalid query: ' . mysql_error());
}
$ns = mysql_result($suc,0,"Nombre");
//traer nombre del departamento
// $abog = mysql_query("select * from asjudinet_abogados where codigo_abogado = $ca",$dbi);
$abog = mysql_query('SELECT * FROM asjudinet_abogados WHERE codigo_abogado = "' . $_POST[ca] . '" ');
if (!$abog) {
die('Invalid query: ' . mysql_error());
}
$na = mysql_result($abog,0,"nombre_completo");
$tres=substr($ft, 0, 4);
$dos=substr($ft, 5, 2);
$uno=substr($ft, 8, 2);
$fecha = ($uno."-".$dos."-".$tres);
}
else
{
echo "<script>alert('El número de cédula no existe en la base de datos, o no corresponde al número del proceso.');</script>";
}
}
}
if ($_POST[modificar])
{
if($cc and $np)
{
require_once("mainfile.php");
include ("config.php");
global $dbi;
$nombre_completo = strtoupper($nombre_completo);
$clase = strtoupper($clase);
$despacho = strtoupper($despacho);
$res = strtoupper($res);
$uno=substr($fecha, 0, 2);
$dos=substr($fecha, 3, 2);
$tres=substr($fecha, 6, 4);
$fecha = ($tres."-".$dos."-".$uno);
// $sql = "update casos_exito set cedula='$cc', numero_proceso = '$np', nombre_completo='$nombre_completo', / clase_negocio='$clase', despacho_judicial='$despacho', pretencion = '$pre', resultado='$res', fecha_termina='$fecha' where cedula = $cc and numero_proceso = $np";
// mysql_query($sql, $dbi) or die(mysql_error());
$res = mysql_query("UPDATE casos_exito set cedula = '" . $_POST[cc] . "', numero_proceso = '" . $_POST[np] . "',nombre_completo = '" . $_POST[nombre_completo] . "',clase_negocio = '" . $_POST[clase] . "',despacho_judicial = '" . $_POST[despacho] . "',pretencion = '" . $_POST[pre] . "',resultado = '" . $_POST[res] . "',fecha_termina = '" . $_POST[fecha] . "' WHERE cedula = '" . $_POST[cc] . "' and numero_proceso = '" . $_POST[np] . "' ");
if (!$res) {
die('Invalid query res actuaciones: ' . mysql_error());
}
//cambiando el código de la sucursal
if($codigo != "")
{
// $cambio = "update casos_exito set codigo_sucursal = '$codigo' where cedula = $cc and numero_proceso = $np";
// mysql_query($cambio, $dbi) or die(mysql_error());
$cambio = mysql_query("UPDATE casos_exito set codigo_sucursal = '" . $_POST[codigo] . "' WHERE cedula = '" . $_POST[cc] . "' and numero_proceso = '" . $_POST[np] . "' ");
if (!$cambio) {
die('Invalid query res cambio: ' . mysql_error());
}
}
//cambiando el código del abogado
if($codigo_abogado != "")
{
// $camabog = "update casos_exito set codigo_abogado = '$codigo_abogado' where cedula = $cc and numero_proceso = $np";
// mysql_query($camabog, $dbi) or die(mysql_error());
$camabog = mysql_query("UPDATE casos_exito set codigo_abogado = '" . $_POST[codigo_abogado] . "' WHERE cedula = '" . $_POST[cc] . "' and numero_proceso = '" . $_POST[np] . "' ");
if (!$camabog) {
die('Invalid query res camabog: ' . mysql_error());
}
}
}
// $sql = "select cedula, numero_proceso, nombre_completo, codigo_sucursal, clase_negocio, despacho_judicial, codigo_abogado, pretencion, resultado, fecha_termina from casos_exito where cedula = $cc and numero_proceso = $np";
// $control = mysql_query($sql, $dbi) or die(mysql_error());
$control = mysql_query('SELECT cedula, numero_proceso, nombre_completo, codigo_sucursal, clase_negocio, despacho_judicial, codigo_abogado, pretencion, resultado, fecha_termina FROM casos_exito WHERE cedula = "' . $_POST[cc] . '" and numero_proceso = "' . $_POST[np] . '" ');
if (!$control) {
die('Invalid query: ' . mysql_error());
}
if ((mysql_num_rows($control)!=0))
{
list($cc, $np, $nc, $cs, $cn, $dj, $ca, $pre, $res, $ft) = mysql_fetch_row($control);
//traer nombre de la ciudad
// $suc = mysql_query("select * from sucursal where Codigo = $cs",$dbi);
$suc = mysql_query('SELECT * FROM sucursal WHERE Codigo = "' . $_POST[cs] . '" ');
if (!$suc) {
die('Invalid query: ' . mysql_error());
}
$ns = mysql_result($suc,0,"Nombre");
//traer nombre del departamento
// $abog = mysql_query("select * from asjudinet_abogados where codigo_abogado = '$ca'",$dbi);
$abog = mysql_query('SELECT * FROM asjudinet_abogados WHERE codigo_abogado = "' . $_POST[ca] . '" ');
if (!$abog) {
die('Invalid query: ' . mysql_error());
}
$na = mysql_result($abog,0,"nombre_completo");
$tres=substr($ft, 0, 4);
$dos=substr($ft, 5, 2);
$uno=substr($ft, 8, 2);
$fecha = ($uno."-".$dos."-".$tres);
}
}
?>
<html>
<head>
<title>Modifica Casos Exito</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.Estilo1 {font-family: "Arial Narrow"}
.Estilo2 {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
}
.Estilo10 {font-weight: bold}
.Estilo17 {font-size: 14}
.Estilo18 {font-family: "Arial Narrow"; font-weight: bold; font-size: 14; }
.Estilo19 {font-family: "Arial Narrow"; font-weight: bold; }
.Estilo21 {font-family: "Arial Narrow"; font-weight: bold; font-size: 14; color: #FFFFFF; }
-->
</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>
</head>
<body onLoad="document.formulario.cedula.focus()">
<form method="post" name="formulario" action="modifica_casos_exito.php" onSubmit="return validar(this)">
<table width="524" border="0" align="center" cellpadding="3" cellspacing="3">
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="4" align="right" nowrap><div align="center"><span class="Estilo2">MODIFICAR DATOS CASOS DE EXITO </span></div></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="4" align="right" nowrap><div align="center" class="Estilo2"><script languaje="JavaScript">Mostrar_Fecha()</script></div></td>
</tr>
<tr valign="baseline" bgcolor="#FFFFCC">
<td width="151"><div align="right" class="Estilo19">Cédula:</div></td>
<td width="90"><input name="cedula" type="text" id="cedula" size="15" maxlength="15"></td>
<td width="151"><span class="Estilo19">Número de proceso: </span></td>
<td width="93"><input name="numero" type="text" id="numero" value="" size="7" maxlength="7" ></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td><div align="right" class="Estilo19">Cédula:</div></td>
<td><input name="cc" type="text" id="cc" value="<?php echo $cc; ?>" size="15" maxlength="15"></td>
<td><span class="Estilo19">Número de proceso: </span></td>
<td><input name="np" type="text" id="np" value="<?php echo $np; ?>" size="7" maxlength="7" ></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td align="right" nowrap><span class="Estilo19">Apellidos y nombres:</span></td>
<td colspan="3"><input name="nombre_completo" type="text" id="nombre_completo" value="<?php echo $nc; ?>" size="50" maxlength="50"></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td align="right" nowrap><span class="Estilo19">Sucursal:</span></td>
<td colspan="3"><input name="sucursal" type="text" id="sucursal" value="<?php echo $ns; ?>" size="30" maxlength="30" readonly=""></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td align="right" nowrap><span class="Estilo19">Sucursal: </span></td>
<td colspan="3"><select name="codigo">
<option value="">--SELECCIONE EL NOMBRE DE LA SUCURSAL--</option>
<?php
do {
?>
<option value="<?php echo $row_Recordset4['codigo']?>"><?php echo $row_Recordset4['nombre']?></option>
<?php
} while ($row_Recordset4 = mysql_fetch_assoc($Recordset4));
$rows = mysql_num_rows($Recordset4);
if($rows > 0) {
mysql_data_seek($Recordset4, 0);
$row_Recordset4 = mysql_fetch_assoc($Recordset4);
}
?>
</select></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td align="right" nowrap><span class="Estilo18">Clase de negocio: </span></td>
<td colspan="3"><input name="clase" type="text" id="clase" value="<?php echo $cn; ?>" size="50" maxlength="50"></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td><div align="left" class="Estilo4 Estilo10 Estilo17 Estilo1">
<div align="right"><span class="Estilo5">Despacho judicial:</span></div>
</div></td>
<td colspan="3"><div align="right" class="Estilo18">
<div align="left">
<input name="despacho" type="text" id="despacho" value="<?php echo $dj; ?>" size="50" maxlength="50">
</div>
</div> </td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td align="right" nowrap><div align="left" class="Estilo4 Estilo10 Estilo17 Estilo1">
<div align="right"><span class="Estilo5">Abogado litigante: </span></div>
</div>
<td colspan="3"><input name="nombre_abogado" type="text" id="nombre_abogado" value="<?php echo $na; ?>" size="50" maxlength="50" readonly=""></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td align="right" nowrap><div align="left" class="Estilo4 Estilo10 Estilo17 Estilo1">
<div align="right"><span class="Estilo5">Abogado litigante: </span></div>
</div></td>
<td colspan="3"> <div align="right" class="Estilo18">
<div align="left">
<select name="codigo_abogado" id="codigo_abogado">
<option value="">--SELECCIONE EL ABOGADO LITIGANTE--</option>
<?php
do {
?>
<option value="<?php echo $row_Recordset1['codigo_abogado']?>"><?php echo $row_Recordset1['nombre_completo']?></option>
<?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
?>
</select>
</div>
</div> </td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="4" align="right" nowrap><div align="center"><span class="Estilo18">PRETENSIONES DE LA CONTRAPARTE </span></div></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="4" align="right" nowrap><div align="center">
<?php
echo "<textarea name='pre' cols='70' rows='5' title='RESPUESTA ENVIADA' >\n";
echo htmlspecialchars($pre)."\n";
echo "</textarea>"; ?>
</div></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="4" align="right" nowrap><div align="center"><span class="Estilo18">RESULTADO DEL EXITO OBTENIDO </span></div></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="4" align="right" nowrap><div align="center">
<?php
echo "<textarea name='res' cols='70' rows='5' title='RESPUESTA ENVIADA' >\n";
echo htmlspecialchars($res)."\n";
echo "</textarea>"; ?>
</div></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td align="right" nowrap><span class="Estilo19">Fecha dd/mm/aaaa:</span></td>
<td colspan="3" bgcolor="#0099FF"> <span class="Estilo18">
<input name="fecha" type="text" id="fecha" value="<?php echo $fecha; ?>" size="10" maxlength="10">
</span></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="4" align="right" nowrap><div align="center">
<input name="consultar" type="submit" id="consultar"value ="Buscar" style="font-family: Verdana; font-size: 8 pt; color: #000080; background-color: #C0C0C0; border-style: solid">
<input name="modificar" type="submit" id="modificar" value ="Modificar" 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: #000080; background-color: #C0C0C0; border-style: solid" onClick="window.location.href='menu_casos-exito.php'" value="Volver al Menú">
</div></td>
</tr>
</table>
</form>
</body>
</html>