File: /home/asjudine/www/acobranzas/cobranzas_modifcar_datos1.php
<?php
require_once("../Conectarse.php");
/////
global $dbi;
//agrego numero de contrato ya que solo estaba trayendo cedula
$result = mysql_query('SELECT numero_carpeta, cedula, nombre_completo, numero, tipo,capital_periodo, capital_renovacion, interes_prejuridico, interes_cobroejecutivo, capital_clausula, deuda_total, oficio_numero, fecha_oficio, unidad, codigo_gestion,cuotas_mora ,valor_mora,clausula_permanencia ,carta_aceptacion FROM cobranzas WHERE cedula = "' .$_GET["ced2"]. '" and numero = "'.$_GET["numcon"].'" ');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
if ((mysql_num_rows($result)!=0))
{
list($numero_carpeta, $cedula, $nombre_completo, $numero, $tipo,$capital_periodo, $capital_renovacion, $interes_prejuridico, $interes_cobroejecutivo,$capital_clausula, $deuda_total, $oficio_numero, $fecha_oficio, $unidad, $codiges, $cuotas_mora ,$valor_mora,$clausula_permanencia , $carta_aceptacion) = mysql_fetch_row($result);
$numero_obligacion = $numero."".$tipo;
//$deuda_total=$interes_prejuridico+ $capital_periodo+$capital_clausula+$interes_cobroejecutivo+$capital_renovacion;
$sqlnom = mysql_query('SELECT numerocontrato,tipocontrato,fecha_inicio_contrato, fecha_terminacion, unidad_descuento FROM cartera_serviasjudinet WHERE cedula = "' . "$cedula". '" and numerocontrato = "' .$_GET["numcon"]. '"');
if (!$sqlnom) {
die('Invalid query cartera_serviasjudinet 11: ' . mysql_error());
}
list($numero,$tipo,$fecha_afiliacion,$fecha_anulacion, $unidad_descuento) = mysql_fetch_row($sqlnom);
}
else
{
echo "<script>alert('Afiliado no esta en cobranzas ó no Pertenece a su Gestión ');</script>";
}
?>
<html>
<head>
<title>Modificar Cobranzas Gestion Juridica</title>
<meta http-equiv="X-UA-Compatible" content="IE=8; IE=9; IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
*{margin: 0;padding: 0;}
body{background-color:#EAEAEA;font-family:Geneva, Arial, Helvetica, sans-serif;}
header {background-color: #B7271F; text-align: center;}
.cerrarsesion{width: auto;background-color: #DBD8C9;color: #000;font-size: 13px;position:absolute;top: 15px;right:10px;z-index:0;padding: 10px;border-radius: 10px;cursor: pointer;}
.cerrarsesion:hover{background-color: #ffffff;color: #000;}
.titulo{width: 100%;text-align: center;background-color: #dbd8c9;color: #b20606;padding: 6px 0;font-size: 18px;}
table{margin: 0 auto;border: 8px solid #bebebe; text-align: center;}
.divirmenu{text-align: center;}
.irmenu{width: 200px;background-color: #1c4fa0;color: #fff; padding: 4px;border-radius: 6px;}
.irmenu:hover{background-color: #67a0d9; color: #000;}
.fecha{background-color: #d6e08b; padding: 2px;color: #000;font-size: 15px; text-align: center;}
td{border: #969696 solid 1px;}
.tdizq{background-color: #EEE; padding: 1px 2px;color: #00135F;font-size: 13px;font-weight: 600; text-align: left;}
.tdcen{background-color: #EEE; padding: 1px 2px;color: #00135F;font-size: 13px;font-weight: 600; text-align: center;}
.tdder{background-color: #EEE; padding: 1px 2px;color: #00135F;font-size: 13px;font-weight: 600; text-align: right;}
.tdderr{background-color: #EEE; padding: 1px 2px;color: #C72125;font-size: 13px;font-weight: 600; text-align: right;}
.info{background-color:#1F88DE; color:#FFF;}
.exp{color:#8A0000; font-size:10px;}
.rojo{color:#C72125;}
.boton1{width:130px;background-color: #ffffff;color: #000;padding: 2px;border:2px solid #580000;border-radius:3px;}
.boton1:hover{background-color: #6f0000;color: #fff;cursor: pointer;}
input[type=text]{border-radius: 5px; padding: 3px;background-color: #FFFFFF;}
.tdtitulo{background-color: #e3dec0; color: #b20606; padding: 2px; text-align: center; font-size: 12px; font-weight: 900}
.tdfull{background-color: #fff; color: #000; padding: 1px; text-align: center; font-size: 12px;}
.tdjustify{background-color: #fff; color: #000; padding: 1px; text-align: justify; font-size: 12px;}
.botonnew{width: 90px; background-color: #e3dec0;color: #b20606;padding: 1px;border-radius:5px;}
.botonnew:hover{width: 90px; background-color: #cbbd6a;color: #000;padding: 1px;border-radius:5px;}
.direcciona{width: 130px;background-color: #D4090C;color: #fff; padding: 4px;border-radius: 3px;}
.direcciona:hover{background-color: #67a0d9; color: #000;}
</style>
<script Language="JavaScript"><!--
function validar(formulario)
{
if (formulario.dia_act.value > 31)
{
alert("El número de día no se debe exceder de 31");
formulario.dia_act.focus();
return (false);
}
if (formulario.mes_act.value > 12)
{
alert("El número del mes no se debe exceder de 12");
formulario.mes_act.focus();
return (false);
}
return (true);
}
//--></script>
<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()">
<header>
<img src="../ELEMENTS/bannerInterasjudinet.png" alt="" width=" 700" height="70">
</header>
<h3 class="titulo">MODIFICAR LIQUIDACION DEUDA</h3>
<form method="post" name="formulario" action="" onSubmit="return validar(this)">
<table width="750" border="0" align="center" cellpadding="3" cellspacing="3">
<!--<tr>
<td colspan="6" align="right" nowrap><div align="center"><span class="Estilo2">MODIFICAR LIQUIDACION DEUDA</span></div></td>
</tr>-->
<tr>
<td colspan="6" class="fecha">
<div align="center" class="Estilo2">
<script languaje="JavaScript">Mostrar_Fecha()</script>
</div>
</td>
</tr>
<tr>
<td class="tdcen">Escriba Número de Cédula:</td>
<td><input name="cedula" type="text" id="cedula" size="15" maxlength="15">
<input name="unidad" type="text" id="unidad" size="15" maxlength="15" value="<?php echo $unidad_descuento ?>"></td>
<td class="exp" colspan="4">Escriba el número de cédula y hacer click en el botón <span class="Estilo26">Buscar</span></td>
</tr>
<tr>
<td class="tdder">Número cédula:</td>
<td class="tdizq"><input name="id" type="text" id="id" value="<?php echo $cedula ?>" size="15" maxlength="15" readonly=""></td>
<td class="tdizq" colspan="4"><input name="nombre" type="text" id="nombre" value="<?php echo $nombre_completo; ?>" size="50" maxlength="50" readonly="" ></td>
</tr>
<tr>
<td class="tdder">Número de Contrato:</td>
<td class="tdizq" width="191"><input name="con" type="text" id="con" value="<?php echo $numero; ?>" size="6" maxlength="6" readonly="" ></td>
<td class="tdder" width="116"><div align="right" class="Estilo18">Tipo:</div></td>
<td class="tdizq" width="43"><input name="tc" type="text" id="tc" value="<?php echo $tipo; ?>" size="4" maxlength="4" readonly="" ></td>
<td class="tdder" ><span class="Estilo18">Carpeta:</span></td>
<td class="tdizq" ><input name="nc" type="text" id="nc" value="<?php echo $numero_carpeta; ?>" size="4" maxlength="4" readonly ></td>
</tr>
<tr>
<td class="tdderr">Carta Aceptacion</td>
<td class="tdizq"><select name="carta">
<option value="">---SELECCIONE OPCION---</option>
<option value="SI">SI</option>
<option value="NO">NO</option>
</select>
</td>
<td class="tdderr">Fecha Afiliacion:</td>
<td class="tdizq" colspan="3"><input name="fecha_afiliacion" type="text" id="fecha_afiliacion" value="<?php echo $fecha_afiliacion; ?>" size="10" maxlength="10" readonly></td>
</tr>
<tr>
<td class='tdderr'>Cuotas En Mora</td>
<td class="tdizq"><input name="cuotas_mora" type="text" id="cuotas_mora" value="<?php echo $cuotas_mora; ?>" size="10" maxlength="10" ></td>
<td class='tdderr'>Valor Cuotas En Mora:</td>
<td class="tdizq" colspan="3"><input name="valor_mora" type="text" id="valor_mora" value="<?php echo $valor_mora; ?>" size="10" maxlength="10" ></td>
</tr>
<tr>
<td class='tdderr'>Clausula De Permanencia Meses:</td>
<td class="tdizq"><input name="clausula_permanencia" type="text" id="clausula_permanencia" size="10" maxlength="10" value="<?php echo $clausula_permanencia; ?>"></td>
<td class='tdderr'>Fecha Anulacion:</td>
<td class="tdizq" colspan="3"><input name="fecha_anulacion" type="text" id="fecha_anulacion" value="<?php echo $fecha_anulacion; ?>" size="10" maxlength="10" readonly ></td>
</tr>
<tr>
<td class="tdder">Capital Período actual</td>
<td class="tdizq"><input name="capitalp" type="text" id="capitalp" value="<?php echo $capital_periodo; ?>" size="10" maxlength="10" ></td>
<td class="tdder" colspan="2">Costas de Proceso: </div></td>
<td class="tdizq" colspan="2"><input name="cr" type="text" id="cr" value="<?php echo $capital_renovacion; ?>" size="10" maxlength="10"></td>
</tr>
<tr>
<td class="tdder">Intereses Cobro Prejurídico</td>
<td class="tdizq"><input name="icp" type="text" id="icp" value="<?php echo $interes_prejuridico; ?>" size="10" maxlength="10" ></td>
<td class="tdder" colspan="2"><div align="right" class="Estilo18">Honorarios: </div></td>
<td class="tdizq" colspan="2"><input name="ice" type="text" id="ice" value="<?php echo $interes_cobroejecutivo; ?>" size="10" maxlength="10"></td>
</tr>
<tr>
<td class="tdder">Capital cláusula penal:</td>
<td class="tdizq"><input name="ccl" type="text" id="cc" value="<?php echo $capital_clausula; ?>" size="10" maxlength="10"></td>
<td class="tdder" colspan="2"><div align="right" class="Estilo18"><span class="Estilo5">Deuda Total:</span></div></td>
<td class="tdizq" colspan="2"><input name="dt" type="text" id="dt" value="<?php echo $deuda_total; ?>" size="12" maxlength="12"></td>
</tr>
<!-- <td colspan="2" ><span class="Estilo18"><?php echo $fecha_oficio ?> </span></td> -->
</table>
<table width="711" height="60" align="center">
<tr>
<td height="26"><div align="center">
<!--<input name="consultar" type="submit" class="Estilo21" id="consultar" value ="Buscar">-->
<input name="modificar" type="submit" class="direcciona" id="modificar" value ="Modificar" >
<input name="button" type="button" class="boton1" onClick="window.location.href='menu_cobranzas_jur1.php'" value="Atrás">
<!--<input name="button" type="button" class="Estilo21" onClick="window.location.reload()" value="Actualizar">-->
</div><?php echo $numero_obligacion ?></td>
</tr>
<tr>
<td class="info" height="26">Luego ubíque el puntero del mouse sobre el campo que desea modificar, reemplace y haga click en <span class="rojo">Modificar </span></td>
</tr>
</table>
</form>
</body>
</html>
<?php
echo "<table width=750 border=2 align=center cellpadding=2 cellspacing=2>
<tr align=center>
<td width='34' class=tdtitulo>#</td>
<td width='400' class=tdtitulo>ACTUACION</td>
<td width='60' class=tdtitulo>FECHA</td>
<td width='200' class=tdtitulo>NOMBRE DEL FUNCIONARIO</td>
<td width='34' class=tdtitulo>CODIGO</td>
</tr>";
$result = mysql_query('SELECT actuacion, fecha, cedula_usuario, codigo_gestion FROM actuaciones_cobranzas WHERE cedula = "'.$_GET["ced2"] . '" and numero_carpeta = "'.$numero_carpeta.'" ');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
if($result)
{
while(list($act, $fecha, $cedula, $cod) = mysql_fetch_row($result))
{
$i=$i + 1;
$tres=substr($fecha, 0, 4);
$dos=substr($fecha, 5, 2);
$uno=substr($fecha, 8, 2);
$fecha = ($uno."-".$dos."-".$tres);
$user = mysql_query('SELECT Nombre_Completo FROM Usuarios WHERE Cedula = "' . "$cedula". '" ');
if (!$user) {
die('Invalid query user: ' . mysql_error());
}
if($result){list($nom) = mysql_fetch_row($user);}
//$result = mysql_query("select Nombre_Completo from Usuarios where Cedula = $cedula",$dbi);
/* printf("<tr>
<td bgcolor='#ECE9D8'><div align='center' class='Estilo14 Estilo1'>".$i."</a></span></div></td>
<td bgcolor='#C5D6FC'><div align='left' class='Estilo14 Estilo1'>".$act."</span></div></td>
<td bgcolor='#C5D6FC'><div align='center' class='Estilo14 Estilo1'>".$fecha."</span></div></td>
<td bgcolor='#C5D6FC'><div align='center' class='Estilo14 Estilo1'>".$nom."</span></div></td>
<td bgcolor='#C5D6FC'><div align='center' class='Estilo14 Estilo1'>".$cod."</span></div></td>");*/
echo "<tr>
<td class=tdfull>$i</td>
<td class=tdjustify><a top=50,left=100,toolbar=no,scrollbars=no,width=790,height=521,status=yes>$act</a></td>
<td class=tdfull>$fecha</td>
<td class=tdfull>$nom</td>
<td class=tdfull>$cod</td></tr>";
} //Terminación del ciclo while
echo "</tr></table>";
}
?>
<?php
if ($_POST["modificar"])
{
global $dbi;
/*
if($id)
{
echo $_POST["id"];
echo $_POST["cp"];
$nombre_completo = strtoupper($nombre_completo);
$tc = strtoupper($_POST["tc"]);
//agrego el numero de contato
$result = mysql_query('SELECT numero_carpeta, cedula, nombre_completo, numero, tipo, capital_periodo, capital_renovacion, interes_prejuridico, interes_cobroejecutivo, capital_clausula, deuda_total, oficio_numero, fecha_oficio, unidad FROM cobranzas WHERE cedula = "' . "$id" . '" and numero = "'.$_GET["numcon"].'" ');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
//$msql = "select numero_carpeta, cedula, nombre_completo, numero, tipo, capital_periodo, capital_renovacion, interes_prejuridico, interes_cobroejecutivo, capital_clausula, deuda_total, oficio_numero, fecha_oficio, unidad from cobranzas where cedula = $id";
// $con = mysql_query($msql, $dbi) or die(mysql_error());
if ((mysql_num_rows($result)!=0))
{
list($numero_carpeta, $cedula, $nombre_completo, $numero, $tipo, $capital_periodo, $capital_renovacion, $interes_prejuridico, $interes_cobroejecutivo,$capital_clausula, $deuda_total, $oficio_numero, $fecha, $unidad ) = mysql_fetch_row($result);
//$uno=substr($fecha, 0, 2);
//$dos=substr($fecha, 3, 2);
//$tres=substr($fecha, 6, 4);
//$fecha_oficio = ($tres."-".$dos."-".$uno);
}
}
/*$result = mysql_query("UPDATE cobranzas set nombre_completo = '".$_POST[nombre]."',numero ='".$_POST[con]."', tipo = '".$_POST[tc]."', numero_carpeta = '".$_POST[nc]."',capital_periodo = '".$_POST["capitalp"]."', capital_renovacion = '".$_POST[cr]."', interes_prejuridico = '" . $_POST[icp] . "', interes_cobroejecutivo = '".$_POST[ice]."', capital_clausula = '".$_POST[ccl]."', deuda_total = '".$_POST[dt]. "', oficio_numero = '" . $_POST[on] . "', fecha_oficio = '" . $_POST[fecha_oficio] . "', cedula_funcionario = '" . $_POST[cf] . "', unidad = '" . $_POST[un] . "', codigo_gestion = '" . $_POST[codiges] . "' ,cuotas_mora = '" . $_POST["cuotas_mora"] . "' ,valor_mora = '" . $_POST["valor_mora"] . "' ,clausula_permanencia = '" . $_POST["clausula_permanencia"] . "', fecha_anulacion = '" . $_POST["fecha_anulacion"] . "', carta_aceptacion = '" . $_POST["carta"]. "', fecha_afiliacion = '" . $_POST["fecha_afiliacion"] . "' WHERE cedula = '" . $_POST[id] . "' and numero = '".$_POST[con]."' ");*/
//SE RECONSTRUYE LA PARTE DE ARRIBA QUE AL PARECER CONTIENE ERRORES
if($_POST["id"])
{
echo $_POST["id"];
echo $_POST["cp"]; //No existe esta variable
$nombre_completo = strtoupper($nombre_completo);
$tc = strtoupper($_POST["tc"]);
//agrego el numero de contato
$result = mysql_query('SELECT numero_carpeta, cedula, nombre_completo, numero, tipo, capital_periodo, capital_renovacion, interes_prejuridico, interes_cobroejecutivo, capital_clausula, deuda_total, oficio_numero, fecha_oficio, unidad FROM cobranzas WHERE cedula = "'.$_GET["ced2"].'" and numero = "'.$_GET["numcon"].'" ');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
//$msql = "select numero_carpeta, cedula, nombre_completo, numero, tipo, capital_periodo, capital_renovacion, interes_prejuridico, interes_cobroejecutivo, capital_clausula, deuda_total, oficio_numero, fecha_oficio, unidad from cobranzas where cedula = $id";
// $con = mysql_query($msql, $dbi) or die(mysql_error());
if ((mysql_num_rows($result)!=0))
{
list($numero_carpeta, $cedula, $nombre_completo, $numero, $tipo, $capital_periodo, $capital_renovacion, $interes_prejuridico, $interes_cobroejecutivo,$capital_clausula, $deuda_total, $oficio_numero, $fecha, $unidad ) = mysql_fetch_row($result);
//$uno=substr($fecha, 0, 2);
//$dos=substr($fecha, 3, 2);
//$tres=substr($fecha, 6, 4);
//$fecha_oficio = ($tres."-".$dos."-".$uno);
}
}
/*$result = mysql_query("UPDATE cobranzas set nombre_completo = '".$_POST[nombre]."',numero ='".$_POST[con]."', tipo = '".$_POST[tc]."', numero_carpeta = '".$_POST[nc]."',capital_periodo = '".$_POST["capitalp"]."', capital_renovacion = '".$_POST[cr]."', interes_prejuridico = '" . $_POST[icp] . "', interes_cobroejecutivo = '".$_POST[ice]."', capital_clausula = '".$_POST[ccl]."', deuda_total = '".$_POST[dt]. "', oficio_numero = '" . $_POST[on] . "', fecha_oficio = '" . $_POST[fecha_oficio] . "', cedula_funcionario = '" . $_POST[cf] . "', unidad = '" . $_POST[un] . "', codigo_gestion = '" . $_POST[codiges] . "' ,cuotas_mora = '" . $_POST["cuotas_mora"] . "' ,valor_mora = '" . $_POST["valor_mora"] . "' ,clausula_permanencia = '" . $_POST["clausula_permanencia"] . "', fecha_anulacion = '" . $_POST["fecha_anulacion"] . "', carta_aceptacion = '" . $_POST["carta"]. "', fecha_afiliacion = '" . $_POST["fecha_afiliacion"] . "' WHERE cedula = '" . $_POST[id] . "' and numero = '".$_POST[con]."' ");*/
//agrego en la condicion el numero de contrato - QUITO UNIDAD QUE ESTABA ACTUALIZANDO A VACIO
$result = mysql_query("UPDATE cobranzas set nombre_completo = '".$_POST["nombre"]."',numero ='".$_POST["con"]."', tipo = '".$_POST["tc"]."', numero_carpeta = '".$_POST["nc"]."',capital_periodo = '".$_POST["capitalp"]."', capital_renovacion = '".$_POST[cr]."', interes_prejuridico = '" . $_POST["icp"] . "', interes_cobroejecutivo = '".$_POST["ice"]."', capital_clausula = '".$_POST["ccl"]."', deuda_total = '".$_POST["dt"]. "', oficio_numero = '" . $_POST[on] . "', fecha_oficio = '" . $_POST[fecha_oficio] . "', cedula_funcionario = '" . $_POST[cf] . "', unidad='".$unidad_descuento."', cuotas_mora = '" . $_POST["cuotas_mora"] . "' ,valor_mora = '" . $_POST["valor_mora"] . "' ,clausula_permanencia = '" . $_POST["clausula_permanencia"] . "', fecha_anulacion = '" . $_POST["fecha_anulacion"] . "', carta_aceptacion = '" . $_POST["carta"]. "', fecha_afiliacion = '" . $_POST["fecha_afiliacion"] . "' WHERE cedula = '" . $_POST["id"] . "' and numero = '".$_POST["con"]."' ");
if (!$result) {
die('No se actualizó la BD : ' . mysql_error());
}
$numero_obligacion = $_POST["con"]."".$_POST["tc"];
$datos_deuda = $_POST["dt"]/1000;
$valor_total_deuda = round ($datos_deuda);
$actualiza_negativo_cifin = mysql_query('UPDATE negativos_cifin SET valor_saldo = "'.$valor_total_deuda.'" WHERE numero_identificacion = "'.$_POST["id"].'" and numero_obligacion = "'.$numero_obligacion.'" ');
if (!$actualiza_negativo_cifin) {
die('No se actualizó la error : ' . mysql_error());
}
echo "<script>alert('Datos Actualizados');</script>";
}
?>