File: /home/asjudine/public_html/modificar_datos_credito.php
<?php
require_once("mainfile.php");
include ("config.php");
require_once("Conectarse.php");
global $dbi;
if(isset($_POST["consultar"]))
{
//$mssql = mysql_query("select * from creditos where cedula = '$cedula' ",$dbi);
$mssql = mysql_query('SELECT * FROM creditos WHERE cedula = "' . $_POST[cedula] .'"');
if (!$mssql) {
die('Invalid query 8: ' . mysql_error());
}
if($mssql)
{
$filas = mysql_num_rows($mssql);
if ($filas > 0)
{
// $sql = "select ciudad, fecha, cedula, grado, nombres, direccion_envio, ciudad_envio, telefono, celular, email, numero_cuotas, valor_mensual, cuenta_ahorros, banco_cuenta, valor_jur, inicio_pagos, numero_libranza, mes_inicio, ano_inicio, mes_termino, ano_termino, empresa, proveedor from creditos where cedula = '$cedula' ";
//$control = mysql_query($sql, $dbi) or die(mysql_error());
$resul = mysql_query('SELECT ciudad, fecha, cedula, grado, nombres, direccion_envio, ciudad_envio, telefono, celular, email, monto_solicitado , numero_cuotas, valor_mensual, cuenta_ahorros, banco_cuenta, valor_jur, neto_consignar , interes_deducible, inicio_pagos, numero_libranza, mes_inicio, ano_inicio, mes_termino, ano_termino, empresa, proveedor FROM creditos WHERE cedula = "' . $_POST[cedula] . '" ');
if (!$resul) {
die('Invalid queryv 7: ' . mysql_error());
}
list($su, $fechalib,$ced, $gr, $nom, $dir, $ciuenv, $tel, $cel, $ema, $mon, $nocuo,$vme, $cue, $ban, $vj, $netocon, $inter, $incio, $num_lib, $mi, $ai, $mt, $at, $emp, $pv) = mysql_fetch_row($resul);
// $sql2 = "select nombre from empresas where codigo = '$epr' ";
//$control2 = mysql_query($sql2, $dbi) or die(mysql_error());
$res = mysql_query('SELECT nombre FROM entidad_laboral WHERE codigo = "' ."$emp". '" ');
if (!$res) {
die('Invalid querybb: ' . mysql_error());
}
list($emp) = mysql_fetch_row($res);
}
}else{
echo "<script>alert('No existe el numero de cedula en la base de datos');</script>";
}
}
if(isset($_POST["enviar"]))
{
if($proved!='0')
{
$prov = $proved;
}
if($emp2!='0')
{
$emp = $emp2;
}else{
// $sql3 = "select codigo from empresas where nombre = '$emp' ";
// $control3 = mysql_query($sql3, $dbi) or die(mysql_error());
$res3 = mysql_query('SELECT codigo FROM entidad_laboral WHERE nombre = "' . $_POST[emp] . '" ');
if (!$res3) {
die('Invalid query 78: ' . mysql_error());
}
list($ne) = mysql_fetch_row($res3);
$emp = $ne;
}
/* $mssql = "update creditos set ciudad='$sucu', fecha='$fechal', nombres='$nomb', grado='$grad', direccion_envio='$direccion_env', ciudad_envio='$ciudad_env', telefono='$telefono', celular='$celular', email='$email', numero_cuotas='$num_cuotas', valor_mensual='$valm', cuenta_ahorros='$cuenta_aho', banco_cuenta='$banco', valor_jur='$val_jur', inicio_pagos='$fechini', numero_libranza='$numero_libranza', mes_inicio='$mesi', ano_inicio='$añoi', mes_termino='$mest', ano_termino='$añot', empresa='$emp', proveedor='$prov' where cedula = '$cedu' ";
mysql_query($mssql, $dbi) or die(mysql_error());*/
$mssql = mysql_query("UPDATE creditos set ciudad = '" . $_POST[sucu] . "', fecha = '" . $_POST[fechal] . "', nombres = '" . $_POST[nomb] . "', grado = '" . $_POST[grad] . "', direccion_envio = '" . $_POST[direccion_env] . "', ciudad_envio = '" . $_POST[ciudad_env] . "', telefono = '" . $_POST[telefono] . "', celular = '" . $_POST[celular] . "', email = '" . $_POST[email] . "', monto_solicitado = '" . $_POST[mon] . "', numero_cuotas = '" . $_POST[num_cuotas] . "', valor_mensual = '" . $_POST[valm] . "', cuenta_ahorros = '" . $_POST[cuenta_aho] . "', banco_cuenta = '" . $_POST[banco] . "', valor_jur = '" . $_POST[val_jur] . "', neto_consignar = '" . $_POST[netocon] . "', interes_deducible = '" . $_POST[inter] . "', inicio_pagos = '" . $_POST[incio] . "', numero_libranza = '" . $_POST[numero_libranza] . "', mes_inicio = '" . $_POST[mesi] . "', ano_inicio = '" . $_POST[añoi] . "', mes_termino = '" . $_POST[mest] . "', ano_termino = '" . $_POST[añot] . "', empresa = '" .$emp. "', proveedor = '" . $prov. "' WHERE cedula = '" . $_POST[cedu] . "' ");
if (!$mssql) {
die('Invalid query update : ' . mysql_error());
}
echo "<script>alert('Se ha modificado correctamente la informacion');</script>";
// $sql = "select ciudad, fecha, cedula, grado, nombres, direccion_envio, ciudad_envio, telefono, celular, email, numero_cuotas, valor_mensual, cuenta_ahorros, banco_cuenta, valor_jur, inicio_pagos, numero_libranza, mes_inicio, ano_inicio, mes_termino, ano_termino, empresa, proveedor from creditos where cedula = '$cedu' ";
// $control = mysql_query($sql, $dbi) or die(mysql_error());
$control = mysql_query('SELECT ciudad, fecha, cedula, grado, nombres, direccion_envio, ciudad_envio, telefono, celular, email, numero_cuotas, valor_mensual, cuenta_ahorros, banco_cuenta, valor_jur, inicio_pagos, numero_libranza, mes_inicio, ano_inicio, mes_termino, ano_termino, empresa, proveedor FROM creditos WHERE cedula = "' . $_POST[cedu] . '" ');
if (!$control) {
die('Invalid query 4: ' . mysql_error());
}
list($su, $fechalib, $ced, $gr, $nom, $dir, $ciuenv, $tel, $cel, $ema, $nocuo, $vme, $cue, $ban, $vj, $incio, $num_lib, $mi, $ai, $mt, $at, $epr, $pv) = mysql_fetch_row($control);
// $sql2 = "select nombre from empresas where codigo = '$epr' ";
//$control2 = mysql_query($sql2, $dbi) or die(mysql_error());
$control2 = mysql_query('SELECT nombre FROM entidad_laboral WHERE codigo = "' ."$epr". '" ');
if (!$control2) {
die('Invalid query 5: ' . mysql_error());
}
list($nemp) = mysql_fetch_row($control2);
}
//$query_sql = "SELECT * FROM empresas order by nombre";
//$sql = mysql_query($query_sql, $dbi) or die(mysql_error());
$sql = mysql_query('SELECT * FROM entidad_laboral order by nombre ');
if (!$sql) {
die('Invalid query 87: ' . mysql_error());
}
$row_sql = mysql_fetch_assoc($sql);
$totalRows_sql = mysql_num_rows($sql);
?>
<html>
<head>
<title>Modificar Creditos</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
.Estilo1 {
font-family: "Courier New", Courier, monospace;
font-weight: bold;
color: #3366FF;
font-size: 18px;
}
.tabla1 {
font-family: "Times New Roman", Times, serif;
font-size: 12px;
font-weight: bold;
color: #339999;
background-color: #B7FFFF;
border: medium doble #CC9900;
}
.Estilo55 { font-family: Arial;
font-size: 16px;
color: #0066FF;
font-weight: bold;
}
.campo {background-color:#FFFFAA; width: 100px; border:2px solid #990000;}
.Estilo58 {background-color: #CCFFCC; font-size: 11px; font-family: Arial; color: #003399; display: block; }
.Estilo51 { color: #3366FF;
font-weight: bold;
}
.boton11 {background-color: #FFCCCC; color:#FFFFFF; width:90px; height:25; border: 3px solid #0000CC; font-family:Arial; color:#990000;}
.boton111 {background-color: #FFCCCC; color:#FFFFFF; width:90px; height:25; border: 3px solid #0000CC; font-family:Arial; color:#990000;}
.Estilo50 {color: #CC3333;
font-family: "Arial Narrow";
font-weight: bold;
}
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<div align="center">
<p class="Estilo1">MODIFICAR DATOS CREDITO </p>
<p class="Estilo1"><span class="Estilo58">Ingrese número de identificación o codigo:</span></p>
<table width="362" border="3" cellspacing="2" cellpadding="2">
<tr>
<td width="153"><div align="center"><span class="Estilo55">Cédula o Codigo:</span></div></td>
<td width="141"><div align="center">
<input name="cedula" type="text" class="campo" id="cedula" value="" size="15" maxlength="15" />
</div></td>
</tr>
</table>
<p class="Estilo1"><span class="Estilo51">
<input name="consultar" id="consultar" type="submit" class="boton11" value="Consultar" />
</span></p>
<table width="867" height="374" border="3" cellpadding="2" cellspacing="2" class="tabla1">
<tr>
<th height="28" colspan="2" scope="col"><div align="center">Cedula:
</div></th>
<th colspan="2" scope="col"><div align="left">
<input name="cedu" type="text" id="cedu" value="<?php echo $ced ?>" size="15" maxlength="15" readonly = "" />
</div></th>
<th colspan="2" scope="col">Nombre: </th>
<th colspan="2" scope="col"><div align="left">
<input name="nomb" type="text" id="nomb" value="<?php echo $nom ?>" size="50" maxlength="50" />
</div></th>
</tr>
<tr>
<td height="28" colspan="2"><div align="center">Sucursal:
</div></td>
<td height="28" colspan="2"><div align="left">
<input name="sucu" type="text" id="sucu" value="<?php echo $su ?>" size="30" maxlength="30" />
</div></td>
<td colspan="2"><div align="center">Numero Libranza : </div></td>
<td colspan="2"><input name="numero_libranza" type="text" id="numero_libranza" value="<?php echo $num_lib ?>" size="30" maxlength="30" /></td>
</tr>
<tr>
<td height="30" colspan="2"><div align="center">Direccion Envio :
</div></td>
<td height="30" colspan="2"><div align="left">
<input name="direccion_env" type="text" id="direccion_env" value="<?php echo $dir ?>" size="40" maxlength="40" />
</div></td>
<td colspan="2"><div align="center">Ciudad Envio :
</div></td>
<td colspan="2"><div align="left">
<input name="ciudad_env" type="text" id="ciudad_env" value="<?php echo $ciuenv ?>" size="40" maxlength="40" />
</div></td>
</tr>
<tr>
<td height="28" colspan="2"><div align="center">Telefono :
</div></td>
<td height="28" colspan="2"><div align="left">
<input name="telefono" type="text" id="telefono" value="<?php echo $tel ?>" size="20" maxlength="20" />
</div></td>
<td colspan="2"><div align="center">Celular :
</div></td>
<td colspan="2"><div align="left">
<input name="celular" type="text" id="celular" value="<?php echo $cel ?>" size="20" maxlength="20" />
</div></td>
</tr>
<tr>
<td height="28" colspan="2"><div align="center">Email :
</div></td>
<td height="28" colspan="2"><div align="left">
<input name="email" type="text" id="email" value="<?php echo $ema ?>" size="20" maxlength="20" />
</div></td>
<td colspan="2"><div align="center">Cuenta Ahorros No :
</div></td>
<td colspan="2"><div align="left">
<input name="cuenta_aho" type="text" id="cuenta_aho" value="<?php echo $cue ?>" size="20" maxlength="20" />
</div></td>
</tr>
<tr>
<td height="28" colspan="2"><div align="center">Banco :
</div></td>
<td height="28" colspan="2"><div align="left">
<input name="banco" type="text" id="banco" value="<?php echo $ban ?>" size="30" maxlength="30" />
</div></td>
<td colspan="2"><div align="center">Valor Juridica :
</div></td>
<td colspan="2"><div align="left">
<input name="val_jur" type="text" id="val_jur" value="<?php echo $vj ?>" size="25" maxlength="20" />
</div></td>
</tr>
<tr>
<td height="28" colspan="2"><div align="center">Fecha Inicio : </div></td>
<td height="28" colspan="2"><input name="fechini" type="text" id="fechini" value="<?php echo $fhi ?>" size="12" maxlength="10" /></td>
<td colspan="2"><div align="center">Valor Mensual: </div></td>
<td colspan="2"><input name="valm" type="text" id="valm" value="<?php echo $vme ?>" size="25" maxlength="20" /></td>
</tr>
<tr>
<td height="28" colspan="2"><div align="center">Grado : </div></td>
<td height="28" colspan="2"><input name="grad" type="text" id="grad" value="<?php echo $gr ?>" size="12" maxlength="10" /></td>
<td colspan="2"><div align="center">Numero Cuotas: </div></td>
<td colspan="2"><input name="num_cuotas" type="text" id="num_cuotas" value="<?php echo $nocuo ?>" size="25" maxlength="20" /></td>
</tr>
<tr>
<td colspan="2"><div align="center">Primer Descuento : </div></td>
<td colspan="2"><input name="incio" type="text" id="incio" value="<?php echo $incio ?>" size="14" maxlength="14" /></td>
<td colspan="2"><div align="center">Fecha Libranza : </div></td>
<td colspan="2"><input name="fechal" type="text" id="fechal" value="<?php echo $fechalib ?>" size="12" maxlength="10" /></td>
</tr>
<tr>
<td width="114" height="21"><div align="left">Mes inicio :</div></td>
<td width="12"><input name="mesi" type="text" id="mesi" value="<?php echo $mi ?>" size="2" maxlength="2" /></td>
<td width="117" height="21"><div align="center">Año Inicio :</div></td>
<td width="115"><input name="añoi" type="text" id="añoi" value="<?php echo $ai ?>" size="4" maxlength="4" /></td>
<td width="75"><div align="left">Mes Termino:</div></td>
<td width="61"><input name="mest" type="text" id="mest" value="<?php echo $mt ?>" size="2" maxlength="2" /></td>
<td width="154"><div align="center">Año Termino :</div></td>
<td width="145"><input name="añot" type="text" id="añot" value="<?php echo $at ?>" size="4" maxlength="4" /></td>
</tr>
<tr>
<td width="114" height="21"><div align="left">Monto Solicitado :</div></td>
<td></td>
<td width="117"><input name="mon" type="text" id="mon" value="<?php echo $mon ?>" size="10" maxlength="10" /></td>
<td width="115"><div align="left">Interes Deducible:</div></td>
<td width="75"><input name="inter" type="text" id="inter" value="<?php echo $inter ?>" size="10" maxlength="10" /></td>
<td width="61"><div align="left">Neto Consignar:</div></td>
<td width="154"><input name="netocon" type="text" id="netocon" value="<?php echo $netocon ?>" size="10" maxlength="10" /></td>
</tr>
<tr>
<td height="69" colspan="2"><div align="center">Empresa : </div></td>
<td height="69" colspan="2"><p>
<input name="emp" type="text" id="emp" value="<?php echo $emp ?>" size="30" maxlength="30" />
</p>
<p>
<select name="emp2" id="emp2">
<option value="0">--SELECCIONE LA EMPRESA--</option>
<?php
do {
?>
<option value="<?php echo $row_sql['codigo'];?>"><?php echo $row_sql['nombre']?></option>
<?php
} while ($row_sql = mysql_fetch_assoc($sql));
$rows = mysql_num_rows($sql);
if($rows > 0) {
mysql_data_seek($sql, 0);
$row_sql = mysql_fetch_assoc($sql);
}
?>
</select>
</p></td>
<td colspan="2"><div align="center">Proveedor : </div></td>
<td colspan="2"><p>
<input name="prov" type="text" id="prov" value="<?php echo $pv ?>" size="30" maxlength="30" />
</p>
<p>
<select name="proved" id="proved">
<option value="0">--SELECCIONE PROVEEDOR--</option>
<option value="COOMANUFACTURAS">COOMANUFACTURAS</option>
<option value="H. ROSERO">H. ROSERO</option>
<option value="EFRAIN LARGO">EFRAIN LARGO</option>
<option value="EFRAIN LARGO DOS">EFRAIN LARGO DOS</option>
</select>
</p></td>
</tr>
</table>
<p><span class="Estilo51">
<input name="enviar" id="enviar" type="submit" class="boton111" value="Enviar" />
</span></p>
<p><span class="Estilo51">
<input name="menu2" type="button" class="Estilo50" id="menu2" onClick="window.location.href='menu_credito.php'" value="IR AL MENU">
</span></p>
</div>
</form>
</body>
</html>