File: /home/asjudine/www/credito_ingresar_solicitud.php
<?php
require_once("mainfile.php");
include ("config.php");
global $dbi;
$espacio = ' ';
$linea = '-';
require_once("Conectarse.php");
$control2 = mysql_query('SELECT cedula, codigo_militar, nombre, grado, direccion, telefono, celular, ciudad, email FROM cartera_serviasjudinet WHERE cedula = "' . $HTTP_GET_VARS["ced2"] . '"');
if (!$control2) {
die('Invalid query 2: ' . mysql_error());
}
list($cedula, $codigo, $nombre, $grado, $direccion, $telefono, $celular, $ciudad, $email ) = mysql_fetch_row($control2);
if ((mysql_num_rows($control2)==0))
{
$control2 = mysql_query('SELECT cedula, grado, nombre, devengado, descuento, neto, unidad FROM datos_credito WHERE cedula = "' . $HTTP_GET_VARS["ced2"] . '" ');
if (!$control2) {
die('Invalid query: ' . mysql_error());
}
list($cedula, $grado, $nombre, $devengado, $descuento, $salario, $unidad ) = mysql_fetch_row($control2);
}
if ((mysql_num_rows($control2)==0))
{
$control2 = mysql_query('SELECT cedula, grado, nombre, direccion, telefono, celular, ciudad FROM creditos_serviasjudinet
WHERE cedula = "' . $HTTP_GET_VARS["ced2"] . '" ');
if (!$control2) {
die('Invalid query: ' . mysql_error());
}
list($cedula, $grado, $nombre, $direccion, $telefono, $celular, $ciudad ) = mysql_fetch_row($control2);
}
if(isset($_POST["guardar"]))
{
$con = mysql_query('SELECT cedula FROM creditos_serviasjudinet WHERE cedula = "' . $_POST[cedula] . '" and estado = "1" ');
if (!$con) {
die('Invalid query: ' . mysql_error());
}
list($ceduli) = mysql_fetch_row($con);
$segur = mysql_query('SELECT cedula FROM solicitud_credito WHERE cedula = "' . $_POST[cedula] . '" and (estado_cre = "0" || estado_cre = "1" || estado_cre = "2" )');
if (!$segur) {
die('Invalid query: ' . mysql_error());
}
list($seguri) = mysql_fetch_row($segur);
if ($seguri != $_POST[cedula] )
{
if ($_POST[cedula] != $ceduli)
{
mysql_query("INSERT INTO solicitud_credito(cedula, ced_ciudad, nombre, fecha, direccion, ciudad, telefono, celular, email, no_solicitud, devengado, descuentos, neto, unidad, monto_solicitado, numero_cuenta, banco, codigo_asesor, codigo_militar, grado, codigo_sucursal, numero_libranza, cuotas_credito, valor_mensual_cre , con_valor_mensual, con_valor_total, tipo_solicitud_cre, estado_cre, entidad_laboral, interes_deducible, neto_consignar) VALUES ('" . $_POST["cedula"] . "', '" . $_POST["ciudad"] . "', '" . $_POST["nombre"] . "', '" . $_POST["fecha"] . "', '" . $_POST["direccion"] . "', '" . $_POST["ciudad"] . "', '" . $_POST["telefono"] . "', '" . $_POST["celular"] . "', '" . $_POST["email"] . "', '" . $_POST["numsoli"] . "', '" . $_POST["devengado"] . "', '" . $_POST["descuento"] . "', '" . $_POST["salario"] . "', '" . $_POST["unidad"] . "', '" . $_POST["monto"] . "' , '" . $_POST["cuenta"] . "', '" . $_POST["banco"] . "', '', '" . $_POST["codigo"] . "', '" . $_POST["grado"] . "', '" . $_POST["sucursal"] . "', '" . $_POST["numlib"] . "', '" . $_POST["numcuo"] . "', '" . $_POST["valcuo"] . "', '" . $_POST["val_jur"] . "', '" . $_POST["val_men_tot"] . "', '2', '0', '" . $_POST["empresa"] . "', '" . $_POST["interes"] . "', '" . $_POST["neto"] . "')");
echo "<script>alert('Los datos fueron grabados correctamente');</script>";
}
else
{
echo "<script>alert('Ya existe un credito para esta persona');</script>";
}
}
else
{
echo "<script>alert('Ya existe Solicitud para esta persona');</script>";
}
}
$sql = mysql_query('SELECT * FROM entidad_laboral order by nombre ');
if (!$sql) {
die('Invalid query: ' . mysql_error());
}
$row_sql = mysql_fetch_assoc($sql);
$totalRows_sql = mysql_num_rows($sql);
$sql2 = mysql_query('SELECT * FROM proveedores order by nombre ');
if (!$sql2) {
die('Invalid query: ' . mysql_error());
}
$row_sql2 = mysql_fetch_assoc($sql2);
$totalRows_sql2 = mysql_num_rows($sql2);
$sql5 = mysql_query('SELECT * FROM sucursal order by nombre ');
if (!$sql5) {
die('Invalid query: ' . mysql_error());
}
$row_sql5 = mysql_fetch_assoc($sql5);
$totalRows_sql5 = mysql_num_rows($sql5);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>INGRESAR SOLICITUD CARTERA</title>
<style type="text/css">
<!--
.est_cont5 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9px;
font-style: normal;
font-weight: normal;
background-color: #EDFAF4;
margin: 2px;
padding: 2px;
height: auto;
width: auto;
border: thin groove #E9AAF0;
color: #C72350;
}
.color_fondo_sc {
background-color: #DCE0E4;
}
.est_cont2 {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
font-weight: normal;
color: #2B39EC;
background-color: #F0F5CF;
height: 18px;
width: auto;
border: thin solid #FABF85;
}
.est_cont6 {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 11px;
font-style: normal;
font-weight: normal;
color: #006262;
background-color: #EDFED3;
margin: 1px;
padding: 1px;
height: auto;
width: auto;
border: thin solid #D9B6F8;
}
.sol_cre1 {
font-family: "Times New Roman", Times, serif;
font-size: 12px;
font-style: normal;
font-weight: normal;
color: #F00;
background-color: #E6FAFF;
margin: 1px;
padding: 1px;
height: 18px;
width: auto;
border: thin outset #56AD95;
}
.col_cre2 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
font-weight: bold;
color: #F92F0B;
background-color: #B3D9F0;
height: auto;
width: auto;
border: medium groove #FC9227;
}
.Estilo50 {color: #CC3333;
font-family: "Arial Narrow";
font-weight: bold;
}
.Estilo53 {color: #2492FF;
font-weight: bold;
}
.recaudo {font-family: "Courier New", Courier, monospace;
font-size: 12px;
font-style: normal;
font-weight: bold;
font-variant: normal;
color: #000000;
background-color: #B6CBDC;
margin: 4px;
padding: 8px;
width: auto;
border: medium outset #339966;
}
.campo1 {background-color: #B7FFFF;
border: thin dashed #B6B6B6;
}
.campo1 {font-family: "Courier New", Courier, monospace;
font-size: 16px;
font-style: normal;
font-weight: bold;
background-color: #E1EFFD;
border: thin doble #009999;
}
.campo1 { font-family: "Courier New", Courier, monospace;
font-size: 11px;
color: #5151FF;
background-color: #C4E4FD;
border: thin solid #009999;
height: 18px;
width: auto;
}
.datos1 {font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 16px;
font-style: normal;
text-decoration: blink;
background-color: #CCFFCC;
margin: 5px;
padding: 7px;
height: auto;
width: auto;
border: thin solid #0099FF;
}
.datos1 {font-family: Georgia, "Times New Roman", Times, serif;
font-size: 16px;
background-color: #FDE0C1;
margin: 2px;
padding: 3px;
border: medium doble #DBAED7;
}
.datos1 { font-family: Georgia, "Times New Roman", Times, serif;
font-size: 11px;
font-weight: normal;
background-color: #B8F5E8;
margin: 4px;
padding: 5px;
border: thin outset #009999;
}
.datos2 { font-family: "Courier New", Courier, monospace;
font-size: 10px;
font-style: normal;
font-weight: normal;
color: #0033FF;
background-color: #FFE2C6;
margin: 2px;
padding: 3px;
border: medium doble #EEBFEB;
}
.datos3 { font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-style: normal;
font-weight: normal;
color: #FF3300;
background-color: #A6ECD7;
margin: 4px;
padding: 4px;
border: medium groove #CCCCFF;
}
.go { font-family: "Times New Roman", Times, serif;
font-size: 9px;
font-style: normal;
color: #FF6633;
background-color: #FBDCBD;
padding: 1px;
height: auto;
width: auto;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
}
.Estilo66 {
font-size: 10px;
font-weight: bold;
}
.label {background-color: #FFFFCC; font-size: 16px; font-family: Arial; color:#0000CC; display: block;}
.Estilo67 {font-size: 18px}
.Estilo70 {
color: #000066;
text-align: left;
}
.Estilo71 {font-size: 10px; font-weight: bold; color: #000066; }
.Estilo72 {
color: #FF0000;
font-weight: bold;
}
.Estilo73 {color: #FF0000; }
-->
</style>
<script Language="JavaScript">
function validarEntero(valor){
//intento convertir a entero.
//si era un entero no le afecta, si no lo era lo intenta convertir
valor = parseInt(valor)
//Compruebo si es un valor numérico
if (isNaN(valor)) {
//entonces (no es numero) devuelvo el valor cadena vacia
return ""
}else{
//En caso contrario (Si era un número) devuelvo el valor
return valor
}
}
function valida_envia(){
if (document.form1.nombre.value == ""){
alert("Falta Ingresar Apellidos y Nombres")
document.form1.nombre.focus()
return (false);
}
if (document.form1.numsoli.value == ""){
alert("Falta Ingresar Numero Solicitud")
document.form1.numsoli.focus()
return (false);
}
if (document.form1.cedula.value == ""){
alert("Falta Digitar numero de Cedula")
document.form1.cedula.focus()
return (false);
}
if (document.form1.codigo.value == ""){
alert("Falta Digitar el codigo militar")
document.form1.codigo.focus()
return (false);
}
if (document.form1.grado.value == ""){
alert("Falta Ingresar el grado")
document.form1.grado.focus()
return (false);
}
if (document.form1.direccion.value == ""){
alert("Falta Ingresar la Direccion")
document.form1.direccion.focus()
return (false);
}
if (document.form1.email.value == ""){
alert("Falta Ingresar el email")
document.form1.email.focus()
return (false);
}
if (document.form1.ciudad.value == ""){
alert("Falta escribir ciudad ")
document.form1.ciudad.focus()
return (false);
}
if (document.form1.telefono.value == ""){
alert("Falta Digitar Telefono")
document.form1.telefono.focus()
return (false);
}
if (document.form1.celular.value == ""){
alert("Falta Digitar celular")
document.form1.celular.focus()
return (false);
}
if (document.form1.cuenta.value == ""){
alert("Falta escribir No cuenta")
document.form1.cuenta.focus()
return (false);
}
if (document.form1.banco.value == ""){
alert("Falta escribir banco ")
document.form1.banco.focus()
return (false);
}
if (document.form1.sucursal.value == ""){
alert("Falta seleccionar sucursal ")
document.form1.sucursal.focus()
return (false);
}
if (document.form1.numlib.value == ""){
alert("Falta escribir número de Libranza ")
document.form1.numlib.focus()
return (false);
}
if (document.form1.monto.value == ""){
alert("Falta escribir monto Solicitado")
document.form1.monto.focus()
return (false);
}
if (document.form1.numcuo.value == ""){
alert("Falta Digitar numero de cuotas")
document.form1.numcuo.focus()
return (false);
}
if (document.form1.valcuo.value == ""){
alert("Falta Digitar valor de la cuotas")
document.form1.valcuo.focus()
return (false);
}
if (document.form1.neto.value == ""){
alert("Falta Digitar valor neto a consignar")
document.form1.neto.focus()
return (false);
}
if (document.form1.interes.value == ""){
alert("Falta Digitar interes deducible")
document.form1.interes.focus()
return (false);
}
if (document.form1.devengado.value == ""){
alert("Falta Digitar El Total Devengado")
document.form1.devengado.focus()
return (false);
}
if (document.form1.descuento.value == ""){
alert("Falta Digitar Total Descuentos")
document.form1.descuento.focus()
return (false);
}
if (document.form1.salario.value == ""){
alert("Falta Digitar Salario Neto")
document.form1.salario.focus()
return (false);
}
return (true);
}
</script>
</head>
<body >
<form action="" method="post" onsubmit="return valida_envia()" enctype="multipart/form-data" name="form1" id="form1">
<div align="center">
<div class="Estilo50 Estilo67">SOLICITUD INGRESAR CREDITO </div>
<br />
<table width="782" border="2" cellpadding="1" cellspacing="1" class="sol_cre1">
<tr bgcolor="#F7FFE1" >
<th width="60" bgcolor="#F7FFE1" scope="col"><div align="right" class="Estilo70">
<div align="right"><strong>Fecha Solicitud :</strong></div>
</div></th>
<th width="130" bgcolor="#F7FFE1" scope="col"><div align="left" class="Estilo70">
<input name="fecha" type="text" class="Estilo66" id="fecha" value="<?php echo date("Y-m-d"); ?>" size="10" maxlength="10" />
</div></th>
<td align="right" bgcolor="#F7FFE1" ><span class="Estilo70"><strong>Nombres:</strong></span></td>
<td colspan="2" align="left" bgcolor="#F7FFE1"><input name="nombre" type="text" class="Estilo66" id="nombre" value="<?php echo $nombre ?>" size="60" maxlength="65" /> </td>
<td align="left" bgcolor="#F7FFE1" ><span class="Estilo70"><strong>No Solicitud:</strong></span><input name="numsoli" type="text" class="Estilo66" id="numsoli" value="<?php echo $numsoli ?>" size="6" maxlength="6" /> </td>
</tr>
<tr>
<td width="60" height="21" bgcolor="#F7FFE1"><div align="right" class="Estilo70">
<div align="right"><strong>Cedula No:</strong></div>
</div></td>
<td width="130" bgcolor="#F7FFE1" ><div align="left" class="Estilo70">
<input name="cedula" type="text" class="Estilo66" id="cedula" value="<?php echo $cedula ?>" size="20" maxlength="20" />
</div></td>
<td width="90" bgcolor="#F7FFE1"><div align="right" class="Estilo70"><strong>Cogido Militar :</strong></div></td>
<td width="161" bgcolor="#F7FFE1" ><div align="left" class="Estilo70">
<input name="codigo" type="text" class="Estilo66" id="codigo" value="<?php echo $codigo ?>" size="14" maxlength="20" />
</div></td>
<td width="134" bgcolor="#F7FFE1"><div align="right" class="Estilo70"><strong>Grado :</strong></div></td>
<td width="172" bgcolor="#F7FFE1"><div align="left" class="Estilo70">
<input name="grado" type="text" class="Estilo66" id="grado" value="<?php echo $grado ?>" size="12" maxlength="10" />
</div></td>
</tr>
<tr>
<td bgcolor="#F7FFE1"><div align="right" class="Estilo70">
<div align="right"><strong>Direccion :</strong></div>
</div></td>
<td colspan="2" bgcolor="#F7FFE1"><div align="left" class="Estilo70">
<input name="direccion" type="text" class="Estilo66" id="direccion" value="<?php echo $direccion ?>" size="45" maxlength="45" />
</div></td>
<td bgcolor="#F7FFE1"><div align="right" class="Estilo70"><strong>E-mail :</strong></div></td>
<td colspan="2" bgcolor="#F7FFE1"><div align="left" class="Estilo70">
<input name="email" type="text" class="Estilo66" id="email" value="<?php echo $email ?>" size="35" maxlength="35" />
</div></td>
</tr>
<tr>
<td bgcolor="#F7FFE1"><div align="right" class="Estilo70">
<div align="right"><strong>Ciudad :</strong></div>
</div></td>
<td bgcolor="#F7FFE1"><div align="left" class="Estilo70">
<input name="ciudad" type="text" class="Estilo66" id="ciudad" value="<?php echo $ciudad ?>" size="14" maxlength="20" />
</div></td>
<td bgcolor="#F7FFE1"><div align="right" class="Estilo70"><strong>Telefono :</strong></div></td>
<td bgcolor="#F7FFE1"><div align="left" class="Estilo70">
<input name="telefono" type="text" class="Estilo66" id="telefono" value="<?php echo $telefono ?>" size="10" maxlength="20" />
</div></td>
<td bgcolor="#F7FFE1"><div align="right" class="Estilo70"><strong>Celular :</strong></div></td>
<td bgcolor="#F7FFE1"><div align="left" class="Estilo70">
<input name="celular" type="text" class="Estilo66" id="celular" value="<?php echo $celular ?>" size="20" maxlength="20" />
</div></td>
</tr>
<tr >
<td bgcolor="#F7FFE1"><div align="right" class="Estilo70">
<div align="right"><strong>Cuenta No :</strong></div>
</div></td>
<td bgcolor="#F7FFE1"><div align="left" class="Estilo70">
<input name="cuenta" type="text" class="Estilo66" id="cuenta" value="<?php echo $cuenta ?>" size="20" maxlength="20" />
</div></td>
<td bgcolor="#F7FFE1"><div align="right" class="Estilo70"><strong>Banco :</strong></div></td>
<td bgcolor="#F7FFE1" ><div align="left" class="Estilo70">
<input name="banco" type="text" class="Estilo66" id="banco" value="<?php echo $banco ?>" size="20" maxlength="20" />
</div></td>
<th width="134" bgcolor="#F7FFE1"><div align="right" class="Estilo70"><strong>Sucursal :</strong></div></th>
<th bgcolor="#F7FFE1" scope="col"><div align="left" class="Estilo70">
<select name="sucursal" class="Estilo66">
<option value="">--SELECCIONE SUCURSAL--</option>
<?php
do {
?>
<option value="<?php echo $row_sql5['nombre'];?>"><?php echo $row_sql5['nombre']?></option>
<?php
} while ($row_sql5 = mysql_fetch_assoc($sql5));
$rows5 = mysql_num_rows($sql5);
if($rows5 > 0) {
mysql_data_seek($sql5, 0);
$row_sql5 = mysql_fetch_assoc($sql5);
}
?>
</select>
</div></th>
</tr>
<tr>
<td bgcolor="#F7FFE1"><div align="right" class="Estilo70">
<div align="right"><strong>Numero libranza:</strong></div>
</div></td>
<td bgcolor="#F7FFE1" ><div align="left" class="Estilo70">
<input name="numlib" type="text" class="Estilo66" id="numlib" value="<?php echo $numlib ?>" size="12" maxlength="12" />
</div></td>
<td height="28" bgcolor="#F7FFE1"><div align="right" class="Estilo70"><strong>Monto Solicitado :</strong></div></td>
<td bgcolor="#F7FFE1"><div align="left" class="Estilo70">
<input name="monto" type="text" class="Estilo66" id="monto" value="<?php echo $monto ?>" size="12" maxlength="10" />
</div></td>
<td bgcolor="#F7FFE1"><div align="right" class="Estilo70"><strong>Numero de Cuotas:</strong></div></td>
<td bgcolor="#F7FFE1" ><div align="left" class="Estilo70">
<input name="numcuo" type="text" class="Estilo66" id="numcuo" value="<?php echo $numcuo ?>" size="12" maxlength="12" />
</div></td>
</tr>
<tr>
<td bgcolor="#F7FFE1" ><div align="right" class="Estilo70">
<div align="right"><strong>Valor Mensual:</strong></div>
</div></td>
<td bgcolor="#F7FFE1"><div align="left" class="Estilo70">
<input name="valcuo" type="text" class="Estilo66" id="valcuo" value="<?php echo $valcuo ?>" size="12" maxlength="12" />
</div></td>
<td bgcolor="#F7FFE1" ><div align="right" class="Estilo70"><strong>Neto Consignar:</strong></div></td>
<td bgcolor="#F7FFE1"><div align="left" class="Estilo70">
<input name="neto" type="text" class="Estilo66" id="neto" value="<?php echo $neto ?>" size="12" maxlength="12" />
</div></td>
<td bgcolor="#F7FFE1" ><div align="right" class="Estilo70"><strong>Interes Deducible:</strong></div></td>
<td bgcolor="#F7FFE1">
<div align="left">
<input name="interes" type="text" class="Estilo66" id="interes" value="<?php echo $interes ?>" size="12" maxlength="12" />
</div>
</tr>
<tr>
<td bgcolor="#F7FFE1" ><div align="right" class="Estilo72">
<div align="right">Total Devengado :</div>
</div></td>
<td bgcolor="#F7FFE1"><div align="left" class="Estilo73">
<input name="devengado" type="text" class="Estilo66" id="devengado" value="<?php echo $devengado ?>" size="12" maxlength="12" />
</div></td>
<td bgcolor="#F7FFE1" ><div align="right" class="Estilo73"><strong>Total Desccuento :</strong></div></td>
<td bgcolor="#F7FFE1"><div align="left" class="Estilo73">
<input name="descuento" type="text" class="Estilo66" id="descuento" value="<?php echo $descuento ?>" size="12" maxlength="12" />
</div></td>
<td bgcolor="#F7FFE1" ><div align="right" class="Estilo73"><strong>Salario Neto :</strong></div></td>
<td bgcolor="#F7FFE1">
<div align="left">
<input name="salario" type="text" class="Estilo66" id="salario" value="<?php echo $salario ?>" size="12" maxlength="12" />
</div>
</tr>
</table>
<p>
<label>
<input name="guardar" type="submit" class="Estilo53" id="guardar" value="Guardar" />
</label>
</p>
</div>
</form>
</body>
</html>