File: /home/asjudine/www/cobranzas_ingresar_nue.php
<?php
require_once("mainfile.php");
include ("config.php");
global $dbi;
function Conectarse()
{
if (!($link=@mysql_connect("localhost","asjudine","as2006")))
{
echo "Error conectando con el servidor.";
exit();
}
$dbname = "asjudinet";
if (!@mysql_select_db($dbname,$link))
{
echo "Error seleccionando la base de datos.";
exit();
}
return $link;
}
Conectarse();
$control = mysql_query('SELECT cedula, nombre, numerocontrato, tipocontrato, unidad_descuento, saldonuevo FROM cartera_serviasjudinet WHERE cedula = "' . $HTTP_GET_VARS["ced2"] . '" and numerocontrato = "' . $HTTP_GET_VARS["numcon"] . '" and estado = "0"');
if (!$control) {
die('Invalid query: ' . mysql_error());
}
list($cedula, $nombre, $numcon, $tipo, $unidad, $salnue) = mysql_fetch_row($control);
if ($tipo > 0)
{
$cont10 = mysql_query('SELECT codigo_contrato FROM planes_contratos WHERE codigo = "' . "$tipo". '" ');
if (!$cont10) {
die('Invalid query 42: ' . mysql_error());
}
list($tipo) = mysql_fetch_row($cont10);
}
$cont = mysql_query('SELECT codigo_gestion FROM cobranzas WHERE cedula = "' . $HTTP_GET_VARS["ced2"] . '" ');
if (!$cont) {
die('Invalid query: ' . mysql_error());
}
list($codiges) = mysql_fetch_row($cont);
if(isset($_POST["elimanar"]))
{
$modificarcob = mysql_query("DELETE FROM cobranzas WHERE cedula = '" . $_POST[cedula] . "'");
if (! $modificarcob) {
die('Invalid query: ' . mysql_error());
}
echo "<script>alert('Carpeta eliminada Correctamente');</script>";
}
?>
<html>
<head>
<title>Capturar Datos Cobranzas Juridica</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.Estilo2 {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
}
.Estilo18 {font-family: "Arial Narrow"; font-weight: bold; font-size: 14; }
.Estilo22 {color: #FF0000}
.texto {background-color: #FFFFCC; font-family:Arial; font-size:12px; color: #000099; font-weight:bold}
.Estilo24 {color: #CC0000}
.Estilo25 {color: #CCFFFF}
.Estilo26 {
color: #000000;
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.cedula.value == "")
{
alert("Ingrese número de cédula del deudor");
formulario.cedula.focus();
return (false);
}
if (formulario.nombre_completo.value == "")
{
alert("Escriba el nombre completo del deudor");
formulario.nombre_completo.focus();
return (false);
}
if (formulario.numero.value == "")
{
alert("Escriba el número del contrato");
formulario.numero.focus();
return (false);
}
if (formulario.tipo.value == "")
{
alert("Escriba el tipo de contrato");
formulario.tipo.focus();
return (false);
}
if (formulario.capital_periodo.value == "")
{
alert("Escriba el capital del período actual");
formulario.capital_periodo.focus();
return (false);
}
if (formulario.capital_renovacion.value == "")
{
alert("Escriba el capital de renovación automática");
formulario.capital_renovacion.focus();
return (false);
}
if (formulario.interes_prejuridico.value == "")
{
alert("Escriba el interés prejurídico");
formulario.interes_prejuridico.focus();
return (false);
}
if (formulario.interes_cobroejecutivo.value == "")
{
alert("Escriba el interés de cobro ejecutivo");
formulario.interes_cobroejecutivo.focus();
return (false);
}
if (formulario.capital_clausula.value == "")
{
alert("Escriba el capital de la cáusula");
formulario.capital_clausula.focus();
return (false);
}
if (formulario.deuda_total.value == "")
{
alert("Escriba la deuda total");
formulario.deuda_total.focus();
return (false);
}
if (formulario.oficio_numero.value == "")
{
alert("Escriba el número del oficio de envío");
formulario.oficio_numero.focus();
return (false);
}
if (formulario.dia_oficio.value == "")
{
alert("Escriba el día del oficio");
formulario.dia_oficio.focus();
return (false);
}
if (formulario.mes_oficio.value == "")
{
alert("Escriba el mes del oficio");
formulario.mes_oficio.focus();
return (false);
}
if (formulario.ano_oficio.value == "")
{
alert("Escriba el año del oficio");
formulario.ano_oficio.focus();
return (false);
}
if (formulario.dia_oficio.value > 31)
{
alert("El número de día no se debe exceder de 31");
formulario.dia_oficio.focus();
return (false);
}
if (formulario.mes_oficio.value > 12)
{
alert("El número del mes no se debe exceder de 12");
formulario.mes_oficio.focus();
return (false);
}
if (formulario.dia_dev.value > 31)
{
alert("El número de día no se debe exceder de 31");
formulario.dia_dev.focus();
return (false);
}
if (formulario.mes_dev.value > 12)
{
alert("El número del mes no se debe exceder de 12");
formulario.mes_dev.focus();
return (false);
}
return (true);
}
//--></script>
</head>
<body onLoad="document.formulario.cedula.focus()">
<form method="post" name="formulario" onSubmit="return validar(this)">
<table width="690" border="2" align="center" cellpadding="3" cellspacing="3">
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="5" align="right" nowrap bgcolor="#ECFFFB"><div align="center"><span class="Estilo2">CAPTURA DATOS COBRANZAS JURIDICA </span></div></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="5" align="right" nowrap bgcolor="#ECFFFB"><div align="center" class="Estilo2"><script languaje="JavaScript">Mostrar_Fecha()</script></div></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td width="154" bgcolor="#ECFFFB"><div align="right" class="Estilo18">Cédula del Deudor:</div></td>
<td bgcolor="#ECFFFB"><input name="cedula" type="text" id="cedula" value="<?php echo $cedula; ?>" size="15" maxlength="15" readonly=""></td>
<td bgcolor="#ECFFFB"><div align="right" class="Estilo18">Número de carpeta:</div></td>
<td colspan="2" bgcolor="#ECFFFB"> <input name="numero" type="text" id="numero" value="<?php echo $numero; ?>" size="4" maxlength="4" ></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td align="right" nowrap bgcolor="#ECFFFB" class="Estilo18"><div align="right" class="Estilo18">Apellidos y Nombres </div></td>
<td colspan="2" bgcolor="#ECFFFB"><input name="nombre_completo" type="text" id="nombre_completo" value="<?php echo $nombre; ?>" size="50" maxlength="50" readonly=""></td>
<td width="64" bgcolor="#ECFFFB"><div align="right" class="Estilo18">Unidad:</div></td>
<td width="95" bgcolor="#ECFFFB"><input name="unidad" type="text" id="unidad" value="<?php echo $unidad; ?>" size="4" maxlength="4" readonly="" ></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td bgcolor="#ECFFFB" class="Estilo18"><div align="right" class="Estilo18">Número de Contrato:</div></td>
<td width="90" bgcolor="#ECFFFB"><input name="numcon" type="text" id="numcon" value="<?php echo $numcon; ?>" size="6" maxlength="6" readonly=""></td>
<td width="201" bgcolor="#ECFFFB"><div align="right" class="Estilo18">Tipo:</div></td>
<td colspan="2" bgcolor="#ECFFFB"><input name="tipo" type="text" id="tipo" value="<?php echo $tipo; ?>" size="4" maxlength="4" readonly="" ></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td align="right" nowrap bgcolor="#ECFFFB" class="Estilo18"><div align="right" class="Estilo18">Capital Período actual</div></td>
<td bgcolor="#ECFFFB"><input name="capital_periodo" type="text" id="capital_periodo" size="10" maxlength="10" value="<?php echo $salnue; ?>" readonly=""></td>
<td bgcolor="#ECFFFB"><div align="right" class="Estilo18">Capital renovación Automática: </div></td>
<td colspan="2" bgcolor="#ECFFFB"><input name="capital_renovacion" type="text" id="capital_renovacion" value="" size="10" maxlength="10" ></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td align="right" nowrap bgcolor="#ECFFFB" class="Estilo18"><div align="right" class="Estilo18">Intereses Cobro Prejurídico </div></td>
<td bgcolor="#ECFFFB"><input name="interes_prejuridico" type="text" id="interes_prejuridico" value="" size="10" maxlength="10" ></td>
<td bgcolor="#ECFFFB"><div align="right" class="Estilo18">Interés Cobro Ejecutivo: </div></td>
<td colspan="2" bgcolor="#ECFFFB"><input name="interes_cobroejecutivo" type="text" id="interes_cobroejecutivo" value="" size="10" maxlength="10" ></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td align="right" nowrap bgcolor="#ECFFFB"><div align="right" class="Estilo18">Capital cláusula penal:</div></td>
<td bgcolor="#ECFFFB"><input name="capital_clausula" type="text" id="interes_prejuridico3" value="" size="10" maxlength="10" ></td>
<td bgcolor="#ECFFFB"><div align="right" class="Estilo18">Deuda Total:</div></td>
<td colspan="2" bgcolor="#ECFFFB"><input name="deuda_total" type="text" id="deuda_total3" value="" size="10" maxlength="10" ></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td align="right" nowrap bgcolor="#ECFFFB"><div align="right" class="Estilo18">Oficio de envó No. </div></td>
<td bgcolor="#ECFFFB"><input name="oficio_numero" type="text" id="oficio_numero" value="" size="4" maxlength="4" ></td>
<td bgcolor="#ECFFFB"><div align="right" class="Estilo18">Fecha <span class="Estilo22">DD/MM/AAAA</span>:</div></td>
<td colspan="2" bgcolor="#ECFFFB"><span class="Estilo18">
<input name="dia" type="text" id="dia" size="2" maxlength="2">
<input name="mes" type="text" id="mes" size="2" maxlength="2">
<input name="ano" type="text" id="ano" size="4" maxlength="4">
</span></td>
</tr>
<tr>
<td colspan="5" align="center">
<?php echo "<input type='button' value='CONSULTAR CONTRATO' name=boton class=Estilo50 onClick =window.open('credito_consulta_credi.php?ced2=$ced2&numcon=$numcon','','top=50,left=70,toolbar=no,scrollbars=yes,width=910,height=530,status=yes')></a>"; ?>
</td>
</tr>
</table>
<br>
<table width="639" border="2" align="center" cellpadding="3" cellspacing="3">
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="4" align="right" nowrap bgcolor="#ECFFFB"><div align="center" class="Estilo33"><span class="Estilo32 Estilo24"><strong>INGRESAR GESTION DE COBRANZAS</strong></span></div></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td width="184" align="right" nowrap bgcolor="#ECFFFB"><span class="Estilo37 Estilo35"><strong>FECHA DE LA GESTION:</strong></span></td>
<td width="211" align="right" nowrap bgcolor="#ECFFFB">
<div align="left" class="Estilo33"><strong><span class="Estilo29">
<input name="dia_act" type="text" id="dia_act" value="<?php echo date("d"); ?>" size="2" maxlength="2" readonly="">
-
<input name="mes_act" type="text" id="mes_act" value="<?php echo date("m"); ?>" size="2" maxlength="2" readonly="">
-
<input name="ano_act" type="text" id="ano_act" value="<?php echo date("Y"); ?>" size="4" maxlength="4" readonly="">
<span class="Estilo33">dd/mm/aaaa</span></span></strong></div></td>
<td width="156" nowrap bgcolor="#ECFFFB"><span class="Estilo37 Estilo35"><strong>CODIGO JURIDICO:</strong></span> </td>
<td width="37" nowrap bgcolor="#ECFFFB"><input name="cod" type="text" class="Estilo33" id="cod" value="<?php echo $codiges; ?>" size="2" maxlength="2" ></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="4" align="right" nowrap bgcolor="#ECFFFB">
<textarea name="actuacion" cols="70" rows="5" id="actuacion"></textarea></td>
</tr>
</table>
<table width="651" align="center">
<tr bgcolor="#ECE9D8">
<td width="159" bordercolor="#CCFFFF" bgcolor="#CCFFFF"><span class="Estilo36 Estilo26">Nombre del usuario: </span></td>
<td bordercolor="#CCFFFF" bgcolor="#CCFFFF"><span class="Estilo25">
<select name="usuario">
<option value="">--------SELECCIONE USUARIO--------</option>
<option value="53013583">PEDRAZA QUINTERO BIBIANA MARCELA</option>
</select>
</span></td>
</tr>
</table>
<table width="651" align="center">
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="5" align="right" nowrap bgcolor="#ECFFFB"><div align="center">
<input name="guardar" type="submit" class="Estilo22" id="guardar" value="Guardar datos">
<input name="button" type="button" class="Estilo18" onClick="window.location.href='menu_cobranzas_jur.php'" value="Volver al Menú">
<input name="button" type="button" class="Estilo18" onClick="window.location.reload()" value="Actualizar">
<?php echo "<input type='button' value='Eliminar Carpeta' name=boton class=Estilo24 onClick =window.open('cobranzas_eliminar_carpeta.php?ced2=$ced2&numcon=$numcon','','top=115,left=350,toolbar=no,scrollbars=yes,width=200,height=200,status=yes')></a>"; ?>
</div></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="formulario">
</form>
</body>
</html>
<?php
if(isset($_POST["guardar"]))
{
require_once("mainfile.php");
include ("config.php");
global $dbi;
//$control = "select * from cobranzas where cedula = '$cedula'";
$result = mysql_query('SELECT * FROM cobranzas WHERE cedula = "' . $_POST[cedula] . '" and numero = "' . $_POST[numcon] . '" and estado = "" ');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
$find = mysql_fetch_row($result);
if(mysql_num_rows($find) == 0)
{
$unidad = strtoupper($unidad);
$gttt = mysql_query("INSERT INTO cobranzas (cedula, numero_carpeta, nombre_completo , numero , tipo , capital_periodo, unidad) VALUES ('" . $_POST["cedula"] . "','" . $_POST["numero"] . "', '" . $_POST["nombre_completo"] . "', '" . $_POST["numcon"] . "', '" . $_POST["tipo"] . "', '" . $_POST["capital_periodo"] . "', '" . $_POST["unidad"] . "' )");
if (!$gttt) {
die('Invalid query: ' . mysql_error());
}
$fecha_oficio = $ano_act."-".$mes_act."-".$dia_act;
$mssql3 = mysql_query("UPDATE cobranzas set capital_renovacion = '" . $_POST[capital_renovacion] . "', interes_prejuridico = '" . $_POST[interes_prejuridico] . "', interes_cobroejecutivo = '" . $_POST[interes_cobroejecutivo] . "', capital_clausula = '" . $_POST[capital_clausula] . "', deuda_total = '" . $_POST[deuda_total] . "', oficio_numero = '" . $_POST[oficio_numero] . "', fecha_oficio = '" ."$fecha_oficio". "', cedula_funcionario = '53013583', codigo_gestion = '" . $_POST[cod] . "', fecha_gestion = '" ."$fecha_oficio". "', estado = '1' WHERE cedula = '" . $HTTP_GET_VARS["ced2"] . "' and numero = '" . $HTTP_GET_VARS["numcon"] . "' ");
if (! $mssql3) {
die('Invalid query este fue: ' . mysql_error());
}
$gttt = mysql_query("INSERT INTO actuaciones_cobranzas (cedula, numero_carpeta, oficio_numero, actuacion, fecha, cedula_usuario, codigo_gestion) VALUES ('" . $_POST["cedula"] . "','" . $_POST["numero"] . "', '" . $_POST["oficio_numero"] . "', '" . $_POST["actuacion"] . "',NOW(), '53013583', '" . $_POST["cod"] . "')");
if (!$gttt) {
die('Invalid query: ' . mysql_error());
}
echo "<script>alert('Registro grabado correctamente');</script>";
}
else
{
echo "<script>alert('Ese número de cedula ya existe');</script>";
}
}
?>