File: /home/asjudine/public_html/ing_casos_exito.php
<?PHP
require_once("Conectarse.php");
echo "<form name='form' action='' method='post'>";
require_once("mainfile.php");
include ("config.php");
global $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);
//$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);
?>
<html>
<head>
<title>Ingresar 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; }
.Estilo25 {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>
<script Language="JavaScript"><!--
function validar(formulario)
{
if (formulario.numero.value == "")
{
alert("Ingrese número del proceso ");
formulario.numero.focus();
return (false);
}
if (formulario.cedula.value == "")
{
alert("Ingres ele número de cédula del afiliado");
formulario.cedula.focus();
return (false);
}
/*
if (formulario.nombre_completo.value == "")
{
alert("Ingrese apellidos y nombres del afiliado");
formulario.nombre_completo.focus();
return (false);
}
if (formulario.codigo.value == "")
{
alert("No ha seleccionado el nombre de la sucursal");
formulario.codigo.focus();
return (false);
}
if (formulario.clase.value == "")
{
alert("Escriba la clase de negocio");
formulario.clase.focus();
return (false);
}
if (formulario.despacho.value == "")
{
alert("Escriba el nombre del despacho judicial");
formulario.despacho.focus();
return (false);
}
if (formulario.codigo_abogado.value == "")
{
alert("No ha seleccione el nombre del abogado litigante");
formulario.codigo_abogado.focus();
return (false);
}
if (formulario.exito.value == "")
{
alert("Escriba el resultado del éxito obtenido");
formulario.exito.focus();
return (false);
}
if (formulario.dia.value == "")
{
alert("Escriba el día de la terminación del proceso");
formulario.dia.focus();
return (false);
}
if (formulario.mes.value == "")
{
alert("Escriba el mes de la terminación del proceso");
formulario.mes.focus();
return (false);
}
if (formulario.ano.value == "")
{
alert("Escriba el año de la terminación del proceso");
formulario.ano.focus();
return (false);
}
if (formulario.dia.value > 31)
{
alert("El número de día no se debe exceder de 31");
formulario.dia.focus();
return (false);
}
if (formulario.mes.value > 12)
{
alert("El número del mes no se debe exceder de 12");
formulario.mes.focus();
return (false);
}
*/
return (true);
}
//--></script>
</head>
<body onLoad="document.formulario.cedula.focus()">
<form method="post" name="formulario" action="<?php echo $editFormAction; ?>" onSubmit="return validar(this)">
<table width="524" border="0" align="center" cellpadding="3" cellspacing="3">
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="2" align="right" nowrap><div align="center"><span class="Estilo2">CAPTURA DATOS CASOS DE EXITO </span></div></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="2" align="right" nowrap><div align="center" class="Estilo2"><script languaje="JavaScript">Mostrar_Fecha()</script></div></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td width="181"><div align="right" class="Estilo19"> Cédula del Afiliado:</div></td>
<td> <input name="cedula" type="text" id="cedula" size="15" maxlength="15">
<span class="Estilo25"> (sin puntos) </span></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td align="right" nowrap><span class="Estilo19">Número de proceso: </span></td>
<td><input name="numero" type="text" id="numero" value="" size="7" maxlength="7" ></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td align="right" nowrap><span class="Estilo19">Apellidos y nombres:</span></td>
<td><input name="nombre_completo" type="text" id="nombre_completo" size="50" maxlength="50"></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td align="right" nowrap><span class="Estilo19">Sucursal: </span></td>
<td><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><input name="clase" type="text" id="clase" 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><div align="right" class="Estilo18">
<div align="left">
<input name="despacho" type="text" id="despacho" 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>
<td> <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="2" align="right" nowrap><div align="center"><span class="Estilo18">PRETENSIONES DE LA CONTRAPARTE</span></div></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="2" align="right" nowrap><div align="center">
<textarea name="pretencion" cols="70" rows="4" id="pretencion"></textarea>
</div></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="2" align="right" nowrap><div align="center"><span class="Estilo18">RESULTADO DEL EXITO OBTENIDO </span></div></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="2" align="right" nowrap><div align="center">
<textarea name="exito" cols="70" rows="4" id="exito"></textarea>
</div></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td align="right" nowrap><span class="Estilo19">Fecha dd/mm/aaaa:</span></td>
<td bgcolor="#0099FF"> <div align="right" class="Estilo19"></div> <span class="Estilo18">
<input name="dia" type="text" id="dia" value="<?php echo date("d"); ?>" size="2" maxlength="2" readonly="">
<input name="mes" type="text" id="mes" value="<?php echo date("m"); ?>" size="2" maxlength="2" readonly="">
<input name="ano" type="text" id="ano" value="<?php echo date("Y"); ?>" size="4" maxlength="4" readonly="">
</span></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="2" align="right" nowrap><div align="center">
<input name="submit" type="submit" value="Guardar datos" 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_admin.php'" value="Volver al Menú">
<input name="button" type="button" style="font-family: Verdana; font-size: 8 pt; color: #000080; background-color: #C0C0C0; border-style: solid" onClick="window.location.reload()" value="Actualizar">
</div></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="formulario">
</form>
</body>
</html>
<?php
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING']))
{
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "formulario"))
{
require_once("mainfile.php");
include ("config.php");
global $dbi;
if($cedula)
{
// $msql = "select * from casos_exito where cedula = $cedula and numero_proceso = '$numero'";
// $dsql = mysql_query($msql, $dbi);
$dsql = mysql_query('SELECT * FROM casos_exito WHERE cedula = "' . $_POST[cedula] . '" and numero_proceso = "' . $_POST[numero] . '" ');
if (!$dsql) {
die('Invalid query: ' . mysql_error());
}
if (mysql_num_rows($dsql)!=0)
{
echo "<script>alert('Este número de cédula ya contiene este número de proceso');</script>";
echo "<script>history.back()</script>";
}
else
{
if($nombre_completo != "")
{
$nombre_completo = strtoupper($nombre_completo);
$clase = strtoupper($clase);
$despacho = strtoupper($despacho);
$exito = strtoupper($exito);
/* $fecha = $dia."-".$mes."-".$ano;
$uno=substr($fecha, 0, 2);
$dos=substr($fecha, 3, 2);
$tres=substr($fecha, 6, 4);
$fecha = ($tres."-".$dos."-".$uno);*/
$fecha = ($_POST[dia]."-".$_POST[mes]."-".$_POST[ano]);
$eldia = $_POST[dia];
$elmes = $_POST[mes];
$elano = $_POST[ano];
$fecha_actuacion = ($_POST[eldia]."-".$_POST[elmes]."-".$_POST[elano]);
$nuevafecha = $_POST[ano]."-".$_POST[mes]."-".$_POST[dia];
mysql_query("INSERT INTO casos_exito (cedula, numero_proceso, nombre_completo, codigo_sucursal, clase_negocio, despacho_judicial, codigo_abogado, pretencion, resultado, fecha_termina) VALUES ( '" . $_POST["cedula"] . "', '" . $_POST["numero"] . "', '" . $_POST["nombre_completo"] . "', '" . $_POST["codigo"] . "', '" . $_POST["clase"] . "', '" . $_POST["despacho"] . "', '" . $_POST["codigo_abogado"] . "', '" . $_POST["pretencion"] . "', '" . $_POST["exito"] . "', '" . "$nuevafecha". "')");
/* VALUES
('$cedula', '$numero', '$nombre_completo', '$codigo', '$clase', '$despacho', '$codigo_abogado', '$pretencion', '$exito', '$fecha')";
mysql_query($sql, $dbi) or die(mysql_error()); */
echo "<script>alert('Registro grabado correctamente');</script>";
}
else
{
echo "<script>alert('>>Ingrese este registro normalmente<<');</script>";
echo "<script>history.back()</script>";
}
}
}
}
?>