File: /home/asjudine/public_html/comercial/credito_ingresar_soli.php
<?php
require_once("../Conectarse.php");
$control2 = mysql_query('SELECT cedula, grado, nombre, devengado, descuento, neto, unidad FROM datos_credito WHERE cedula = "' . $_GET["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, codigo_militar, nombre, grado, direccion, telefono, celular, ciudad, email FROM cartera_serviasjudinet WHERE cedula = "' . $_GET["ced2"] . '"');
if (!$control2) {
die('Invalid query 2: ' . mysql_error());
}
list($cedula, $codigo, $nombre, $grado, $direccion, $telefono, $celular, $ciudad, $email ) = 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', '5', '" . $_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>
<head>
<title>INGRESAR SOLICITUD CARTERA</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>
*{margin: 0;padding: 0;}
body{background-image:url(../ELEMENTS/fondo.jpg);font-family:Geneva, Arial, Helvetica, sans-serif;}
header {background-color: #B7271F; text-align: center;}
.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;}
/*Dif*/
.fecha{background-color: #d6e08b; padding: 2px;color: #000;font-size: 13px;}
td{border: 1px solid #a0a0a0;}
.td{background-color: #e5e5e5; padding: 1px;color: #00135F;font-size: 13px;font-weight: 600; text-align: center;}
.tdizq{background-color: #e5e5e5; padding: 1px 10px;color: #00135F;font-size: 12px;font-weight: 600; text-align: left;}
.tdcen{background-color: #e5e5e5; padding: 1px 10px;color: #00135F;font-size: 12px;font-weight: 600; text-align: center;}
.tdder{background-color: #e5e5e5; padding: 1px 10px;color: #00135F;font-size: 12px;font-weight: 600; text-align: right;}
.boton1{width:150px;background-color: #ffffff;color: #000;padding: 2px;border:2px solid #580000;border-radius:10px;}
.boton1:hover{background-color: #6f0000;color: #fff;cursor: pointer;}
input[type=text]{border-radius: 5px; padding: 1px;background-color: #fffde8;}
.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;}
.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;}
.tdactua{background-color: #ffffff;color: #000; font-size: 12px; font-family: sans-serif; text-align: justify;}
</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.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 Dirreccion")
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);
}
return (true);
}
</script>
</head>
<body >
<form action="" method="post" onsubmit="return valida_envia()" enctype="multipart/form-data" name="form1" id="form1">
<header>
<img src="../ELEMENTS/bannerInterasjudinet.png" alt="" width=" 700" height="70">
</header>
<h3 class="titulo">SOLICITUD INGRESAR CREDITO</h3>
<div align="center">
<table width="985" border="2" cellpadding="1" cellspacing="1" class="sol_cre1">
<tr>
<td class="tdcen">
<div align="right"><strong>Fecha Solicitud :
</td>
<td class="tdizq">
<input name="fecha" type="text" id="fecha" value="<?php echo date("Y-m-d"); ?>" size="10" maxlength="10" />
</td>
<td class="tdcen">Apellidos y Nombres:</td>
<td class="tdizq" colspan="2"><input name="nombre" type="text" id="nombre" value="<?php echo $nombre ?>" size="60" maxlength="65" /> </td>
<td class="tdcen">No Solicitud:<input name="numsoli" type="text" id="numsoli" value="<?php echo $numsoli ?>" size="6" maxlength="6" />
</td>
</tr>
<tr>
<td class="tdcen">
<div align="right"><strong>Cedula No:
</td>
<td class="tdizq">
<input name="cedula" type="text" id="cedula" value="<?php echo $cedula ?>" size="20" maxlength="20" />
</td>
<td class="tdcen">Cogido Militar:
</td>
<td class="tdizq">
<input name="codigo" type="text" id="codigo" value="<?php echo $codigo ?>" size="14" maxlength="20" />
</td>
<td class="tdcen">Grado :
</td>
<td class="tdizq">
<input name="grado" type="text" id="grado" value="<?php echo $grado ?>" size="12" maxlength="10" />
</td>
</tr>
<tr>
<td class="tdcen">Direccion :
</td>
<td colspan="2" bgcolor="#F7FFE1"><div align="left" >
<input name="direccion" type="text" id="direccion" value="<?php echo $direccion ?>" size="45" maxlength="45" />
</div></td>
<td class="tdcen">Ciudad :
</td>
<td class="tdizq" colspan="2"><div align="left" >
<input name="ciudad" type="text" id="ciudad" value="<?php echo $ciudad ?>" size="30" maxlength="30" />
</div></td>
</tr>
<tr>
<td class="tdcen">Telefono :</td>
<td class="tdizq">
<input name="telefono" type="text" id="telefono" value="<?php echo $telefono ?>" size="10" maxlength="20" />
</td>
<td class="tdcen">Celular :</td>
<td class="tdizq">
<input name="celular" type="text" id="celular" value="<?php echo $celular ?>" size="20" maxlength="20" />
</td>
<td class="tdcen">E-mail :</td>
<td class="tdizq" colspan="2">
<input name="email" type="text" id="email" value="<?php echo $email ?>" size="35" maxlength="35" />
</td>
</tr>
<tr >
<td class="tdcen">Cuenta No :
</td>
<td class="tdizq">
<input name="cuenta" type="text" id="cuenta" value="<?php echo $cuenta ?>" size="20" maxlength="20" />
</td>
<td class="tdcen">Banco :</td>
<td class="tdizq">
<input name="banco" type="text" id="banco" value="<?php echo $banco ?>" size="20" maxlength="20" />
</td>
<td class="tdcen">Sucursal :</td>
<td class="tdizq">
<select name="sucursal">
<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>
</td>
</tr>
<tr>
<td class="tdcen">
Numero libranza:
</td>
<td class="tdizq">
<input name="numlib" type="text" id="numlib" value="<?php echo $numlib ?>" size="12" maxlength="12" />
</td>
<td class="tdcen">Monto Solicitado :</td>
<td class="tdizq">
<input name="monto" type="text" id="monto" value="<?php echo $monto ?>" size="12" maxlength="10" />
</td>
<td class="tdcen">Numero de Cuotas:</td>
<td class="tdizq">
<input name="numcuo" type="text" id="numcuo" value="<?php echo $numcuo ?>" size="12" maxlength="12" />
</td>
</tr>
<tr>
<td class="tdcen">Valor Mensual:
</td>
<td class="tdizq" colspan="5">
<input name="valcuo" type="text" id="valcuo" value="<?php echo $valcuo ?>" size="15" maxlength="15" />
</td>
</tr>
<tr>
<td class="tdcen">Total Devengado:</td>
<td class="tdizq">
<input name="devengado" type="text" id="devengado" value="<?php echo $devengado ?>" size="12" maxlength="12" />
</td>
<td class="tdcen">Total Descuento :</td>
<td class="tdizq">
<input name="descuento" type="text" id="descuento" value="<?php echo $descuento ?>" size="12" maxlength="12" />
</td>
<td class="tdcen">Salario Neto :</td>
<td class="tdizq">
<input name="salario" type="text" id="salario" value="<?php echo $salario ?>" size="12" maxlength="12" />
</tr>
</table>
<p>
<label>
<input name="guardar" type="submit" class="boton1" id="guardar" value="Guardar" />
</label>
</p>
</div>
</form>
</body>
</html>